Skip to content

refactor(test): remove repeated suite boilerplate - #108

Merged
steipete merged 1 commit into
mainfrom
refactor/test-boilerplate
Aug 3, 2026
Merged

steipete merged 1 commit into
mainfrom
refactor/test-boilerplate

Conversation

@steipete

@steipete steipete commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • strengthen four boundary-escape tests with outside-path side-effect checks
  • extract platform aliases, temp fixtures, and typed filesystem safety error assertions
  • reuse shared security layouts, add local spy factories, and compact API coverage imports
  • preserve every existing test and add one fixture-ordering regression

Verification

  • pnpm check
  • pnpm test:security
  • two consecutive pnpm test runs: 740 passed, 42 skipped
  • git diff --check
  • Codex autoreview: clean

Coverage improved from 84.11% to 84.21% lines. The coverage command remains below the configured global thresholds in this checkout, as it was before this test-only refactor.

@steipete
steipete requested a review from a team as a code owner August 3, 2026 00:13
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P3 Low-risk cleanup, docs, polish, ergonomics, or speculative feature. labels Aug 3, 2026
@clawsweeper

clawsweeper Bot commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 9:10 PM ET / August 3, 2026, 01:10 UTC.

ClawSweeper review

What this changes

This PR consolidates repeated Vitest temporary-directory cleanup, platform gating, and typed filesystem-safety error assertions across 62 test files, while strengthening several boundary-escape checks.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

Keep open. The branch is a broad but coherent test-harness cleanup with no source or package-runtime changes, and the completed cross-platform CI signal is positive; however, the external contributor has not attached after-fix real-behavior evidence beyond test and CI claims, so it still needs redacted terminal or live output before merge.

Priority: P3
Reviewed head: b1d3dff68a0f68284795240fbac9e3b65ea0c0bc

Review scores

Measure Result What it means
Overall readiness 🦪 silver shellfish (2/6) The patch is a coherent, CI-positive test refactor, but its evidence remains below the required real-behavior proof gate.
Proof confidence 🦪 silver shellfish (2/6) Needs real behavior proof before merge: The PR body and CI show test-oriented validation, but no attached redacted terminal output, live run, recording, or runtime log demonstrates the refactored suite running after the change; please add that proof and update the PR body, then request @clawsweeper re-review if a new review does not start automatically.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body and CI show test-oriented validation, but no attached redacted terminal output, live run, recording, or runtime log demonstrates the refactored suite running after the change; please add that proof and update the PR body, then request @clawsweeper re-review if a new review does not start automatically.
Evidence reviewed 4 items Focused branch scope: The proposed branch changes test files plus the test file-size allowance; it does not modify runtime source, package metadata, dependencies, workflows, or release files.
Shared cleanup preserves mock-restoration ordering: The new fixture registers cleanup before each file’s later local afterEach hooks, and the added regression test verifies that mocked fs.rm is restored before temp-directory cleanup executes.
Current security-test ownership trail: Current main attributes the established shared security-test helper to Peter Steinberger, and current main’s latest store-safety change is also authored by Peter Steinberger; this makes the area ownership trail clear rather than inferred only from this PR.
Findings None None.
Security None None.

How this fits together

The test suite exercises fs-safe’s capability-style filesystem roots and guarded file operations against traversal, symlink, hardlink, archive, permission, and race conditions. Shared test fixtures create isolated paths and assertions, then verify the package continues to reject unsafe operations without affecting paths outside the controlled root.

flowchart LR
  A[Security regression cases] --> B[Shared test fixtures]
  B --> C[Temporary roots and platform gates]
  C --> D[fs-safe guarded operations]
  D --> E[Typed safety errors]
  D --> F[Outside-path side-effect checks]
  E --> G[Cross-platform test results]
  F --> G[Cross-platform test results]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body and CI show test-oriented validation, but no attached redacted terminal output, live run, recording, or runtime log demonstrates the refactored suite running after the change; please add that proof and update the PR body, then request @clawsweeper re-review if a new review does not start automatically.
  • Resolve merge risk (P1) - This refactor centralizes cleanup and platform gating across 62 test files, so a missed harness regression could weaken security regression coverage despite unchanged production code.
  • Resolve merge risk (P1) - The branch still lacks contributor-supplied after-fix real behavior proof; CI and the PR’s command list are supplemental evidence rather than that merge-gate proof.
  • Complete next step (P2) - No mechanical repair is identified; the remaining merge blocker is contributor-provided real behavior proof, which an automated repair lane cannot create on the contributor’s setup.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Test surface 62 files affected; 2 new test helpers/tests A repository-wide test harness refactor deserves proof that the shared lifecycle and platform aliases preserve existing security coverage.
Automated validation 18 successful checks, 3 in progress, 1 skipped Cross-platform CI is encouraging but does not replace contributor-run evidence for the changed test harness.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain the shared fixtures and land the refactor after the contributor posts redacted terminal or live output from the refactored suite, including the boundary/security test run and the full check.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain the shared fixtures and land the refactor after the contributor posts redacted terminal or live output from the refactored suite, including the boundary/security test run and the full check.

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

Not applicable: this PR refactors test infrastructure rather than reporting a current user-facing failure; source inspection shows focused shared fixtures and unchanged runtime code.

Is this the best way to solve the issue?

Yes, subject to proof: consolidating repeated temporary-directory, platform, and typed-error patterns into shared test helpers is the narrower maintainable direction, and the fixture-ordering regression directly covers its key lifecycle assumption.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against be27814e98e7.

Labels

Label changes:

  • add rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦪 silver shellfish, so this older rating label is no longer current.

Label justifications:

  • P3: This is test-suite cleanup and regression-coverage consolidation with no reported production behavior change.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body and CI show test-oriented validation, but no attached redacted terminal output, live run, recording, or runtime log demonstrates the refactored suite running after the change; please add that proof and update the PR body, then request @clawsweeper re-review if a new review does not start automatically.

Evidence

What I checked:

  • Focused branch scope: The proposed branch changes test files plus the test file-size allowance; it does not modify runtime source, package metadata, dependencies, workflows, or release files. (test/helpers/vitest.ts:1, b1d3dff68a0f)
  • Shared cleanup preserves mock-restoration ordering: The new fixture registers cleanup before each file’s later local afterEach hooks, and the added regression test verifies that mocked fs.rm is restored before temp-directory cleanup executes. (test/helpers/vitest.ts:18, b1d3dff68a0f)
  • Current security-test ownership trail: Current main attributes the established shared security-test helper to Peter Steinberger, and current main’s latest store-safety change is also authored by Peter Steinberger; this makes the area ownership trail clear rather than inferred only from this PR. (test/helpers/security.ts:1, be27814e98e7)
  • Validation status: The supplied PR checks show 18 successful runs across Linux, macOS, and Windows coverage/check/smoke surfaces; three Windows-oriented runs remain in progress. The PR body lists test commands but contains no attached terminal, live-output, recording, or redacted runtime-log proof. (package.json:110, be27814e98e7)

Likely related people:

  • steipete: Peter Steinberger authored the current-main security helper lines and the most recent current-main store-safety change; the submitted refactor targets that same test and safety-validation surface. (role: recent area contributor; confidence: high; commits: be27814e98e7, 16e1bd489ae8; files: test/helpers/security.ts, test/fs-safe.test.ts, test/write-boundary-bypass.test.ts)
  • Josh Avant: History includes Josh Avant’s Windows secure-read fallback work, an adjacent platform-specific filesystem-safety area exercised by this test refactor. (role: adjacent security-test contributor; confidence: medium; commits: a7f366ed0874; files: test/helpers/security.ts, test/native-integration.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Attach redacted terminal or live output showing pnpm test:security succeeding on the refactored checkout.
  • Attach redacted terminal or live output showing pnpm check succeeding, then update the PR body for re-review.

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.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-03T00:18:28.854Z sha 9018a94 :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the refactor/test-boilerplate branch from 9018a94 to b1d3dff Compare August 3, 2026 01:07
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 3, 2026
@steipete
steipete merged commit 3564f64 into main Aug 3, 2026
24 checks passed
@steipete
steipete deleted the refactor/test-boilerplate branch August 3, 2026 01:11
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: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant