Repository navigation
fix(gateway): preserve private fixture directories - #201875
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThis PR makes both Gateway test configuration writers preserve existing parent-directory permissions. Example: A Gateway fixture writes configuration inside a POSIX directory with mode 0700 under umask 002.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep open: this maintainer-authored PR fixes a concrete fixture-permission defect still present on main, with no actionable correctness or security findings. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway test helpers publish fixture configuration for real and mocked readers; both session synchronization and adapter writes reach fs-safe's atomic JSON writer. flowchart TD
A[Session fixture synchronization] --> C[Gateway test config writer]
B[Config adapter writes] --> C
C --> D[fs-safe atomic JSON writer]
D --> E[Fixture config file]
D --> F[Preserved parent permissions]
Technical reviewBest possible solution: Keep the shared fixture writer with dirMode preserve and retain the existing boundary tests for both callers. Do we have a high-confidence way to reproduce the issue? The old fixture calls and pinned fs-safe implementation establish the permission-widening path under permissive POSIX umasks; no target code was executed during this read-only review. Is this the best way to solve the issue? The patch fixes the policy at the existing fixture owner, serves both callers, preserves atomicity, and avoids changing the shared production writer or unsafe-directory guard. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 307d9c45fb25. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +8, Tests +35. Total +43 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 19, 2026, 9:52 AM ET / 14:52 UTC. |
|
Merged via squash.
|
Related: #200486
What Problem This Solves
Gateway tests can lose a private fixture directory's permissions when they update session or runtime configuration. A subsequent operation can reject that directory as an unsafe writable ancestor, preventing the test from exercising its intended behavior.
User Impact
No released runtime behavior changes. This repair keeps existing private Gateway fixture directories private across configuration writes.
Why This Change Was Made
Both fixture writers now share their existing config-runtime owner's atomic write policy with
dirMode: "preserve". The three existing config-publication cases check that real session and adapter writes preserve the parent directory's device, inode and0700mode on POSIX, while retaining their functional assertions on Windows.The pinned dependency, fs-safe0.27.1, derives its default numeric directory mode from the process umask and applies that policy to existing directories. Its preserve policy retains the existing directory mode. See the versioned atomic-write default and directory-mode implementation. This follows the production config writer's existing
stateRootDirectoryModepolicy; the shared production writer and unsafe-directory guard are unchanged.Production changes: zero. Fixture and test changes: +47/-4 across three files. This completes the fixture directory's creation-and-write policy; it does not establish the original failed worker's umask, first affected dependency version or release exposure.
Evidence
Independent source reviews are complete for
46b757a9e3eb41cc98ab54041f8df4e708d62002. The complete committed-range local autoreview finished with one P0-only pass, zero findings and final source verification. This scoped review does not replace the independent source reviews or exact-head hosted review and CI.The regression-only baseline
2df69d70d1c70cdff4b01fd5e8a75de4abaa6b30produced one pass, two assertion failures and seven filtered cases under each child-only umask. The real session writer and config adapter preserved the parent device/inode but widened0700to0777under000, and to0775under002. Reply preparation passed because that path did not invoke either writer. Both negative mechanisms and native cleanup were independently verified.The retained runs are mask 000 and mask 002. Their delegated workloads correctly exited 1; the Actions carriers were cancelled during normal native cleanup. These are scoped negative proofs, not green CI.
The same three cases on the repaired source passed under both child-only masks: six selected passes, zero failures and fourteen explicitly filtered rows across two invocations. Both real writer paths retained the same parent device/inode and
0700mode. The repaired-source proof and native cleanup were independently verified. Its workload exited 0; the Actions carrier was cancelled during normal native cleanup and is not a green CI claim.On the same repaired head, the full ordinary proof passed all 10 cases in
src/gateway/test-helpers.server-rpc.test.ts, with no skips, filtering or forced umask. Targeted formatting and lint for all three changed files, plus the canonicalcore-test-gateway-rootandcore-test-gateway-servertype graphs, passed. The workload and static-check receipts were independently reviewed. Dependency preparation emitted five module-directive warnings; lint reported zero warnings and errors. The delegated workload exited 0 and native cleanup completed; its cancelled Actions carrier is not a green CI claim.The original integration context passed all 103 cases across 13 files, with zero failures, skips, filtering or unrun cases. This separate private proof used
7ab975c477f225975bcd6889705d02c784f4f497, derived from the parent proof baseline with the same three-file fixture repair and the separately reviewed placement-fixture correction. It preserved the original two-fork shared-process context, case order, timeouts and ambient umask. All 27 private-completion cases and all four placement cases passed. Workload, unchanged source, actual workflow inputs and complete native cleanup were independently verified; the cancelled Actions carrier is not a green CI claim. This private source is distinct from the ordinary PR head.Required exact-head hosted checks, hosted review and final native landing gates remain open. The parent R5 obligation remains unresolved; no inherited-CI exception is requested.
Follow-up: private-completion gate waits that do not race admitted-operation failure or cancellation can cascade into long timeouts after a failed restart. That lifecycle issue is outside this permission repair.