Skip to content

test(cursor): remove per-file temp HAPI homes after cursor-models suites - #1269

Merged
heavygee merged 1 commit into
tiann:mainfrom
heavygee:test/cursor-models-temp-cleanup
Jul 31, 2026
Merged

test(cursor): remove per-file temp HAPI homes after cursor-models suites#1269
heavygee merged 1 commit into
tiann:mainfrom
heavygee:test/cursor-models-temp-cleanup

Conversation

@heavygee

Copy link
Copy Markdown
Collaborator

Fast-follow to #1268 addressing the HAPI Bot [Minor] finding on that PR.

What / why

The per-file HAPI homes created by the cursor-models test cluster were never removed, so every run leaked a directory into the system temp dir (afterEach only cleared the cache file inside them). Over many runs this litters /tmp with hapi-cursor-models-* dirs.

This restores the previous HAPI_HOME and recursively removes each per-file temp root in teardown:

  • cursorModels.test.ts - afterAll restore + rmSync (the file the bot flagged)
  • cursorModelsSharedCache.test.ts - afterAll restore + rmSync (the file the bot flagged)
  • cursorModelsStaleLock.test.ts - same latent leak (join(tmpdir(), 'hapi-cursor-models-lock-<pid>') was never cleaned) - folded in so the whole cluster is leak-free

No source/runtime change - test hygiene only.

Verification

  • bun typecheck clean (cli+web+hub).
  • 22 cursor-models tests pass.
  • Ran the cluster 3x with a pre-cleaned /tmp: 0 leaked hapi-cursor-models-* dirs after each run (before the fix, one dir leaked per run per file).

The one unrelated runner.integration.test.ts failure on my machine reproduces identically on pristine upstream/main (live-runner-daemon collision, environment-specific) and passed in CI on the #1268 merge commit - not touched by this diff.

Made with Cursor

Follow-up to tiann#1268. The per-file `mkdtempSync`/`join(tmpdir(), ...)` HAPI
homes in the cursor-models test cluster were never removed, so every run
leaked a directory into the system temp dir (afterEach only cleared the
cache file inside them). Save/restore HAPI_HOME and recursively remove
each per-file temp root in teardown across all three cursor-models test
files (cursorModels, cursorModelsSharedCache, and the stale-lock test that
had the same pattern). No source/runtime change.

Co-authored-by: Cursor <cursoragent@cursor.com>

@github-actions github-actions 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.

Findings

  • No Blocker, Major, Minor, or Nit issues found in the added or modified lines.

Summary
Review mode: initial

  • Reviewed the complete latest diff across the three cursor-model test files. The teardown order restores HAPI_HOME after cache resets and removes only the suite-owned temporary roots.
  • Residual risk: filesystem cleanup behavior remains dependent on platform-specific temp-directory semantics; the repository CI test job was still in progress when reviewed.

Testing

  • Not run (automation; PR code was not executed under the review security policy). GitHub test check: in progress.

HAPI Bot

@heavygee
heavygee merged commit c7afc50 into tiann:main Jul 31, 2026
2 checks passed
@heavygee

Copy link
Copy Markdown
Collaborator Author

Fast-follow to close the HAPI Bot [Minor] on #1268 - temp-dir cleanup, bot re-review is Findings:None. Merging this one too under the low-impact arrangement.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant