Skip to content

test(proofs): native-storage proof, the owner's own database behind auth: true (#1052 S7) - #1060

Merged
jimhoyd merged 1 commit into
mainfrom
claude/native-storage-proof-1052
Sep 30, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/native-storage-proof-1052

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 30, 2026

Copy link
Copy Markdown
Collaborator

Part of #1052 (slice S7, the owner-choice acceptance proof).

What

proofs/native-storage is a small notes application that:

  • stores its data with Node's built-in node:sqlite, called directly from trusted function routes (app/functions/notes.mjs: DatabaseSync, prepared statements, an explicit transaction). No URLCode store, adapter or descriptor is involved.
  • signs users in with auth: true through the independent Auth.js provider (proofs/authjs-provider), exactly as the Auth.js proof does. The function reads context.capabilities.authjs.identity.userId.
  • installs neither the store nor the audit extension. host.mjs composes only authjs.
  • keeps its data outside the project: the routes bind env: {DATA_DIR: {env: URLCODE_DATA_DIR}}. That is an operator grant for serving (proposed by urlcode permissions) and a fresh temporary directory for every urlcode test/audit run. The operator's Auth.js secret and accounts go in data/, or in NATIVE_STORAGE_DATA.

The README explains the split: URLCode supplies routing, validation, the auth: true gate, review and tests. The owner chooses the storage library, and none of the store's guarantees carry over.

Test: npm run test:proof:native

test/native-storage.integration.ts is in verify:workspaces, the packed-integration CI job, ci-plan high-impact paths and docs/CI.md. It packs core as a release does and the provider as a tarball, installs them into a copy of the site, and checks:

  • validate --local, explain (extensions.authjs, the identity capability, trusted execution) and review (functions/notes.mjs hashed, no packages, no observations);
  • without URLCODE_DATA_DIR, validate refuses before serving (Missing required environment binding);
  • urlcode test passes twice. The first signed-in step expects zero notes, so the second run passes only on a fresh database. A restart step shows the file survives a restart;
  • urlcode audit --expect-routes 3 is ready;
  • the hermetic runs wrote no database into the site or the operator directory;
  • store vocabulary is refused, not emulated. With extensions.store and an extension: store mount added, validate, test and serve all refuse. Both the declaration and the mount are named (Not registered by the host file: store);
  • when served, owners see only their own notes (another owner's note is 404), five concurrent creates all commit, cross-origin POST is 403, and the database is an ordinary SQLite file in the granted directory, which the test reads back with node:sqlite.

Dependency cost

None added. node:sqlite is built into Node, so there are no native builds and no network. @auth/core 0.41.3 is the Auth.js proof's existing dependency, installed only into the proof's temporary copy. No package-lock.json entries changed. Proofs are not in the packed files, so package budgets are unaffected.

Docs

  • docs/FRAMEWORK.md: one pointer in the function-routes-with-auth: true section.
  • docs/EXTENSIONS.md: a short "Owner choice of storage" paragraph.
  • llms.txt: the Persistence row. llms-full.txt was regenerated.

Evidence and limits

npm run verify passed locally (macOS, Node 26.10), including all proofs. This is not a statement about other databases: the proof exercises one library, node:sqlite. The Auth.js gaps (JWT sessions without server-side revocation) apply as recorded in the Auth.js proof. The missing-binding error names the route but not the variable (URLCODE_DATA_DIR).

🤖 Generated with Claude Code

…uth: true (#1052 S7)

proofs/native-storage keeps its notes with node:sqlite, called directly from
trusted function routes, and signs users in with auth: true through the
independent Auth.js provider. Neither the store nor the audit extension is
installed. The data directory is the operator's URLCODE_DATA_DIR grant, and a
fresh temporary directory for every test and audit run.

test/native-storage.integration.ts (npm run test:proof:native, in
verify:workspaces and the packed-integration CI job) packs core and the
provider, then checks validate, explain, review, test twice, audit ready, a
refusal without the data directory, served owner isolation and concurrent
writes, and that extensions.store without the store extension is refused
before serving rather than emulated.

No new dependency: node:sqlite is built in; @auth/core is the Auth.js proof's.

Part of #1052.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@jimhoyd
jimhoyd enabled auto-merge (squash) September 30, 2026 15:40
@jimhoyd
jimhoyd merged commit 355c629 into main Sep 30, 2026
25 checks passed
@jimhoyd
jimhoyd deleted the claude/native-storage-proof-1052 branch September 30, 2026 15:48
jimhoyd added a commit that referenced this pull request Sep 30, 2026
…pact in the paths-filter plan

Co-Authored-By: Claude Opus 5.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