FE-1237: Add optional per-place token capacity - #9177
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
6a7dd72 to
367c694
Compare
367c694 to
f78b501
Compare
f78b501 to
03a799f
Compare
03a799f to
9985050
Compare
9985050 to
6e5226a
Compare
6e5226a to
3c8e832
Compare
1259e63 to
c3bb82d
Compare
c3bb82d to
5c74426
Compare
5c74426 to
ba9db1e
Compare
PR SummaryMedium Risk Overview The engine precomputes per-transition capacity constraints at build time, stores dense Docs and arch notes are updated; nets without capacities keep empty constraint tables on the hot path. Reviewed by Cursor Bugbot for commit 5c8e305. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit e16c503. Configure here.
An experiment ran every run in a single worker, using one core however many the machine had. Runs are independent, so they now split across one worker per logical core minus one, capped at the run count — measured at ~4x on 8 shards. Sharding cannot change results: seeds derive from the run's global index rather than its position in a shard, and per-frame statistics recombine through the metric accumulator monoids, so output is byte-identical at every shard count. Scalar frames carry their pre-reduction accumulator state, since a mean of means is not a mean.
Replaces em dashes with commas, colons or full stops in worker-sharding.mdx and the changeset. No content change.
A place can declare a maximum token count, which participates in transition enablement the standard way: a transition cannot fire if it would take an output place above capacity. Output tokens apply at the end of a frame, so the check folds in what earlier transitions this frame already committed. Deadlock detection uses the same check, so a net blocked only by full output places is reported as deadlocked rather than stepping to maxTime doing nothing. Nets without capacities keep empty constraint tables and skip the check.
Replaces em dashes with full stops. No content change.

🌟 What is the purpose of this PR?
Adds an optional per-place token capacity, set from the place properties panel.
It also converts frames from growable to fixed-size, which the GPU backend (#9179) requires.
🔍 What does this change?
A transition cannot fire if firing would take an output place above its capacity. This is the standard Petri-net capacity constraint.
maxTime.buildSimulationrejects an initial marking that exceeds a place's capacity, with a message naming the place.Review fixes
executeTransitions) now threads a pending-output tally into the capacity check, so several transitions feeding one capped place in a single step can no longer collectively overflow it. This matches the Monte Carlo path and the behaviourdocs/simulation.mdalready promised. A regression test incompute-next-frame.test.tspins it: two producers feed one capacity-1 place, and exactly one fires.buildSimulationnow normalizes the capacity the same way the runtime does, so a malformed capacity that runs unbounded cannot reject a marking.NumberInputgained amaxof 4294967294, one below the engine's unbounded sentinel.Pre-Merge Checklist 🚀
🚢 Has this modified a publishable library?
This PR:
📜 Does this require a change to the docs?
The changes in this PR:
🕸️ Does this require a change to the Turbo Graph?
The changes in this PR:
🐾 Next steps
Build the fixed-size frame layout (SoA over WASM linear memory). The runtime still uses growable frames.
🛡 What tests cover this?
engine/capacity.test.tscovers the constraint tables and the headroom check.monte-carlo/capacity.test.tscovers end-of-frame accumulation across several transitions feeding one place, and deadlock reporting.engine/compute-next-frame.test.tscovers the interactive stepping path holding a capacity when two transitions feed one place in a single step.❓ How to test this?