Skip to content

build(gateway): embed the UI tree as a fossilize directory asset - #1837

Merged
BYK merged 40 commits into
mainfrom
devin/1789772172-ui-fossilize-asset-dir
Sep 19, 2026
Merged

BYK merged 40 commits into
mainfrom
devin/1789772172-ui-fossilize-asset-dir

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Sep 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #1831, stacked on its branch (retarget to main once #1831 lands). Pins fossilize to 0.11.0 (the release with BYK/fossilize#37) and uses its directory-asset embedding for the UI.

build-binary-sea.ts stops enumerating the UI files for fossilize. The staged tree is copied to <staging>/ui and passed as one directory asset with a key prefix:

// per target
await fossilize({
  assetManifest: manifestPath,            // workers, model, vec0, ORT (unchanged)
  assets: [`${join(stagingDir, "ui")}=ui/`], // → SEA keys ui/<relative path>
  ...
}, bundlePath);

so ui/index.html, ui/assets/index-*.js.br, ui/ui-manifest.json, … are embedded exactly as before and src/ui-static.ts's getRawAsset("ui/<path>") is untouched. The sharedManifest UI loop and UiAssetsResult.staged (its only consumer) are removed; --from-staging stays self-contained since the copy lives inside the staging dir. The .br/.gz variants are still produced by script/ui-assets.ts and ride along in the directory — fossilize 0.11.0 does not precompress.

