Repository navigation
feat(id): measure per-call guest fuel and guard it with budgets - #247
Merged
Merged
Conversation
Record fuel spent per guest call kind on WorldInstance (in memory only), add `id world measure` for offline measurement, and add a test that holds every checked-in example within baseline-plus-25-percent fuel budgets. Territory's view uses 78 percent of the default fuel and exceeds it at six or more seats; recorded as a follow-up.
This was referenced Oct 18, 2026
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.
Summary
Phase 11 task F11.6. Fuel is the guests' main performance ceiling, and it was invisible.
WorldInstancerecords fuel used per guest call (init, update, view, layout, records, wants, snapshot, restore): calls, total, max, last. A fuel-exhausting trap records the full limit. Fixed array, no locking, never journaled, never on the wire.id world measure --module FILE.wasm --seed N [--input HEX]... [--width W --height H]prints one JSON report: module size, the fuel limit, per-call stats, and the worst call as a percent of the limit.checked_in_examples_stay_within_fuel_budgetsfails when any call exceeds its baseline by more than 25 percent, and when a call has no budget row. Every example module must be at most 1 MiB. The failure message says to re-baseline deliberately.Design record:
doc/2026-10-17T15-30-00Z_feature_world_perf_budgets/. Stacked on #234.Finding: territory overflows the fuel limit with six or more seats
Worst call as a share of the 10M limit: roc-counter 0.04%, tic-tac-toe 0.14%, roc-chat 0.90%, lounge 1.95%, roc-grid 9.8%, roc-screen 11.9%, territory 78.0% with two seats. Each seat adds about 0.8M, so six or more seats run out of fuel, and a view that runs out of fuel poisons the world. Territory allows eight seats. My earlier claim that the styled view fits with all eight seats was wrong; that measurement used few seats. The fix is the next PR; the budget table only guards the two-seat baseline, which the record flags.
Validation
cargo test --lib: 1335 passed, 5 ignored (the subagent's run). I re-ransandbox::(27 passed, 1 ignored) and the measure tests (2 passed).cargo fmt --check: clean. Clippy via the rustup 1.97.0 cargo exits 0; plaincargo clippyfails with E0514 as before.Summary by CodeRabbit
id world measurecommand to report guest-call fuel usage, including call counts, totals, maximums, and usage relative to the fuel limit. It supports repeatable inputs and optional viewport dimensions.