fix(stella-cli): let the witness author name the candidate root in glob - #1843
Merged
Conversation
…lob` The `glob` tool documents `path` as "Subdirectory to search (default: workspace root)" and resolves both `.` and `""` to the root. The witness executor's guard reused `normalized_candidate_path`, whose `None` means "no relative path" — which covers *both* "escapes the root" and "is the root". Only the second is legal, and collapsing them made `glob` refuse its own default argument, denying the blind-discovery move #1792 exists to enable. `names_candidate_root` answers the second question separately. It rules out absolute and drive-qualified spellings first, so `/` — which would otherwise trim to the empty string — stays an escape. Witness: `glob_accepts_the_root_spelled_out_as_well_as_omitted`, which also pins `/`, `..`, `../..` and `/etc` as still refused.
Contributor
There was a problem hiding this comment.
Sorry @macanderson, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
Contributor
Reviewer's GuideAdjusts the File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
macanderson
added a commit
that referenced
this pull request
Aug 6, 2026
…1813 (#1859) ## What this is An unbreak: 608a0aa (#1813) landed two `clippy -D warnings` failures in `crates/stella-pipeline/src/pipeline/witness_stage.rs`, so the fmt+clippy+test gate is red on main and on every PR branched from it. The first masks the second because cargo stops at the first error. - **clone_on_copy** (line 55): `apply_role_shaping` did `params.clone()` where `GenerationParams` became `Copy` in a parallel change — copy it out of the borrow instead. - **field_reassign_with_default** (line 648, tests): the #1785 witness test built its worker config by mutating a `default()` — struct-update syntax now. ## Verification Pure lint fixes, no behavior change, so no witness test — the witness is clippy itself: `cargo clippy -p stella-pipeline --all-targets -- -D warnings` fails on main at both sites and passes on this branch. `cargo test -p stella-pipeline shaping` (including #1785's `verifier_shaping_overlays_the_worker_engine_config`) passes. After this merges, open PRs (#1843, #1836, #1844) need `gh pr update-branch` to go green. ## Summary by Sourcery Fix clippy lint violations in stella-pipeline’s witness_stage to restore a clean build. Bug Fixes: - Avoid cloning a Copy GenerationParams value when applying role shaping overrides. - Construct test EngineConfig instances with struct update syntax instead of mutating a default value to satisfy clippy lints. Co-authored-by: Stella Test <test@stella.local>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Refs #1792, #1813.
The review bot flagged this on #1813 (
witness_tools.rs:200) and it merged before the thread was answered, so the defect is onmainnow.The witness author's
globguard refuses the tool's own default argument.crates/stella-tools/src/glob.rsdocuments and implements the root two ways:But
WitnessToolExecutorgatedpathonnormalized_candidate_path, which answersNonefor both:""→ theis_empty()guard"."→ theCurDircomponent is dropped,partsends up empty, and(!parts.is_empty()).then(...)yieldsNoneSo a model that spells the default out loud — which they routinely do — is told "the path must stay within the candidate root" about the root itself. That is the blind author's opening move, and the whole reason
globwas offered to it in #1792.The root cause
normalized_candidate_path'sNoneconflates two different answers: "escapes the root" and "is the root". That is correct forread_file, which was what it was written for — a path naming no file is simply not readable. It is wrong for a listing tool, where the root is the most ordinary argument there is.names_candidate_rootanswers the second question separately. It rules out absolute and drive-qualified spellings first, so/— which would otherwise trim to the empty string and look like the root — stays an escape.The witness
main, passes here).candidate_ws::witness_tools::tests::glob_accepts_the_root_spelled_out_as_well_as_omitted, checked the artisanal way:It asserts both directions:
.,"",./are allowed and actually search the root;/,..,../..,/etcare still refused.Why the existing test did not catch it:
glob_lets_the_author_discover_tests_without_leaking_credentialsonly ever passes nopath(exercising the tool's own default, which never reaches the guard) or an escaping one. The explicit-root case sat exactly in the gap between them.The gate
cargo fmt --check -p stella-clicargo test -p stella-cli— 1421 pass, 0 failNothing left behind
Summary by Sourcery
Allow the witness
globtool to treat explicit root paths as valid while still denying paths that escape the candidate workspace.Bug Fixes:
globwitness tool incorrectly rejecting explicit root paths such as "." or "" that should resolve to the workspace root.Enhancements:
Tests:
globaccepts explicit root spellings and continues to refuse paths that leave the candidate root.