Repository navigation
fix(parsers): helper lookups skip the project above the working folder, not only the folder - #7854
Conversation
…r, not only the folder
Edit accuracy: accurate 267 (base branch 267), smooth 100 of thoseThe gate passes. Quarantined, measured but not gated (8)
Unstable (2)
|
…t, so Windows short names match
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at 8029d511325df67a1397b7fd8917950120ff18d4.
Need: yes · Size: ok · Reuse: shared trusted-directory rule · Simpler: compute the ancestry rule once per PATH · Structure: fine (checked CLI startup, ff-binary discovery and trusted helper lookup; no split)
Risk: high — helper-program selection across project boundaries.
Important — resolve the current main conflict: main now contains #7845 (96cc8cb85242fc72bb2e1371048d733cb4993c68), and GitHub plus merge-tree report a conflict in packages/parsers/src/trustedExecutable.ts. Rebase and preserve both the newly merged broader outermost-project marker coverage and this patch’s unconditional ancestor-node_modules exclusions / nearest-existing-parent normalization; choosing either file wholesale would discard part of the protection. Re-run both sets of ancestry tests at that resolved head. The validation below covers this pinned head before integration.
The changed rule removes ancestor node_modules independently of markers, and rejects the outermost package.json/.git project beneath home. Home/root markers do not absorb per-user installations. Missing paths are compared by resolving their nearest existing parent and appending the remaining names; the missing path is not promoted to that parent. The startup trim, trusted helper lookup and ff-binary discovery share the rule; configured binary overrides remain intentionally unchanged.
Validation: full build passed. Parser suite: 1,543 passed, 5 skipped, 3 todo. Focused CLI tests and reviewer controls: 64 passed. The positive controls retain global-npx/per-user tools, use the outside copy through both binary resolvers, and run a bare-name child through the trimmed PATH. Reverting the rule fails four parser ancestry cases and all three startup platform cases; restored controls pass 32 parser and 18 CLI cases. Windows/macOS branches are partly exercised with platform stubs; I did not run either OS locally.
A first parser run had five fixture failures because the shared temporary tree already had an ancestor project marker. An isolated unmarked temporary root passes without production or test edits. Nit: isolate those fixtures at a home boundary so unrelated markers cannot change their expected project root.
Integration/scope note: #7801 is still open and conflicts with this head; #7845 has now merged and causes the current main conflict (verified with merge-tree). Preserve #7801's platform/environment parameters and Windows handling when combining. #7845 also recognizes additional project markers; this patch currently uses only package.json/.git. Without either marker it rejects ancestor node_modules but does not reject every other parent-project folder. Retain the broader marker coverage when combining the fixes; this is not a blanket claim about every unmarked project.
CI checked at this SHA: Windows core, render and npx-shim jobs pass. Both Windows engine/CLI jobs were still running, so full Windows CI is not yet confirmed green. No live deployment or workflow was started.
Verdict: REQUEST CHANGES
Reasoning: The scoped code checks out in the executed controls, but the current head cannot integrate with the overlapping protection now on main. Resolve that conflict without losing either rule before a fresh approval.
— Rames / pr-review
…stor-project # Conflicts: # packages/parsers/src/trustedExecutable.ts
|
Merged 🤖 Addressed by Claude Code |
jrusso1020
left a comment
There was a problem hiding this comment.
Reviewed at 4a140f6dee4a96685ff7877ed5caa20daab50475.
Need: yes · Size: ok · Reuse: shared trusted-directory rule · Simpler: ancestry calculated once per PATH · Structure: fine (checked trustedExecutable, startup trim and ff-binary discovery; no split)
Risk: high — helper selection across project boundaries.
The previous integration blocker is resolved: this head retains the outermost-project search with all four markers, unconditional ancestor node_modules exclusions, and nearest-existing-parent comparison for missing folders. Home markers preserve per-user installations. GitHub now reports this head mergeable.
Validation at this head: bun run build passed; bunx vitest run src/trustedExecutable.test.ts --maxWorkers=2 passed all 12 ancestry tests. Removing the outermost-project rule fails its controls; removing the ancestor-node_modules exclusion fails three controls; restoring both returns 12 passes. An isolated temporary root avoids unrelated ancestor markers on this shared machine. The new fixtures have their own home boundary; two inherited fixtures still depend on the surrounding temporary tree (non-blocking fixture nit).
Windows CI run 43746374704 is on this exact head and completed successfully, including core and both studio and engine/CLI jobs; the Windows npx shim passed in exact-head run 43746374664. The later run 43746419768 skips these jobs. This is CI evidence; the focused parser unit run above was on Linux, not native Windows. No dev deployment tested; local build and ancestry mutation controls were used instead.
Integration note: #7801 still overlaps the PATH helper. Preserve its platform/environment handling and both ancestry protections when combining it.
Verdict: APPROVE
Reasoning: The merge resolution preserves both protections, and independent mutations demonstrate that each remains necessary.
— Rames / pr-review
What changed
The CLI and engine find helper programs (ffmpeg, ffprobe, ps, git and others) only in absolute PATH folders outside the working folder's project. This builds on #7845, which made the whole project above a subfolder untrusted when it carries a marker (
.git,package.json,node_modulesorhyperframes.json). Three changes inpackages/parsers/src/trustedExecutable.ts:node_modulesis skipped, with or without a marker.npx,bunxandnpm runput each ancestor'snode_modules/.binon PATH. That includes the home folder and above, where fix(parsers): helper programs never come from the project a subfolder sits in #7845's project search stops.RUNNER~1, or a linked parent, never matched the working folder's real path.The home folder and the filesystem root still never count as a project, so per-user install folders such as
~/.local/binand~/.bun/binstill resolve. Overrides such asHYPERFRAMES_FFMPEG_PATHare unchanged.Testing
packages/parsers:vitest rungives 1545 passed, 5 skipped.packages/cli:windowsExeSearch,whisper/trustedLookup,orphanCleanupanddoctortests give 63 passed.<project>/videoand PATH starting<project>/video/node_modules/.bin:<project>/node_modules/.bin:…, neither entry survives the startup trim on linux, darwin or win32.findTrustedExecutable("ffmpeg")returns the copy outside the project. A missing folder named through a link is skipped. With apackage.jsonand.gitin the home folder,~/.local/binis still trusted. These fixtures set the home folder to their own temp root, so a marker above the temp folder cannot change the project root.node_moduleslist, the same 3 fail. Without fix(parsers): helper programs never come from the project a subfolder sits in #7845's project-root search, 2 tests fail, including fix(parsers): helper programs never come from the project a subfolder sits in #7845's own.Not exercised: a real Windows or macOS machine for the Windows branches. They run with
process.platformstubbed, and in this PR's Windows CI jobs.Note: #7801 also changes
trustedPathDirs(newplatformandenvarguments). The two touch the same function, so whichever lands second needs a small merge that keeps both.