Skip to content

fix(bench): default to incremental GC under EOP, imply legacy persistence for legacy collectors#606

Merged
Kamirus merged 9 commits into
mainfrom
fix/bench-gc-flag
Jun 30, 2026
Merged

fix(bench): default to incremental GC under EOP, imply legacy persistence for legacy collectors#606
Kamirus merged 9 commits into
mainfrom
fix/bench-gc-flag

Conversation

@Kamirus

@Kamirus Kamirus commented Jun 30, 2026

Copy link
Copy Markdown
Collaborator

mops bench (no --gc flag) crashed on moc 0.15+ — a regression from 2.16.0 (#601), which made enhanced orthogonal persistence the default bench mode but left the default --gc as copying. moc fixes the GC to incremental under EOP and rejects the legacy collectors there, so the default run was an invalid flag combination.

Before — default mops bench:

moc-wrapper -c --idl canister.mo --force-gc --copying-gc --release ...
moc: Invalid compiler flag combination: --copying-gc is not supported with --enhanced-orthogonal-persistence
Error: benchmarks failed

After — default mops bench compiles under EOP with no collector flag (incremental is moc's fixed GC there):

moc-wrapper -c --idl canister.mo --force-gc --release ...

--gc copying|compacting|generational still works: those collectors only exist under legacy persistence, so selecting one now implies --legacy-persistence (instead of crashing with an opaque moc error). --gc incremental or omitting --gc keeps measuring under EOP.

Why the bug evaded detection

#601 switched bench to EOP-by-default and smoke-tested with --gc incremental, but the --gc default stayed copying, so the unflagged mops bench invocation everyone runs was never exercised. More fundamentally, there was no mops bench end-to-end test at all — and this repo's own mops.toml pins moc 0.14.14 (pre-EOP), so even the local bench never touched the EOP path. The crash only surfaced on a downstream project (motoko-core) running a newer moc.

This PR adds an e2e test (cli/tests/bench.test.ts + cli/tests/bench/ fixture) that pins moc 1.3.0 + pocket-ic 12.0.0 and runs mops bench for real, asserting exit 0 and no Invalid compiler flag combination. Verified it fails against the pre-fix state with the original moc error and passes with the fix.

Migration

Default benchmark numbers shift from copying (legacy) to incremental (EOP) — but 2.16.0 already shifted numbers by switching persistence modes, and incremental is the only GC consistent with EOP-by-default. To reproduce the old legacy-mode measurements: mops bench --gc copying (now auto-enables --legacy-persistence).

…ence for legacy collectors

`mops bench` crashed on moc 0.15+ with the default `--gc copying`:
`--copying-gc` is rejected under enhanced orthogonal persistence (the
default persistence mode since 2.16.0). moc fixes the GC to incremental
under EOP, so the default GC is now `incremental`. Selecting a legacy
collector (copying/compacting/generational) implies `--legacy-persistence`,
the only mode where moc accepts them.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Cursor AI review

👍 APPROVE — looks safe to merge

Category Assessment Details
Summary Fixes mops bench crashing on moc 0.15+ by defaulting --gc to incremental (EOP-compatible), omitting collector flags under EOP, and auto-enabling --legacy-persistence when a legacy collector is selected. Adds an EOP e2e test and syncs docs/changelog/help.
Code Quality Minimal, focused change; isLegacyGc and getMocArgs logic are clear and reuse existing SemVer/version checks.
Consistency Commander default, bench.ts defaults, docs, --help, and changelog all agree on the new behavior.
Security No auth, signing, or package-integrity paths touched.
Tests New e2e test pins moc 1.3.0 + pocket-ic 12.0.0 to exercise the EOP path that repo CI otherwise misses; targeted assertions are appropriate for a regression guard.
Maintainability Comments explain the moc 0.15+ EOP/GC constraint; verbose output surfaces the implicit legacy-persistence switch.

Verdict

Decision: APPROVE
Risk: Low
Reason: This is a targeted fix for a real 2.16.0 regression (invalid --copying-gc under EOP) with correct flag-generation logic, a documented migration path (--gc copying), and a meaningful e2e test. No correctness or production-risk issues found in the diff.


Generated for commit 91a2d45

Kamirus and others added 8 commits June 30, 2026 16:07
Co-authored-by: Cursor <cursoragent@cursor.com>
Inline getMocArgs back into bench.ts (drop the bench-gc-args.ts extraction)
and replace the isolated unit test with an end-to-end test that runs
`mops bench` against a fixture pinning moc 1.3.0 + pocket-ic 12.0.0 —
exercising the enhanced-orthogonal-persistence path that the default
`--gc copying` crashed on. Verified the test fails against the pre-fix
state with the original moc error and passes with the fix.

Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…nce)

Co-authored-by: Cursor <cursoragent@cursor.com>
@Kamirus Kamirus requested a review from alexandru-uta June 30, 2026 14:33
@Kamirus Kamirus enabled auto-merge (squash) June 30, 2026 14:38
@Kamirus Kamirus merged commit 55fe2fe into main Jun 30, 2026
26 checks passed
@Kamirus Kamirus deleted the fix/bench-gc-flag branch June 30, 2026 14:39
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.

2 participants