Repository navigation
feat(form-records): new add-on saving a declared form into an owned store collection, with typed forms/store exports (#529) - #740
Merged
Conversation
forms' host() now returns FormsExports (contract version 1): define(name, body) validates a flow body (the new formFlowBodySchema, a flow without a mount) with the same rules as a declared flow, and the handle renders, admits and confirms it on the consumer's own mount with forms' escaping, same-origin admission, body bound, CSRF and 422 handling. CSRF tokens for exported flows carry a scope, so a token for one consumer page is refused on another and never admits a forms-served flow; only(names) narrows the admitted fields for an edit page. Declared flows are unchanged. The store's host() now returns StoreExports (contract version 1): records(name) gives a declared collection's ownership, readOnly and frozen fields, and create/get/partial update calls that take the request principal and apply the JSON API's ownership scoping, validation, limits and If-Match/412, failing with the same StoreError statuses. Each export is proven with a synthetic consumer fixture (not form-records). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
…on (#529) A separate, operator-installed extension that requires forms and store and owns their composition. A record flow declares a form (a forms flow body), an ownership: owner collection, the form-to-collection field map and the editable fields. It serves <mount> (create), <mount>/<id> (a confirmation read back from the saved record) and <mount>/<id>/edit (the editable fields pre-filled, the rest read-only, saved as a partial update with If-Match from the rendered version). It reads neither forms' nor store's configuration: only FormsExports and StoreExports through ctx.get. Activation refuses a shared or read-only collection, a mount without a principal-providing policy, an unmapped or mismatched field and forms or store declared after it. Another user's record is 404, a stale edit is a 412 page with the current values, a non-editable field is a 422, and forms' CSRF (scoped per page and record), admission and 422 handling hold. Node only, like the store. The capability install adds no route; --example (with auth) mounts a signed-in todo form over the store example's todos collection. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
… and docs (#529) ci-plan selects form-records when ui, forms or store change and builds ui, forms and store before it; package-audit gains its budget; the add-on integration test expects its --example (/todo-form) beside the other demos. EXTENSIONS, FRAMEWORK (now eight packages), README, llms.txt and AGENTS.md name it; llms-full.txt is regenerated. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
…ecords export together (#529) Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
CodeQL flagged /\/+$/ on the request path as a polynomial regex on uncontrolled data. A single backwards scan replaces it; core already refuses empty path segments first, and the add-on no longer relies on it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem and change
Closes #529. Owner decision: a separate, operator-installed add-on.
@jimhoyd/urlcode-form-records(packages/form-records). Itrequiresforms and store, and runs on Node only (targets: ['node']). It is released in lockstep with the other packages, per VERSION-ALIGNMENT, with v1 export contracts on both sides.ctx.get:FormsExportsv1:define(name, body)returns a handle withrender,submit,only(names)andconfirmationPage, plusformFlowBodySchema. CSRF tokens gain an optionalscopeclaim.StoreExportsv1:records(name)returnscreate/get/update(principal, …). These go through the existingCollectionmethods, somaxRecords,maxRecordsPerOwner([Request]: per-owner record limit for owned store collections #731), validation, ownership and ETags all apply.packages/forms/test/exports.test.ts,packages/store/test/records.test.ts).extensions.form-records.config.records.<name>: {mount, collection, form, fields?, editable?, editTitle?}.--exampleimpossible (owner accepted).<mount>(create, then 303),<mount>/<id>(confirmation) and<mount>/<id>/edit.readOnlycollection, or a mount without a principal-providing policy. No principal gets 401, and another user's record gives 404 everywhere.editablefields are rendered and admitted. Any other submitted field gets 422, and saving is a partial update.--exampleadds an onboarding demo into the store example's ownedtodoscollection, which needs auth.scripts/ci-plan.ts: package list, dependencies (ui, forms, store) and dependents, withtest/ci-plan.test.ts.test/addons.integration.tschecks the form-records example.docs/EXTENSIONS.md,docs/FRAMEWORK.md(now eight packages),docs/STORE.md, README,llms.txt,llms-full.txt, and the package table inAGENTS.md.Verification
Run on Node v26.10.0:
npm run verifyon these commits stacked on feat: per-owner store limits and reassign, user-linked API keys, shared passkey domain, include-aware authoring tools (#731, #732, #729, #733) #737 (same tree asmain+ this PR): exit 0. Root 876 tests; workspaces 34, 97, 240, 34 (forms), 65 (store) and 66; form-records 13;test:addons4 (includingextensions add <all> --exampleserving/todo-form). All 0 failures, includingbuild-addon-manifest --check,audit:packagesandcheck-workspace-links.npm run test:package: exit 0 on this branch (704149 packed, 2867257 unpacked bytes).main, which already has it.Compatibility and security
Additive. A new package; forms and store gain exports only. The forms config schema bytes and forms'
urlcode.jsonare unchanged.Limitations (documented):
onSubmitdoes not run for these forms.todoscollection.Not an independent security review.
Changes match the documented portable contract; docs/examples are updated where needed.
Relevant tests and package checks pass, or limitations are explained above.
No credentials, customer data or private project material are included.
Runtime/starter changes remain aligned where applicable.
🤖 Generated with Claude Code
https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
Generated by Claude Code