Fix metta_calculus step budget - #58
Closed
MesTTo wants to merge 3 commits into
Closed
Conversation
MesTTo
marked this pull request as ready for review
June 23, 2026 10:23
Contributor
Author
bench_flybase and the meta-exec staging test in mork test both called metta_calculus(0) depending on the pre-fix loop running one exec anyway. Under the exact budget they become no-ops and the staging test's assert fails; both want exactly one redex, so pass 1. mork test exits 0 again with the fix.
Five independent execs pending, budget 3: exactly three interpret (return 3, three rewrites in the space, two execs still scheduled). The old loop ran budget+1, which is the divergence the exponential bench made visible (33 steps of work reported as 32). Counts are line-anchored because the pending execs' templates also contain the output pattern text.
MesTTo
force-pushed
the
pr/mork-semantic-regression-tests
branch
from
July 4, 2026 13:29
aac6a9a to
ffefb5a
Compare
Collaborator
|
Yeah, in hindsight, this would've been a better interpretation than "repetitions" to be performed after a rewrite. However, I'm not sure we can change this now given how many places downstream rely on this interpretation. In any case, ths is not a bug, and all usage sites should be updated accordingly (instead of changing the semantics). |
Contributor
Author
|
fair, it's not a bug then, the repetitions interpretation is load-bearing downstream. closing, i'll leave the semantics alone. |
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.
Makes
Space::metta_calculus(steps)honor its budget exactly: the loop checkeddone < stepsonly after fetching and interpreting an exec, so budget 0 still ran one redex and budget k ran k+1. The fix checks before interpreting, so 0 does nothing and k runs exactly k. Ten regression tests pin the semantics, including a pending-surplus case (five execs pending, budget 3: return 3, three rewrites, two still scheduled) that fails on the unfixed loop.Two
main.rscall sites relied on the old off-by-one (bench_flybaseand the meta-exec staging case inmork test, both passing 0 to run one exec); they now pass 1, andmork testexits 0.Benchmark impact, disclosed: every benchmark in
mork bench alluses a run-to-fixpoint budget and is byte-identical under the fix (verified: bfc steps 801 / size 2872847, counter_machine 1813/2753, fringe 46/803777, and the rest) — exceptexponential, whose budget binds: it previously executed 33 steps while reporting 32 (size 265723), and now executes exactly the 32 it reports (size 206675). The old number was the bug made visible; work now equals the report. The two budget-limited chainer prints inmork testshift one frontier step for the same reason.Sequencing: #110 carries this same fix byte-identically plus the chaining-semantics tests; land either first and the other rebases (comments on both PRs).