Enforce Go cutover completion gates#108
Conversation
Migration Benchmark Results
Migration CLI BenchmarkIncludes fixture-backed commands that must read, write, execute, or fail against real project state. The installed-project fixture contains apm.yml, apm.lock.yaml, apm_modules packages, local .apm primitives, target directories, deployed prompt files, and sample source files. Max allowed Go/Python median ratio:
Workloads
|
Migration Benchmark Results
Migration CLI BenchmarkIncludes fixture-backed commands that must read, write, execute, or fail against real project state. The installed-project fixture contains apm.yml, apm.lock.yaml, apm_modules packages, local .apm primitives, target directories, deployed prompt files, and sample source files. Max allowed Go/Python median ratio:
Workloads
|
TL;DR
This PR makes the Python -> Go migration completion claim deterministic. It adds a Go-only cutover gate that runs with Python runtime env vars cleared, requires every checked-in legacy Python pytest node to have an explicit Go replacement mapping, and turns the real command behavior/state-diff checks into hard failures.
Normal PRs still collect this evidence without failing solely because the migration is incomplete. Crane PRs and manual
enforce_completion=trueruns now hard-fail until the real command gates, golden replay gates, no-Python gate, and test-conversion manifest all pass.Related to #78. This does not mark #78 done; it prevents future false completion.
Problem
Score: 1.0andcrane-completedwhile core Go CLI behavior still fails real command assertions.Approach
TestGoCutover*tests that run the Go binary with Python hidden and emit Crane gates.t.Errorfresults.TestGoCutover, append both JSON streams to scorer input, and enforce cutover status only in completion-enforced mode.Implementation
.github/workflows/migration-ci.yml: runsgo test -skip '^TestGoCutover' ./..., then runsgo test ./cmd/apm -run '^TestGoCutover'with Python env vars cleared.GO_CUTOVER_STATUSis hard-gated only when migration completion is enforced..crane/scripts/score.go: treats Python reference/test gates as satisfied only when the Go-only real behavior, golden fixture, all-Go replay, and no-Python gates are all green.cmd/apm/go_cutover_coverage_test.go: discovers Python pytest nodes undertests/excepttests/parity/, compares them to the Go cutover manifest, and emitspython_behavior_contracts,golden_fixture_corpus,all_go_golden_tests, andno_python_runtime_dependencygates.cmd/apm/real_behavior_test.go: expands the real behavior contract to install/update/compile/pack/unpack/run/audit/policy/mcp/runtime/plugin/marketplace/config/cache/uninstall/prune/deps/view scenarios.cmd/apm/CUTOVER.md: documents the new completion gate command and the final deletion-grade checklist.tests/unit/test_crane_score.py: verifies the scorer can reach 1.0 without live Python only when all-Go replay evidence is complete.Trade-offs
0/23766mapped Python tests today. That is evidence, not noise.crane/*PRs and manual completion checks..github/workflows/migration-ci.yml, not the Agentic Workflow markdown sources, sogh aw compileis not required byAGENTS.md.Benefits
Validation
Expected incomplete-cutover result on current
mainbehavior:Mermaid validation was attempted for a PR-body diagram, but local
mmdcrequired Chrome148.0.7778.97while Puppeteer installed149.0.7827.22; this body omits the diagram rather than including an unvalidated one.How to test
.venv/bin/python -m pytest tests/unit/test_crane_score.py -q.APM_PYTHON_BIN= APM_PYTHON_CONTRACT_INVENTORY= PYTHONPATH= VIRTUAL_ENV= go test ./cmd/apm -run '^TestGoCutover' -jsonand confirm it fails with unmapped Python tests plus real behavior gate ratios.Migration Parity and Benchmarksmanually withenforce_completion=trueto verify incomplete cutover blocks completion.Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com