Skip to content

test: consolidate root, boundary and sync/async contract scenarios - #805

Closed
steipete wants to merge 1 commit into
mainfrom
steipete/deslop-r3-tests-root
Closed

steipete wants to merge 1 commit into
mainfrom
steipete/deslop-r3-tests-root

Conversation

@steipete

@steipete steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Root, boundary, and primitive suites duplicated scenarios: sync/async twins in new-primitives and path-input-snapshot, two copies of the opened-handle observer for Root-read races, 16 hand-repeated Root rejection assertions in the read-bypass suite, near-identical Windows hostile-diagnostic harnesses, and five smoke tests already covered by stronger tests elsewhere.

User Impact

No user-visible change; tests only (src/ byte-identical).

Why This Change Was Made

  • Sync/async twins become named rows that call the real sync and async APIs (the walker row now applies the richer async assertions to both).
  • test/helpers/root-read-observer.ts and test/helpers/windows-owner-diagnostics.ts hold the shared harnesses; race and alias scenarios become tables crossed with the existing operations, keeping each hook and policy.
  • Read-bypass rejections run from operation rows that still assert exact FsSafeError codes.
  • Five subsumed smoke tests are deleted, each mapped to its stronger counterpart (flag tests → the platform flag matrix in nonblocking-write-admission; symlink append and directory stat → regular-file-failure; default rename move → coverage-gaps).

Net -363 lines.

Evidence

  • Expanded tests 250 → 246: exactly the five named deletions plus one pinned-open scenario split into its own test; every race, alias, and rejection case remains.

  • Focused run: 246 passed, 5 platform skips.

  • tsc, lint:file-size, lint:fs-boundary: pass. Codex autoreview (P0-P2): one finding examined and rejected (the sync swap spy is present); otherwise clean.

  • Tests added or updated when behavior changed

  • Security and compatibility impact considered

  • CHANGELOG.md updated when release-relevant

  • No credentials, private paths, private hosts, or sensitive contents included

@steipete
steipete requested a review from a team as a code owner October 1, 2026 13:15
@clawsweeper

clawsweeper Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@clawsweeper clawsweeper Bot added P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 1, 2026
@clawsweeper

clawsweeper Bot commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 1, 2026, 9:18 AM ET / 13:18 UTC.

ClawSweeper review

What this changes

The PR consolidates filesystem boundary, race, Windows diagnostic, and sync/async tests into shared helpers and scenario tables, removing redundant smoke tests.

Merge readiness

✅ Ready for maintainer review

This remains a useful, bounded test consolidation that is absent from the pinned main revision. No actionable patch defect was found, and the member-authored PR must remain open for normal review.

Priority: P3
Reviewed head: f831e3acc29433dfe2305056e4e9cac360ccaccb

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused consolidation with preserved security scenarios and no actionable defect found in the introduced diff.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository-state context identifies a member author, and the patch changes only tests; production Root admission and secure-read behavior remain unchanged. Reported focused test results are supplemental validation. No stored-data contract changes.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository-state context identifies a member author, and the patch changes only tests; production Root admission and secure-read behavior remain unchanged. Reported focused test results are supplemental validation. No stored-data contract changes.
Evidence reviewed 7 items Applicable repository policy: Read the full root AGENTS.md. Its security-contract and regression-coverage guidance informed the comparison; maintenance-only test consolidation does not require a changelog entry. No nested AGENTS.md or matching maintainer notes were found. Tests and build commands were not executed under the read-only review contract.
Verified introduced scope: The pinned base-to-head diff contains only ten test/helper files, totaling 301 additions and 664 deletions. Production source, package metadata, dependencies, and workflows have no changes. The consolidation is not already present at the fetched main revision; no merged replacement was supplied. The GitHub canonical-search command was denied, so it supplied no additional relationship evidence.
Root race coverage preserved: Compared the original and introduced Root final-fence scenarios. All three replacement timings remain crossed with open, text-read, and absolute-read operations; both escaping alias cases retain their symlink policies, identity assertions, rejection codes, and checks for closing without reading.
Findings None None.
Security None None.

How this fits together

fs-safe gives Node.js applications guarded filesystem operations for untrusted paths. These tests exercise confinement, file identity, and permission checks and verify that rejected operations do not read protected contents.

flowchart TD
  A[Untrusted paths and race scenarios] --> B[Shared test fixtures]
  B --> C[Sync and async filesystem APIs]
  C --> D[Boundary and identity checks]
  D --> E[Permitted reads or handle handoff]
  D --> F[Rejected operation]
  F --> G[Assert error and closure without reading]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test delta production +0/-0; tests +301/-664; net -363 The consolidation reduces test duplication without expanding production code.

