Skip to content

refactor(test): share duplicated fixtures and drop dead test adapters - #791

Merged
steipete merged 4 commits into
mainfrom
steipete/deslop-test-fixtures
Oct 1, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/deslop-test-fixtures

Conversation

@steipete

@steipete steipete commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The test suite re-implemented the same small fixtures many times: 18 copies of a void promise barrier, hand-rolled temp-directory tracking in suites that could use the shared fixture, identical FileHandle override proxies, a duplicate fixture CRC32, an error-code adapter that has been an identity function since May, and unused imports.

User Impact

No user-visible change; test and test-helper files only. Production source is unchanged.

Why This Change Was Made

Net -207 test lines across 46 files, with each helper's behavior kept exactly:

  • Finish adopting useTempDirs() in six suites and drop leftover cleanup loops in two converted ones, preserving prefixes and restore-before-cleanup order.
  • Move one deferred() barrier into test/helpers/deferred.ts (same synchronous executor and { promise, resolve } shape) for 17 call sites.
  • Share the FileHandle override proxy in test/helpers/file-handle-proxy.ts for six suites.
  • Inline the six literal codes passed through expectedFsSafeCode and delete it; reuse fixtureCrc32 for the gzip fixture; remove unused imports.

A second commit covers the same duplicates in suites that #772 rewrote (copy-fallback cleanup and failures, atomic chunk values, directory-mode owner), now that #772 has landed.

Evidence

  • tsc and a strict type-check of the touched test files: no new errors.

  • 77 affected and dependent suites: 1,586 passed, 79 skipped, zero failures; the four refactor(atomic): share sync and async resource ownership #772 suites: 21 passed.

  • lint:file-size, lint:fs-boundary, git diff --check: pass.

  • Codex autoreview (P0-P2): scoped-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 03:56
@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, 3:06 AM ET / 07:06 UTC (Revision 3).

ClawSweeper review

What this changes

The PR shares test promise barriers and file-handle proxies, adopts existing temporary-directory fixtures, and removes redundant adapters and unused imports.

Merge readiness

✅ Ready for maintainer review

This remains useful work beyond current main. The introduced changes preserve test behavior, and no actionable correctness or security defect was found.

Priority: P3
Reviewed head: 001c61160bff584e59186c6f247f845873517a20

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, behavior-preserving test consolidation with reported validation and no blocking findings.
Proof confidence 🌊 off-meta tidepool Not applicable: This verified repository-admin PR changes only test scaffolding and no production owner or runtime behavior; ordinary external-contributor proof is exempt, and 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: This verified repository-admin PR changes only test scaffolding and no production owner or runtime behavior; ordinary external-contributor proof is exempt, and no stored-data contract changes.
Evidence reviewed 9 items Full applicable repository policy: Read the complete root AGENTS.md. No nested AGENTS.md or maintainer-note files were found. Applied the filesystem-boundary and maintenance-only changelog guidance; no changelog entry is needed for this test-only consolidation.
Pinned introduced scope: Read the introduced hunks across all 46 test and helper files. The delta is 105 additions and 312 deletions; production source, package metadata, dependencies, and workflows are unchanged.
Equivalent shared helpers: The shared deferred helper retains synchronous promise-executor initialization and the same promise/resolve shape. The file-handle proxy retains override precedence and binds remaining methods to the original handle. The reused fixture CRC32 has the same algorithm as the deleted gzip-local implementation.
Findings None None.
Security None None.

How this fits together

The test suite exercises fs-safe’s guarded filesystem operations using temporary directories, controlled file handles, concurrency barriers, and archive fixtures. These helpers supply test inputs and fault scenarios while assertions check filesystem safety and cleanup.

flowchart TD
 A[Test scenarios] --> B[Shared test fixtures]
 B --> C[Temporary directories]
 B --> D[Controlled handles and barriers]
 B --> E[Archive bytes]
 C --> F[Guarded filesystem operations]
 D --> F
 E --> F
 F --> G[Safety assertions and cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production and test LOC production +0/-0; tests +105/-312, net -207 across 46 files The consolidation reduces test duplication without growing or changing the shipped implementation.

Technical review

Best possible solution:

Keep one shared implementation of each identical test fixture while preserving assertions, fault injection, platform behavior, and cleanup ordering.

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

Not applicable: this PR consolidates existing test scaffolding and reports no runtime bug; the duplicated implementations are directly visible in the pinned diff.

Is this the best way to solve the issue?

Yes: reusing the existing cleanup fixture and extracting identical small helpers is a bounded solution that preserves the test scenarios and assertions.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9753fc43a941.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is maintenance-only test consolidation with no changed public behavior.
  • 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: This verified repository-admin PR changes only test scaffolding and no production owner or runtime behavior; ordinary external-contributor proof is exempt, and no stored-data contract changes.

Evidence

What I checked:

  • Full applicable repository policy: Read the complete root AGENTS.md. No nested AGENTS.md or maintainer-note files were found. Applied the filesystem-boundary and maintenance-only changelog guidance; no changelog entry is needed for this test-only consolidation. (AGENTS.md:1, 001c61160bff)
  • Pinned introduced scope: Read the introduced hunks across all 46 test and helper files. The delta is 105 additions and 312 deletions; production source, package metadata, dependencies, and workflows are unchanged. (001c61160bff)
  • Equivalent shared helpers: The shared deferred helper retains synchronous promise-executor initialization and the same promise/resolve shape. The file-handle proxy retains override precedence and binds remaining methods to the original handle. The reused fixture CRC32 has the same algorithm as the deleted gzip-local implementation. (test/helpers/file-handle-proxy.ts:3, 001c61160bff)
  • Cleanup ordering remains covered: The existing temporary-directory helper registers cleanup before local restoration hooks. Converted suites preserve their prefixes and restoration hooks; the existing fixture-ordering regression spies on removal and verifies the directory disappears after restoration. (test/temp-fixture.test.ts:17, 001c61160bff)
  • Still distinct from main and release: Neither pinned main nor v0.22.0 contains the new deferred or file-handle-proxy helper paths. Earlier merged refactor(test): remove repeated suite boilerplate #108 established the shared temporary-directory pattern but does not implement this remaining consolidation. (test/helpers/deferred.ts:1, ef7b5a909bff)
  • Area history and routing: Available main history connects Peter Steinberger to the merged test-boilerplate consolidation and recent fixture maintenance. Deeper follow-history and blame inspection encountered an unavailable historical object with HTTP 403, so no source-line introduction claim is made. (test/helpers/vitest.ts:22, 3564f64ea4d7)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (2 earlier review cycles)
  • reviewed 2026-10-01T03:59:07.567Z sha 3d77587 :: needs maintainer review before merge. :: none
  • reviewed 2026-10-01T04:31:13.406Z sha 686af09 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 74cf375 into main Oct 1, 2026
45 checks passed
@steipete
steipete deleted the steipete/deslop-test-fixtures branch October 1, 2026 07:21
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