Skip to content

feat(id): seeded stress-world generator in world_bench (#13083) - #13163

Merged
dezren39 merged 1 commit into
mainfrom
lane-of-13083
Nov 23, 2026
Merged

dezren39 merged 1 commit into
mainfrom
lane-of-13083

Conversation

@dezren39

@dezren39 dezren39 commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Implements the #13083 generator slice of the #6304 stress program (design: doc/2026-11-23T07-53-00Z_design_scale_perf_stress_v1/).

What lands

  • A stress_gen profile in pkgs/id/benches/world_bench.rs alongside full/quick: deterministic (seeded, following the harness's BENCH_SEED pattern), parameterized by scale tier — quick smoke, 1x, 10x, 100x per the design's tier table — with ID_BENCH_STRESS_TIER / ID_BENCH_STRESS_SEED / ID_BENCH_STRESS_OUT / per-axis env overrides in the ManyWorldsConfig style.
  • Produces a world directory set (idle worlds as durable headers, active worlds, one hot world) plus 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; the bench line format and JSONL bundle are untouched.
  • Every measured world is verified through WorldCore::restore during 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 hash 8ef2ffc8a61f687b.
  • Determinism: two same-seed quick runs → manifests and full trees byte-identical; seed 424242 → every hash differs.
  • 10x tier (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.
  • No regression: --quick --only guest_replay still runs and writes its matrix bundle; cargo check/cargo build green; 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)"
  }
}

Proof this PR
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

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.
@coderabbitai

coderabbitai Bot commented Nov 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: bba0eb88-deed-430d-b514-0571e814fe6f
Commits

Reviewing files that changed from the base of the PR and between 96c8407 and a05ff6d.

Files selected for processing: 2

  • doc/2026-11-23T07-53-00Z_design_scale_perf_stress_v1/2026-11-23T07-53-00Z_design_scale_perf_stress_v1.md
  • pkgs/id/benches/world_bench.rs
  • 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

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T09:37:47.319662Z a05ff6d 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.

@dezren39
dezren39 merged commit 9c54940 into main Nov 23, 2026
2 checks passed
@dezren39
dezren39 deleted the lane-of-13083 branch November 23, 2026 09:35

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment on lines +1793 to +1797
let at = index % 1_000;
if at < STRESS_MIX_CHAT {
StressShape::Chat
} else if at < STRESS_MIX_CHAT + STRESS_MIX_DOC_EDIT {
StressShape::DocEdit

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +1978 to +1982
WorldEventKind::Input(
format!(
"program-install files={files} total_bytes={total_bytes} bundle={}",
corpus.text(world_index, sequence, 96)
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Comment on lines +2089 to +2091
let mut hash = Fnv1a::new();
hash.write(&bytes);
hash.write(&restored.core.current_sequence().to_le_bytes());

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Comment on lines +2128 to +2131
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)?;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant