Skip to content

fix: stale cli.py / _bin/ references break tests + action_surface#10

Merged
zackees merged 1 commit into
mainfrom
fix/9-stale-cli-bin-references
Jun 22, 2026
Merged

fix: stale cli.py / _bin/ references break tests + action_surface#10
zackees merged 1 commit into
mainfrom
fix/9-stale-cli-bin-references

Conversation

@zackees

@zackees zackees commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Summary

Same failure shape as fbuild#748: PR #7 refactored the wheel-build path (ship template-cli as raw wheel script, drop the Python launcher) but left stale source-tree references in two artifact-walking tools.

Fixes:

  • Test now probes PATH for the installed template-cli, skips when absent (dev venv), otherwise asserts --version returns code 0 with non-empty output.
  • Gate searches $CARGO_TARGET_DIRROOT/target → PATH. Matches the new shipping topology.
  • Docs match.

Test plan

  • ./ci.sh test → 34 pass, 2 skip (intentional).
  • ./ci.sh action_surface → ok.
  • grep -rn '_bin\|template_python_rust_cmd\.cli' tests/ ci/ src/ returns no live-code hits.

Closes #9. Refs #7, fbuild#748.

🤖 Generated with Claude Code

…oses #9)

Followup cleanup to #7 (drop Python CLI shim, ship raw wheel script).
The package-side refactor worked at the wheel-build level but left
stale source-tree references in two artifact-walking tools — same
failure shape as fbuild#748 (a packaging refactor that worked at the
wheel level but broke a tool walking the source tree a different way).

Stale references found by `git grep '_bin\|template_python_rust_cmd\.cli'`:

1. `tests/test_cli.py` — imported `template_python_rust_cmd.cli.
   packaged_binary_path` (module deleted in #7). Whole file failed to
   collect with ImportError; the suite was silently 1 file short.

2. `ci/gates/action_surface.py::_binary_path()` — listed
   `src/template_python_rust_cmd/_bin/template-cli[.exe]` as its FIRST
   lookup candidate. That directory was removed in #7. Fallback to
   target/release worked locally but the gate doesn't honor
   CARGO_TARGET_DIR (pinned to ~/.template-python-rust-cmd/cargo-target/
   wheel-build in #5), so it silently misses the binary on a
   wheel-build-driven runner.

3. `tests/README.md` — described `test_cli.py` as covering "the Python
   CLI shim's binary-discovery logic" (module gone).

Fix:

- `tests/test_cli.py` rewritten as a runtime contract check: probe
  PATH for `template-cli`, skip if absent (dev venv without install),
  otherwise assert it's invokable and produces non-empty --version
  output. Matches the new shipping mechanism (raw wheel script) which
  doesn't leave a source-tree probe target.

- `ci/gates/action_surface.py::_binary_path()` now searches, in order:
    1. $CARGO_TARGET_DIR/{release,debug}/ if set
    2. ROOT/target/{release,debug}/ for the local ./test flow
    3. PATH via shutil.which for pip/uv-installed binaries
  Updated the "no binary found" warning to match.

- `tests/README.md` describes what test_cli.py actually does now.

Verified:
- `uv run pytest tests/test_cli.py tests/test_version.py tests/test_bindings.py -v`
  → 2 pass, 2 skip (test_cli skips because dev venv has no installed
  template-cli — expected behavior).
- `./ci.sh test` → 34 pass, 2 skip, [test] ok.
- `./ci.sh action_surface` → finds the binary, gate passes.

Closes #9.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@zackees zackees merged commit 5dca341 into main Jun 22, 2026
@zackees zackees deleted the fix/9-stale-cli-bin-references branch June 22, 2026 06:57
zackees added a commit that referenced this pull request Jun 22, 2026
Followup to #7 (raw wheel script) and #9/#10 (test + gate cleanup). #9
fixed the tools that broke at runtime; this PR fixes the docs that
broke at the human-reader level. Same failure shape as fbuild#748: a
packaging refactor was correct at the wheel-build path but downstream
readers walking artifacts a different way still saw the dead shape.

Files touched (doc-only; no behavioral change):

- README.md: tree diagram no longer shows cli.py/_bin/. Packaging
  section describes the actual raw-wheel-script mechanism.
- CLAUDE.md: agent-routing doc now describes the post-#7 wheel layout
  + the pinned CARGO_TARGET_DIR build pipeline. No more cli.py shim
  invariants.
- ENHANCE.md: invariants updated — "no Python shim, raw wheel script,
  re-adding [project.scripts] would re-introduce the Windows os.execv
  race" replaces the old shim invariants.
- crates/template-cli/README.md: describes the inject_cli_into_wheel
  step instead of the deleted _bin/ staging step.
- docs/ARCHITECTURE.md: package contents accurately reflect what's
  actually in src/template_python_rust_cmd/ today (no cli.py listed).
- docs/RELEASE.md: build_wheel.py described as cargo → maturin →
  inject into .data/scripts/, not stage into _bin/.

Verified:
- `grep -rn '_bin\|template_python_rust_cmd\.cli\|cli\.py' README.md
  CLAUDE.md ENHANCE.md docs/ crates/template-cli/README.md` returns
  only historical-context references explicitly explaining the
  migration (acceptance-criterion-allowed).
- `./ci.sh test` → 34 pass, 2 skip.
- `./ci.sh action_yaml` → ok.
- `./ci.sh action_surface` → ok.

Closes #11. Refs #7, #9, fbuild#748.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
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.

Stale cli.py / _bin/ references survive #7 cleanup, break tests and action_surface gate

1 participant