Skip to content

feat(ssr): tenant collapse + loader silent-skip fix (plan 078 phases 4-5) - #1227

Open
efizzybot wants to merge 2 commits into
mainfrom
feat/ssr-tenant-collapse
Open

efizzybot wants to merge 2 commits into
mainfrom
feat/ssr-tenant-collapse

Conversation

@efizzybot

Copy link
Copy Markdown
Collaborator

Summary

Closes out plan 078 (phases 4–5). The tenant capability gate collapses to pin presence + policy, and the loader's one silent-degrade path is deleted.

  • Tenant collapse (host/src/services/tenant-runtime.ts): ssrAllowed = hasSsrPin(effectiveConfig.ui) && binding.allowSsr. allowSsr is pure policy — capability travels with the artifact. The three-field strip keeps its job as pin-removal-as-policy, unchanged. No schema change; allowSsr stays on the binding (the bindings endpoint is still unbuilt, Host 500s every request on non-base domains when GET /api/tenants/bindings 404s — no fallback, and no runtime ships the route #665 — its contract note lands in book 11 §7: bindings carry permissions and status, never capability).
  • hasSsrPin = (ssrEntryUrl || ssrUrl) && ssrIntegrity — pin = URL + digest. The design floated deleting the integrity clause ("pins carry integrity by construction"); the survey refuted the naive deletion: the version-manifest plane pairs the fields by construction (version-manifest.ts emits ssr: { entry, integrity } only with both; resolution stamps them together) and the tenant draft flow enforces the pair — but a hand-authored config can carry an ssr URL with no digest: the authored schema (types.ts PluginUiConfigSchema) declares ssr/ssrIntegrity independently and resolution maps them independently (resolution/runtime.ts: ssrUrl: uiIsRemote ? uiConfig.ssr : undefined, ssrIntegrity: uiIsRemote ? uiConfig.ssrIntegrity : undefined). Deleting the clause would have let a policy-allowed tenant SSR from never-verified bytes. The verdict is pinned in the plan doc and ADR 0061.
  • Loader silent-skip fix (loadRouterModule): a remote source whose SSR entry lacks an integrity digest is refused by name (FederationError → the caller's documented fallback shape) instead of silently skipping verification; a digest present → verification always runs (unchanged). Dev loopback containers stay exempt — the local entry carries no digest by construction, and that path is pinned by a new test. The old useCache integrity term is dead after the refusal and removed.
  • Records: new ADR 0061 — SSR is a composition pin (the four-plane collapse, allowSsr = policy, the dev-default flip with the measured +0.59s / <1s tolerance, the loader clause deleted); book 06 gains an "SSR in dev" section, book 11 §7 and book 12 updated to pin+policy semantics; plan 078 + plans README rows marked DONE (phase 0 via docs(plans): 078 phase 0 — SSR dev rebuild measurements #1204; 1 via feat(ssr): pin-presence gate behind isSsrAvailable — behavior-neutral (plan 078 phase 1) #1211; 2 via feat(dev): supervisor-owned SSR intent — always-emit for ui-local dev (plan 078 phase 2) #1221; 3 via feat(dev): SSR by default for ui-local dev — the flip (plan 078 phase 3, #472) #1226; 4–5 via this PR).

Evidence

  • pnpm --filter host test — 62 files, 410/410 green (tenant matrix re-pinned: policy-allowed + pin → SSR; policy-denied → CSR, strip unchanged; pin absent → CSR regardless of policy; ssrUrl-without-digest → CSR even when policy allows — the crux; new ssrEntryUrl-arm pin test; loader refusal test asserts no load + no verification; dev local-container path pinned)
  • BOS_NO_BANNER=1 pnpm run bos typecheck — 15/15
  • pnpm run lint — green (comment budget holds)
  • pnpm run docs:check — green (73 files)

Merge danger

  • feat(dev): SSR by default for ui-local dev — the flip (plan 078 phase 3, #472) #1226 (phase 3) touches host/src/services/federation/loader.ts — a different function (requireSsrEntryUrl's error message vs this PR's loadRouterModule); rebase on origin/main before merging if it lands first. No other overlap (its docs are skills/AGENTS/README; this PR's docs are book/plans/ADR).
  • Behavior change, by design: a production stack whose SSR entry lacks a digest now renders CSR (tenant, via the strip) or fails loud at the loader (base) instead of silently loading unverified bytes. The deploy train always pairs ssr+ssrIntegrity, so only hand-authored configs can hit the refusal — those were rendering unverifiable bytes before.
  • The plans README row records phase 3 as feat(dev): SSR by default for ui-local dev — the flip (plan 078 phase 3, #472) #1226; if that PR is abandoned, the row needs a one-line correction.

This branch has not been deployed

No deployments
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.

2 participants