Repository navigation
refactor(test): share duplicated fixtures and drop dead test adapters - #791
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. Reviewed October 1, 2026, 3:06 AM ET / 07:06 UTC (Revision 3). ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThe 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]
Before mergeNone. Agent review detailsSecurityNone. Review metrics
Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
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:
useTempDirs()in six suites and drop leftover cleanup loops in two converted ones, preserving prefixes and restore-before-cleanup order.deferred()barrier intotest/helpers/deferred.ts(same synchronous executor and{ promise, resolve }shape) for 17 call sites.test/helpers/file-handle-proxy.tsfor six suites.expectedFsSafeCodeand delete it; reusefixtureCrc32for 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
tscand 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.mdupdated when release-relevantNo credentials, private paths, private hosts, or sensitive contents included