Skip to content

Store: 'may' — the transitions the caller may run, on list and record answers (#873) - #884

Merged
jimhoyd merged 1 commit into
mainfrom
claude/transition-may
Sep 29, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/transition-may

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #873 item 2 (option 1).

  • List answers: collection and readers lists become {items, total, next?, may, etags}, with may: {<id>: [transition names]} for every listed record.
  • Single-record answers: these carry Allow-Transitions: a, b, like ETag. That covers GET/HEAD, readers GET, and the answers to create, PUT, PATCH, increment and transition.
  • How may is decided: inside the answer's own transaction. The record must hold the from values, the by: owner/others rule must hold, and the caller must pass the members gate. A readOnly collection offers nothing.
  • Bounded: at most one membership lookup per distinct gate per answer, and zero on owner mounts. A spy counts them in the test.
  • Privacy: only the caller's own membership is read, and no gate or member is named.
  • A hint, not a grant: every transition still re-checks everything.
  • Breaking: an empty list is now {"items":[],"total":0,"may":{},"etags":{}}. The store-crud recipe fixture is updated.
  • ui crud script: shows a transition button only when may[id] includes it, and falls back to the from match when may is absent. Per the Retire the ui kit, forms and form-records; frontends are ordinary builds over declared JSON routes (#841 order 4) #883 decisions the ui screens will be deleted later; the store's may is the lasting API contract.

Evidence (macOS, Node 26)

  • npm run verify passes: root 1151, store 138, ui 113, test:addons 6, test:proof 12. npm run test:package passes. The browser test passes 7/7 on local Chrome.
  • New may.test.ts covers:
    • owner, other, member, non-member and anonymous callers across the owner, readers and shared mounts;
    • the header on each answer;
    • a reviewer's own request excluded;
    • a membership change reflected on the next list;
    • bounded lookups.
  • The served screen e2e: a non-lead reviewer sees only approve, and sees escalate after being granted lead. A reviewer's own request shows no button.
  • No budget raised. ui has 454 bytes of unpacked headroom.

🤖 Generated with Claude Code

…cord answers (#873)

Store list answers (collection and readers mounts) add `may: {<id>: [names]}`
and single-record answers (GET/HEAD, readers GET, create/PUT/PATCH/increment/
transition) add the `Allow-Transitions` header, computed in the answer's own
transaction from `from`, ownership against `by`, and the caller's own
membership (at most one lookup per distinct gate, only when a listed record
could take it; never another principal's). A caller with no principal is
offered only ungated shared transitions.

The ui crud script shows a transition button only when `may` names it for the
row (write answers update it from Allow-Transitions), falling back to the
`from` match when the API sends no `may`. A non-member no longer sees a gated
button, and a reviewer's own request shows no `by: others` button.

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.

Store screens: If-Match on edit/delete, membership-aware transition buttons, browser coverage, ui size headroom

1 participant