Skip to content

feat(ui): lake's web UI as a React/Vite app following rev-os, on lake's styling (#561) - #563

Merged
homer6 merged 198 commits into
mainfrom
issue-561-spa
Oct 11, 2026
Merged

homer6 merged 198 commits into
mainfrom
issue-561-spa

Conversation

@homer6

@homer6 homer6 commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Lake's web UI is now a React single-page app in frontend/, built the way oramasearch/rev-os builds its frontend. Lake's styling is unchanged. Epic: #561

What changed

The app. React 19, Vite 6, Tailwind 4, TypeScript, TanStack Query and React Router.

  • It uses lake's own Orama tokens: tools/ui/build-tokens.mjs now also writes frontend/src/styles/tokens.css.
  • It keeps the self-hosted IBM Plex fonts and lake's component classes, moved verbatim to styles/lake.css.
  • Tailwind's theme is bound to the tokens, and preflight is off.
  • The UX follows rev-os:
    • one route registry, which feeds the rail, the breadcrumbs, the ⌘K Go-to palette and the router;
    • a collapsible rail, and an off-canvas drawer below 1024 px;
    • one UI kit;
    • a failed read never shows as an empty list (the build checks this);
    • a 401 shows "Your session has ended" with Sign in again;
    • Ask Orama is a side panel beside every page, not an iframe.
  • Every page keeps its URL and query parameters. Workspace pages stay under /w/<id>/.

Serving.

  • CMake builds the app, and tools/ui/embed-frontend.mjs embeds dist/ into the binary.
  • A browser GET (Accept: text/html) for any path no server route owns gets index.html. This is checked ahead of the npm catch-all. /ui/* is content-hashed and immutable.
  • The image gains a Node 22 stage.

API. The app calls only /v1. Fourteen capabilities close the gaps the old pages filled with direct store reads: viewer, send_ask_message, settle_ask_turn, confirm_ask_proposal, approve_agent_proposal, latest_agent_task, compile_pipeline, render_pipeline, list_packages, my_permissions, resolve_model, list_docs, get_doc and mcp_setup. repository_file gains units. See docs/api/web-app.md.

Security.

  • Any unsafe request authenticated by the session cookie must come from lake's own origin. A cookie-authenticated /v1 or /mcp POST must also be JSON (refuse_cross_site).
  • agent_turn now checks a confirmed ApplicationAgent or ExperimentsAgent proposal against the stored task and its digest. That check used to live only in the retired form handlers.
  • Found during the work and filed separately: Security: sign_in_sso issues a session for an unverified, caller-asserted SSO identity #562 (sign_in_sso).

Retired.

  • Every console page renderer: web_ui.cpp goes from 10,834 lines to 357; web_ui_streams.cpp and web_ui_experiments.cpp are deleted.
  • Every HTML form handler, the deferred panels, /workspace/select, the lake_workspace cookie, the server-side workspace link rewriting, and the vendored chart assets.
  • http_server.cpp goes from 21,880 lines to 13,700.

Kept on the server.

  • The hosted identity-application sign-in pages (/apps/:id/* and custom domains), /apps/authorize and /v1/apps/auth.
  • POST /session, POST /logout, POST /identity/clerk-session and the OAuth callback.
  • The download routes, llms.txt, the skill and every protocol route.

Docs

  • docs/ui/* is rewritten for the app; docs/ui/web-app.md covers the build, the kit and the page rules.
  • docs/api/web-app.md covers the new capabilities.
  • CLAUDE.md and README.md have the new server rules.

Proof

  • macOS: lake suite 779/779 at load ~4–6, and frontend tests 34/34. npm run build is green, including the effect and failed-read checks.
  • The Linux suite runs on the cluster BuildKit; the result will be added here.
  • Run locally against a memory-store lake: operator sign-in, the shell, Customers, Audit, the palette and the dark theme.

Since the first push (2026-10-10)

Everything below is on this branch, tested (full suite 839/839 on the head, frontend 156/156) and deployed to the dev cluster, last as 20261010z (dc5a3c4). Work is tracked in order in the queue epic #571.

The look and the shell

Data

Design, Train and Ship

Organization

Docs

  • A 36-page in-app guide in sections, with search and a table of contents.
  • The guide says lake designs, trains and ships AI.

UX review 2026-10-10 (epic #595)

Waiting on Steve

homer6 added 30 commits October 10, 2026 10:25
…lake's tokens (#561)

The build, the styles (lake's tokens and component classes, unchanged), the API
client over /v1, the UI kit, overlays, toasts, the shell with the route registry,
the command palette and the session provider. CMake builds the app and embeds
dist/ into the binary through web_app.hpp.
A browser GET that accepts text/html, for a path no server route owns, is
answered with the embedded index.html (no-cache, frame-ancestors 'self'),
ahead of the workspace redirects and the npm catch-all. /ui/:file serves the
content-hashed bundle immutable. Hosted application sign-in pages keep their
custom domains. The image builds the app in a Node 22 stage.
Organizations, organization settings with its nine tabs, team, member, SSO,
teams, members, invitations, direct grants and the four effective-access
routes, each calling its /v1 capabilities. The invitation form computes
expires_at from its day count (1 to 90) and the convert form checks the typed
handle against get_customer, as their handlers did. A plain member sees the
invitations 403 in its panel instead of losing the whole page.
Home keeps the landing copy pinned by docs/ui/front-door.md word for word,
with the visitor (Clerk and native), account and operator variants. Any
unknown address now gets an HTML not-found page instead of the server's JSON.
/login posts the operator credential to /session as a real form. /sign-in and
/sign-up call sign_in_password, verify_mfa (keeping the email and password for
the TOTP step), sign_up_password and start_oauth; under Clerk they load
clerk-js from the instance's Frontend API host and post the lake template
token to /identity/clerk-session as a top-level form, signing Clerk out first
after ?signed_out=1. /passkey-sign-in runs the WebAuthn script as it was.
After sign-in the page opens ?return_to (only /apps/authorize), ?next (a
same-origin path) or the server's old default with a full page load.
…b app (#561)

MFA enrolment shows the otpauth URI and recovery codes once from memory.
Sessions marks the session this browser uses (viewer.session_id) and asks
before revoking it; device revoke sends {id}, which the server form never did.
Tokens shows a new secret once with Copy. Settings keeps its five tabs.
Docs reads list_docs and get_doc and renders the guide's Markdown in the
browser with the contents and the Next link. MCP reads mcp_setup and makes the
key with create_token, building the input the /developer/mcp/key handler did
(read-only and never-expiring scopes from mcp_setup).
… to the web app (#561)

Packages follows each build's events by long poll; Apps runs the ApplicationAgent turn and
confirms its proposal against a fresh read of the task; the app page maps every control to its
capability, follows app and build events, and reads app_logs items. Environments, Environment,
Logs (environment_logs by GET, polled every 3 seconds) and Repository Export call /v1 directly.
… Ship and Ask (#561)

The workspace page frame with lake's gate (start, preparing with a 15 s
check, failed), workspace_query reads over POST that do not refresh every
read on screen, the lean dataset list, the agent labels and Agent Library,
and the Ask Orama conversation: send_ask_message, get_agent_task polled every
2 s, settle_ask_turn once final, confirm_ask_proposal. The proposal digest
is computed in the browser as nlohmann dump() writes it, with a pure SHA-256
so it also works on a lake served over plain HTTP.
Your Agents is an ordinary read of list_agents. Create an Agent takes its
model values from viewer.config and schedules a frontier agent's trigger.
The agent page grants and revokes pipelines, schedules and unschedules,
runs and stops (checking every 5 s while a run starts), shows training and
deletes with the typed name, removing its schedules. The Agent Factory
talks to AgentCreator and approves with approve_agent_proposal.
Upload is read as text and sent to upload_dataset with the 16 MiB check in
the browser; pull, generate, connections, services and storage call their
capabilities directly. A store's connection shows only in a dialog. Query
keeps statement and database in the URL.
The run page checks every 15 s while a run is running and reads its report
only once it is not, as the server page did.
#561)

Publish and unpublish through workspace_act; the index's datasets are a
normal read; search keeps q, field and top_k in the URL and makes a search
key with create_token; Services checks every 3 s while a service changes
and shows a connection only in a dialog.
The panel replaces the embedded iframe: a header with a new conversation
and the full view, the conversation, and the message box at the bottom. It
works in the session's workspace and says so when there is none. The page
keeps from, agent, conversation and task in the URL.
…earch pages (#561)

Customers; the identity-application console (applications and register,
application, users with suspend, organizations with create and delete, the
event log with a webhook secret shown once); usage with the storage limit;
activity and the audit log with the transparency-log panel when the lake has a
checkpoint service; the public transparency monitor; secret mounts from the
session's workspace, secrets and encryption keys; the model page through
resolve_model and get_model; and search. The hosted /apps/:id pages stay on
the server.
)

The list pages through list_streams with the filter and New Topic; the topic page browses
newest first with paging and a jump, follows Live with the bounded forward browse_stream read,
and previews then confirms settings changes and deletions. Buttons follow my_permissions.
…sitory pages (#561)

Lake's forge markup as React: identifiers, badges, sizes, the repository
tabs and breadcrumbs, the repository error page, the conflict resolution
block and the per-change diff reads behind blame. Repository pages call
their capabilities without the /w/<id> prefix, which would pin
workspace_id to the remembered workspace. Markdown keeps lake's heading
anchors.
The repository list with Create a Repository, the repository home
(README, refs, releases, languages, effective access, clone and push from
viewer.external_origin, Build image), tree, file with blame, line anchors,
C/C++ highlighting and syntax-unit shading, change log, change review with
the unified and side-by-side layouts, issues with their filters, issue,
releases, webhooks with retry, branch protection, conflicts with
resolution, build results with paging and filters, and one build result.
Webhooks and branch protection now ask a visitor to sign in.
…e web app (#561)

The folder in list or grid view with new folder, upload (base64 JSON
through upload_drive_files, with the drop zone), rename, move and delete;
preview with the format registry's markup; download as lake's
/drive/download route; history with compare and restore; version
comparison; conflict resolution; folder sharing with the workspace
chooser and the share right checked through my_permissions; and one
link's detail with revoke.
…web app (#561)

/shared-with-me lists the folders shared with the viewer; /share/:token
and /share/:token/preview open a bearer link with no sign-in through
resolve_drive_share_link and preview_drive_share_link, with downloads
through lake's /share/:token/download route.
homer6 added 19 commits October 10, 2026 19:51
…cross workspaces (#564)

Usage tracking for every installation, without billing. Each workspace Zetta gets two series, an
hour a bucket for 400 days: the counter lake_usage (API and MCP calls, each model's answered
predictions, speech-to-text seconds, model tokens, instance and volume seconds of services, stores
and apps) and the gauge lake_storage (repositories, images, workspace data, transcripts, drive
files). A bounded UsageRecorder holds what requests add, never on their critical path; the owner
loop flushes it every ten seconds and on stop, and the store root's owner samples stored bytes and
service time every fifteen minutes.

usage_over_time adds the chosen workspaces up by hour, day or month, with breakdowns by workspace,
kind, agent, launch, model and object, beside the exact repository transfer and build records,
image builds and workspace runs; another account's workspace is refused. usage_limits and
set_usage_limit keep content-free per-dimension limits (migration 0072_usage_limits): storage's
is the enforced quota, the others warn from 80%. record_model_usage takes an agent's own
credential. metering_usage is unchanged.

CPU and memory (#612), dictation outside a transcript (#613) and agent-reported tokens (#248) are
listed as not measured. No price, plan, invoice or ledger.
…ome and each thing (#564)

Organization → Usage (/usage) reads usage_over_time for the chosen workspaces (Home's
multi-select, now shared in components/WorkspaceToggles.tsx) and the period before: a figure per
dimension with its change, a uPlot chart stacked by workspace or by kind, the breakdowns, a
per-workspace table, limit meters with Set a limit, Not Measured Yet and CSV export. The operator's
Administration → Usage (/usage/accounts) lists every account's usage for capacity planning;
/usage?customer_id= opens one. /metering stays as Repository Usage by Hour.

Home's Dashboard gets a Usage button; the agent, app and model pages a Usage This Month card
(model tokens, instance time, predictions answered); Ship → Services a This Month column. No prices.

Docs: docs/ui/usage.md, docs/guide/usage.md (runnable examples), the UI indexes.
…tory (#605)

server_info answers deployments: whether the platform mirror is configured. Ship -> Deployments
reads it first: on a lake without the mirror its one call is server_info and it shows
"Deployments Are Not Set Up on This Lake" without listing repositories or asking any of them for
environments. A lake that does not send the flag gets the first repository asked alone, and the
others only once it answered something other than not_supported.

Tests: PlatformFixture.ServerInfoSaysWhetherDeploymentsAreSetUp, frontend/tests/deployments.test.ts.
Docs: docs/api/platform.md, docs/api/README.md, docs/ui/apps.md, docs/ui/README.md.
…signed (#602)

create_grant, create_membership and the administrator's accept_invitation stored whatever
attestation_digest the caller sent, so the grants and members pages showed evidence that proved
nothing. Each now writes and signs its own statement with lake's TAAP identity, as
share_drive_folder does since #585: lake.grant/1 (purpose grant) and lake.org_membership/1
(purpose org-membership). The digest is sha256 of {statement, signer, signature}; the answer and
the audit event carry the attestation. attestation_digest is optional, accepted only when it is
lake's digest for the same change, and anything else is invalid_input at /attestation_digest with
nothing written, so programs that repeat a call keep working.

The signing moves into src/api/lake_attestation.cpp (sign_lake_attestation,
check_supplied_digest), shared with share_drive_folder, whose digests are unchanged.

Test: Organizations.GrantsAndMembershipsKeepTheDigestOfAStatementLakeSigned; the tests that sent
made-up digests leave the field out. Docs: docs/api/policy.md, docs/api/organizations.md,
docs/api/sharing.md, docs/api/errors.md, docs/api/README.md, the Access and Organizations guides.
…ta (#601)

The in-app guides named the engine about seventy times ("the workspace Zetta", "an Orama Zetta
cluster of its own", "let Zetta choose"). They now say the workspace, its engine, or lake, and
use the page's own words where a page shows one (With Workspace Data, Attach workspace data, the
Workspace card on Streams). Zetta stays only where a person picks it by name, as a Service kind on
Ship -> Services: the Services guide and the glossary's Service entry, each saying once what it
is (Orama's data and AI engine, the one every workspace runs on). The Apps anchor for bindings
becomes #bindings-workspace-data-and-services.

Docs.GuidesNameZettaOnlyWhereAPersonChoosesIt refuses Zetta in guide prose outside an allow-list
of six lines, each with its reason, and fails when an allowed line disappears.
)

WorkspaceStoreSearch.ASearchNeverOpensAWorkspaceItsCallerCannotRead failed under load with one
extra request to gamma's Zetta. The fake now records each endpoint's requests, which showed the
extra one is GET lake_store:usage: the owner loop's quota read of every switched workspace's
usage (refresh_workspace_usage), run after start and every ten seconds whoever is calling. It
opens no store, takes no lease and carries no content, so it is not a refused search reaching
gamma. Under load the first read after the restart landed after the baseline.

The test now counts store_requests_to (every request except :usage reads) and prints what gamma
received when it fails. No server change: the refused searches never reached gamma.

Proof: ctest -j 6 --repeat until-fail:20 -R WorkspaceStoreSearch, every
ASearchNeverOpensAWorkspaceItsCallerCannotRead run passed (it failed 1 of 20 before).
…ds directly (#607)

The request log added for lake#607 grew by one line per request for the life of a test, which a
large pull or a long sync would carry in memory. It now keeps the last 512 requests per endpoint
for failure output, and store_requests_to subtracts a counter of :usage reads from the request
count instead of scanning the log.
…ld never puts its manifest back (#606)

WorkspaceStoreHandoff.IndexWorkTheDrainDropsIsRebuiltByTheSuccessor failed under load because a
150 ms delay on every store request stood for "the rebuild is still running": the commit made
during the rebuild waited for the lane behind the rebuild's repository reads, the rebuild finished
first, and the drain had no index work to drop, so it rightly left the complete manifest. The
fake Zetta now holds matching requests until the test lets them go (hold, let_go, held); the test
holds the rebuild's segment writes, which take no lane, so the rebuild is still building at the
drain under any load, and lets them go once the successor holds the lease.

Holding them exposed a real defect. A rebuild stops only between repositories, so its index
writes can be in flight at the drain. The drain removed the manifest, released the lease, and the
rebuild then put its manifest back. A successor's newer fence refuses those writes, but without
one (a plain stop) the next process loaded an index that lacked the commit made during the
rebuild and never found it. Each open workspace store now has an IndexWriteGate: the drain's
invalidation and every close of the store close it, a replacing put (manifest, artifact members)
or a remove holds it shared across its request, and a write-once put checks it, so a manifest put
lands before the removal or is refused after it.

Tests: WorkspaceStoreHandoff.AnIndexWriteInFlightAtTheDrainNeverPutsTheManifestBack (fails without
the gate: the manifest returns and the next process never finds the commit) and the reworked
IndexWorkTheDrainDropsIsRebuiltByTheSuccessor. Docs: docs/architecture/workspace-store.md,
tests/README.md.
…nswered (#603)

RegistryStore.PullsCountAgainstTheLaneForTheirWholeStreamAndOtherWorkspacesAnswer slept 300 ms
after starting a 2 MiB put and took that to mean the put held alpha's lane while forty HEAD pulls
arrived. Under load the put's upload, or the forty connections, take longer than that, so pulls
could run before the put reached the store or after it finished, and fewer than 32 were refused.
The lane's admission order was not at fault.

The put's store write is now held in the fake Zetta (hold) until at least 32 pulls have been
refused, which is the lane's rule: at most its admissions wait behind the put. Another workspace
is read while the put is held and must answer within 3 s, then the put is let go and answers
201. The test runs in about 1 s instead of 2.5 s. Docs: docs/api/registry.md.
… process (#614)

WorkspaceStoreHandoff.AFreshProcessCreatesOneLocalIdentityForItsConcurrentFirstOpens
read the repositories_preopened events from stderr after stop(). The
pre-open opens the repositories in the background beside the test's read
and commit, and nothing ordered it before the stop. Under load the stop
came first and drained it, so it logged nothing or 0 and the test read 0.

The test now waits (up to 30 s) for the event of both workspaces before
it stops the server, then checks that each counted 1. StderrLines gains
text(), a snapshot while capturing goes on. Docs:
docs/deployment/store-volume.md and tests/README.md.
…ident set (#616)

RegistryStore.ALargeLayerIsStreamedNeverHeldWhole sampled the resident
set on macOS. That counts pages malloc freed and kept for reuse, so the
growth during a 304 MiB pull depended on the allocator and timing: with
six pulls at once it grew by 29 to 136 MiB, and once by 142 MiB under
ctest -j 6, while the bytes in live allocations grew by 6 to 10 MiB.
Lake's pull path holds one 1 MiB send buffer and its window reads; it
was not buffering the layer.

On macOS the test now reads the bytes in use in every malloc zone
(malloc_zone_statistics). glibc keeps the resident set after
malloc_trim. After the pull the test holds 64 MiB and checks that the
measure rises by at least 48 MiB, so it cannot pass by seeing nothing.
Docs: docs/api/registry.md and docs/design/status.md (also lake#614).
…fields (#615, #596)

The workspace engine now answers each search hit as {id, score, fields} (zetta#1243).

- `search_index` takes an optional `fields` array and passes it to the engine's `search`: absent
  means every field the index holds, [] ids and scores only, and an unknown field is refused by
  the engine with the index's fields listed. Its description and output schema say what a hit
  holds; the "no row fields yet" caveat is gone.
- Ship → Search Index shows each hit's fields in the index's order (`hitFields` in
  `ship/search.ts`), falling back to the row id for an engine that sends none. The JavaScript and
  Python snippets say what a hit carries.
- Docs: the Ship guide's `search_index` table and answer, the workspaces API row, the UI page.
…t pipeline to its dataset (#615)

The gate (zetta#1240):
- The engine lists only the checks that applied and counts the rest (`applied`,
  `not_applicable`). The pipeline page's gate panel now says "N checks did not apply to this
  pipeline" under the table, and **List them for an audit** asks the gate again with
  `include_not_applicable: true`; a check that did not apply shows as "did not apply" in a neutral
  tone, never as a pass (`gateCounts`, `checkTone`, `notApplicableLine`).

Building a pipeline (zetta#1246):
- `compile_pipeline` passes the chosen dataset's `source` and `table`, and the new optional
  `label_column` and `entity_column` inputs (the label falls back to a design's model `target`),
  to the engine's `compile_intent` as `hints`, so the steps are named from the data.
- `point_pipeline` leaves a connect step the engine already pointed at the dataset as the engine
  named it, and still points and renames one from an older engine.
- Build a Pipeline offers the chosen dataset's columns as **Predicts** and **Each row is about**
  (`datasetColumns`), and its toast says the steps are named from the dataset.
- Docs: the Design guide's Build a Pipeline and Check sections.
…ts (#615)

A GBDT classifier run with a held-out split now logs a confusion matrix, an ROC curve and
calibration, each named `held_out` (zetta#1247).

- `get_run_metrics`' description promises them again, and says when none are logged (a regressor,
  or a run without a held-out split).
- The run and compare pages head each chart by its kind and source ("ROC Curve · held-out rows"),
  draw the ROC curve against the chance diagonal on a false-positive-rate axis and calibration
  against the perfectly calibrated diagonal on a mean-predicted-probability axis (the x axis used
  to read "Step"), and name the table columns (`artifactChart`, `artifactTitle`,
  `artifactSource`).
- Docs: the experiments API, guide and UI pages, and the status row for lake#615.
…d from each workspace (#564)

Decision 56 (lake#617): billing records are multitenancy in lake's control Postgres; usage stays in
each workspace Zetta. Migration 0073_billing (guard billing_guard) adds billing_plans,
billing_plan_prices, billing_subscriptions, billing_invoices (at most one a customer and month that
is not void) and billing_invoice_lines, numbers only.

Ten capabilities, audited in the central log: billing_plans and set_billing_plan (the price list, a
price per usage dimension beyond what a plan includes), billing_account and choose_billing_plan (a
plan from this month, or a change from next month), bill_preview (the month's bill from
usage_over_time, called as the caller, storage averaged by day), issue_invoice (a month that has
ended, lines frozen, refused while any workspace's usage cannot be read), list_invoices,
get_invoice, record_invoice_payment and void_invoice.

Payment goes through the PaymentProvider interface; only the manual (invoice only) provider exists
and no provider is chosen (lake#620). LAKE_BILLING=on registers billing; off, as on an enterprise
install, every billing capability, viewer.billing and the Billing guide are absent, and usage is
unchanged. Monthly invoices are issued by hand for now (lake#621).

Tests: Billing.*, BillLines.*, PostgresBilling.*, the schema conformance, audit routing, examples
and docs status suites with billing registered. Docs: docs/api/billing.md, docs/guide/billing.md,
the schema, status and deployment pages.
…re the lake bills (#564)

Organization → Billing (/billing) shows the account's plan, this month's bill so far, a card per
plan with a confirmed choice (start now, change next month, or stay), the invoices and what is not
measured; the operator opens an account with ?customer_id= and issues an invoice for a month that
has ended. /billing/invoices/:invoiceId is one invoice, printable, with How to Pay; the operator
records a payment or voids it. Administration → Billing (/billing/plans) is the price list and its
plan editor.

Every billing screen and rail item is marked billing and shown only when viewer.billing is true;
an enterprise install has no Billing item, and /billing answers Not Available. Pure rules in
pages/billing/billing.ts, tested by tests/billing.test.ts. Docs: docs/ui/billing.md and the indexes.
…t (lake#604)

WorkspaceStoreBackend.ACrashAnywhereKeepsAPrefixOfTheIssueOrderPastTheLastBarrier crashed under
load at 0x5ffffffffff8: corosio's io_context executor read 8 bytes before a continuation that
capy's range when_all posted, and the read fell off the start of a page. The fix is in corosio
(oramasearch/corosio#13), pinned by liquid 88c5ef4, which also carries liquid#350's offload wake
fix. Lake builds against liquid-bridge's liquid pin, which is now 88c5ef4.
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