Lockfile change is limited to the fossilize entry (same transitive deps as 0.10.1); pnpm install --frozen-lockfile accepts it. No effect on dist/index.cjs (17,478,460 B, unchanged from #1831) — only the SEA binary build path changes.

Verified against the released fossilize@0.11.0: build:binary:sea --platforms linux-x64 logs Embedding 40 assets (12 manifest + 27 ui/ + manifest.json), node scripts/ui-deep-link-smoke.mjs -- <binary> passes from outside the repo, main JS served content-encoding: br (78,658 B) decodes to the 294,264 B identity file, /ui/favicon.svg (public asset) 200. pnpm run typecheck / lint / format:check clean.

Part of #1797.

Link to Devin session: https://app.devin.ai/sessions/5ac126b5d15542608f3dcaccc477ac32
Open in Devin Desktop: https://app.devin.ai/desktop/session/5ac126b5d15542608f3dcaccc477ac32?variant=devin
Requested by: @BYK

BYK and others added 30 commits September 18, 2026 15:06
…ity smoke project

Adds packages/ui as a workspace package pinned to Solid 1.9.15 (Solid 2 rc
blocked by @kobalte/core / vite-plugin-solid / @solidjs/router, see README),
with a jsdom compatibility smoke (router, Kobalte dialog+select, IME
composition, TanStack table/virtual, Tailwind 4 + Lore tokens), the /api/v1
inventory corrected against api.ts, a reproducible gateway baseline script and
the clean-main numbers. Root test scripts now also run the UI unit tests.

Part of #1796

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…dashboard removal

Solid SPA shell (project nav, list pane, document-first detail, search
placeholder, connection status, responsive collapse, dark/light) with real
data from /api/v1 and the /ui/fixture design specimen. The gateway embeds
the built assets and serves /ui, /ui/* with history fallback, strict CSP,
immutable caching for hashed files and the same management authorization
as /api. Removes packages/gateway/src/ui.ts; the contradiction/dedup
decision logic moves to review-actions.ts without new routes.

Part of #1797, #1824. Parity gaps tracked in #1823.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…and mapping

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…alls

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Map packages/website/public/theme.css light/dark semantic variables onto the
Lore CSS custom-property tokens and Tailwind theme (values only, no website
CSS), soften radii/borders/shadows to match the site's cards, self-host the
website font stack (DM Sans / Playfair Display, latin+latin-ext woff2) so the
strict CSP holds, and copy the light/dark Lore logo + favicon into
packages/ui for a theme-aware shell header. The fixture banner now uses the
shared inverse tokens. Mapping table documented in packages/ui/README.md.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…nd logo

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…oke' into devin/1789743959-ui-02-shell-gateway
…ark the gateway unreachable

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…apsed hours

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
… on gateway port collisions

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…oke' into devin/1789743959-ui-02-shell-gateway
Dev/test-only screens (fixture, _compat) are mounted only under
import.meta.env.DEV. Playwright now runs fixture.spec.ts against a Vite dev
server proxying /api to the same seeded gateway (dev-* projects), and the
production projects assert both routes render the not-found screen.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…esponses

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…otiation

Embed zstd (22), brotli (11, text) and gzip (9) variants of compressible UI
assets at build time (node:zlib only; zstd skipped with a warning when the
build host lacks it; build ID still digests identity bytes only). The static
handler negotiates zstd > br > gzip > identity honouring q-values, sets
Vary: Accept-Encoding and per-encoding ETags on compressible assets, and
never compresses at request time.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…e as documented

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…oke' into devin/1789743959-ui-02-shell-gateway
…equests

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…oke' into devin/1789743959-ui-02-shell-gateway
At its level-22 ceiling zstd stayed 5-8 % larger than brotli on every UI
asset (long-distance matching / window / strategy tuning changed nothing),
so it only grew the bundle. Also adds a regression test that cached asset
bodies are standalone copies of the embedded bytes.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
knowledge_contradictions is keyed on logical ids; resolveContradiction /
dismissContradiction now map possibly-superseded version ids through
ltm.logicalIdOf first, so a stale reviewer id no longer returns a false
negative. Regression tests use a genuinely stale (non-logical, non-head)
version id.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…oke' into devin/1789743959-ui-02-shell-gateway
…lives on #1796

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…oke' into devin/1789743959-ui-02-shell-gateway

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	packages/ui/README.md
#	packages/ui/docs/api-inventory.md
#	packages/ui/docs/baseline.md
BYK and others added 3 commits September 18, 2026 22:41
…ts or disk

Replace the generated ui-assets module (base64 bytes inside the bundle) with
a staged file tree: script/ui-assets.ts copies packages/ui/dist into
packages/gateway/dist/ui with .br/.gz siblings and writes ui-manifest.json
(types, sizes, variants, identity-only build ID). ui-static.ts reads that tree
through a UiAssetSource: sea.getRawAsset("ui/<path>") in the SEA binary
(build-binary-sea.ts adds every staged file to the fossilize manifest) and
dist/ui on disk otherwise (npm CJS, Bun ESM, tsx, tests). Manifest is
validated before serving; bodies are read lazily and cached. Negotiation,
ETags, CSP and caching are unchanged; dist/index.cjs shrinks by ~0.9 MB.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…2-shell-gateway

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	packages/ui/README.md
#	packages/ui/index.html
#	packages/ui/package.json
#	packages/ui/src/app.tsx
#	packages/ui/src/styles/app.css
#	pnpm-lock.yaml
Pass <staging>/ui=ui/ through fossilize's `assets` option instead of
listing every staged UI file in the per-target asset manifest. Requires
fossilize >= 0.11 (BYK/fossilize#37); UiAssetsResult.staged is gone
with its only consumer.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

Released with BYK/fossilize#37 (directory assets with key prefixes).

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration
devin-ai-integration Bot marked this pull request as ready for review September 19, 2026 08:25
BYK and others added 3 commits September 19, 2026 10:02
authorOf trimmed created_by for the label but not for the avatar kind, so
a blank-but-non-empty author rendered "Curator" with a person avatar.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
- CONTENT_TYPES becomes a Map
- fs/promises + promisified zlib throughout ui-assets.ts; one recursive
  dirent readdir instead of a stat per entry; reads/compressions run
  concurrently and fold back in tree order so the build ID stays stable
- drive vite's programmatic build() in-process instead of spawning its CLI
- .lore.md / AGENTS.md describe the UI package, serving and staging design

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…2172-ui-fossilize-asset-dir

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>

# Conflicts:
#	packages/gateway/script/ui-assets.ts

@BYK BYK left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't forget to update .lore.md if this changes any entries there.

BYK and others added 2 commits September 19, 2026 11:23
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

Re .lore.md: the only affected entry is the Lore UI asset staging, precompression, and SEA embedding decision added on #1831; a459a46 updates its last sentence to describe the fossilize (>= 0.11) directory asset (<staging>/ui=ui/ → SEA keys ui/<relative path>, no per-file manifest entries). No other entries reference the SEA asset list.

Base automatically changed from devin/1789743959-ui-02-shell-gateway to main September 19, 2026 11:27
Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@github-actions

Copy link
Copy Markdown
Contributor

Coverage Results 📊

✅ Patch coverage is 100.00% (no changed executable lines found; target 80%).
Project statement coverage is 84.15% (up 1.77 percentage points from base (04820b4) to head (866a25d)).

Coverage diff
@@            Coverage Diff             @@
##          main     #1837       +/-##
==========================================
+ Coverage    82.38%    84.15%    +1.77%
==========================================
  Files          260       262        +2
  Tracked lines     46600     45554     -1046
  Branches     37483     36683      -800
==========================================
- Hits         38391     38335       -56
+ Misses        8209      7219      -990
+ Partials      3986      3953       -33

Generated by Coverage Action

@BYK
BYK merged commit aa94ea9 into main Sep 19, 2026
31 checks passed
@BYK
BYK deleted the devin/1789772172-ui-fossilize-asset-dir branch September 19, 2026 13:51
@github-actions

Copy link
Copy Markdown
Contributor
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-19 13:52 UTC

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