Technical review

Best possible solution:

Keep one shared harness per security scenario while preserving operation-specific hooks, rejection codes, and assertions that forbidden reads never occur.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR consolidates existing tests and reports no production bug; tests were not executed during this read-only review.

Is this the best way to solve the issue?

Yes: shared fixtures and named scenario rows preserve the inspected contracts, and the deleted smoke cases have retained counterparts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 167673bc7724.

Labels

Label changes:

  • add P3: This is test maintenance with no changed production behavior or identified urgent regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository-state context identifies a member author, and the patch changes only tests; production Root admission and secure-read behavior remain unchanged. Reported focused test results are supplemental validation. No stored-data contract changes.

Label justifications:

  • P3: This is test maintenance with no changed production behavior or identified urgent regression.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository-state context identifies a member author, and the patch changes only tests; production Root admission and secure-read behavior remain unchanged. Reported focused test results are supplemental validation. No stored-data contract changes.

Evidence

What I checked:

  • Applicable repository policy: Read the full root AGENTS.md. Its security-contract and regression-coverage guidance informed the comparison; maintenance-only test consolidation does not require a changelog entry. No nested AGENTS.md or matching maintainer notes were found. Tests and build commands were not executed under the read-only review contract. (AGENTS.md:25, f831e3acc294)
  • Verified introduced scope: The pinned base-to-head diff contains only ten test/helper files, totaling 301 additions and 664 deletions. Production source, package metadata, dependencies, and workflows have no changes. The consolidation is not already present at the fetched main revision; no merged replacement was supplied. The GitHub canonical-search command was denied, so it supplied no additional relationship evidence. (f831e3acc294)
  • Root race coverage preserved: Compared the original and introduced Root final-fence scenarios. All three replacement timings remain crossed with open, text-read, and absolute-read operations; both escaping alias cases retain their symlink policies, identity assertions, rejection codes, and checks for closing without reading. (test/root-read-final-fence.test.ts:84, f831e3acc294)
  • Deleted smoke tests have retained counterparts: The append-flag platform matrix at test/nonblocking-write-admission.test.ts:295 includes missing O_NOFOLLOW; test/regular-file-failure.test.ts:34 and :174 retain directory-stat and sync symlink-append refusal checks; test/coverage-gaps.test.ts:200 retains ordinary move semantics. The consolidated sync read race still installs the lstatSync swap spy, which matches the production preview in src/regular-file.ts. (test/new-primitives.test.ts:767, f831e3acc294)
  • Windows diagnostic assertions preserved: The extracted helper retains both public inspection routes, exact permission-unverified classification, original cause identity, descriptor closure, no readFile call, and secret non-disclosure. Both consuming suites retain their hostile-trap assertions; the stderr suite also retains its exact escaped diagnostic assertion. (test/helpers/windows-owner-diagnostics.ts:35, f831e3acc294)
  • Merged-area history for routing: Main-revision blame points the unchanged replacement fixture to this commit. Its raw recorded parent was inspected, and comparison against that parent shows the test file was added. Nearby main history also records Peter Steinberger's work on permissions and export routing. Deeper follow-history searches encountered unavailable promisor objects; no broader introduction claim relies on them. (test/root-read-final-fence.test.ts:23, 54342760a4e9)

Likely related people:

  • Peter Steinberger: Raw commit 5434276 adds test/root-read-final-fence.test.ts:23 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 54342760a4e9; files: test/root-read-final-fence.test.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

steipete added a commit that referenced this pull request Oct 1, 2026
)

Collapse sync/async twin scenarios into rows, share the Root-read observer and Windows hostile-diagnostic harnesses, table the read-bypass rejections while keeping exact error codes, and delete five smoke tests strictly covered by stronger tests. Tests only; 250 to 246 expanded tests, net -363 lines.
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed on main as 9a9c561 through the batch PR #816 (rebase merge, one commit per original PR), to avoid ten serial up-to-date CI cycles. Content is identical to this PR's reviewed diff.

@steipete steipete closed this Oct 1, 2026
steipete added a commit that referenced this pull request Oct 1, 2026
)

Collapse sync/async twin scenarios into rows, share the Root-read observer and Windows hostile-diagnostic harnesses, table the read-bypass rejections while keeping exact error codes, and delete five smoke tests strictly covered by stronger tests. Tests only; 250 to 246 expanded tests, net -363 lines.
@steipete
steipete deleted the steipete/deslop-r3-tests-root branch October 1, 2026 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant