Skip to content

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

Draft
github-actions[bot] wants to merge 2 commits into
mainfrom
crane/crane-migration-python-to-go-full-apm-cli-rewrite
Draft

[Crane: crane-migration-python-to-go-full-apm-cli-rewrite]#117
github-actions[bot] wants to merge 2 commits into
mainfrom
crane/crane-migration-python-to-go-full-apm-cli-rewrite

Conversation

@github-actions

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

Copy link
Copy Markdown
Contributor

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

Migration: Python 3.10+ (CPython, Click, Rich) -> Go (native binary)
Strategy: greenfield
Migration Issue: #78
State File: crane-migration-python-to-go-full-apm-cli-rewrite.md


Iteration 79 -- Stale-Completion Reset + Cache Parity Fix

Status: Accepted -- Completion Candidate (fresh stale-completion reset after PR #115 merged)

Changes in this iteration:

  • cmd/apm/cmd_cache.go: fix runCache to route subcommand --help to the correct handler instead of intercepting all --help flags at the top level; add -f/--force and -y/--yes flags to cache clean help text; align output messages ([*] Cleaning cache... + [+] Cache cleaned.) to match Python
  • cmd/apm/parity_harness_test.go: add 3 new parity contract tests (GoCacheCleanHelp, GoCachePruneHelp, GoCacheCleanOutputMessages)
Metric Value
Score 1.0 (fresh; best: 1.0, delta: +1.0 from stale-reset)
Parity 858/858 (100%) -- +3 from iter 78
Go tests 903 passing -- +3 from iter 78
Python tests 247 passing
Commit c4aa22e7
Run 27236411257

All 13 deletion-grade gates: python_reference_required, surface_parity, help_parity, functional_contracts, state_diff_contracts, python_behavior_contracts, golden_fixture_corpus, all_go_golden_tests, no_python_runtime_dependency, known_exceptions=0, go_tests, python_tests, benchmarks.

Generated by Crane · ● 76M ·

…79: fix cache subcommand --help routing; add --force/--yes flags and output parity

Changes:
- cmd/apm/cmd_cache.go: fix runCache to route subcommand --help to the
  subcommand handler instead of intercepting all --help flags at the
  top level (cache clean --help and cache prune --help now show their
  own usage, not the top-level cache menu)
- cmd/apm/cmd_cache.go: add -f/--force and -y/--yes flags to cache clean
  help text; align output messages to Python ('Cleaning cache...' +
  'Cache cleaned.' instead of 'Cache cleared: <dir>')
- cmd/apm/parity_harness_test.go: add 3 new parity contract tests
  (GoCacheCleanHelp, GoCachePruneHelp, GoCacheCleanOutputMessages)

Score: 1.0 (858/858 parity, 903 Go tests, 247 Python tests, all 13 gates pass)
Run: https://github.com/githubnext/apm/actions/runs/27236411257

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor Author

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.4424s 0.0013s 0.00x 340.63x faster {'python': [0], 'go': [0]}
targets json targets --json installed-project 0.4249s 0.0013s 0.00x 324.23x faster {'python': [0], 'go': [0]}
script list list installed-project 0.4288s 0.0013s 0.00x 322.45x faster {'python': [0], 'go': [0]}
deps list deps list installed-project 0.4359s 0.0014s 0.00x 318.14x faster {'python': [0], 'go': [0]}
deps tree deps tree installed-project 0.4300s 0.0014s 0.00x 316.30x faster {'python': [0], 'go': [0]}
install local package install --no-policy ./packages/local-tools local-install-project 0.4704s 0.0017s 0.00x 271.31x faster {'python': [0], 'go': [0]}
compile copilot target compile --target copilot compilation-project 0.4490s 0.0014s 0.00x 331.69x faster {'python': [0], 'go': [0]}
pack output pack --output dist installed-project 0.4506s 0.0014s 0.00x 316.47x faster {'python': [0], 'go': [0]}
run script run stamp runnable-project 0.4346s 0.0022s 0.01x 199.23x faster {'python': [0], 'go': [0]}
audit hidden unicode audit --ci audit-finding-project 0.4412s 0.0015s 0.00x 286.55x 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.

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.

0 participants