Skip to content

fix: vendor web-shared via git subtree, unblock frontend CI#2

Merged
davidfic merged 4 commits intomainfrom
fix/vendor-web-shared-via-subtree
Apr 15, 2026
Merged

fix: vendor web-shared via git subtree, unblock frontend CI#2
davidfic merged 4 commits intomainfrom
fix/vendor-web-shared-via-subtree

Conversation

@davidfic
Copy link
Copy Markdown
Contributor

Summary

Unblocks prism's frontend test job which was failing in CI across ~15 `src/api/*.test.tsx` files and several page-level tests, all because the whole module graph couldn't resolve:

```
Failed to resolve import "@beacon-shared/..."
```

Same structural issue as pilot's parallel PR — a sibling-directory path alias that resolved locally but not on GitHub runners.

What this PR does

  1. Pulls `beacon-stack/web-shared` into `web/ui/src/shared/` via `git subtree add --prefix=web/ui/src/shared https://github.com/beacon-stack/web-shared.git main --squash`.
  2. Rewires `vite.config.ts` alias `@beacon-shared` → `./src/shared`.
  3. Rewires `tsconfig.app.json` `paths` map the same way.

Zero import changes. Every existing `import X from "@beacon-shared/Y"` resolves unchanged.

Why subtree over a published package

Same reasoning as pilot's parallel PR — see Beacon-Stack/pilot#2 for the full rationale and the devil's advocate / architect decision trail. Short version: `web-shared` ships `.tsx` source not compiled JS, a real package needs a build step + `exports` map + `peerDependencies`, and the existing React singleton hack gets harder when the dep resolves via `node_modules` instead of an alias.

Verification

```
cd web/ui
npm run build # ✓ builds cleanly, 2.49s
npm run test:coverage # ✓ 267 passed, 23 skipped, 0 failed, 898ms
```

Test plan

  • CI `Test Frontend` job green (previously failing on ~15 test files)
  • CI `Build` job green
  • CI `Lint` job green

davidfic and others added 4 commits April 15, 2026 07:49
git-subtree-dir: web/ui/src/shared
git-subtree-split: a5195d42958310e8d1cbc14a7d5349d30115b251
Previously web/ui/vite.config.ts and tsconfig.app.json resolved
@beacon-shared/* via a path relative to a sibling directory outside
the prism repo:

    "@beacon-shared": "../../../web-shared"

That worked on the author's laptop (where the beacon monorepo checkout
sits with all four app repos alongside a web-shared dir) but broke
every CI run, since GitHub runners only check out prism and the
sibling dir doesn't exist. Consequence: ~15 src/api/*.test.tsx files
plus page tests all failed under `npm run test:coverage` because the
whole module graph couldn't resolve.

Vendors web-shared into prism's tree at web/ui/src/shared/ via
`git subtree add --prefix=web/ui/src/shared
https://github.com/beacon-stack/web-shared.git main --squash` (the
parent commit on this branch), then rewires the Vite alias and the
tsconfig path map to point at the vendored copy.

No import changes in any prism source file — every existing
`import X from "@beacon-shared/Y"` still resolves correctly.

Same architectural reasoning as pilot's parallel PR: subtree over
published npm package because web-shared ships .tsx source not
compiled JS, a real package needs build/exports/peerDeps, and the
React singleton hack gets harder when the dep is installed via npm
instead of aliased in-tree. Graduate to a published package when a
fourth consumer joins, web-shared needs a React-coupled transitive
dep, two consumers need the same component to behave differently,
or a non-Beacon project wants to consume it. None are true today.

Verified: `npm run build` succeeds, `npm run test:coverage` passes
267 tests with 0 failures.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
prism's integration tests (internal/api/v1/*_test.go via
internal/testutil/db.go) connect to a real Postgres database to
create per-test schemas. Locally they work because the author runs
Postgres on 5432. On CI they silently fell through to the default
DSN and failed on every integration-test package with:

    dial tcp 127.0.0.1:5432: connect: connection refused

Adds a postgres:17-alpine service container to the test job with
trust auth, user=runner, database=prism_test, and a health check so
the go test step only fires once Postgres is ready. Also sets
PRISM_TEST_DSN so testutil/db.go picks up the service DSN explicitly
instead of falling through to its localhost default.

Note: the non-test CI jobs (lint, build, docker) don't need the
database, so the service is scoped to the test job only.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@davidfic davidfic merged commit b8725f0 into main Apr 15, 2026
7 checks passed
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