Skip to content

Add the operator-installed store extension and init --with store (refs #253) - #315

Merged
jimhoyd merged 2 commits into
mainfrom
feat/store-extension-253
Sep 20, 2026
Merged

jimhoyd merged 2 commits into
mainfrom
feat/store-extension-253

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator

Refs #253 (does not close it). Not merged.

What

New workspace package @jimhoyd/urlcode-store: an operator-installed extension that serves declared collections as a bounded JSON CRUD API, mounted with extension: store (e.g. /api/todos/*). No handler code.

  • Own field schema (string/integer/number/boolean, required, default, length/range/enum), server-owned id (UUID), createdAt, updatedAt. No dependency on [Request]: Declarative validation for JSON request bodies and path parameter patterns #254 / PR Add request.body.schema and parameter format/pattern (refs #254) #306.
  • File-backed: one JSON file per collection in an operator directory outside the project; atomic writes (tmp + fsync + rename + dir fsync), 0700/0600, per-collection maxRecords/maxRecordBytes/pageSize, body cap, readOnly.
  • Single-writer: a lock file refuses a second server over one directory; dead-process locks are reclaimed. Writes serialize per collection. Limits are documented honestly in docs/STORE.md (no transactions, last write wins, whole-file rewrite, no network filesystems).
  • Errors are fixed messages plus field names; never submitted values, file contents or paths (tested).
  • JSON-only writes plus a same-origin Origin check. init --with store scaffold (adds auth: true and reuses auth's pin when auth is listed first). CRUD recipe in docs/STORE.md.
  • Wired into verify:workspaces and the package audit. Core init --with needed no change.

Why an extension (retirement reason)

Per the maintainer's clarification on #253: urlcode-dynamic-link was retired because stored short links did not belong, and the project moved from a locked-down sandbox to trust by default; it is not a precedent against a data extension. Repo history agrees (#164/#165 retirement, #127 trusted-by-default).

Not in this PR (recorded in docs/OPEN-DECISIONS.md)

Verification

npm ci failed locally in this worktree, so npm install was used and the lockfile updated. npm run verify passes (lint, typecheck, check, build, 623 tests 0 fail, verify:workspaces including store's 12 tests, package audit and the workspace integration incl. a new init --with store end-to-end test). npm run docs:llms and npm run check:docs pass.

🤖 Generated with Claude Code

@jimhoyd

jimhoyd commented Sep 20, 2026

Copy link
Copy Markdown
Collaborator Author

Heads-up from the maintainer, before this hits it: the core package has a 420-entry budget (scripts/package-audit.ts, added by #305), and it was already nearly full. #306 exceeded it at 422 and failed every verify job.

The budget is not raised. Each PR that adds shipped files, such as new source, examples or recipes, trims to fit. Run npm run test:package:built on this PR and check the entry count before merge. If a genuine need for more room arises, raise it with the maintainer as a separate decision.

Separately, the Windows workspaces job failed on an admin test, "real user-query pagination and page export preserve combined filters across more than fifty accounts", after about 18 seconds. I suspect a timeout on the slower runner but have not confirmed it.

…#253)

A new workspace package, @jimhoyd/urlcode-store, serves declared collections as a
bounded JSON CRUD API from atomically written files in an operator-owned directory.
It owns its field schema (no dependency on #254), enforces per-collection record and
byte quotas, and refuses a second writer over one directory. Includes the init --with
scaffold, docs/STORE.md (CRUD recipe, HTTP contract, honest concurrency limits) and
an end-to-end scaffold test. Catalog recipe and release-train wiring are recorded in
docs/OPEN-DECISIONS.md.

Co-Authored-By: Claude Sonnet 5 <[email protected]>
@jimhoyd
jimhoyd force-pushed the feat/store-extension-253 branch from e3b59f2 to ab4753a Compare September 20, 2026 18:26
@jimhoyd
jimhoyd merged commit 1032c32 into main Sep 20, 2026
20 checks passed
@jimhoyd
jimhoyd deleted the feat/store-extension-253 branch September 20, 2026 18:42
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