Skip to content

[Crane: crane-migration-python-to-go-full-apm-cli-rewrite]#114

Merged
mrjf merged 2 commits into
mainfrom
crane/crane-migration-python-to-go-full-apm-cli-rewrite
Jun 8, 2026
Merged

[Crane: crane-migration-python-to-go-full-apm-cli-rewrite]#114
mrjf merged 2 commits into
mainfrom
crane/crane-migration-python-to-go-full-apm-cli-rewrite

Conversation

@github-actions
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot commented Jun 8, 2026

[bot] This PR is maintained by Crane. Each accepted iteration adds a commit to this branch.

Migration: Python to Go -- Full APM CLI Rewrite

Source: Python 3.10+ (Click, Rich, PyInstaller)
Target: Go (native binary)
Strategy: greenfield
Migration Issue: #78


Current Status

Iteration 73 -- Stale completion reset; resuming with new deps info parity contract.

Gate Status
python_reference_required pending CI
surface_parity pending CI
help_parity pending CI
functional_contracts pending CI
state_diff_contracts pending CI
python_behavior_contracts pending CI
golden_fixture_corpus pending CI
all_go_golden_tests pending CI
no_python_runtime_dependency pending CI
python_tests pending CI
benchmarks pending CI
known_exceptions pending CI

Best Score: 1.0 (previous run, pending re-verification)


Iteration 73 Changes

  • cmd/apm/cmd_deps.go: runDepsInfo now requires PACKAGE argument. Without it, exits 2 with "Error: Missing argument 'PACKAGE'." matching Python Click behavior.
  • cmd/apm/cmd_deps.go: Fix help routing so apm deps info --help shows subcommand help (not parent deps help).
  • cmd/apm/cmd_deps.go: runDepsInfo reads package metadata from apm_modules/<pkg>/apm.yml.
  • cmd/apm/parity_harness_test.go: New tests -- TestParityHarnessDepInfoHelp, TestParityHarnessDepInfoMissingPackage, TestParityHarnessDepInfoNotInstalled.
  • cmd/apm/testdata/go_cutover/python_test_coverage.json: 12 deps-info Python tests mapped to new Go contract tests.

Generated by Crane · ● 94.8M ·

…73: fix deps info parity (required PACKAGE arg, missing-arg exit 2)

Changes:
- cmd_deps.go: runDepsInfo now requires PACKAGE argument (exits 2 with 'Error: Missing argument PACKAGE' when missing, matching Python Click behavior)
- cmd_deps.go: fix runDeps help routing so 'apm deps info --help' shows subcommand help (not parent)
- cmd_deps.go: runDepsInfo shows package metadata from apm_modules/<pkg>/apm.yml
- parity_harness_test.go: add TestParityHarnessDepInfoHelp, TestParityHarnessDepInfoMissingPackage, TestParityHarnessDepInfoNotInstalled
- python_test_coverage.json: map 12 deps-info Python tests to new Go contract tests

Run: https://github.com/githubnext/apm/actions/runs/27120376316

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented Jun 8, 2026

Migration Benchmark Results

Migration CLI Benchmark

Includes 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.
The harness checks return-code parity for each command. Detailed stdout/stderr byte counts are kept in the JSON samples, but this is not an output-parity test.

Max allowed Go/Python median ratio: 5.00

Benchmark Command Fixture Python median Go median Go/Python Result Return codes
init scaffold init --yes empty-project 0.4401s 0.0013s 0.00x 339.29x faster {'python': [0], 'go': [0]}
targets json targets --json installed-project 0.4219s 0.0013s 0.00x 317.92x faster {'python': [0], 'go': [0]}
script list list installed-project 0.4248s 0.0014s 0.00x 304.22x faster {'python': [0], 'go': [0]}
deps list deps list installed-project 0.4323s 0.0014s 0.00x 305.39x faster {'python': [0], 'go': [0]}
deps tree deps tree installed-project 0.4289s 0.0014s 0.00x 304.99x faster {'python': [0], 'go': [0]}
install local package install --no-policy ./packages/local-tools local-install-project 0.4665s 0.0017s 0.00x 270.26x faster {'python': [0], 'go': [0]}
compile copilot target compile --target copilot compilation-project 0.4502s 0.0014s 0.00x 312.53x faster {'python': [0], 'go': [0]}
pack output pack --output dist installed-project 0.4467s 0.0014s 0.00x 316.87x faster {'python': [0], 'go': [0]}
run script run stamp runnable-project 0.4314s 0.0022s 0.00x 200.39x faster {'python': [0], 'go': [0]}
audit hidden unicode audit --ci audit-finding-project 0.4407s 0.0016s 0.00x 274.45x faster {'python': [1], 'go': [1]}

Workloads

  • init scaffold: Creates a new apm.yml in an otherwise empty project directory.
  • targets json: Reads configured project targets from apm.yml and emits machine output.
  • script list: Reads apm.yml scripts and renders the runnable script inventory.
  • deps list: Scans apm_modules package directories and apm.lock.yaml metadata.
  • deps tree: Builds a dependency tree from apm.lock.yaml and installed package metadata.
  • install local package: Installs a local package and materializes lock/module state.
  • compile copilot target: Discovers local primitives and writes the Copilot target artifact.
  • pack output: Resolves local package contents and writes a distributable artifact.
  • run script: Executes a project script and writes the script's side-effect file.
  • audit hidden unicode: Scans a real installed file and fails on planted hidden Unicode.

@github-actions
Copy link
Copy Markdown
Contributor Author

github-actions Bot commented Jun 8, 2026

[bot] Iteration 74 accepted -- Crane run

  • Commit: eb77b67
  • Change: CI confirmed green; deterministic completion gate passed
  • Milestone: 22 -- Re-verify all gates after stale-completion reset (done)
  • Score: 1.0 (best: 1.0, delta: +0.0)
  • Progress: 849/849 parity passing (100%)
  • Tests/parity: 849/849 passing (894 Go tests, 247 Python reference tests)

[+] Migration complete. All 13 deletion-grade gates are green. The APM CLI rewrite from Python to Go is done.

Generated by Crane · ● 17.5M ·

@mrjf mrjf marked this pull request as ready for review June 8, 2026 18:31
@mrjf mrjf merged commit c7d9106 into main Jun 8, 2026
6 checks passed
@mrjf mrjf deleted the crane/crane-migration-python-to-go-full-apm-cli-rewrite branch June 8, 2026 18:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant