Repository navigation
Description
Stale references survive the raw-wheel-script refactor
Same failure shape as fbuild#748: a packaging refactor (#7 — drop the Python CLI shim, ship template-cli as a raw wheel script) worked at the wheel-build / runtime level but left stale references in tools that walk the source tree a different way. Three of them visible in git grep cli.py _bin:
Broken
-
tests/test_cli.pydoesfrom template_python_rust_cmd.cli import packaged_binary_path— module deleted in fix(install): ship template-cli as raw wheel script; drop Python shim #7.pytestcollection fails withImportError. The whole test file is now unrunnable. -
ci/gates/action_surface.py:49hasROOT / "src" / "template_python_rust_cmd" / "_bin" / BINARY_NAMEas its first candidate in_binary_path(). That directory was removed in fix(install): ship template-cli as raw wheel script; drop Python shim #7 (the binary now lands in the wheel's.data/scripts/directly, not staged into the package source tree first). The fallback candidates (target/release/,target/debug/) still work for the dev./testflow, but they don't honorCARGO_TARGET_DIR— pinned by perf(install): pin CARGO_TARGET_DIR + disable PEP 517 isolation #5 to~/.template-python-rust-cmd/cargo-target/wheel-build/. AfterBUILD_PROFILE=dev(feat(build): BUILD_PROFILE=dev env var for fast local iteration #8) lands in a release-path build context, that pinned dir is where the binary actually is, andaction_surfaceskips the runtime check with a "no binary found" warning. -
tests/README.md:10-11still describestest_cli.pyas covering "the Python CLI shim's binary-discovery logic" — module gone, doc stale.
Why this is analogous to fbuild#748
PR #748 fixed a case where package-dir worked correctly for the wheel build but produced a PEP 660 meta-path finder whose MAPPING was too narrow — runtime imports worked, but static analyzers walking top_level.txt / .pth files couldn't resolve from fbuild.api import …. The bug only showed up in tools that walked the artifact differently from how the wheel-builder did.
Here the wheel-build path is fine: ci/build_wheel.py produces a working wheel with template-cli.exe at <name>-<ver>.data/scripts/. But artifact-walking tools — pytest discovering test modules, action_surface probing the source tree for the staged binary — still expect the pre-#7 layout. Same failure shape, different tool surfaces.
Fix
-
tests/test_cli.py— replace thetemplate_python_rust_cmd.cliimport with a test against the actual installedtemplate-clibinary on PATH (viashutil.which). Asserts the binary exists and is invokable. The original test's intent — "the package can locate its CLI" — is preserved; the implementation matches the new shipping mechanism. -
ci/gates/action_surface.py::_binary_path()— drop the dead_bin/candidate. Add aCARGO_TARGET_DIRhonor (mirror the resolution inci/build_wheel.py::_cargo_target_root) so the gate finds the binary even when the wheel-build path put it under the pinned target dir. Keeptarget/release/andtarget/debug/as fallbacks for the dev./testflow. Update the user-facing warning to match the new search paths. -
tests/README.md— describe whattest_cli.pyactually tests now (binary-on-PATH probe, not the deleted shim).
Acceptance
uv run pytest tests/test_cli.py -vcollects + passes (noImportError)../ci.sh action_surfacefinds the binary underCARGO_TARGET_DIR/release/(the pinned wheel-build dir) when one exists, without needing to fall back to the "no binary found" skip path.grep -rn "_bin\|template_python_rust_cmd\.cli" tests/ ci/ src/returns no live-code hits (READMEs may still reference them historically).
Activity
docs: scrub stale cli.py / _bin/ references after #7 (closes #11) (#12)