Skip to content

fix(builder): build the dev host where it's served, and repair the stale obc-pack paths - #990

Merged
timohueser merged 4 commits into
developfrom
fix/builder-stale-paths
Jul 29, 2026
Merged

fix(builder): build the dev host where it's served, and repair the stale obc-pack paths#990
timohueser merged 4 commits into
developfrom
fix/builder-stale-paths

Conversation

@timohueser

Copy link
Copy Markdown
Owner

Two independent path bugs in builder/, found one after the other. Both are the
silent kind: nothing throws, so nothing noticed.

1. The dev host's bundle was tracked, and served from nowhere

builder/static/dist/ was a Vite build artifact committed by accident in
c070d62. Vite's dev outDir was ../static/dist relative to builder/app,
resolving to builder/static/dist — but server.py, tools/justfile, the
README and .gitignore all name builder/server/static/dist. Only the ignore
rule was expected to cover it, so 640 KB of bundle landed in the tree, and
a6b0c35 later swept 36 more files of it into an unrelated chore commit.

The same mismatch meant the FastAPI dev host was broken: it mounts a
directory that never existed, so python -m builder.server served its
"Frontend not built yet" page even immediately after npm run build.

Fixed by pointing the outDir at the path the other four references already
agreed on, then untracking the misplaced copy. The .gitignore line was
already correct and needed no change.

2. /api/schema's fallback could never fire

SCHEMA_FILE still named firmware/obc-pack/…, a path that stopped existing
when the crate moved to host/. The binary branch kept working, os.path.exists
quietly went False, and the repo-file fallback stopped firing — so an unbuilt
packer took the 503 instead of degrading to a usable schema, and the editor lost
the capability information it derives from that envelope.

ci.yml builds obc-pack immediately before pytest, so the existing /api/schema
test always took the binary branch and could not have caught this. The Rust side
pins the file's contents through include_str! (a move there is a compile
error) and the frontend imports it by relative path — Python's string-joined path
was the only one that could rot in silence. builder/tests/test_schema_source.py
now pins it, along with the fallback branch actually answering and both sources
producing the same envelope shape.

Also fixed: the build hints in server.py and jobs.py said in firmware/, and
both schema staleness tests told you to regenerate into obc-pack/schema/…
followed from the repo root that creates a stray top-level obc-pack/ directory
and leaves the test still failing. firmware/obc-pack now appears nowhere.

Verification

  • npm run build writes builder/server/static/dist (same asset hashes the
    committed bundle had), the server serves it at 200 with no console errors, and
    git status stays clean after a build.
  • With the directory absent, / still returns the existing 503 build-me page
    rather than a stack trace.
  • builder/tests/: 10 passed with obc-pack built. The three new path tests were
    checked against the pre-fix code and all three fail there.
  • cargo test -p obc-pack: 199 passed. cargo fmt --all clean.

Docs

README.md's three-hosts table pointed at frontend/dist/<host>/, the app
directory's pre-refactor name — corrected to builder/app/dist/ in its own
docs: commit. Nothing in docs/content/ describes these paths or the schema
fallback, so the docs site needs no update.

🤖 Generated with Claude Code

timohueser and others added 4 commits July 29, 2026 18:21
`builder/static/dist/` was a build artifact committed by accident in
c070d62: vite's `dev` outDir is `../static/dist` relative to builder/app,
which resolves to builder/static/dist — but server.py, tools/justfile, the
README and .gitignore all name builder/server/static/dist. Only the ignore
rule was expected to cover it, so the 640 KB bundle landed in the tree, and
a6b0c35 then swept 36 more files of it into an unrelated chore commit.

The mismatch also meant the FastAPI dev host served its "Frontend not built
yet" page even right after `npm run build`, since the directory it mounts
never existed. Point the outDir at builder/server/static/dist — one line,
and the four references that already agreed keep agreeing — then untrack
the misplaced copy.

Verified: `npm run build` now writes builder/server/static/dist (the same
asset hashes the committed bundle had), `python -m builder.server` serves
the app at 200 with no console errors, `git status` stays clean after a
build, and with the directory absent "/" still returns the 503 build-me
page rather than a stack trace.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The three-hosts table still named `frontend/dist/<host>/`, the app
directory's pre-refactor name. Vite writes `dist/web` and `dist/desktop`
relative to builder/app, which is also what deploy-site.yml copies from
and what .gitignore's `builder/app/dist/` covers.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…he path

`/api/schema` falls back to the checked-in config schema when the obc-pack
binary isn't built, but SCHEMA_FILE still named `firmware/obc-pack/…` — a
path that stopped existing when the crate moved to `host/`. The failure is
silent by construction: the binary branch keeps working, `os.path.exists`
just goes False, and the fallback never fires again. So an unbuilt packer
took the 503 instead of degrading to a usable schema, and the editor lost
the capability information it derives from that envelope.

CI builds obc-pack before running builder/tests/, so the existing
`/api/schema` test took the binary branch and could not have caught it.
test_schema_source.py covers what was uncovered: the path resolves and
holds a config schema, the fallback branch actually answers with no binary
in sight, and both sources produce the same envelope shape (the frontend
reads schema_version / format_version / source off either). All three fail
against the pre-fix code.

The 503's build hint said `in firmware/` too, as did the same hint in
jobs.py — the workspace is rooted at the repo root, so both now say so.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Both staleness tests tell you to regenerate with a redirect into
`obc-pack/schema/…`, from before the crate moved under `host/`. Followed
literally from the repo root — which is where you run cargo — that creates
a stray top-level `obc-pack/` directory and leaves the test still failing.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@timohueser
timohueser merged commit 2c8f64e into develop Jul 29, 2026
25 checks passed
@timohueser
timohueser deleted the fix/builder-stale-paths branch July 29, 2026 18:22
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