fix(embed): untrack web/frontend/dist/* and serve a fallback stub on bare go builds#473
Merged
Dumbris merged 1 commit intoMay 17, 2026
Conversation
The .gitignore already declares `web/frontend/` "auto-generated", and every documented build path (`make build`, `make build-server`, the release.yml + pr-build.yml CI workflows, the frontend/README.md "Production Deployment" recipe) regenerates the bundle from source. But the 39+ files under web/frontend/dist/ have been tracked since a27d360, which means every `make frontend-build` produces a flood of "deleted old-hash" + "untracked-but-gitignored new-hash" entries in `git status`. This commit brings the tracked state in line with the maintainers' stated intent. Changes: 1. `git rm --cached -r web/frontend/` removes the tracked Vite output. 2. Track `web/frontend/dist/.gitkeep` so //go:embed has at least one file to embed on a fresh module fetch. 3. Track `web/embedded_fallback/index.html`, a small stub UI shown when no real Vite bundle is present. 4. Change the embed directive in web/web.go to `all:frontend/dist` (required to pick up the dotfile placeholder) and add a second embed for the fallback. The handler falls back to the stub when index.html isn't found in the real bundle. 5. `.gitignore` gains explicit re-include lines so the new .gitkeep survives the generic `dist/` ignore rule earlier in the file. 6. Makefile's `frontend-build` recreates `.gitkeep` after copying the freshly built dist into web/frontend/, so subsequent rebuilds leave a clean `git status`. User-visible behavior: | Flow | Before | After | |-----------------------------------------|---------------------|------------------------| | `make build` from a clean tree | dirty tree after | clean tree after | | `make build` re-run | dirty tree after | clean tree after | | Bare `go build ./cmd/mcpproxy` | stale embedded UI | fallback stub at /ui/ | | `go install …@latest` (no npm) | stale embedded UI | fallback stub at /ui/ | | Docker / .deb / DMG release | uses `make build` | unchanged | | CI release.yml / pr-build.yml | always rebuilds | unchanged | The trade-off is that bare-Go-toolchain users (no npm) now get a stub UI with a "build from source for the real UI" message instead of a silently-stale bundle. The REST API, MCP endpoints, and CLI are unaffected — only the `/ui/` route changes. Verified: - `go build ./...` succeeds - `make frontend-build` produces a clean `git status` - After wiping web/frontend/dist/* except .gitkeep, bare `go build ./cmd/mcpproxy` compiles and the binary serves the fallback HTML at /ui/ - `git archive HEAD | tar -x -C tmp && cd tmp && go build ./cmd/mcpproxy` (the `go install` module-fetch simulation) produces the same fallback behaviour
electrolobzik
added a commit
to HaloCollar/mcpproxy-go
that referenced
this pull request
May 16, 2026
…proxy#473) Brings in the embed untrack + fallback stub: - e46d3d7 fix(embed): untrack web/frontend/dist/* and serve a fallback stub After this merge: - web/frontend/dist/* is no longer tracked (only .gitkeep remains as a placeholder so //go:embed all:frontend/dist still compiles on a fresh module fetch). - web/web.go embeds a small fallback HTML page at web/embedded_fallback/ that is served when no real Vite bundle is present (e.g. `go install …@latest` users who don't run npm). - Makefile's `frontend-build` recreates .gitkeep after copying the freshly built dist, so subsequent rebuilds leave a clean working tree. All three documented install paths verified end-to-end (see PR smart-mcp-proxy#473).
Member
|
Thank you, @HaloCollar! 🙏 Untracking the generated |
Dumbris
approved these changes
May 17, 2026
Dumbris
added a commit
that referenced
this pull request
May 17, 2026
…474) PR #473 changed the Makefile `frontend-build` target to copy into `web/frontend/dist/` and `touch web/frontend/dist/.gitkeep` (so the `//go:embed all:frontend/dist` directive always has something to embed). The release.yml and pr-build.yml "Copy frontend dist" steps still used the older `cp -r frontend/dist web/frontend/` form. Both forms place a real index.html under web/frontend/dist/ so release artifacts were never broken, but the divergent forms are confusing and the workflow steps did not recreate the tracked .gitkeep. This aligns both workflows with the Makefile so there is a single canonical form. Follow-up to #473. No functional change to release/CI artifacts. Co-authored-by: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The
.gitignorealready declaresweb/frontend/"auto-generated":But 39+ files under
web/frontend/dist/have been tracked sincea27d360(“chore: regenerate OpenAPI spec and frontend build”, Spec 031). Themake frontend-buildtarget doesrm -rf web/frontend && cp -r frontend/dist web/frontend/, and Vite's content-hashed output filenames change with bundle content. The result: everymake buildproduces a flood of “deleted old-hash” + “untracked-but-gitignored new-hash” entries ingit status, onmaintoday.This PR aligns the tracked state with the maintainers' stated intent.
What changes
git rm --cached -r web/frontend/— untracks the previously-tracked Vite output.web/frontend/dist/.gitkeep(empty) — gives//go:embedsomething to embed on a fresh module fetch (go install …@latest), before any real UI has been produced.web/embedded_fallback/index.html— a small stub page shown when no real Vite bundle is present. It tells the user how to get the real UI (release artifacts ormake build).web/web.go— changes the embed pattern to//go:embed all:frontend/dist(required to pick up the dotfile placeholder), adds a second embed for the fallback, and adjusts the handler to fall back to the stub whenfrontend/dist/index.htmlisn't found in the embedded FS..gitignore— explicit re-includes for!web/frontend/dist/and!web/frontend/dist/.gitkeepso they survive the genericdist/ignore rule earlier in the file.frontend-buildnowcp -r frontend/dist/. web/frontend/dist/(copy contents, not the directory) andtouch web/frontend/dist/.gitkeepso the placeholder survives subsequent rebuilds.User-visible behavior
make buildfrom a clean treemake buildre-rungo build ./cmd/mcpproxya27d360-era commit (broken:index.htmlreferences different asset hashes than the binary actually serves)/ui/with build-from-source instructionsgo install …@latest(no npm available)make buildrelease.yml/pr-build.ymlCIweb/frontend/fromfrontend/The trade-off is the bare-Go-toolchain install paths (
go install,go buildwithoutmake). Those previously produced a binary with a technically embedded stale UI bundle whoseindex.htmlreferenced assets the binary doesn't actually contain after subsequent feature PRs landed Vue code without re-committingweb/frontend/dist/*. After this PR, those paths produce a small, intentional fallback page instead. The REST API, MCP endpoints, and CLI are untouched — only/ui/changes.Verification (all three install paths)
make buildfrom clean tree → clean tree after.Re-running
make frontend-buildrepeatedly continues to produce a clean status.Bare
go build ./cmd/mcpproxyfrom a fresh-clone-shaped tree.Including SPA routes:
go install …@latestsimulated via the actual module zip pkg.go.dev would serve.What this PR is not
This PR does not touch
cmd/generate-types/main.goorfrontend/src/types/contracts.ts. The independentcontracts.tschurn (where the hardcoded TS string incmd/generate-typeshas drifted from the actual file) is fixed in #472, which can land independently in either order.🤖 Generated with Claude Code