Skip to content

test(responses): make the periodic spill sweep resume case deterministic - #6848

Merged
lidge-jun merged 1 commit into
devfrom
cursor/stabilize-spill-orphan-sweep-6bb0
Oct 9, 2026
Merged

lidge-jun merged 1 commit into
devfrom
cursor/stabilize-spill-orphan-sweep-6bb0

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Oct 9, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • The periodic spill-sweep test assumed three 25ms liveness ticks could stat and unlink a full directory. On a slow CI runner the wall-clock deadline stopped each tick early, so tests/responses/responses-spill-orphan-sweep.test.ts saw 3 removals instead of every orphan (shard 4/4 on feat(gui): add a Context accounting control to the Claude Code page #6782).
  • The resume case now drives directory order through the existing readdirEntry seam and holds Date.now still. The first tick must stop at scanMax with nothing removed; the next tick removes only the orphans and leaves the referenced spills. The process-global sweep cursor is reset around each case.
  • Production reclaim is unchanged. The 25ms deadline is still covered by the following test, which advances a fake clock 10ms per name.

Verification

  • bun test ./tests/responses/responses-spill-orphan-sweep.test.ts — 6 pass, 0 fail, 24 expects.
  • Same command, 20 consecutive runs: 20 pass, 0 fail.
  • Same command, 20 more runs while four python3 busy-loops saturated the CPUs: 20 pass, 0 fail.
  • Diff against dev is only tests/responses/responses-spill-orphan-sweep.test.ts (46 insertions, 15 deletions). scripts/test-layout/layout.json is unchanged.
  • No GUI change. CI, including the Windows job, is the remaining check.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Tests
    • Made periodic sweep tests deterministic and isolated by resetting the sweep cursor between test runs.
    • Updated the full-window test to verify that a completed scan removes orphaned files while retaining owned files.

The window case assumed three 25ms liveness ticks could finish a real
directory. On a slow runner the deadline stopped each tick early, so the
assertion saw 3 removals instead of every orphan. Drive order through the
existing readdir seam, hold the clock still, and assert the first tick stops
at the scan window while the next tick removes only the orphans. Reset the
process-global sweep cursor around each case.

Co-authored-by: JUN <jun@lidgeai.com>
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner October 9, 2026 20:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-09T20:24:25.832769Z 0768fd2 PR opened
ℹ️ 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.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: lidge-jun/opencodex/.coderabbit.yaml
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 005e555d-9345-4f00-aaf1-798f307c1f8b

📥 Commits

Reviewing files that changed from the base of the PR and between d17a9f2 and 0768fd2.


📒 Files selected for processing (1)
  • tests/responses/responses-spill-orphan-sweep.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.



📝 Walkthrough

Walkthrough

The test suite resets the process-global periodic sweep cursor before and after each test. The full-window test uses deterministic enumeration to verify scan-limit handling, orphan removal, and retention of owned files.

Changes

Spill orphan sweep tests

Layer / File(s) Summary
Sweep cursor setup and full-window test
tests/responses/responses-spill-orphan-sweep.test.ts
Lines 82–93 reset the periodic sweep cursor during setup and cleanup. Lines 202–244 use deterministic enumeration to verify that the first tick removes nothing and the next tick removes both orphans while retaining owned spills and files.

Priority: ⬇️ Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Other


Merge Risk: ⚪ Minimal · up to 0768f

This change only makes a flaky test deterministic and does not alter production behavior. It carries no merge-blocking risk.

Pre-merge checks | Passed 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly identifies the test scope and the main change: making the periodic spill sweep resume case deterministic. It is concise, specific, and consistent with the described test-only changes…
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.


✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR

🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR


  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Oct 9, 2026
@lidge-jun
lidge-jun merged commit 93ed1a4 into dev Oct 9, 2026
33 of 37 checks passed
@lidge-jun
lidge-jun deleted the cursor/stabilize-spill-orphan-sweep-6bb0 branch October 9, 2026 20:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants