Skip to content

Retire the UI primitive fallback; settle the provider execution model - #220

Merged
jimhoyd merged 3 commits into
mainfrom
claude/open-spikes-next-steps-b46475
Sep 20, 2026
Merged

jimhoyd merged 3 commits into
mainfrom
claude/open-spikes-next-steps-b46475

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Summary

Two independent changes that came out of a review of open spikes and next steps.

1. The UI primitive fallback is retired

Auth and admin each had two render paths: through the urlcode-ui kit when the host supplied and activated the ui extension, and through shared primitives otherwise. Every screen's HTTP suite ran twice. The kit path is now the only path.

@jimhoyd/urlcode-ui was already a required peer dependency of both packages, so this changes nothing about what must be installed — what changes is that the ui extension must now be supplied and active, where before it was optional configuration.

Both packages refuse at activation, naming what is missing and how to fix it, rather than failing per request.

A correction this forced: the runtime activates extensions in urlcode.yaml declaration order, not host-array order (src/extensions.ts iterates Object.entries(declarations)). The previous README advice that declaring ui first in the host file was sufficient only held while the kit was read lazily per request. ui must now be declared first, and the error messages and docs say so.

Removed as dead: packages/admin/src/admin-presentation.ts, auth's pageResponse, presentationSource, the on-demand template compile caches, activeKit(), RenderPath, and screenObserver's path argument. Admin's hand-built sidebar (plus its CSS-hidden mobile duplicate) collapsed onto the kit's shell, with per-item icons carried as NavigationItem.icon.

Scaffolding follows, or every generated project would throw at boot. ui's scaffold reads the composed names and emits createUiExtension({..., sources: [authCatalogue], extensions: [authUiTemplates, adminUiTemplates]}), wiring only the peers actually present. Auth's and admin's scaffolds refuse when ui is absent or ordered after them, before anything is written. The standalone initAuthentication / initAdministration paths compose the kit themselves. No change to core's scaffold contract was needed — ScaffoldRequest.names already carried the composed set in --with order.

Two defects surfaced on the way, both pre-existing:

  • Admin wrapped its kit layout with kit.resolveContext(preferences) while rendering the body with the console's presentation, producing lang="en" around translated copy.
  • initAuthentication's writer never created parent directories, so nested scaffold files (the kit's ui/copy/, ui/templates/) failed with ENOENT.

Security posture is unchanged: strict CSP, nonce binding, no-store, immutable hashed assets and escaping of user-controlled values are exactly as strict as before, now asserted on one path instead of two.

2. The provider execution model is decided

