You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
portal: Restore, Reassign and inline card forms still resolve the patch by name #371
area:uiPortal and first-party browser pages, shared rendering and stylesbugSomething isn't workingready-for-agentFully specified, ready for an AFK agent
PR #362 (issue #339) bound the Retire and Delete confirmations to the patch's stable ID so a stale form cannot mutate a patch that later took the name. Restore, Reassign and the card's inline description, sharing and rollback forms still resolve the patch by its mutable name on POST. Reassign is the most exposed: both patches can share an owner, so an old Reassign confirmation left open across a rename and name reuse would hit the replacement.
Fix the same way as #362: carry expectedPatchId in each form, refuse on the card when the name no longer resolves to it, and pass only the validated ID to the mutation.
Found by grok build reviewing PR #362; filed by Claude Fable 5.1 via Claude Code.
Category: bug Summary: Every portal POST form carries the ID of the patch it was rendered for, and the server refuses a form whose name now belongs to a different patch.
Current behavior: #362 bound the Retire and Delete confirmations to the patch's stable ID. The other five portal forms (Restore, Reassign, and the card's inline description, sharing and rollback forms) still look the patch up by its 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 acts on the replacement.
Reproduced during triage with a portal test. The test renders a form for patch A, renames A by publishing it under a new name, publishes B under A's old name, then posts the untouched form:
Form
Result on B
Why the existing precondition passed
Sharing
made public, 303
expectedScope is company for both
Reassign (admin)
reassigned, 303
expectedOwnerUserId matches, since both patches share an owner
Restore
restored, 303
expectedState is retired for both
Description
overwritten, 303
expectedDescriptionUpdatedAt collides when neither patch has ever had a description (both null)
Rollback
refused, 409
expectedCurrentVersionId is unique, but the stale notice describes B's history as if it were A's
Sharing is the worst case: an owner's stale form can make a different patch reachable by anyone on the internet.
Desired behavior:
Every POST form in the portal, covering card forms and confirmation pages for all seven actions (description, scope, rollback, retire, delete, restore, reassign), carries expectedPatchId. That includes the restore confirmation that an inline restore re-renders with 409 when it finds off sources. The POST handler checks the submitted ID against the patch the name resolves to once, before dispatching on the action, not per action as #362 does today:
The ID is mismatched: answer 409 on the card for the name's current patch with "This name now belongs to a different patch. Nothing was done." Do not re-render a form for the current holder.
The ID is missing (a tab opened before this change): answer 409 on the card with an out-of-date notice. The wording must fit inline card forms as well as confirmations, so it should no longer say "confirmation".
On a match, only the validated ID reaches the Patches mutation. Every existing precondition (owner/admin, state, scope, owner, version, description stamp, dependants, typed delete name) stays as it is and is still checked.
Retire and Delete keep their current behavior, but their per-case checks fold into the shared one.
Key interfaces:
The portal's POST handler for /patches/:name/<action>: one expectedPatchId check, ahead of the action switch, for all seven actions
The card's inline description, sharing and rollback forms, the restore control on off cards, and the Restore and Reassign confirmation forms each gain a hidden expectedPatchId
The Patches service mutation signatures do not change
Acceptance criteria:
For each of the five newly covered actions, a portal test takes the rendered form's real hidden fields, renames the patch, publishes a new patch under the old name and posts the old form. It gets 409 on the card, with both patches unchanged, for both a mismatched and a missing expectedPatchId. Extend fix(portal): an old retire or delete form no longer hits a patch that took its name #362's existing "refuses an old … once its name belongs to another patch" test rather than writing a parallel one.
The current-form happy path for every action still succeeds (existing portal tests pass)
Retire and Delete still refuse a mismatched or missing ID with the same 409 behavior
docs/product.md's lifecycle section no longer says only Retire and Delete carry the patch's ID; it says every portal form does
pnpm verify passes
Out of scope:
The CLI and lifecycle API, which resolve names at call time rather than from a stale form
The user deactivation and reactivation pick pages under /company/users/:id
Changing any action's own precondition or its notice wording, apart from the out-of-date notice above
Reserving former names or otherwise changing name reuse
area:uiPortal and first-party browser pages, shared rendering and stylesbugSomething isn't workingready-for-agentFully specified, ready for an AFK agent
Activity
allisonmahmood commentedon Oct 2, 2026
Agent Brief
Category: bug
Summary: Every portal POST form carries the ID of the patch it was rendered for, and the server refuses a form whose name now belongs to a different patch.
Current behavior:
#362 bound the Retire and Delete confirmations to the patch's stable ID. The other five portal forms (Restore, Reassign, and the card's inline description, sharing and rollback forms) still look the patch up by its 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 acts on the replacement.
Reproduced during triage with a portal test. The test renders a form for patch A, renames A by publishing it under a new name, publishes B under A's old name, then posts the untouched form:
expectedScopeiscompanyfor bothexpectedOwnerUserIdmatches, since both patches share an ownerexpectedStateisretiredfor bothexpectedDescriptionUpdatedAtcollides when neither patch has ever had a description (both null)expectedCurrentVersionIdis unique, but the stale notice describes B's history as if it were A'sSharing is the worst case: an owner's stale form can make a different patch reachable by anyone on the internet.
Desired behavior:
Every POST form in the portal, covering card forms and confirmation pages for all seven actions (
description,scope,rollback,retire,delete,restore,reassign), carriesexpectedPatchId. That includes the restore confirmation that an inline restore re-renders with 409 when it finds off sources. The POST handler checks the submitted ID against the patch the name resolves to once, before dispatching on the action, not per action as #362 does today:Patchesmutation. Every existing precondition (owner/admin, state, scope, owner, version, description stamp, dependants, typed delete name) stays as it is and is still checked.Retire and Delete keep their current behavior, but their per-case checks fold into the shared one.
Key interfaces:
/patches/:name/<action>: oneexpectedPatchIdcheck, ahead of the action switch, for all seven actionsexpectedPatchIdPatchesservice mutation signatures do not changeAcceptance criteria:
expectedPatchId. Extend fix(portal): an old retire or delete form no longer hits a patch that took its name #362's existing "refuses an old … once its name belongs to another patch" test rather than writing a parallel one.docs/product.md's lifecycle section no longer says only Retire and Delete carry the patch's ID; it says every portal form doespnpm verifypassesOut of scope:
/company/users/:idfix(portal): every portal form refuses a patch that took its name
fix(portal): a reused name refuses before the owner check, and one op…