Skip to content

refactor(test): reuse canonical secret fixture cleanup - #189492

Merged
vincentkoc merged 1 commit into
mainfrom
refactor-test-secret-fixture-temp-owner-next100-20261031
Nov 27, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
refactor-test-secret-fixture-temp-owner-next100-20261031

Conversation

@vincentkoc

Copy link
Copy Markdown
Member

What Problem This Solves

The secret-file test fixture duplicates the canonical asynchronous temporary-directory lifecycle, leaving another cleanup owner to maintain.

User Impact

No runtime change. CLI credential-file option tests retain their real file setup, callback results and cleanup behavior through the shared fixture owner.

Why This Change Was Made

Delegate directory creation, callback awaiting and final removal to withTempDir. Preserve the prefix, token-before-password writes, empty-versus-absent handling and original failure precedence. Production/tooling LOC: 0; test support: -3.

Evidence

  • Both complete CLI option owners: 65 Node and 65 Bun tests passed.
  • Actual first token-write rejection retained the identical error, never invoked the callback, and removed the real directory.
  • Matching CLI test types, targeted type-aware lint, formatting and diff checks passed.
  • Independent complete-context static review: scoped-clean, confidence 0.99; no findings.
  • Trusted local fallback after unavailable remote broker. Transport mocks unchanged; no ACP/Codex protocol verdict, native Windows or timing/billed-minute claim.

@vincentkoc vincentkoc self-assigned this Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@vincentkoc
vincentkoc marked this pull request as ready for review October 31, 2026 15:13
@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR delegates temporary secret-file directory creation and cleanup to the existing withTempDir helper.

Example: An ACP option test supplies token content "tok_file\n".

  • Before: The secret-file fixture creates token.txt and removes its directory using its own lifecycle code.
  • After: The same file and callback behavior use the shared directory lifecycle.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The patch is focused and source-verified; validation evidence consists of author-reported test results rather than inspectable execution artifacts.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored test-support refactor changes no shipped behavior; reported consumer tests support the source-level equivalence assessment.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
Reason: The maintainer-authored direction reduces duplicate test-support ownership while retaining the existing behavior and consumers.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR makes a focused, behavior-preserving simplification with no actionable correctness or security findings; CI remains pending.

Priority: P3
Reviewed head: 6a06632426d36f726899de579c72b4f41a19e7c2

Before merge

None.

Findings

None.

Agent review details

How this fits together

The test-support fixture receives synthetic credentials and a callback, writes optional files, returns the callback result, and removes the temporary directory.

flowchart TD
  A[CLI option tests] --> B[Secret file fixture]
  B --> C[Shared temporary directory helper]
  C --> D[Write optional credential files]
  D --> E[Await test callback]
  E --> F[Remove temporary directory]
Loading

Technical review

Best possible solution:

Use withTempDir as the sole directory lifecycle owner while preserving the fixture's credential-writing contract.

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

There is no reported runtime bug to reproduce; source inspection confirms the duplicated lifecycle and equivalent shared helper.

Is this the best way to solve the issue?

The diff is the smallest complete simplification: it removes duplicate lifecycle ownership without adding machinery or changing consumer contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 7caee827c5be.

Provenance checked

  • Secret-file fixture directory lifecycle keeps the original intent (158a3b4: The creation commit consolidated CLI option-collision fixtures; delegation retains that purpose and the original cleanup semantics.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

  • Pinned introduced change: The introduced diff replaces local mkdtemp and finally cleanup with withTempDir while retaining file writes and callback awaiting. (src/test-utils/secret-file-fixture.ts:17, 6a06632426d3)
  • Equivalent lifecycle owner: withTempDir uses the same temporary root, prefix, awaited callback, and recursive forced removal in finally; cleanup failure precedence is preserved. (src/test-utils/temp-dir.ts:7, 6a06632426d3)
  • Current-main comparison: Fetched main still contains the fixture's separate lifecycle implementation, so this simplification remains distinct work. (src/test-utils/secret-file-fixture.ts:17, 7caee827c5be)
  • Feature history: The fixture's creation commit explicitly deduplicated CLI option-collision fixtures and contains the preserved credential-writing behavior. History also identifies an earlier shared temporary-directory helper effort; its historical blob is unavailable locally. (src/test-utils/secret-file-fixture.ts:17, 158a3b49a7a7)
  • Discussion and validation claims: The complete body reports 65 passing tests on each of Node and Bun plus a real-directory write-failure check; these are author-reported results, not independently observed runs. Discussion adds a re-review request without additional behavioral artifacts. (6a06632426d3)

Likely related people:

  • Peter Steinberger: Raw commit 158a3b4 adds src/test-utils/secret-file-fixture.ts:19 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 158a3b49a7a7; files: src/test-utils/secret-file-fixture.ts)

PR surface

Tests -3. Total -3 across 1 file. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 0 0 0 0
Tests 1 3 6 -3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 1 3 6 -3

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is a small test-support cleanup with no production behavior change.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 31, 2026, 11:17 AM ET / 15:17 UTC.

@vincentkoc
vincentkoc merged commit a2fe72e into main Nov 27, 2026
188 of 190 checks passed
@vincentkoc
vincentkoc deleted the refactor-test-secret-fixture-temp-owner-next100-20261031 branch November 27, 2026 07:21
@vincentkoc

Copy link
Copy Markdown
Member Author

Merged via squash.

vincentkoc added a commit that referenced this pull request Nov 27, 2026
…restoration-ci-189390-20261127

* commit '6feeb50a3f14fbf0aa5167d342f186dc4d67fc18': (9846 commits)
  fix: stop 2026-11-17 main Git checkouts from half-switching on a schema update (#206341)
  refactor(codex): centralize native completion delivery (#206447)
  fix(subagents): finish claimed stops after session rotation (#206405)
  fix: let owners fork a chat with exec after a subagent or exec completion (#206483)
  test(cli): gate agent --local cold-start processes and workers (#206466)
  perf(ci): skip baseline inventory when line-cap debt is empty (#189909)
  refactor(test): share core process-result fixtures (#174149)
  refactor(ci): reuse canonical budget flag parsing (#189480)
  fix: recover Codex chats after oversized requests (#206475)
  fix(agents): skip the bootstrap ritual in one-shot runs (#206477)
  fix(test): preserve stack coordinates in redacted failure reports (#152384)
  fix(gateway): return consistent unavailable response guidance (#191933)
  fix: preserve emphasis in Markdown table row labels (#205349)
  fix(nextcloud-talk): keep webhook spool helpers private (#206470)
  perf(plugins): overlay native receipts once per visible root (#206464)
  fix: keep GitHub comment approvals alive and skip repeat approval on the session PR (#206129)
  perf(config): retain one snapshot for unchanged validation results (#206465)
  refactor(test): reuse canonical secret fixture cleanup (#189492)
  refactor(subagents): own descendant Stop cancellation (#206444)
  refactor(subagents): keep announce cleanup action type private (#206407)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XS 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