Skip to content

TR-1170: a git install builds without the console; a release build still requires it - #588

Merged
sudopower merged 2 commits into
mainfrom
factory/TR-1170
Nov 11, 2026
Merged

sudopower merged 2 commits into
mainfrom
factory/TR-1170

Conversation

@sudopower

Copy link
Copy Markdown
Member

Ticket: TR-1170

A fresh clone has no ui/dist (gitignored, needs Node), and the wheel build force-included it, so uv tool install git+https://github.com/glassflow/tares@<branch> failed.

What changed

  • hatch_build.py (new wheel build hook): adds ui/dist as tares/console only when ui/dist/index.html exists. Without it, the build passes and says so in one line. TARES_REQUIRE_CONSOLE=1 turns a missing console into an error. pyproject.toml drops the unconditional force-include.
  • tares/_ui.py (new): where the console lives and whether there is one. daemon.py uses it; without a console / answers 404 console not built: ... with how to get one. tares up prints that hint in one line and starts, no traceback.
  • release.yml: uv build runs with TARES_REQUIRE_CONSOLE=1, then checks the wheel holds tares/console/index.html.
  • ci.yml: new wheel-clean job on ubuntu and windows. From a clean checkout it builds the wheel, checks it has no console, checks the require flag fails the build, installs it, runs tares --version and tares factory doctor.
  • windows-crew.yml, factory-engine.yml: the empty ui/dist stub step is gone.
  • Tests: tests/test_crew_packaging.py (no ui/dist builds and the wheel has no console; require flag fails the build; stub console still lands as tares/console), new tests/test_no_console.py.

With ui/dist built the wheel is unchanged. The sdist keeps **/node_modules excluded and carries hatch_build.py; an sdist builds to a wheel with and without a console.

Checks (scratch HOME)

  • python tests/test_crew_packaging.py: 74 passed, 0 failed. Break-test: the hook no longer raises on the flag, 1 failed (require flag case).
  • python tests/test_no_console.py: 13 passed, 0 failed. Break-test: tares up hint removed, 1 failed.
  • test_cli 46, test_degraded 23, test_ci_list 55 passed, 0 failed.
  • Clean clone with no ui/dist: uv build --wheel, install in a new venv, tares --version prints 1.56.0, tares factory doctor runs, tares up prints the hint and / answers 404 with it.
  • check_ledger.py ok, check_port_drift.py origin/main HEAD ok.

Overlap

PR 587 also edits windows-crew.yml, tares/daemon.py, tests/ci_list.txt; PR 159 edits daemon.py, ci.yml; PR 48 edits pyproject.toml. Different hunks as far as I can tell; whoever merges second rebases.

Out of scope, as the ticket says: building the UI in the wheel build, publishing to PyPI.

@sudopower

Copy link
Copy Markdown
Member Author

factory/review: changes at 6312371

The approach is right. A build hook that adds ui/dist only when index.html exists, plus TARES_REQUIRE_CONSOLE=1 in release.yml and a post-build check that the wheel holds tares/console/index.html, makes a git install work and still keeps a release from going out without its console. But the release Docker image no longer builds.

Verified (worktree at 6312371, TARES*/FACTORY*/CLAUDE* stripped, fail keyring)

  • test_crew_packaging 74/0, test_no_console 13/0, test_cli 46/0, test_degraded 23/0, test_ci_list 55/0, test_parity 95/0.
  • Break 1: the hook always force-includes ui/dist. test_crew_packaging fails 3: the no-console build, its one-line warning and the require-flag case. Restored, 74/0.
  • Break 2: _serve_ui goes back to UI_DIST.exists(). test_no_console fails (rc=1: the empty-folder 404 case breaks). Restored, 13/0.
  • release.yml: uv build builds the sdist, then the wheel from the sdist. artifacts = ["ui/dist/**"] and the tracked hatch_build.py are both in the sdist, and the step's TARES_REQUIRE_CONSOLE=1 reaches the wheel build. A console is required there and checked afterwards.
  • The daemon still exports _ui_dist (test_cli imports it). Removing the ui/dist stubs from windows-crew and factory-engine is sound, because an editable install with no console now builds with only a warning.
  • Scope: 14 files, no hooks.json, min_tares.txt or version change. Main moved 1 commit (ci_list.txt only), and the PR does not conflict with it.

F1 (P1, blocking, deploy/docker/Dockerfile:16-22): the release image build fails, because the Dockerfile never copies hatch_build.py

  • Stage 2 copies pyproject.toml README.md LICENSE, tares/, ee/, claude-plugin/ and ui/dist, then runs pip install ".[otlp-grpc,postgres-state]". pyproject now names the hook path = "hatch_build.py", which isn't there.
  • Reproduced offline with exactly that file set: OSError: Build script does not exist: hatch_build.py. With hatch_build.py added, the same set builds a wheel that holds tares/console/index.html. main's pyproject builds that set fine.
  • docker-publish.yml builds this Dockerfile only on a v* tag, so PR CI never sees it. The next release would publish to PyPI and then fail the image.
  • Fix: add hatch_build.py to the stage-2 COPY. Also set ENV TARES_REQUIRE_CONSOLE=1 before the pip install, so an image whose UI stage produced no index.html fails instead of shipping without a console.
  • Before the next round, build the image's file set (or docker build -f deploy/docker/Dockerfile . through factory-heavy) and say what it gave.

Notes (P3, non-blocking)

  • F2 (deploy/docker/Dockerfile:5, :19): the comments still say "hatch force-include ui/dist". Update them with the fix.
  • F3 (ci.yml wheel-clean): the job builds --wheel straight from the tree. That is close to uv tool install git+..., but it does not run the isolated build that pip and uv do for a git URL. Optional: also run uv tool install --from ., or pip install . into a fresh venv.

Not verified

  • CI was still running at review time (14 pass, 18 in progress, including windows-crew). The wheel-clean jobs had passed.
  • A real docker build: I reproduced the file set with uv build --offline instead.

A Sonnet challenger confirmed F1 (the context is ., .dockerignore keeps hatch_build.py, and there is no COPY . .), checked the sdist and editable paths, and found F2 and F3.

Next round: the fix and the delta, the image file-set build, CI on the new head, and windows-crew compared with main.

@sudopower

Copy link
Copy Markdown
Member Author

factory/review: pass at 13480e0 (round 2)

F1 is fixed. The image's stage 2 now copies hatch_build.py next to pyproject.toml, and it sets TARES_REQUIRE_CONSOLE=1 before the pip install. An image can therefore no longer build without the hook file, or ship without its console. The new Dockerfile check in test_no_console guards against the file being dropped from the hand-written COPY list again.

Verified (worktree at 13480e0, TARES*/FACTORY*/CLAUDE* stripped, fail keyring)

  • Delta from 6312371: one commit, no rebase. It changes the Dockerfile (+5/-3) and test_no_console (+7).
  • The image's file set, copied from the Dockerfile's own stage-2 COPY lines:
    • with ui/dist present, TARES_REQUIRE_CONSOLE=1 uv build --wheel builds, and the wheel holds tares/console/index.html;
    • without ui/dist it fails with RuntimeError: TARES_REQUIRE_CONSOLE is set but ui/dist/index.html is missing.
  • The builder also reports a real docker build -f deploy/docker/Dockerfile through factory-heavy with rc 0. I did not repeat that.
  • test_no_console 15/0, test_crew_packaging 74/0.
  • Break: with hatch_build.py taken out of the COPY line, test_no_console gives 14/1 ("the Dockerfile copies hatch_build.py next to pyproject.toml"). Restored, the tree is clean.
  • F2: the comments at :5 and :19 now describe the hook.
  • F3: wheel-clean installs the built wheel into a fresh venv and runs tares --version and tares factory doctor. That is enough; the extra isolated-build step was optional.
  • CI on this head: all 30 required checks pass, including both wheel from a clean checkout jobs (ubuntu and windows). Those build, install and run a no-console wheel. Only secrets is red (see below).
  • windows-crew (advisory) was still running when I posted. Round 1's run was cancelled. The Windows wheel-clean job covers the no-ui/dist install path that dropping the stub depends on. I did not wait for the full parity run, because the orchestrator asked for speed.

Resolved: F1 fixed. F2 fixed. F3 fixed (answered, no change needed).

On the red secrets check

  • It is not from this PR. gitleaks detect with fetch-depth: 0 scans every ref.
  • Main's own push run, 43006800940 at 27d37be, fails the same way: "1274 commits scanned", "leaks found: 1". The main run before it (43004328136) passed.
  • Something pushed to another branch since then is being flagged. That needs fixing separately, for main and every PR.

Not run

  • A real docker build: I rebuilt the image's file set with uv build --offline instead. The builder ran the real build through factory-heavy.
  • Challenger skipped: small delta (+12/-3), and the fix and its break are verified.

@sudopower
sudopower merged commit 5b6aea5 into main Nov 11, 2026
32 of 33 checks passed
@sudopower
sudopower deleted the factory/TR-1170 branch November 11, 2026 11:24
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