rtk gain --project mis-scopes project directories whose path contains [, * or ?
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 82/100
Research direction
Start in src/core/tracking.rs at project_filter_params, which builds the <cwd>/* GLOB pattern, and list every query that consumes it (summary, daily/weekly/monthly, recent). Either escape [, ], *, ? before appending /*, or replace the GLOB with a substr(project_path, 1, length(?1) + 1) = ?1 || '/' comparison. Reproduce with the scratch RTK_DB_PATH recipe given, then add a test pairing a bracketed project directory with its unbracketed twin; done means only the bracketed project and its subdirectory are counted.
Written by the indexing model from the issue text.
Description
rtk gain --project builds its subdirectory filter as a SQLite GLOB pattern (project_filter_params in src/core/tracking.rs: <cwd>/*) without escaping the path. A project directory whose name contains a GLOB metacharacter ([, ], *, ?) is therefore scoped wrongly: its own subdirectories are left out, and sibling directories that the pattern happens to match are counted in.
Repro (v1.0.1 and a build of develop 3ab08beca; project_filter_params is byte-identical in v1.0.1, v1.2.0 and develop), with a scratch RTK_DB_PATH:
mkdir -p 'proj[1]/sub' proj1/sub
(cd 'proj[1]' && rtk ls) ; (cd 'proj[1]/sub' && rtk ls) ; (cd proj1/sub && rtk ls)
cd 'proj[1]' && rtk gain --project
Rows recorded: proj[1], proj[1]/sub, proj1/sub. Expected in scope: the first two. Actual: proj[1] and proj1/sub. [1] is read as a character class, so the pattern …/proj[1]/* matches …/proj1/sub and not …/proj[1]/sub.
Every query that goes through project_filter_params is affected (summary, daily/weekly/monthly, recent, and --failures --project once #3227 lands). A fix escapes the three metacharacters ([ → [[], * → [*], ? → [?]) before appending /*, or swaps GLOB for substr(project_path, 1, length(?1) + 1) = ?1 || '/', with a test that has a bracketed project next to its unbracketed twin.
- Dominant language
- Rust
- Stars
- 86.4k
- Forks
- 5.5k
- Avg merge
- 7d 6h
- Merged PRs (30d)
- 48
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from rtk-ai/rtk
-
Difficulty 1/5 Under an hour Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
delegates call `rtk rewrite <cmd>` without `--`, so a command of `--help` or `-h` comes back as rtk's help text with exit 0Possibly taken @LeviReisJs claimed this 2 days ago. Openarea:cli area:security bug priority:medium
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
rtk-ai/rtk#5127 · 2 comments · 1 assignee ·
Maintainers usually reply within 1 day
-
hooks: version floor says `rtk rewrite` came in 0.23.0; it came in 0.25.0Possibly taken @TechWizard9999 claimed this 2 days ago. Openarea:docs bug good first issue priority:low
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
tinystream-dev/tinystream#132 ·
-
contract good first issue testing
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Emmyt24/nova-launch#2436 ·
Maintainers usually reply within 1 day