Skip to content

[Crane: crane-migration-python-to-go-full-apm-cli-rewrite] Iteration 71: fix benchmark gate (deps Console width under TERM=dumb)#112

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] Iteration 71: fix benchmark gate (deps Console width under TERM=dumb)#112
github-actions[bot] wants to merge 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 5, 2026

Migration: crane-migration-python-to-go-full-apm-cli-rewrite

Iteration 71 | Score: 1.0 | All 13 gates passing

Problem

After PR #111 was merged, the crane branch ceased to exist on remote. The pre-step detected stale_completed_state: repo-memory said Completed: true, but the completion gate (PR head checks on ce02a62) could no longer be verified on the current default branch. Fresh verification was required.

Running the verification contract locally revealed the benchmarks gate was failing 9/10 checks: the deps list benchmark was truncating microsoft/apm-package-alpha to microsof... in the table output.

Root cause

Rich's Console.size property only honours an explicit _width when both _width and _height are set. The deps list command creates Console(width=max(120, term_width)) without a height argument, so when the benchmark subprocess sets TERM=dumb, Rich's is_dumb_terminal guard overrides the width to 80 columns. The Package column in the 8-column table then gets ~9 characters, truncating microsoft/apm-package-alpha.

Fix

  • src/apm_cli/commands/deps/cli.py: pass height=24 to Console() so the explicit width is always honoured regardless of TERM.
  • scripts/ci/migration_cli_benchmark.py: add COLUMNS=10000 as a belt-and-suspenders guard for future Rich version changes.

Verification (local)

migration_score: 1
cutover_ready: true
benchmarks: pass  (was: fail 9/10, now: pass 10/10)
gates passing: 13/13

All 13 deletion-grade gates pass. CI pending on this PR.


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

Warning

Firewall blocked 2 domains

The following domains were blocked by the firewall during workflow execution:

  • astral.sh
  • bitbucket.example.com

To allow these domains, add them to the network.allowed list in your workflow frontmatter:

network:
  allowed:
    - defaults
    - "astral.sh"
    - "bitbucket.example.com"

See Network Configuration for more information.

Generated by Crane · ● 135.2M ·

…allback

Rich's Console.size property only honours an explicit width when both
_width and _height are set.  When only width is passed, it falls through
to is_dumb_terminal and returns 80 columns, truncating long package names
in the `deps list` table (e.g. 'microsoft/apm-package-alpha' -> 'microsof...').

Fix: supply height=24 alongside the explicit width so the fast path is
taken regardless of the TERM environment variable.

Also add COLUMNS=10000 to the benchmark subprocess env as a belt-and-
suspenders guard for future Rich version changes.

Verification: all 13 migration gates now pass (migration_score=1.0).

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

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

github-actions Bot commented Jun 5, 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.4278s 0.0012s 0.00x 343.94x faster {'python': [0], 'go': [0]}
targets json targets --json installed-project 0.4117s 0.0013s 0.00x 312.96x faster {'python': [0], 'go': [0]}
script list list installed-project 0.4123s 0.0013s 0.00x 322.50x faster {'python': [0], 'go': [0]}
deps list deps list installed-project 0.4229s 0.0013s 0.00x 330.51x faster {'python': [0], 'go': [0]}
deps tree deps tree installed-project 0.4158s 0.0013s 0.00x 324.25x faster {'python': [0], 'go': [0]}
install local package install --no-policy ./packages/local-tools local-install-project 0.4559s 0.0016s 0.00x 278.98x faster {'python': [0], 'go': [0]}
compile copilot target compile --target copilot compilation-project 0.4380s 0.0013s 0.00x 328.37x faster {'python': [0], 'go': [0]}
pack output pack --output dist installed-project 0.4364s 0.0013s 0.00x 331.09x faster {'python': [0], 'go': [0]}
run script run stamp runnable-project 0.4180s 0.0021s 0.01x 195.80x faster {'python': [0], 'go': [0]}
audit hidden unicode audit --ci audit-finding-project 0.4382s 0.0015s 0.00x 295.70x 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 6, 2026

[bot] Iteration 72 accepted -- Crane run

[+] Migration complete! Python -> Go rewrite finished after 72 iterations. All 13 deletion-grade gates passing. Python can be removed from the shipping path.

Generated by Crane · ● 14.7M ·

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