Skip to content

Store screens: If-Match on edits and deletes, stale-page message, browser coverage (#873) - #877

Merged
jimhoyd merged 1 commit into
mainfrom
claude/screen-if-match
Sep 29, 2026
Merged

jimhoyd merged 1 commit into
mainfrom
claude/screen-if-match

Conversation

@jimhoyd

@jimhoyd jimhoyd commented Sep 29, 2026

Copy link
Copy Markdown
Collaborator

Fixes #873 items 1, 4 and 5. Item 2 (membership-aware buttons) waits for #876; the options are on the issue. Item 3 (409 reachability) is unchanged and documented.

Changes

  • One write helper. Edits, checkbox toggles (PATCH), deletes and transitions all go through it.
    • It sends If-Match from the list's etags or from the last write's ETag, and none when the record has neither.
    • A 412 shows the stale-page message. The edit keeps what was typed, a toggle rolls back and a deleted row stays.
    • A successful write stores its new ETag.
    • Merging the four write paths made the script 158 bytes smaller while adding the feature.
  • Breaking copy key: ui.crud.transitionStale becomes ui.crud.stale and is on every screen, in English and French.
  • Docs: ui README and CONTRACT, docs/STORE.md, ui CHANGELOG.

Evidence (macOS, Node 26)

  • npm run verify and npm run test:package pass. ui 113, store 126.
  • Unit tests: If-Match on edit, toggle and delete, chaining each write's returned ETag; a 412 changes nothing; no If-Match without an ETag.
  • End to end, with ui and store served and two pages on one record:
    • the current page's edit succeeds;
    • the stale page's edit and delete each get 412 and the database is unchanged;
    • the current page's delete then succeeds with its new ETag.
  • The Playwright browser test ran on local Chrome, 6/6: a transition click, chained edits, and a stale edit that keeps the typed text. CI already runs it on the ubuntu / Node 24 leg.
  • ui size: 100,305 of 102,400 bytes packed, and 367,685 of 368,640 unpacked (955 bytes left), so the next ui change will need the unpacked limit raised.

🤖 Generated with Claude Code

…browser coverage (#873)

The crud script now sends If-Match on every write to an existing record
(PATCH for a saved edit or a checkbox toggle, DELETE, and transitions as
before) from the list's etags map or the ETag of its own last write. A 412
is a page message and changes nothing: the draft stays, a toggle rolls
back, a deleted row stays. A successful write moves the row to the ETag
its response returned. The four write paths share one helper, so the
script is smaller than before.

Breaking: ui.crud.transitionStale is renamed ui.crud.stale and moves from
crudTransitionCopyKeys to crudCopyKeys (English and French).

Tests: fake-DOM unit tests for If-Match on PATCH/DELETE and the 412
message; a served ui+store end-to-end stale edit and stale delete; the
real-browser test now covers a transition click, a successful edit that
carries its new ETag, and a stale edit's 412.

Items 2 and 3 of #873 remain open.

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