Projects that use function or middleware deploy as one trusted Node process (container or VM). Per-route Lambda compilation is declined, on the three grounds its own proposal states: it would replace the sandbox guarantee rather than preserve it (losing the fresh-per-invocation state that sandbox: true guarantees since #127), it would make this project the author of generated IAM roles, and it would trade an honest refusal for a larger claim nobody has deployed.

AWS and Vercel continue to refuse function/middleware at activation. That refusal is now a settled position, not a gap awaiting an adapter, and docs/AWS.md and docs/VERCEL.md say so while keeping their existing deployment: 'unverified' caveats verbatim.

SPIKE-LAMBDA-COMPILE.md gained a plain-language layer and is archived as the analysis behind the decision, with all inbound links repointed. The roadmap's stale middleware-package references are corrected: that package was withdrawn and its repository deleted, not migrated, so there is nothing to move into core and nothing to fold in afterward.

Verification

npm run verify and npm run check both exit 0.

Suite Result
core 518 passing
ui 57 passing
auth 191 passing
admin 62 passing
workspace integration 1 passing

Test counts dropped where the primitive half of the two-path matrix was removed (auth 207 → 191, admin 68 → 62); no assertion was weakened. New negative tests cover both refusals — missing ui, and ui ordered last — in all three packages and the root integration test, each asserting nothing is left on disk. Composed-output assertions build their expectation from ui's own scaffold rather than copying its YAML block, so drift in either package is caught.

Breaking changes

Changesets included for @jimhoyd/urlcode-auth, @jimhoyd/urlcode-admin and @jimhoyd/urlcode-ui.

Not done

A themed browser walkthrough of the account pages is owed a re-run — the existing evidence predates the single render path, and packages/auth/ACCEPTANCE.md records that. Broader accessibility and WCAG 2.2 AA assessment remain manual and open, as before.

🤖 Generated with Claude Code

jimhoyd and others added 2 commits September 19, 2026 22:25
Auth and admin each had two render paths: through the urlcode-ui kit when the
host supplied and activated the `ui` extension, and through shared primitives
otherwise. Every screen was tested twice. The kit path is now the only path.

`@jimhoyd/urlcode-ui` was already a required peer of both packages, so nothing
new needs installing; what changes is that the extension must be supplied and
active. Both refuse at activation, naming what is missing, rather than failing
per request. Activation order follows `urlcode.yaml` declaration order, not the
host array, so `ui` must be declared first -- the errors and docs say so.

Scaffolding follows: ui's scaffold reads the composed `names` and registers each
peer's copy and templates with the kit, auth's and admin's refuse when `ui` is
absent or ordered after them, and the standalone `init` paths compose the kit
themselves. Without this, every generated project would have thrown at boot.

Two defects surfaced on the way: admin wrapped its kit layout with a different
presentation context than it rendered with (`lang="en"` around translated copy),
and `initAuthentication` never created parent directories for nested scaffold
files.

Separately, the provider execution model is decided: projects using `function`
or `middleware` deploy as one trusted Node process. Per-route Lambda compilation
is declined, and the AWS/Vercel refusal is now a settled position rather than a
gap awaiting an adapter. Its spike is archived as the analysis behind that
decision, and the roadmap's stale middleware-package references are corrected --
that package was withdrawn, not migrated.

Co-Authored-By: Claude Opus 5 <[email protected]>
Resolves two doc conflicts and one interaction with work that landed while this
branch was open.

- docs/OPEN-DECISIONS.md: main added the extension-schema retrieval question;
  this branch removed the provider execution model row by deciding it. Both.
- docs/README.md: main archived the monorepo spike, this branch archived the
  Lambda spike as declined. Neither is an open proposal any more.
- ROADMAP.md: the monorepo migration is complete on main -- all three packages
  released from here and the source repositories gone -- so the preamble no
  longer claims that tail is open, and its link follows the plan to the archive.
- packages/auth/test/lifecycle-hooks.test.ts: a call site main added predates
  `ui` being required, so it now activates the kit like its siblings.

Co-Authored-By: Claude Opus 5 <[email protected]>
Ports the documentation and CLI changes from #219, which is closed as superseded
by this branch. Auth and admin render only through the kit and the runtime
activates extensions in declaration order, so every documented invocation now
names ui first.

Two files #219 did not reach were stale the same way: DEVELOPMENT-PIPELINE.md
and CI-FOLLOWUP-2026-09-19.md both wrote `--with auth,admin,ui`, which is the
one order the scaffolds now refuse.

The admin README keeps this branch's wording rather than #219's: that PR
documented the host entry as `adminExtension({..., ui, authMount: '/account'})`,
while the code here emits `authMount` first.

Co-Authored-By: Claude Opus 5 <[email protected]>
@jimhoyd
jimhoyd merged commit d9d627f into main Sep 20, 2026
20 checks passed
@jimhoyd
jimhoyd deleted the claude/open-spikes-next-steps-b46475 branch September 20, 2026 03:49
jimhoyd added a commit that referenced this pull request Sep 20, 2026
…217)

first: the wiring half is already done. #220 (d9d627f) made the ui scaffold
register authCatalogue/authUiTemplates/adminUiTemplates and pass the kit into
authExtension/adminExtension, so all three "observed source evidence" bullets
in the issue are stale. It also retired the UI primitive fallback, which means
the issue's "preserve standalone auth/admin without ui" requirement no longer
describes a supported configuration: those combinations now refuse at scaffold
time. Nothing here re-opens that decision.

What was missing was the demonstration and the documentation.

Generated-consumer regression (test/workspace-scaffold.integration.ts):
runs `init site --with ui,auth,admin` against the built packages, writes
ui/templates/auth/sign-in.html, ui/templates/admin/dashboard.html and
ui/copy/en.json into the generated site, bootstraps an administrator through
the generated operator module, creates a runtime from the extension array the
generated host.mjs exports, and asserts both the template and the copy
override appear on a rendered /account/login and a rendered /admin. Verified
to fail — not just compile — by removing adminUiTemplates from the ui
scaffold: the composition assertion fails and the render test fails at
activation. It skips, with the reason printed, when the host SQLite is not the
one auth's store requires. The same test now also pins ui-alone to
`sources: [], extensions: []` with no peer import.

A throwing onSignUp is covered in packages/auth/test/lifecycle-hooks.test.ts,
so the documented "post-action hooks cannot undo anything, keep them
non-throwing" rule is a tested property.

docs/COMPOSING-A-SITE.md is the new root document, linked from
docs/AI-AUTHORING.md's reading order, llms.txt and llms-full.txt. It separates
declarative config, project functions used for lifecycle hooks, and the
TypeScript a new extension needs; tabulates each supported --with combination
and each refusal; and gives per-package hook input, verdict, timing and
failure semantics read from the implementation (get_extensions exposes the
schemas but not these).

