test(office): prove a dropped children-completed wake gets recovered - #3486
Conversation
Adds regression coverage requested on PR kdlbs#3271's review (discussion_r3909576685): queueChildrenCompletedRun can fail after AreAllChildrenTerminal succeeds (e.g. a transient GetChildSetKey error), and finalizeDone only logs that at Warn because ParentWakeReconciler is documented as the recovery path. Nothing proved that recovery actually happened until now. TestParentWakeReconciler_RecoversFailedEdgeDispatch injects a one-shot failure into the edge-triggered on_children_completed dispatch, confirms nothing is queued/receipted, then asserts a reconciler Tick re-delivers the same wake (same operation id) as a real queued run. TestParentWakeReconciler_DoesNotDoubleQueueASuccessfulEdgeDispatch is the non-vacuity control proving the assertions discriminate on the edge path's outcome. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
|
Claude finished @nova28's task in 5m 48s —— View job FindingsReviewed commit Suggestion (recommended, doesn't block)
Summary
Verdict: Ready with suggestions. The two core tests are logically sound:
All three findings above are suggestions the PR author already acknowledged; none block correctness or introduce a regression risk. |
|
Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: QUIET Plan: Team Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 4 included reviews per hour; 2 remain after this review. 📝 SummarySummary by CodeRabbit
WalkthroughThe test suite adds helpers for simulated dispatch failures and child completion events. It verifies retry behavior after failed edge dispatches and prevents duplicate queue entries after successful dispatches. ChangesParent wake reconciler validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Merge Risk: ⚪ Minimal · up to The change adds regression coverage for retrying failed parent wake dispatches and preventing duplicate runs after successful dispatches, without modifying production behavior. It is ready to merge. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. A rabbit reads each line, Comment |
|
| Filename | Overview |
|---|---|
| apps/backend/internal/office/service/scheduler_wake_reconciler_test.go | Adds useful wake-recovery regression coverage, but misidentifies the injected failure boundary and does not directly observe duplicate dispatches in the control test. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart LR
A[Child reaches Done] --> B[Edge wake dispatch]
B -->|Injected dispatcher failure| C[No run or receipt]
C --> D[ParentWakeReconciler Tick]
D --> E[Dispatch same operation ID]
E --> F[Queued run and receipt]
B -->|Success| G[Queued run]
G --> H[Reconciler sweep should not dispatch again]
Reviews (1): Last reviewed commit: "test(office): cover ParentWakeReconciler..." | Re-trigger Greptile
Address Greptile review threads on PR kdlbs#3486: rename the injected failure error to describe the actual failure point (dispatch, not GetChildSetKey), guard the one-shot dispatcher's call log with a mutex to match the fakeDispatcher convention, and wrap the control test's dispatcher in a call counter so it directly proves the reconciler makes zero dispatch attempts behind a successful edge delivery.
|
CI on This is unrelated to this PR's diff (one file,
I don't have admin rights on this repo to trigger |
|
Added a small follow-up commit (2904323) that clarifies the injected failure boundary and verifies that both edge and reconciler dispatches target the expected parent and trigger. This makes the regression test more precise without changing production behavior. Thanks for the contribution. |
Tip
PR walkthrough: Open the visual walkthrough
Adds the regression test a github-actions review bot asked for on #3271: proof that
ParentWakeReconcileractually recovers a parent'son_children_completedwake when the edge-triggered dispatch fails, since #3271 downgraded that failure's log level from Error to Warn on the strength of an until-now-untested assumption.Today: If
queueChildrenCompletedRunfails partway (e.g. a transient DB error), the parent's wake is silently dropped on the edge path and only logged at Warn — nothing in the test suite proved the reconciler's recovery sweep actually re-queues it.After this: A new test drives that exact failure through
ParentWakeReconciler.Tickand asserts a second dispatch attempt with the same operation id, one queued run, and a receipt whose delivery id matches. A control test alongside it proves a successful edge dispatch is not double-queued by the same sweep.Who hits this: Contributors changing the office wake/reconciler path — this closes the exact gap the review bot flagged on #3271, which was previously an assumption baked into a comment, not a test.
Scope: Standalone follow-up to #3271; no sibling PRs.
Not here: No production code changes — this is test-only coverage. Two pre-existing, unrelated test failures on this environment are noted below (not caused by this diff, not fixed here).
Validation
make test(full suite) has two pre-existing failure sets on this environment, both proven unrelated to this diff (identical failures reproduce on a clean checkout with none of this branch's changes):internal/worktree+ several dependents (internal/task/service,internal/task/handlers,internal/launcher,internal/system/storage/workspaces,internal/agent/...,internal/agentctl/...) — this macOS sandbox's/var/folderssymlink layout trips the worktree manager's own path-safety checks. Reproduces identically on a scratch clone of the merge base.internal/office/repository/sqlite'sTestMigrate_PriorityIdempotent— fails deterministically on currentmain(3d042e9d8) with no relation to this branch (git diff origin/main HEAD --statshows only the one test file this PR adds). Introduced by an unrelated commit between the old and currentmaintip; filed as a follow-up (kandev task4f422031-3cd1-4893-85ee-3e9f77ec2f63).Possible Improvements
Low risk — test-only change, zero production code touched. Review noted a few test-rigor nitpicks (a doc-comment could more precisely name the injected failure point, and the control test could assert on the dispatcher directly rather than only counting runs); judged non-blocking and left as-is to keep the diff minimal.
Checklist
apps/web/), I have added or updated Playwright e2e tests inapps/web/e2e/and verified them withmake test-e2e.docs/public/**and updated them or noted why no docs change is needed.