Repository navigation
Conversation
…never dispatched The Node host's scheduler and shard-alarm timers only ever clear their own bookkeeping on fire — nothing dispatches the scheduled function or wakes an alarm callback. Rating both "emulated" let codegen's fail-closed gate pass ctx.scheduler through silently for target: "node" apps whose scheduled work would never run; "emulated" means built on lower-level primitives and working, which never-dispatched is not. Flip both to "unsupported" in NODE_CAPABILITIES so codegen omits the surface and emits platform_unsupported_feature instead. Drop the scheduler's deadLetter member (and simulateDeadLetter): its presence is the contract's documented at-least-once claim, and this host cannot back it. Document that shardAlarms has no CapabilityKey to gate through codegen's usage map — it is engine-internal, never an app import — so the rating exists for Studio parity reporting rather than codegen gating. Update the codegen golden test to expect scheduler gated off.
Two latent lifecycle/correctness bugs in the Node host, both hardened here together since they share node-shard-host.ts: - close() was not a terminal state: after tearing a NodePlatform down, scheduler.schedule() armed a fresh setTimeout nothing would ever clear, scheduler.list()/cancel() kept reporting stale jobs, and alarms.set() mutated in-memory state before throwing on the closed connection. Every mutating call now checks closed-ness first (the connection's own open state for alarms, a dedicated flag for the scheduler) and throws before any mutation; reads/cancels answer emptied/false rather than throwing, so teardown-order races stay benign. - transaction() ran raw BEGIN/COMMIT/ROLLBACK directly against the shared connection with no serialization of its own. Two overlapping transaction() calls could throw "cannot start a transaction within a transaction" or, worse, let one's COMMIT commit the other's uncommitted writes. Routing transaction through the existing runSerialized queue would deadlock (the engine already composes runSerialized(() => transaction(work))), so this adds a second, private transactionTail chain of the identical shape, used only by transaction — bare overlapping calls now serialize against each other instead of corrupting commits, and the engine's composition stays deadlock-free. Same fix applied to the reference host, which has the identical shape. New lifecycle legs and a transaction-concurrency test on both hosts; each was confirmed to fail against the pre-fix code (stashed and re-run) before this commit.
…, safe cleanup The host-contract TCK could not fail for the failures that mattered most: - No leg ever asserted a scheduled job was actually dispatched — only that scheduling math was right and an id existed. A host that stores jobs and drops them on the floor (exactly what both the Node and reference hosts did pre-267) passed every scheduler leg, dead-letter legs included. Add ConformanceHost.awaitJobDispatched (optional, but mandatory for a host that declares scheduler.deadLetter — the contract's at-least-once claim), make the reference host observably dispatch (a dispatchedJobs set populated from its scheduler timer, not just bookkeeping deletion), and add a leg that fails a host claiming deadLetter without provable dispatch rather than skipping it. - 14 optional-tier branches padded expect(true).toBe(true) (or a self-evident toBeUndefined()) instead of skipping, so a host exercising 20 of 28 legs still reported "28 passed". Replaced every one with vitest's dynamic context.skip(), moving each leg's expect.assertions() below the tier check. The workerd adapter (itInDurableObject) now forwards the real TestContext into the suite body so context.skip() reaches a runner that recognizes it. - All 43 host.cleanup?.() calls were bare trailing statements, never in a finally — a failing assertion above one skipped cleanup, leaking the alarm/scheduler setTimeouts (and, on a file-backed host, the open connection). Introduced a withHost(run) wrapper that guarantees cleanup on every path (assertion failure, context.skip(), or return) without an afterEach, which the workerd call site's runInDurableObject scoping rules out. Also added "keeps overlapping transactions atomic" to the ShardHost block, pinning plan 267's transactionTail fix suite-wide (including against the real Cloudflare host over storage.transaction). Verified per-host outcome: reference host 43/43 green, 0 skips (implements every optional tier). Node host 50 passed, 4 skipped (the delivery leg plus the three dead-letter legs it no longer claims post-267). Cloudflare (@lunora/do, LUNORA_WORKERD_TESTS=1) 570 passed, 12 skipped (2 recycle + 1 mutable-tag + 9 scheduler legs — it has no scheduler at all), 0 failed. Each new/changed behavior was demonstrated against pre-fix code before landing: the delivery leg fails a host with deadLetter but no observable dispatch, and a deliberately broken assertion in the rollback leg produces a prompt red exit instead of a handle-leak hang.
|
Warning Review limit reached
Next review available in: 56 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: ⛔ Files ignored due to path filters (5)
📒 Files selected for processing (8)
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. Comment |
❌ Deploy Preview for lunorash failed.
|
|
Thank you for following the naming conventions! 🙏 |
|
Thank you for confirming the Contributor License Agreement! 🙏 |
|
Closing: this PR was opened in error by an automated run, outside the scope of its task. No work is lost — the branch is retained on origin and this PR can be reopened at any time. Context: this branch predates the merges of #288 and #289, so much of its content is already on |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Work from an agent worktree, pushed under a descriptive name (local branch was
worktree-agent-a3e2c22e70fd79ddf).Branched before #288/#289 landed, so it needs a rebase onto current alpha before merge.
Commits