Skip to content

[Refactor]: compose stable store with auth and admin without migrating security data #336

Closed

Description

@jimhoyd

Goal

After the store extension has a stable first release, evaluate using its collection contract as the standard way auth-backed applications expose ordinary domain records and optional admin management. This is a composition refactor, not a migration of auth or admin persistence into the JSON file store.

Why

The new store owns bounded application CRUD. Auth already owns a security-critical Node/SQLite service: credentials, passkeys, MFA/recovery state, opaque sessions, revocation, role assignments, encryption, transactional audit data, backup/restore and strict database handling. Admin intentionally consumes that auth service. Replacing those records with the current store would weaken existing guarantees.

Desired end state

  • Auth can provide an opaque, validated principal to an explicitly configured store ownership policy; store never reads auth cookies, sessions or tables directly. See [Request]: Per-record ownership for the store extension and CRUD screen #331.
  • A project can compose auth plus store for user-owned application records, while shared/public collections remain possible.
  • Admin may opt into managing declared store collections only through explicit roles, audit events and ownership-aware queries; it does not become a second store backend.
  • UI CRUD remains optional and replaceable. Store remains usable without UI/auth, and backend/storage selection stays in reviewed operator code rather than YAML.

Preconditions

  1. Store has a first npm release and its collection/API contract is stable.
  2. The generic identity/ownership contract in [Request]: Per-record ownership for the store extension and CRUD screen #331 is designed and implemented.
  3. Store has an explicit schema-evolution/migration policy and an operator-host backend seam before any non-file backend is introduced.
  4. Filtering, sorting and cursor semantics are bounded and declared, not an arbitrary query language ([Request]: Richer data-bound CRUD screens: per-field labels, columns, filtering and sorting #330).

Non-goals

  • Do not move accounts, credentials, sessions, MFA/recovery data, roles, auth audit trails or admin service state from auth SQLite into store.
  • Do not couple store to auth internals or add provider/database configuration to route YAML.
  • Do not claim multi-user CRUD safety before ownership enforcement and cross-user denial tests exist.

Acceptance evidence

A composed auth/store fixture proves one user cannot list, read, change or delete another user's owned record; an authorized admin operation is audited; shared collections retain their declared behavior; and a custom UI can replace the CRUD screen without changing the collection contract.

Activity

  1. added
    extension
    on Sep 20, 2026
  2. jimhoyd commented on Sep 20, 2026

    @jimhoyd
    CollaboratorAuthor

    Alignment note from the merged-main audit: the current UI CRUD screen directly reads extensions.store.config.collections at activation and calls the store mount from its browser script. That is acceptable for the first slice because fields have one declaration, but it is also the seam to preserve when adding a non-file backend or broader data sources.

    Recommendation: keep store as the stable collection declaration/API adapter that UI consumes; put backend selection in reviewed host code behind that adapter. Do not let UI screens grow arbitrary URL/driver configuration in YAML. A future generic collection-provider contract can be considered only if a second real provider needs it, with the current store adapter remaining compatible. This keeps custom UI replaceable and avoids turning the UI config into an unreviewed data-access layer.

  3. added
    important
    on Sep 20, 2026
  4. jimhoyd commented on Sep 22, 2026

    @jimhoyd
    CollaboratorAuthor

    Precondition check (no code changes, no PR — not all four are met):

    1. Store first npm release, stable contract — MET. @jimhoyd/urlcode-store is at 0.5.0 on npm; docs/STORE.md documents a complete, stable HTTP contract.

    2. Generic identity/ownership contract from #331 — NOT MET. #331's own closing comment says "Decision: not built" — the request reaching a mounted extension carries no user identity today, and docs/STORE.md explicitly warns there is no per-user ownership model and that auth: true on a route is not record-level access control. This is #336's own stated dependency, and it was decided against, not merely deferred.

    3. Schema-evolution/migration policy + operator-host backend seam — NOT MET. No migration/schema-evolution policy exists anywhere in the repo or in docs/OPEN-DECISIONS.md. docs/STORE.md's "Not built yet" list names a SQLite backend as unbuilt, and storage is a single-writer, one-JSON-file-per-collection design with no backend abstraction point.

    4. Bounded/declared filtering, sorting, cursor semantics (#330) — MET on the store side. PR #357 shipped declared sortable/filterable fields, bounded filters, opaque keyset cursors, and 400s for undeclared queries. (The screen-side UI controls were reverted for size budget and remain a separate open decision, but that's not this precondition.)

    Net: 2 of 4 preconditions hold; the identity/ownership contract this issue explicitly depends on was decided against, and there's no migration policy or backend seam. This issue should stay open/blocked until #331's decision is revisited or a narrower scope is proposed that doesn't require per-record ownership.

  5. jimhoyd commented on Sep 22, 2026

    @jimhoyd
    CollaboratorAuthor

    Checked the four preconditions against current state:

    The #331 gap is disqualifying on its own: this issue is specifically about auth-backed apps exposing domain records through store, which almost always implies per-user data isolation. Without ownership, composing store with auth doesn't give you that — every logged-in user would see every other user's records through the same mount.

    Closing this as blocked on #331. Re-open once #331 has a real design (and worth re-checking the schema-evolution/backend-seam precondition at the same time, since it's the secondary gap here) — until then there's nothing to design in this issue that isn't premature.

  6. jimhoyd commented on Sep 22, 2026

    @jimhoyd
    CollaboratorAuthor

    Closing per the analysis above — blocked on #331, nothing further to design here until that lands.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    extensionimportant

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions