Skip to content

test(providers): own temporary directories through createTestTempDirectory - #12722

Merged
morluto merged 3 commits into
mainfrom
cursor/test-providers-temp-directories-8b28
Nov 20, 2026
Merged

morluto merged 3 commits into
mainfrom
cursor/test-providers-temp-directories-8b28

Conversation

@morluto

@morluto morluto commented Nov 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

Provider-boundary tests created temporary directories with mkdtemp(join(tmpdir(), …)) and deleted them by hand. Those directories now come from createTestTempDirectory, which returns the canonical path and removes it in onTestFinished after afterEach. Two Cutter tests that returned early on Windows are skipped with it.skipIf. Unknown plugin recovery is checked for the explanation source is unknown, independently of the formatter.

Directories whose removal was withheld until process cleanup succeeded stay on mkdtemp and are removed only by that owner. The Rizin decoder directory stays owned by createProviderEnvironmentMcpHarness.

Problem and expected behavior

Manual mkdtemp cleanup can leak an owned directory when a test fails before its rm, and a bare return on Windows made two Cutter tests pass without running. Each case should own one canonical directory that is removed after process shutdown, and Windows-inapplicable checks should be reported as skipped. A directory that is kept when process cleanup fails, or that another helper already deletes, must keep that single owner.

Change and scope

mkdtemp / mkdtempSync sites in 25 files under tests/boundary/providers now call createTestTempDirectory, except the leave-alones below. Matching manual rm, rmSync, and onTestFinished directory deletion was removed where the helper took ownership. afterEach still closes sessions, managers, and inferior processes before that removal, because Vitest runs afterEach before onTestFinished.

Left alone:

  • tests/boundary/providers/ida/verifierObservations.test.ts:151 removes its directory only when owned-command cleanup is confirmed. Unconfirmed cleanup retains the workspace.
  • GdbSessionManagers.test.ts, GdbSessionReviewRegressions.test.ts, and GdbSessionManagerCoverage.test.ts remove the directory inside fixtureOwner.cleanup, which throws before removeFiles if a child has not exited.
  • GdbCommandQueue.test.ts and RizinInferiorExit.test.ts remove the directory only after close or stop succeeds. A failure throws first and retains the directory.
  • RizinDecoderInputs.test.ts creates the directory with mkdtemp. createProviderEnvironmentMcpHarness is the only deleter.

Assertion replacement:

  • CutterBridgeClient.test.ts asserts that unknown recovery contains source is unknown, not the return value of cutterBridgeSourceRecovery. The case also asserts bridge_source: "unknown" and that the recovery contains the packaged plugin path. A connective wording change that keeps the phrase still passes. Removing the phrase fails both unknown cases.

npm run test:local refuses these paths because they belong to a built boundary project. npm run test:focused is the command that runs them.

Follow the contribution scope.
Unresolved scope, authority, side effects, or required verification block
integration. Link the required maintainer scope decision for new providers or
capabilities involving target execution, injection, mutation, or protection
recovery; ordinary fixes within existing boundaries may state "not applicable".
Draft PRs may leave the scope decision pending and the readiness and merge checklists
unchecked. Maintainers can help resolve open questions.

Contract and boundary impact

  • Semantic owner and earliest changed stage: test fixture ownership only. Production providers are unchanged.
  • Contribution scope fit and linked maintainer decision: not applicable. Test cleanup inside existing provider-boundary suites.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none. The two POSIX Cutter checks are now it.skipIf(process.platform === "win32") instead of returning before any assertion.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details (if applicable): none.
  • Generated metadata (docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs and skills/; edit authored instructions in .agents/skills/reverse-engineer-anything/ and never commit build outputs): none.

Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

Evidence and regression coverage

  • Tests added or updated: the 25 files above. No production behavior changed.
  • Base reproduction or other evidence: source-derived. A Windows early return counts as a pass. Comparing recovery with cutterBridgeSourceRecovery("unknown") follows the formatter, so deleting the unknown-source explanation from that function still passes. toContain("source is unknown") fails when that phrase is removed.
  • User-visible CLI/MCP output (if applicable): none.
  • Remaining proof gaps: RizinDecoderInputs.test.ts skipped all 6 tests because no Rizin binary is on PATH. Real Ghidra, Hopper, and IDA lanes were not run; these are fixture tests.

For boundary fixes, identify the applicable boundary regressions
and lifecycle regressions
covered by the evidence above, and explain relevant gaps.

Not a boundary or lifecycle production fix. Fixture directories that the helper owns are removed after the existing process shutdown in afterEach. Directories gated on confirmed process cleanup stay with that owner.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity, source provenance, and failed attempts remain preserved.
  • Unsupported, incomplete, unavailable, or uncertain outcomes remain visible.

Validation performed

Node.js 24.22.1. Head: b3926d692.

  • npm run test:focused -- the 25 files — two full runs before the ownership fix: 497 passed, 8 skipped (24 files passed, RizinDecoderInputs.test.ts skipped).
  • npm run verify:test-temp-hygiene -- those 25 files — "no owned residues remain" (497 passed, 8 skipped).
  • npm run test:focused -- the six files restored to gated mkdtemp cleanup — two passes: 249 passed, 6 skipped (RizinDecoderInputs.test.ts).
  • npm run test:focused -- tests/boundary/providers/CutterBridgeClient.test.ts — 40 passed after restoring toContain("source is unknown").
  • Changing "so its source is unknown" to "so the plugin source is unknown", then restoring it, left those 40 tests passing. Replacing the phrase with "so its origin was not published" failed both unknown cases, and the production string was restored.
  • npm run check:fast — typecheck, lint, and architecture guards passed on the earlier commits. The pre-push hook ran it on the first push.
  • git diff --check — clean.

npm run test:local -- these files exits before running them and tells the caller to use test:focused.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not run. Suites use fixtures. No Rizin binary was available for RizinDecoderInputs.test.ts.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: test-only. Helper-owned directories are removed after the existing process shutdown. Gated directories are removed only after that cleanup confirms the processes have stopped.

Author readiness

Human owner: @morluto

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.
Open in Web Open in Cursor 

…ctory

Route provider-boundary fixtures through createTestTempDirectory so each
case removes its canonical directory after the test. Process shutdown stays
in afterEach, which still runs before that removal. Skip the two Windows
Cutter checks with it.skipIf, and compare unknown plugin recovery with
cutterBridgeSourceRecovery.
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-20T03:56:29.237464Z eecc3dd New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@greptile-apps

greptile-apps Bot commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The reviewed changes appear safe to merge.

Summary

Provider tests now use createTestTempDirectory for directories that can be removed after each test.

  • Provider tests let each test case own its temporary folders.
  • Cutter tests report Windows-only exclusions as skips and compare recovery text with its formatter.

Reviews (3) · Last reviewed commit: "test(cutter): keep an independent unknow..." · Reviewed by Greptile

createTestTempDirectory always deletes after the test, including when
GDB or inferior cleanup fails and when the Rizin MCP harness already
owns the directory. Restore mkdtemp removal behind confirmed process
cleanup, and leave decoder inputs owned by the harness.

Co-authored-by: morluto <[email protected]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: eecc3dd83e

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comparing discovery recovery with cutterBridgeSourceRecovery follows the
formatter, so dropping the unknown-source explanation still passes. Assert
that explanation directly, beside bridge_source and the plugin path.

Co-authored-by: morluto <[email protected]>
@morluto
morluto enabled auto-merge (squash) November 20, 2026 04:06
@morluto
morluto merged commit 94c3077 into main Nov 20, 2026
38 checks passed
@morluto
morluto deleted the cursor/test-providers-temp-directories-8b28 branch November 20, 2026 04:06
jimpablo added a commit to jimpablo/rea that referenced this pull request Nov 21, 2026
…-admission

Resolve conflicts with upstream/main (8fefe18):
- Remove docs/specs/README.md and docs/specs/native/macho-dsym-companion/* per morluto#12856
- Combine caller_input_path and debug_companion in liveBinaryTargetSummary.ts
- Combine ComLoader import and debug_companion in GhidraAnalysisProfile.ts
- Combine detectDatabaseEngine, boolean hasTrailingZipArchive, and retainTargetCancellation (morluto#12339) with dsym_path admission and cleanup in BinaryTargetResolver.ts
- Update advertised schema summary for open_binary.json
- Migrate new tests in ghidraCheckpointLifecycle.test.ts and GhidraProvider.behavior.test.ts to createTestTempDirectory (morluto#12722)
Entrpi added a commit to Entrpi/rea that referenced this pull request Nov 22, 2026
…xture changes

RizinInferiorTty now imports tests/fixtures/temporaryDirectory.ts from main (morluto#12722), so the workflow's direct-import path list names it too.
@morluto morluto added the area: providers Provider and capability discovery, including provider proposal triage label Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: providers Provider and capability discovery, including provider proposal triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants