Repository navigation
Conversation
Contributor
🦋 Changeset detectedLatest commit: e211051 The changes in this PR will be included in the next version bump. This PR includes changesets to release 0 packagesWhen changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
Sim WorldSimulated world deterministic testing for races. Traces 🟠 world-sim scenario book — 1 fail of 42 total
Full trace: |
Co-Authored-By: Claude <noreply@anthropic.com> Co-Authored-By: Pranay Prakash <1797812+pranaygp@users.noreply.github.com>
pranaygp
force-pushed
the
workflow-docs-cleanup-thu-8-oct
branch
from
October 8, 2026 16:09
5c08368 to
d08a0c3
Compare
pranaygp
added a commit
that referenced
this pull request
Oct 8, 2026
…ounted (#4783) ## Summary Sim World has reported `in-flight-before-decision-counted` as the book's one red on every PR, docs-only ones included. The cause is a stale expectation, not a runtime regression. This PR restores the check #3519 wrote for slot ids and adds a unit test for the count half of the fence, which no scenario reaches anymore. ## Where it started It started at ec709ba (#3544, Aug 17), not in the #4772–#4782 range. It has failed on every `main` push since then: - At b0adb50 (the parent of #3544), the append-only lane, which became the only lane, passes with `ok check: the fence rejected the write`. - At ec709ba the single remaining lane fails `the count guard fenced the write the watermark let through`. - I reproduced both locally (`pnpm sim in-flight-before-decision-counted`, with `--append-only` on the parent). The runtime trace is identical at both commits: the orchestrator's `step_started` decision is rejected with `PreconditionFailedError: … changed out of band since the caller's snapshot`, it reloads, and it completes with replay ok. Only the check changed. While removing the mint-ordered log, #3544 put back the scenario's pre-#3519 check, which matches the count half's own message (`at or below the caller`). #3519 had replaced it on purpose. Watermarks used to be milliseconds, so the hook and the timeout compared equal and only the count could separate them. A slot watermark is strictly ordered. ## Why the expectation is stale, not the runtime With commit-time slots, the in-flight hook commits at slot 8, above the caller's watermark of 7. The watermark half rejects the decision, and it is evaluated first. The old check can't pass even if the count half is reached: I disabled the watermark half locally, and at the decision write `recorded == loaded` (7 == 7), so the count half lets it through. The count half fires only later, on the settle step's `step_completed`, after the branch has run. That makes the old check worse than unsatisfiable. With the watermark half broken it **passes**, because it accepts that late rejection. The runtime does the right thing here: it fences the decision, reloads, and settles on the branch the log implies, with 0 violations. ## Changes - `in-flight-before-decision-counted`: assert that the fence rejected the orchestrator's `step_started` decision (`PreconditionFailedError`, writer `orchestrator`). Matching any 412 would also accept the late step-body rejection above. The description now matches what happens. - `store.test.ts`: a test for the count half, a snapshot missing an event below its own watermark, rejected only with `countGuard`. I mutation-checked it: loosening the predicate to `recorded > count + 1` makes it fail. No changeset. `@workflow/world-sim` and the workbench are private, and nothing outside tests and scenarios changed. ## Verification - `pnpm sim`: 42 passed, 0 failed, 0 violations (🟢 0 fail of 42). - `pnpm sim --no-fence`: only this scenario fails, by design, with 0 violations. This is what `run.ts` and the README document. - With the watermark half disabled in the built sim: the new check fails, and the old one passed. - `vitest run src/store.test.ts` in `packages/world-sim`: 25 passed. `tsc --noEmit` is clean. ## Follow-up (not in this PR) `packages/world-sim/DESIGN.md` still describes the mint-ordered model #3544 removed: "The three" table, `appendOnlyLog`, and "6 → 8" violations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
Signed-off-by: Peter Wielander <mittgfu@gmail.com>
VaguelySerious
approved these changes
Oct 9, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Catches the docs up with SDK changes that shipped in the last day without (complete) docs updates.
Promise.racehook.then()on every iteration, which still misses a command sent while the workflow snapshots or refreshes the sandbox. The example now keeps one pendingnextCommandpromise, and the pitfall note says whyI reviewed the other PRs from the last day and they need no further docs: the batched fan-out chunk cap (#4727) shipped its own docs, and the Zod schema compilation change (#4712), tagged
clear()lock files (#4742), the in-band writer fence (#4733, not used by the runtime yet), and dependency upgrades (#4736, #4737, #4738) aren't user-facing. The Workflows pages invercel/frontwere also checked and need no changes for these.Docs Preview
🤖 Generated with Claude Code