Skip to content

Have the Tree Check Call escapes_repo_root and Refuse a Symlinked Component - #2243

Merged
ptr727 merged 1 commit into
developfrom
feature/auto-1452
Oct 1, 2026
Merged

ptr727 merged 1 commit into
developfrom
feature/auto-1452

Conversation

@ptr727

@ptr727 ptr727 commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Summary

  • spec/validate.py's tree loop now calls escapes_repo_root for each tree's source and target, beside reduces_to_repo_root, rather than restating three of its conditions. A backslash or drive-letter spelling is now refused here as scripts/carry.py refuses it, and one implementation of the rule remains.
  • A tree source or target with a symlinked component is refused, by a new symlinked_component helper that walks the path's components under the root the way scripts/carry.py's relative_root does for both fields. The existing is_dir() check follows a link, so before this a symlinked source validated while the carrier refused it on every host.
  • tests/test_spec_validate.py gains TreePathGateCase, 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 live spec/files.json declares passes both checks.

Verification

  • Reverting the spec/validate.py change 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

…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]>
Copilot AI balanced review requested due to automatic review settings October 1, 2026 10:24
@coderabbitai

coderabbitai Bot commented Oct 1, 2026

Copy link
Copy Markdown

Important

  • 🔍 Trigger review

This repository does not receive automatic reviews because it has fewer than 10 stars.

⚙️ Run configuration

Configuration used: Repository: ptr727/ProjectTemplate/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: a69e3235-7eca-4d65-8e32-c93f4b07a4be

  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Autopilot is currently an internal CodeRabbit preview.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 6 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@774d000). Learn more about missing BASE report.

Files with missing lines Patch % Lines
spec/validate.py 50.00% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #2243   +/-   ##
==========================================
  Coverage           ?   56.67%           
==========================================
  Files              ?       16           
  Lines              ?     7492           
  Branches           ?        0           
==========================================
  Hits               ?     4246           
  Misses             ?     3246           
  Partials           ?        0           
Flag Coverage Δ
python-3.13 56.67% <50.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 calls escapes_repo_root (alongside reduces_to_repo_root) for each source/target, and a new symlinked_component helper refuses any symlinked path component the way the carrier does.
  • tests/test_spec_validate.py: adds TreePathGateCase, 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.

@ptr727
ptr727 merged commit fbaa528 into develop Oct 1, 2026
11 checks passed
@ptr727
ptr727 deleted the feature/auto-1452 branch October 1, 2026 10:31
ptr727 added a commit that referenced this pull request Oct 1, 2026
## 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants