Repository navigation
fix(portal): every portal form refuses a patch that took its name - #485
Merged
Merged
Conversation
Restore, Reassign and the card's description, sharing and rollback forms looked their patch up by name on submit. After a rename, a form left open acted on whichever patch claimed the old name; an owner's stale sharing form could make a different patch public. Every portal POST form, including the restore button on an off patch's address, now carries expectedPatchId. The POST handler checks it once, before dispatching on the action: a mismatch or a missing id answers 409 on the card with nothing done. Retire and Delete's per-case checks fold into the shared one. Closes #371 Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ener writes every form's id Review follow-ups for #371. The patch-id check now runs before the owner/admin check, so an owner's old form answers "This name now belongs to a different patch" even when someone else's patch took the name, not 403. Every portal form opens through actionForm, which writes expectedPatchId, so a new form cannot forget it. Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
…ries the patch id Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
allisonmahmood
force-pushed
the
t3code/implement-issue-371
branch
from
October 2, 2026 20:00
e11240f to
3769b9c
Compare
3 of 4 tasks
allisonmahmood
added a commit
that referenced
this pull request
Oct 3, 2026
…wice (#496) # What changed The nested CSS watch test in `pageImports.test.ts` flaked on CI (`test (22)` on #485). It read one watcher result per file write. A plain write truncates and then writes, which can trigger two rebuilds, so a stale duplicate refusal could stand in for the fixed build. The test now saves by renaming a complete file into place, and its `next()` skips a result identical to the one it last returned. These are the mitigations the dev server's watch test already uses (`save` and `inspectedChanges` in `devServerWatch.test.ts`). Assertions stay outside the wait, so a new error or unexpected CSS still fails. No production code changes; triage found no production defect. Closes #487 ## How it was verified - [x] `pnpm test` passes locally - [x] Added or updated tests covering this change - Temporary checks (not shipped): pushing a duplicate refusal into the queue before and after the fix write fails the old test, and the new test reaches the blue build. The new test still fails on a differing refusal after the fix, or on a fix that writes green instead of blue. - `isDeepStrictEqual` treats two `LocalError` refusals with the same code and message as equal, and different ones as unequal, on Node 22.22.0 and 24.20.0. - Looped 50 times each on Node 22.22.0 and 24.20.0, run concurrently: 100/100 passed. - `pnpm verify`: format, lint, typecheck, test (1625/1625), postgres-concurrency, cli-smoke, tier2-smoke and browser pass. - After rebasing onto `b320800` (#497), which adds an unrelated `it.each` build test to the same file: looped 25 times each on Node 22.22.0 and 24.20.0, 50/50 passed; format, lint and test typecheck pass. ## Release impact - [ ] **Breaking** - [x] **Not breaking**: test only. ## Review - GPT 6.1 Sol (codex): no findings. - `/code-review` standards and spec passes: no hard findings. The file's node-builtin waiver reason now covers the deep comparison. Made by Claude Opus 5.5 via Claude Code; reviewed by GPT 6.1 Sol via codex. Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Closes #371.
#362 bound the Retire and Delete confirmations to the patch's ID. The other portal forms (Restore, Reassign, and the card's description, sharing and rollback forms) still looked their patch up by name when submitted. A live patch's former name can be claimed by another patch, so a form left open across a rename and name reuse acted on the replacement. An owner's stale sharing form could make a different patch public.
Every portal POST form now carries
expectedPatchId. That includes the Restore button on an off patch's own address page, which posts into the same handler. The forms open through oneactionFormhelper that writes the ID, so a new form can't leave it out. The handler checks the ID once, before anything else:Patchesmutation. Every existing precondition still runs, and the mutation signatures are unchanged.The ID check runs before the owner/admin check. Otherwise an owner's stale form at a name now held by someone else's patch would get "Only the owner or an admin can do that", which is misleading. A form whose ID matches still gets the same 403 as before.
Tests: #362's name-reuse test now covers all seven actions, using each page's real hidden fields. On the old code, description, sharing, restore and reassign returned 303 and changed the replacement patch, and rollback refused with the wrong notice. Now each gets 409 on the card, for both a mismatched and a missing ID, with both patches unchanged. A new test covers a different owner's patch taking the name.
pnpm verifypasses all 8 stages.Made by Claude Opus 5.5 via Claude Code; reviewed by GPT 6.1 Sol via codex.