fix(warehouse): normalize --paths input before tracked-set membership check (PER-184)#151
Conversation
OpenCode ReviewModel: FindingsNo findings. Open QuestionsNone. Notes
Token UsageInput tokens: |
… check (PER-184) `abc warehouse contribute --paths` was rejecting paths with `./` prefix or redundant `//` separators because the membership check was a direct string comparison against the tracked set. Add `_normalize_path()` helper that: - Strips `./` and collapses `//` via `os.path.normpath`. - Rejects absolute paths with a clear error. - Rejects parent-directory (`..`) traversal with a clear error. - Returns POSIX-style forward slashes for cross-platform consistency. Apply normalization to every `--paths` entry before checking membership against `tracked_set`, and use the normalized form as the commit-paths list so git sees the same canonical strings. Test suite extended with 4 new cases under `TestContributePaths`: leading `./`, double `//`, absolute rejection, and `..` rejection. Closes PER-184.
4cb113f to
9b94588
Compare
OpenCode ReviewModel: I’ll check the repository-specific context rules, then review only the supplied diff against those constraints. FindingsNo findings. Open QuestionsNone. Notes
Token UsageInput tokens: |
Supervisor triage — bot round 1 + 2Bot reviewed commits: Findings
Notes / residual risks (bot's "Notes" section)
PR is READY for human review/merge. CI green across pre-commit, Unit Tests 3.12/3.13, E2E, and review jobs. 🤖 diligent-supervisor |
Per PR #151 review: `_normalize_path` is a stateless helper with no warehouse-domain knowledge — it belongs in utils/, not buried as a private domain helper. - New `beacon/utils/paths.py` with public `normalize_relative_path()`. - `contribute.py` imports it; drops the now-unused `import os`. - Add direct unit coverage in `tests/unit/utils/test_paths.py` (the contribute tests already cover it behaviorally). No behaviour change. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
OpenCode ReviewModel: Reviewing the attached diff against the repository guidance and Beacon-specific checks. Findings
Open QuestionsNone. Notes
Token UsageInput tokens: |
Supervisor triage — bot round 3 (post-refactor)Bot reviewed commit: Findings
PR remains READY. No further changes. 🤖 diligent-supervisor |
Summary
abc warehouse contribute --pathsrejected./prefixand//-containing path spellings even when they pointed at tracked artifacts._normalize_path()helper that strips./, collapses//, rejects absolute paths and..traversal, and returns POSIX-style strings.--pathsentry before tracked-set membership and use the normalized form as commit-paths.TestContributePaths: leading./, double//, absolute rejection,..rejection.Closes PER-184.
Test plan
pytest libs/beacon/tests/unit/warehouse/ libs/beacon/tests/unit/test_architecture.py→ 94 passedruff checkon touched files → clean🤖 Generated by diligent-supervisor / delegate-to-oc (kimi-for-coding/k2p6)