Skip to content

test(native): share fixture helpers and parameterize codec and descriptor cases - #806

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

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

Conversation

@steipete

@steipete steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

The native crate's inline test modules (8,200 of its 20,500 lines) re-implemented the same fixture utilities: 34 copies of a unique temp-path builder across 20 files, five copies of a Windows test directory opener, six identical TAR codec fixture arrays, four single-purpose cancellation wrappers, and source/target twins of the same descriptor-rejection checks.

User Impact

No user-visible change; Rust test code only (production Rust and TypeScript unchanged).

Why This Change Was Made

  • native/src/test_support.rs (cfg(test)) provides unique_path_in/temp_path with one naming implementation and the existing Windows directory opener, used only at call sites with identical access, sharing, and backup-semantics flags. Each caller keeps its own base directory (including FS_SAFE_CLONE_TEST_ROOT), ACL setup, ownership, and cleanup timing.
  • One encoded_tar_variants helper replaces six codec arrays in their original order; the four raw-refill cancellation tests stay separately named through a small matrix that keeps real file-backed execution.
  • Closed-source/closed-target and i32::MAX descriptor rejections run from one parameterized body, with the isolated subprocess cases unchanged.

Net -247 lines.

Evidence

  • cargo test --workspace --locked: 188 passed; -- --list names identical before and after (native 138, archive-core 50). Per-file all-cfg case counts are unchanged, including Windows- and Linux-only modules.

  • No new clippy diagnostics.

  • Windows-only test code is compiled and run by the Native check (windows-latest) job (local cross-check stops at zstd-sys C headers on macOS).

  • Codex autoreview (P0-P2): 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:20
@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:23 AM ET / 13:23 UTC.

ClawSweeper review

What this changes

The PR shares native test fixture helpers and parameterizes archive codec, cancellation, and descriptor-rejection cases while preserving their assertions.

Merge readiness

✅ Ready for maintainer review

Keep open: this is a useful, bounded test refactor that is not already on main. Inspection of all introduced hunks found no actionable correctness defect.

Likely related people: steipete and Jason (Json), suggested from recent merged native-code history.

Priority: P3
Reviewed head: 2f03c3a175798f4545bf149986a67576dd99af4d

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused test consolidation preserves the inspected scenarios and introduces no concrete blocking defect.
Proof confidence 🌊 off-meta tidepool Not applicable: The supplied MEMBER classification exempts this test-only PR from contributor runtime proof; reported workspace tests are supplemental validation, and no production or 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 supplied MEMBER classification exempts this test-only PR from contributor runtime proof; reported workspace tests are supplemental validation, and no production or stored-data contract changes.
Evidence reviewed 7 items Complete policy inspection: Read the full root AGENTS.md and CONTRIBUTING.md; no nested AGENTS.md or maintainer notes were found. Applied the security-boundary and maintenance-only changelog guidance.
Pinned introduced change: Read all introduced hunks across 22 files. Changes are confined to test modules, test fixtures, and the cfg(test) module declaration; production filesystem operations, exports, dependencies, and workflows are unchanged. Main still contains the duplicated fixtures.
Fixture and Windows handle equivalence: The shared path builder preserves caller-selected roots and adds a process-wide atomic sequence. The Windows directory helper retains read access, read/write/delete sharing, and backup-semantics flags from the replaced openers; caller ACL setup and cleanup remain intact.
Findings None None.
Security None None.

How this fits together

The native Rust layer implements filesystem and archive operations for fs-safe's Node.js API. Its tests construct temporary filesystem fixtures and exercise platform-specific safety checks.

flowchart TD
 A[Native test cases] --> B[Shared fixture helpers]
 B --> C[Temporary files and directories]
 A --> D[Codec and descriptor cases]
 C --> E[Native filesystem and archive operations]
 D --> E
 E --> F[Safety assertions and cleanup]
Loading

Before merge

None.

Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; test infrastructure +159/-406; net -247 The reduction consolidates test code without growing the shipped implementation.

Technical review

Best possible solution:

Keep fixture construction shared while retaining platform-specific roots, permissions, handle flags, assertions, and cleanup ownership.

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

Not applicable: this PR consolidates existing tests rather than reporting a runtime defect; source comparison preserves the exercised cases.

Is this the best way to solve the issue?

Yes: test-only helpers remove repetition while leaving platform setup and safety assertions with their existing callers.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is maintenance-only test deduplication with no user-visible behavior change.
  • 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 supplied MEMBER classification exempts this test-only PR from contributor runtime proof; reported workspace tests are supplemental validation, and no production or stored-data contract changes.

Label justifications:

  • P3: This is maintenance-only test deduplication with no user-visible behavior change.
  • 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 supplied MEMBER classification exempts this test-only PR from contributor runtime proof; reported workspace tests are supplemental validation, and no production or stored-data contract changes.

Evidence

What I checked:

  • Complete policy inspection: Read the full root AGENTS.md and CONTRIBUTING.md; no nested AGENTS.md or maintainer notes were found. Applied the security-boundary and maintenance-only changelog guidance. (AGENTS.md:1, 2f03c3a17579)
  • Pinned introduced change: Read all introduced hunks across 22 files. Changes are confined to test modules, test fixtures, and the cfg(test) module declaration; production filesystem operations, exports, dependencies, and workflows are unchanged. Main still contains the duplicated fixtures. (native/src/lib.rs:9, 2f03c3a17579)
  • Fixture and Windows handle equivalence: The shared path builder preserves caller-selected roots and adds a process-wide atomic sequence. The Windows directory helper retains read access, read/write/delete sharing, and backup-semantics flags from the replaced openers; caller ACL setup and cleanup remain intact. (native/src/test_support.rs:5, 2f03c3a17579)
  • Archive and descriptor coverage preserved: The codec helper preserves raw TAR, gzip TAR, Zstandard, and bzip2 ordering. Four separately named cancellation cases retain cursor/file selection and raw-read assertions. Closed source/target descriptor cases still execute in isolated subprocesses, and both invalid descriptor positions retain EBADF assertions. (native/src/archive.rs:1218, 2f03c3a17579)
  • Reported validation and reviewer limits: The captured PR body reports 188 passing workspace tests and unchanged listed test names. These results were not independently executed during this read-only review. The existing native-check workflow runs workspace tests across Linux, macOS, and Windows. git diff --check passed and the checkout remained clean. (.github/workflows/ci.yml:1064, 2f03c3a17579)
  • Merged-area routing history: Available main history records Peter Steinberger's recent archive and Windows refactors and Jason (Json)'s retained-file and publication work. A targeted archive blame failed because a required promisor object could not be fetched with HTTP 403, so no source-line introduction attribution is claimed. (native/src/archive.rs, 167673bc7724)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Jason (Json): 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.

steipete added a commit that referenced this pull request Oct 1, 2026
…ptor cases (#806)

Share one cfg(test) temp-path builder and the Windows test directory opener across 20 native test modules, replace six TAR codec fixture arrays with one helper, and parameterize the cancellation and descriptor-rejection twins. All 188 Rust test names are unchanged; Rust test code only, net -247 lines.
@steipete

steipete commented Oct 1, 2026

Copy link
Copy Markdown
Contributor Author

Landed on main as 82d501f 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
…ptor cases (#806)

Share one cfg(test) temp-path builder and the Windows test directory opener across 20 native test modules, replace six TAR codec fixture arrays with one helper, and parameterize the cancellation and descriptor-rejection twins. All 188 Rust test names are unchanged; Rust test code only, net -247 lines.
@steipete
steipete deleted the steipete/deslop-r3-tests-rust 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