It also records a gap found while writing it and confirmed by running the CLI:
`urlcode-ui` builds its kit without the auth and admin namespaces, so `list`
omits auth/* and admin/*, `eject auth/sign-in` is refused, `copy --missing`
skeletons cover kit ids only, and `doctor` reports a project override of an
extension template with no `expected` view model, so its `behind` flag cannot
detect a stale extension override. The runtime path is unaffected.

Not established: no HTTP listener, TLS proxy, browser or deployed site was
exercised, and no published npm tarball was compared against this checkout.
packages/ui/README.md's claim that auth/admin have not adopted the kit is left
to #200.

Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd added a commit that referenced this pull request Sep 20, 2026
#220 merged and retired the UI primitive fallback, but the decisions table
still described the code as retaining "tested primitive rendering without it"
and recommended keeping both pending a decision. Verified against main:
packages/auth/src/auth.ts:71 now refuses activation without ui and says
outright there is no shared-primitive fallback, so the row was wrong about the
current code and contradicted the composition path this branch documents.

Moved to the closed-questions list rather than deleted, so the resolution stays
on the record.

Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd added a commit that referenced this pull request Sep 20, 2026
…217)

first: the wiring half is already done. #220 (d9d627f) made the ui scaffold
register authCatalogue/authUiTemplates/adminUiTemplates and pass the kit into
authExtension/adminExtension, so all three "observed source evidence" bullets
in the issue are stale. It also retired the UI primitive fallback, which means
the issue's "preserve standalone auth/admin without ui" requirement no longer
describes a supported configuration: those combinations now refuse at scaffold
time. Nothing here re-opens that decision.

What was missing was the demonstration and the documentation.

Generated-consumer regression (test/workspace-scaffold.integration.ts):
runs `init site --with ui,auth,admin` against the built packages, writes
ui/templates/auth/sign-in.html, ui/templates/admin/dashboard.html and
ui/copy/en.json into the generated site, bootstraps an administrator through
the generated operator module, creates a runtime from the extension array the
generated host.mjs exports, and asserts both the template and the copy
override appear on a rendered /account/login and a rendered /admin. Verified
to fail — not just compile — by removing adminUiTemplates from the ui
scaffold: the composition assertion fails and the render test fails at
activation. It skips, with the reason printed, when the host SQLite is not the
one auth's store requires. The same test now also pins ui-alone to
`sources: [], extensions: []` with no peer import.

A throwing onSignUp is covered in packages/auth/test/lifecycle-hooks.test.ts,
so the documented "post-action hooks cannot undo anything, keep them
non-throwing" rule is a tested property.

docs/COMPOSING-A-SITE.md is the new root document, linked from
docs/AI-AUTHORING.md's reading order, llms.txt and llms-full.txt. It separates
declarative config, project functions used for lifecycle hooks, and the
TypeScript a new extension needs; tabulates each supported --with combination
and each refusal; and gives per-package hook input, verdict, timing and
failure semantics read from the implementation (get_extensions exposes the
schemas but not these).

It also records a gap found while writing it and confirmed by running the CLI:
`urlcode-ui` builds its kit without the auth and admin namespaces, so `list`
omits auth/* and admin/*, `eject auth/sign-in` is refused, `copy --missing`
skeletons cover kit ids only, and `doctor` reports a project override of an
extension template with no `expected` view model, so its `behind` flag cannot
detect a stale extension override. The runtime path is unaffected.

Not established: no HTTP listener, TLS proxy, browser or deployed site was
exercised, and no published npm tarball was compared against this checkout.
packages/ui/README.md's claim that auth/admin have not adopted the kit is left
to #200.

Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd added a commit that referenced this pull request Sep 20, 2026
#220 merged and retired the UI primitive fallback, but the decisions table
still described the code as retaining "tested primitive rendering without it"
and recommended keeping both pending a decision. Verified against main:
packages/auth/src/auth.ts:71 now refuses activation without ui and says
outright there is no shared-primitive fallback, so the row was wrong about the
current code and contradicted the composition path this branch documents.

Moved to the closed-questions list rather than deleted, so the resolution stays
on the record.

Co-Authored-By: Claude Opus 5 <[email protected]>
jimhoyd added a commit that referenced this pull request Sep 20, 2026
…217) (#226)

* Demonstrate the composed ui/auth/admin override path and document it (#217)

first: the wiring half is already done. #220 (d9d627f) made the ui scaffold
register authCatalogue/authUiTemplates/adminUiTemplates and pass the kit into
authExtension/adminExtension, so all three "observed source evidence" bullets
in the issue are stale. It also retired the UI primitive fallback, which means
the issue's "preserve standalone auth/admin without ui" requirement no longer
describes a supported configuration: those combinations now refuse at scaffold
time. Nothing here re-opens that decision.

What was missing was the demonstration and the documentation.

Generated-consumer regression (test/workspace-scaffold.integration.ts):
runs `init site --with ui,auth,admin` against the built packages, writes
ui/templates/auth/sign-in.html, ui/templates/admin/dashboard.html and
ui/copy/en.json into the generated site, bootstraps an administrator through
the generated operator module, creates a runtime from the extension array the
generated host.mjs exports, and asserts both the template and the copy
override appear on a rendered /account/login and a rendered /admin. Verified
to fail — not just compile — by removing adminUiTemplates from the ui
scaffold: the composition assertion fails and the render test fails at
activation. It skips, with the reason printed, when the host SQLite is not the
one auth's store requires. The same test now also pins ui-alone to
`sources: [], extensions: []` with no peer import.

A throwing onSignUp is covered in packages/auth/test/lifecycle-hooks.test.ts,
so the documented "post-action hooks cannot undo anything, keep them
non-throwing" rule is a tested property.

docs/COMPOSING-A-SITE.md is the new root document, linked from
docs/AI-AUTHORING.md's reading order, llms.txt and llms-full.txt. It separates
declarative config, project functions used for lifecycle hooks, and the
TypeScript a new extension needs; tabulates each supported --with combination
and each refusal; and gives per-package hook input, verdict, timing and
failure semantics read from the implementation (get_extensions exposes the
schemas but not these).

It also records a gap found while writing it and confirmed by running the CLI:
`urlcode-ui` builds its kit without the auth and admin namespaces, so `list`
omits auth/* and admin/*, `eject auth/sign-in` is refused, `copy --missing`
skeletons cover kit ids only, and `doctor` reports a project override of an
extension template with no `expected` view model, so its `behind` flag cannot
detect a stale extension override. The runtime path is unaffected.

Not established: no HTTP listener, TLS proxy, browser or deployed site was
exercised, and no published npm tarball was compared against this checkout.
packages/ui/README.md's claim that auth/admin have not adopted the kit is left
to #200.

Co-Authored-By: Claude Opus 5 <[email protected]>

* Retire the superseded UI-fallback row in OPEN-DECISIONS

#220 merged and retired the UI primitive fallback, but the decisions table
still described the code as retaining "tested primitive rendering without it"
and recommended keeping both pending a decision. Verified against main:
packages/auth/src/auth.ts:71 now refuses activation without ui and says
outright there is no shared-primitive fallback, so the row was wrong about the
current code and contradicted the composition path this branch documents.

Moved to the closed-questions list rather than deleted, so the resolution stays
on the record.

Co-Authored-By: Claude Opus 5 <[email protected]>

* Load the companion packages through a computed specifier

CI's `static` job runs typecheck after `npm ci` but without a workspace build,
so `@jimhoyd/urlcode-auth` and `@jimhoyd/urlcode-admin` have no type
declarations there and the two literal dynamic-import specifiers failed with
TS2307. It passed locally only because this worktree had the packages built.

The specifier is now computed, which TypeScript does not resolve. Verified the
mechanism rather than assuming it: a literal `import('@not/installed-anywhere')`
reports TS2307 under the same compiler settings and the computed form reports
nothing. Runtime resolution is unchanged and verify:workspaces still passes.

Co-Authored-By: Claude Opus 5 <[email protected]>

* Release the SQLite WAL before removing the generated site

The new override test failed on Windows with EBUSY unlinking
site/data/auth.sqlite-wal, then hung until the job was cancelled at ten
minutes.

Cause: node:test runs after-hooks in registration order, and the project()
helper registers its own directory removal first. The auth store's closes are
registered later in the test body, so the directory was removed while SQLite
still held the WAL open. POSIX unlinks an open file without complaint, which is
why this passed everywhere except Windows.

This test now takes its own mkdtemp and registers the removal last, after the
host and runtime closes. The first test in the file keeps project(): it opens
no store, so the helper's ordering is fine there.

Not established: I could not reproduce the EBUSY locally, having no Windows
host. The ordering defect it reports is real and reproducible by inspection --
the removal genuinely ran first -- but only the Windows CI leg can confirm the
fix.

Co-Authored-By: Claude Opus 5 <[email protected]>

* Describe the CLI's extension namespaces instead of the closed gap

#229 gave `urlcode-ui` an `--extensions` option: it resolves the named
packages from `--project` and loads the namespaces they ship, so `list`,
`eject`, `preview`, `doctor` and `copy --missing` cover `auth/*` and `admin/*`
as the host that registers them does.

This page still described the gap as current, and its example commands omitted
the flag, so a reader following them would reproduce the old behaviour and
conclude the tooling was broken. The section now describes what the CLI does,
including the `extensions` field in the `doctor` report and why admin-owned
`adminUi.*` ids are deliberately absent from `copy --missing` (#227).

Co-Authored-By: Claude Opus 5 <[email protected]>

---------

Co-authored-by: Claude Opus 5 <[email protected]>
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