Repository navigation
Have the Tree Check Call escapes_repo_root and Refuse a Symlinked Component - #2243
Conversation
…ponent The tree loop in spec/validate.py restated a weaker subset of escapes_repo_root, so a backslash or drive-letter spelling validated while scripts/carry.py refused it. It now calls escapes_repo_root beside reduces_to_repo_root, and refuses a tree path with a symlinked component the way the carrier's relative_root does, since is_dir() follows a link. Closes on promotion: #1452 Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID:
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 |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #2243 +/- ##
==========================================
Coverage ? 56.67%
==========================================
Files ? 16
Lines ? 7492
Branches ? 0
==========================================
Hits ? 4246
Misses ? 3246
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Copilot review overview
🟢 Approval recommended
The small, well-tested change correctly consolidates tree-path validation onto the existing canonical rule and mirrors the carrier's symlink refusal, with coverage confirming the live manifest still passes.
Review effort: Balanced
Findings: None
What changed in this PR
This PR hardens spec/validate.py's tree-path validation so it refuses the same spellings scripts/carry.py refuses, eliminating a class of "green validator, failing carrier" divergences. Previously the tree loop hand-rolled a weaker subset of the file's own escapes_repo_root (missing backslash and drive-letter spellings), and its is_dir() existence check followed symlinks, so a symlinked source validated even though the carrier rejects it on every host. The change consolidates on the single canonical rule and adds a filesystem-aware symlink check, keeping one implementation of the rule instead of two.
Changes:
spec/validate.py: the tree loop now callsescapes_repo_root(alongsidereduces_to_repo_root) for eachsource/target, and a newsymlinked_componenthelper refuses any symlinked path component the way the carrier does.tests/test_spec_validate.py: addsTreePathGateCase, running the real validator against a scratch tree to pin backslash, drive-letter, and symlinked-source refusals, plus a control tree and a live-manifest pass check.
| File | Description |
|---|---|
| spec/validate.py | Adds symlinked_component helper and switches the tree loop to escapes_repo_root + symlink refusal, matching scripts/carry.py. |
| tests/test_spec_validate.py | Adds end-to-end gate tests proving backslash, drive-letter, and symlinked-source paths are refused while valid/live trees pass. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
## Summary Promotes develop to main, carrying the pull requests below, each already reviewed and merged into develop. - [#2203](#2203): Strip every heredoc body a line opens in the wait-loop rule. - [#2216](#2216): Point the charset-unknown message at where a tier is classified. - [#2218](#2218): Name the leftover old tree when the Bash loader cannot remove it. - [#2227](#2227): End the guard's stdin redirect scan at a trailing comment. - [#2230](#2230): Tell apart the causes a labels payload is refused for. - [#2232](#2232): Correct the task names and pointers in the Python tasks snippet header. - [#2234](#2234): Drop the stale private-repository note from PhotoCleaner's registry entry. - [#2237](#2237): State the bootstrap's archive live channel in two skills. - [#2239](#2239): Stop the promotion count on a failed fetch in backlog-burndown. - [#2241](#2241): Render the include walk once per `build_dist.py --check` run. - [#2243](#2243): Have the tree check call `escapes_repo_root` and refuse a symlinked component. - [#2247](#2247): Refuse a Windows drive component anywhere in a tree path. - [#2222](#2222): Tick the adopted repos in the merge-bot and gate rollout stages. - [#2121](#2121): Refuse a dangling remote-tracking target in `local_review`. - [#2249](#2249): Ignore a quoted separator when the guard finds a loop's `done`. Closes #2112 Closes #2171 Closes #1790 Closes #2152 Closes #1372 Closes #2149 Closes #1082 Closes #1772 Closes #1310 Closes #1379 Closes #1452 Closes #2244 Closes #2168 Closes #2106 Closes #2207 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Summary
spec/validate.py's tree loop now callsescapes_repo_rootfor each tree'ssourceandtarget, besidereduces_to_repo_root, rather than restating three of its conditions. A backslash or drive-letter spelling is now refused here asscripts/carry.pyrefuses it, and one implementation of the rule remains.sourceortargetwith a symlinked component is refused, by a newsymlinked_componenthelper that walks the path's components under the root the wayscripts/carry.py'srelative_rootdoes for both fields. The existingis_dir()check follows a link, so before this a symlinked source validated while the carrier refused it on every host.tests/test_spec_validate.pygainsTreePathGateCase, which runs the real script against a scratch tree and pins a backslash spelling, a drive-letter spelling, and a symlinked source as refused. A control tree draws no path error, and every tree the livespec/files.jsondeclares passes both checks.Verification
spec/validate.pychange fails every new refusal case.python3 -m unittest discover -s tests, ruff format and check, mypy,spec/validate.py, the prose gate, and the EOL gate all pass.Closes on promotion: #1452
🤖 Generated with Claude Code