Skip to content

feat(forms,store,form-records): name off-page field errors; clear optional fields on edit; per-user list page (#739, #738) - #743

Merged
jimhoyd merged 2 commits into
mainfrom
claude/sleepy-shannon-xvazgl
Sep 25, 2026
Merged

jimhoyd merged 2 commits into
mainfrom
claude/sleepy-shannon-xvazgl

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 25, 2026

Copy link
Copy Markdown
Collaborator

Problem and change

  • Closes [Bug]: forms 422 for a field that is not on the page shows only "Correct the highlighted fields" #739 (forms). When a 422 error map has keys the page doesn't render, the alert now explains them.
    • Declared field not on the page: it is named by its label, e.g. "Name cannot be changed on this form." The text is capped at 200 characters and escaped.
    • Undeclared key: it becomes the fixed sentence "This form received a field it does not accept." The key name and submitted values are never echoed.
    • Where it applies: forms' own flows and exported handles, so form-records' create and edit pages get it too.
    • Also fixed: admission's error map is now prototype-free. A crafted __proto__ field was previously dropped silently and the submission accepted; it now gets 422 like any undeclared field.
  • Closes [Request]: form-records follow-ups: clearing optional fields on edit, and a per-user list page #738.
    • store: a JSON API PATCH and StoreRecords.update accept null to remove an optional field.
      • Refused: null on a required field gives 400 invalid_record ("is required and cannot be cleared"), and null on an increments field is refused too.
      • Unchanged: ownership, If-Match/412 and validation work as before, and PUT is unchanged. null was previously always a 400, so no request that used to succeed changes meaning.
    • store: new StoreRecords.list(principal, {limit?, cursor?}) returns {items, total, next?, previous?}, scoped to the principal. Export contract v1 is unchanged; this only adds a method.
    • form-records: an empty editable input on the edit page now clears the field. A required field gives 422 and nothing is saved.
    • form-records: optional list: {title?, columns} adds a per-user list page at the exact path <mount>/ (GET/HEAD).
      • Content: the caller's own records only, up to 20 per page, with View/Edit links and Previous/Next through ?cursor=. Values are escaped and the page is served no-store.
      • Refusals: a bad cursor gives 400 and a missing principal gives 401.
      • Activation: columns must be form fields.
      • Unchanged without list: behaviour is exactly as before.
    • Dependency change: form-records now requires ui as well (for the list page). ui is an optional peer in package.json; npm install --package-lock-only reproduces the committed lockfile.
  • Budget: the store's packed budget goes from 40 to 42 KiB (42040 bytes), with the rationale recorded.
  • Path parsing: the list route is an exact string comparison. The only new regex on request data is the anchored, bounded cursor check /^\d{1,9}$/. The linear trimTrailingSlashes() from feat(form-records): new add-on saving a declared form into an owned store collection, with typed forms/store exports (#529) #740 is kept.

Verification

Run on Node v26.10.0 on this branch (latest main + these two commits):

  • npm run verify: exit 0. Root 876 tests; workspaces 34, 97, 240, 35 (forms), 68 (store) and 66; form-records 17; test:addons 4. All 0 failures, including build-addon-manifest --check and audit:packages.
  • npm run test:package: exit 0 (704181 packed, 2867347 unpacked bytes).
  • Generated files: build:addons and docs:llms produced no further changes.
  • New tests:
    • forms: hostile key and value, mixed errors, __proto__, and exported only() handles.
    • store: PATCH null (clear, 412, required, increments, undeclared, PUT unchanged); records export clear and list (ownership, pagination, pageSize cap, 401, bad cursor).
    • form-records: clearing optional number and text fields, a required field refused, and the list page (own records only, escaping, pagination, 400/401, HEAD, confirmation link, activation checks).

Compatibility and security

  • Additive:

    • null in PATCH was previously always rejected.
    • The list page is opt-in.
  • form-records requires ui: projects installing form-records now also need ui. The CLI installs required add-ons together.

  • 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

A 422 whose error map held a key the page does not render (a crafted POST
with an undeclared field, or a declared field outside an only() handle)
showed only "Correct the highlighted fields.", with nothing highlighted.

The shared page renderer now lists such errors in the page alert: a
declared field the page does not render by its label ("Name cannot be
changed on this form."), and any undeclared key as the fixed "This form
received a field it does not accept.", never echoing the key or a
submitted value. It applies to forms-served flows and exported flows,
including form-records' create and edit pages.

Admission's error map now has no prototype, so an undeclared field named
__proto__ is refused like any other instead of being silently dropped.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
…al per-user list page (#738)

Store: a partial update may set an optional field to null to remove it,
through both the JSON API's PATCH and the records export's update. null
for a required field is 400 invalid_record with "is required and cannot
be cleared" (an increment field is refused too); ownership, If-Match/412
and validation of the other fields apply as before, and PUT is unchanged.
null was previously refused as the wrong type, so no accepted request
changes meaning. The records export gains list(principal, {limit,
cursor}): one page of the principal's scope in creation order with
total and next/previous cursors, capped at the collection's pageSize.

form-records: an editable field emptied on the edit page is sent as null
and removed from the record (previously saved as empty text, or refused
for a number); a required collection field refuses the clear with a 422
field error. A record flow may declare list: {title?, columns}; exactly
<mount>/ then lists the caller's own records, 20 per page at most, with
View/Edit links and Previous/Next page links from the store's cursors,
every value escaped and served no-store. Columns must be form fields
(checked at activation). Without list nothing changes. form-records now
requires ui, which renders the list page, and declares it an optional
peer.

Docs: docs/STORE.md (clearing a field, the export's list), store and
form-records README/CHANGELOG/SECURITY/llms.txt, FRAMEWORK.md,
EXTENSIONS.md, regenerated urlcode.json and llms-full.txt. The store's
packed-size budget rises from 40 to 42 KiB (42040 bytes measured).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_014jmv9dMggduiprzSsNd7iP
@jimhoyd
jimhoyd merged commit 376931a into main Sep 25, 2026
24 checks passed
@jimhoyd
jimhoyd deleted the claude/sleepy-shannon-xvazgl branch September 25, 2026 12:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants