Skip to content

fix(component-contract): check-gen-contract.sh finds the engine beside specfuse - #200

Merged
clabonte merged 1 commit into
mainfrom
fix/gen-contract-find-engine
Nov 3, 2026
Merged

clabonte merged 1 commit into
mainfrom
fix/gen-contract-find-engine

Conversation

@clabonte

@clabonte clabonte commented Nov 3, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the kit half of internal-ideas#3.

check-gen-contract.sh tried specfuse gen-contract, which the CLI does not have yet, then python3. On a pipx or uv install the engine is in the tool's own environment, so the script failed with the engine is not importable by python3. The issue reports uv; pipx fails the same way. Its hint, python3 -m pip install, is refused on a Homebrew Python (externally-managed-environment).

Changes

  • Lookup: the first of SPECFUSE_PYTHON, the interpreter beside the specfuse command when it has the engine, then python3. The script follows symlinks, as pipx and uv install one. It does not parse the shebang, because uv's reads #!/bin/sh.
  • Hint: names pipx install specfuse and uv tool install specfuse. The template README and C# guide say the same.
  • Test: test-csharp-contract-template.sh stubs python3. CI pip-installs the engine there, the one case that always worked, so nothing covered this.

Not fixed here

Seeded scripts belong to the component and the kit never rewrites them, so existing components keep the old lookup. The guide tells them to set SPECFUSE_PYTHON or copy the script again. A specfuse gen-contract command in the umbrella CLI fixes them without re-seeding, because their scripts already try it first; that is specfuse/specfuse#245.

Verification

  • The new test cases fail on the old script and pass on the new one.
  • Covered by stubs: relative symlink, plain virtualenv layout, a specfuse too old to carry the engine with python3 as fallback, nothing available (exit 2 with hint), and explicit SPECFUSE_PYTHON not overridden.
  • On real installs, default PATH pipx and a temporary uv tool install specfuse both reach the engine. That probe used a contract with builtins: removed, so it stopped at the engine's GEN-040 error, not a green run.
  • check-shipped-docs.py and check-csharp-page.py pass.

Not measured: Linux locally (CI covers it), Windows, or a run under specfuse run.

No version bump; that belongs to the release.

🤖 Generated with Claude Code

…e specfuse

The script only tried `python3`, so it failed on a pipx or uv install, where the
engine lives in the tool's own environment, and told the user to pip-install
into an interpreter that may refuse it. Under the loop that is a failed gate on
every attempt.

Try the interpreter beside the `specfuse` command first, when it has the engine,
and name pipx and uv in the hint. SPECFUSE_PYTHON still wins. CI pip-installs the
engine into python3, the one case that worked, so the template test stubs python3.

Seeded scripts are owned by the component, so existing ones keep the old lookup;
the guide says how to pick this up.

Co-Authored-By: Claude Opus 5.5 <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.

1 participant