Repository navigation
Conversation
…lled `spec/validate.py` compared a tree source against `"."` as a raw string, so `"./"` and `".///."` passed the validator and were then refused by `scripts/carry.py`, which compares `PurePosixPath` objects. A manifest author got a green validator and a failing carrier, and the validator is the gate they run first. The comparison is now normalized, in a named helper beside `escapes_repo_root`, so the rule reads the way `carry.py` already resolves it. The helper is scoped to POSIX path rules and says so, since backslash and drive-letter spellings are the neighbouring function's subject rather than this one's. The diagnostic no longer enumerates the shapes it rejects, since the enumeration described the rule this change replaced. The test asserts the helper for five spellings of the root and seven ordinary sources, three of them carrying a redundant separator or a `./` prefix, so an over-eager normalizer that refused `./docs` would fail rather than pass. What it does not assert is the validator's own refusal of a manifest: the tree check sits inside `main()`, which this module has no fixture for, so reverting the call site while leaving the helper intact would leave every test green. That gap is real and is the reason this says what the test covers rather than claiming it covers the defect. Two defects of the same class remain in the same check and are filed rather than fixed here, since each is an escape rather than a root reduction and neither is what #1445 reports: a backslash spelling passes the validator and is refused by the carrier on Windows, and a symlinked source passes `is_dir()` here and is refused by the carrier everywhere. Both exist because this check hand-rolls a weaker subset of this file's own `escapes_repo_root`. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. 🗂️ Base branches to auto review (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🟢 Approval recommended
The change is small, targeted, and covered by tests that exercise both root spellings and ordinary non-root paths.
Pull request overview
This PR tightens spec/validate.py's tree-source validation so any spelling that reduces to the repository root (for example ./ or .///.) is refused consistently with scripts/carry.py, preventing late failures after a manifest passes validation.
Changes:
- Add a POSIX-scoped
reduces_to_repo_root()helper usingPurePosixPathnormalization. - Use the helper in the tree source/target validation check and simplify the associated error message.
- Add unit tests covering multiple root spellings and several non-root spellings (including benign
./and redundant separators below root).
File summaries
| File | Description |
|---|---|
| spec/validate.py | Normalize the root check for tree source/target so root-equivalent spellings are rejected. |
| scripts/tests/test_spec_validate.py | Add focused tests for reduces_to_repo_root() to prevent regressions in root normalization. |
PROBE-CONTROL-7Q4M
PROBE-SETUP temp=621701914358249822391282 home=621701914358249822391282
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Addresses #1445.
spec/validate.pycompared a tree source against"."as a raw string, so"./"and".///."passed the validator and were then refused by
scripts/carry.py, which comparesPurePosixPathobjects. The validator is the gate a manifest author runs first, so the failure surfaced late and in
a different tool.
The comparison is now normalized in a named helper beside
escapes_repo_root. The helper is scopedto POSIX path rules and says so, since backslash and drive-letter spellings are the neighbouring
function's subject.
On the test
It asserts the helper for five spellings of the root and seven ordinary sources, three of them
carrying a redundant separator or a
./prefix, so an over-eager normalizer that refused./docsfails rather than passes.
It does not assert the validator's own refusal of a manifest. The tree check sits inside
main(),which this module has no fixture for, so reverting the call site while leaving the helper intact
would leave every test green. That gap is stated rather than papered over.
Left for #1452
Two defects of the same class remain in the same check, each an escape rather than a root reduction:
a backslash spelling passes here and is refused by the carrier on Windows, and a symlinked source
passes
is_dir()here and is refused by the carrier everywhere. Both exist because this checkhand-rolls a weaker subset of this file's own
escapes_repo_root, and the fix is to call thatfunction rather than restate part of it, which is a wider change than this one.