Repository navigation
feat(id): seeded stress-world generator in world_bench (#13083) - #13163
Conversation
Add the stress_gen profile to the pkgs/id bench harness: a deterministic generator for the #6304 scale tiers (quick smoke, 1x, 10x, 100x) that materializes a world directory set (idle header-only worlds, active worlds, one hot world with the tier's member count) plus a manifest.json recording the seed, tier, event mix (chat / doc-edit / program-install at the codified shapes), per-world event counts, and each measured world's expected final state hash (FNV-1a over the journal bytes plus the restored sequence). Every measured world is verified through WorldCore::restore before its hash is recorded. The 10x tier's 320-member hot world meets a codified wall: WorldLimits::default().participants is 256. The generator caps the hot world at the limit and records the wall in the manifest; the design doc's limits table gains the participants row and the entities/programs gap row is narrowed accordingly. Verified on the reference laptop: quick tier runs, two same-seed runs produce byte-identical trees and manifests, a different seed changes every hash, and the 10x tier generates 11,001 worlds / 200,000 events with all 1,001 measured worlds restore-verified.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 38 minutes. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a05ff6d3cf
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| let at = index % 1_000; | ||
| if at < STRESS_MIX_CHAT { | ||
| StressShape::Chat | ||
| } else if at < STRESS_MIX_CHAT + STRESS_MIX_DOC_EDIT { | ||
| StressShape::DocEdit |
There was a problem hiding this comment.
Interleave event shapes in short world histories
Every world starts this schedule at zero, so the first 700 events are exclusively chat. Consequently, the default quick run produces 280 chat events and no document edits or installs, and every default active world in all three scale tiers is also chat-only because its history is only 100 events. This leaves the smoke run and active-world fixtures without the mixed replay workload advertised by the manifest. Use a deterministic interleaved schedule that preserves the intended proportions in short histories.
Useful? React with 👍 / 👎.
| WorldEventKind::Input( | ||
| format!( | ||
| "program-install files={files} total_bytes={total_bytes} bundle={}", | ||
| corpus.text(world_index, sequence, 96) | ||
| ) |
There was a problem hiding this comment.
Generate an installed program for guest replay fixtures
The purported program installations are ordinary Input events containing descriptive text; no generated world contains a ProgramInstalled event or module artifact. In world/core.rs, only ProgramInstalled populates the restored program, so these fixtures always reach the None => EmptyProgram branch in world_store::open_world, which never calls restore_program or replays the inputs into a guest. Downstream join/replay/frame measurements would therefore measure a programless world rather than the advertised document/install workload. Generate a runnable installed program and inputs it actually interprets.
Useful? React with 👍 / 👎.
| let mut hash = Fnv1a::new(); | ||
| hash.write(&bytes); | ||
| hash.write(&restored.core.current_sequence().to_le_bytes()); |
There was a problem hiding this comment.
Hash the restored state rather than the source journal
For the downstream replay correctness check, this hash cannot distinguish correct restoration from one that corrupts replay payloads, membership, or other state while retaining the same sequence: it hashes the original journal bytes and only the restored sequence. The preceding replay-length check does not detect changed contents either. Such a fast-but-wrong replay can still match expected_state_hash, defeating the design's stated verification contract. Hash a canonical representation of the resulting restored state, retaining the journal checksum separately if useful.
Useful? React with 👍 / 👎.
| out.join("manifest.json").exists(), | ||
| "stress output root {out:?} exists and holds no stress manifest; refusing to overwrite it" | ||
| ); | ||
| std::fs::remove_dir_all(&out)?; |
There was a problem hiding this comment.
Verify the stress manifest before deleting an existing directory
If ID_BENCH_STRESS_OUT points to an unrelated directory containing any file named manifest.json, this guard succeeds and remove_dir_all recursively deletes that directory's contents. The check does not establish that the manifest belongs to this generator, despite promising to refuse foreign output roots. Parse and validate the stress-manifest discriminator and supported schema before allowing destructive regeneration.
Useful? React with 👍 / 👎.
Implements the #13083 generator slice of the #6304 stress program (design:
doc/2026-11-23T07-53-00Z_design_scale_perf_stress_v1/).What lands
stress_genprofile inpkgs/id/benches/world_bench.rsalongsidefull/quick: deterministic (seeded, following the harness'sBENCH_SEEDpattern), parameterized by scale tier — quick smoke, 1x, 10x, 100x per the design's tier table — withID_BENCH_STRESS_TIER/ID_BENCH_STRESS_SEED/ID_BENCH_STRESS_OUT/ per-axis env overrides in theManyWorldsConfigstyle.manifest.json: seed, tier, event mix (chat / document edits at the codified 64 KiB / 512-item shapes / program installs under the 8-file / 256 KiB cap, 700/200/100 per 1,000), expected event counts per world, and each measured world's expected final state hash (FNV-1a over the journal bytes + the restored sequence). No new harness binary; thebenchline format and JSONL bundle are untouched.WorldCore::restoreduring generation (sequence + replay-length checks) before its hash is recorded.Wall found and recorded
The 10x tier targets 320 members on the hot world; a world refuses more than the codified
WorldLimits::default().participants= 256. The generator caps the hot world at 256 and records the wall in the manifest (walls[]), per the design's run protocol. The design doc's limits table gains the participants row (codified) and the old "entities / members / programs: none codified" gap row is narrowed to entities / programs.Verification (reference laptop, debug build)
--quick --only stress_gen: 15 worlds, 280 events, hot hash8ef2ffc8a61f687b.ID_BENCH_STRESS_TIER=10x): 11,001 worlds, 1,001 measured worlds, 200,000 events (hot world exactly 70,000 chat / 20,000 doc-edit / 10,000 install), all restore-verified,walls=1, 35.7 s; hot journal 29 MB, under the 64 MiB cap.--quick --only guest_replaystill runs and writes its matrix bundle;cargo check/cargo buildgreen; rustfmt clean; no new warnings from the new code.Refs #13083 (acceptance record and close follow on the issue).
{ "direct_parent": null, "links": [], "lineage": { "design": null, "roadmap_item": null, "priority": null }, "pm_meta": 1, "provenance": { "queue_id": null, "scheduled_start": null, "picked_up_at": null, "work_started_at": null, "created_at": "2026-11-23T09:33:59Z", "session_id": null, "lane": null, "host": "htch-runtime", "worktree": null, "model": null, "lane_start_issues": [], "workspace_ref": null, "auth_subject": "archer", "stamped_by": "fleet 0.1.0 (native)" } }Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.