Repository navigation
fix(portal): an old retire or delete form no longer hits a patch that took its name - #362
Conversation
Astra reviewReviewed StandardsNo merge-blocking method or YAGNI findings. The change uses the existing escaped hidden-field helper, form decoders, refusal rendering and lifecycle mutations. It adds no routing redesign or future-facing abstraction. No UI consistency findings. No Effect service findings. SpecNo merge-blocking intent findings. Both Retire and Delete confirmations carry a required stable patch ID. Submission rejects a changed name-to-ID binding before mutation and passes only the checked ID to the existing service. Actor, lifecycle-state, dependant and typed-name checks remain intact. Leaving other portal actions unchanged matches the Retire/Delete scope of #339. The regression cases submit the rendered hidden fields after normal rename and name reuse. They verify 409 for the stale identity, 422 for a missing ID, and unchanged original and replacement patches. VerificationRan Applicable cross-checks were served HTML, its POST consumers, regression coverage and the updated product documentation. No API/CLI contract, dev-loop, migration, company-resource, reverse-state or repository-layout change. Summary: Standards 0 blockers; Spec 0 blockers. No worst issue on either axis. |
|
Reviewed PR 362 against issue 339, on SpecIssue 339 asks a Retire or Delete confirmation to carry the patch id it was rendered for. Submit must require that id, refuse when the name now resolves to a different patch, and pass only that id to the existing mutation. Actor, state, and dependant checks stay. Routing stays by name. The rendered form does this. The hole is a post with no Tabs open before this ships have no Issue 339 says a stale act should do nothing. The 409 card does that. StandardsEffect service conventions hold. UI consistency holds. The new control is the existing The same id compare sits in the retire branch and the delete branch. That is a duplicated-code smell, and a judgement call. It should stay. Delete still has its own typed-name check, and a wrapper would only hide those two lines.
The comment above MethodResolve the name, compare ids, then call
A missing id should end on a card too. Keep "This name now belongs to a different patch. Nothing was done." for a present id that does not match. A missing id is a different case, including an old tab whose patch was never renamed, so that sentence would be false there. "This confirmation is out of date. Nothing was done." on the same 409 card covers it. Stop on that card. Reassign still trusts the name plus TestsThe new test follows the issue. It reads the confirmation, renames the live patch, publishes another patch under the old name, and posts the hidden fields the page rendered. Both The 422 half of that test locks the dangerous page in. It checks the sentence and that the first post wrote nothing. The body is still a Retire or Delete form for the replacement. Once the refusal is a card, that arm should expect 409 and no The older retire and delete posts send The regex wants Standards: no hard violations. One judgement, the duplicated compare, and it should stay. |
|
Addressed the reviews in 699574a. Fixed
Kept as is
Verification: portal suite 51/51, |
ae80ec8 to
d654649
Compare
… patch that took its name A Retire or Delete confirmation resolved its patch by name at submission, so after the original patch was renamed and another patch took the old name, the untouched form retired or deleted the new patch. The confirmation now carries the patch id it was rendered for; the POST requires it, refuses with 409 and nothing done when the name resolves to a different patch, and passes only that id to the existing mutation. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… on the card A form posted without expectedPatchId, such as a tab opened before the id was added, failed decoding and re-rendered a confirmation for whichever patch now holds the name, with Delete's typed name already filled in. It now ends on the card at 409 with nothing done, the same page a mismatched id gets. Co-Authored-By: Claude Opus 5.5 <[email protected]>
699574a to
379c813
Compare
…#363) Stacked on #362 (branch fix/339-stale-confirmation). Closes #330. The root `dev` script bundled the shell broker before handing off to the runner, so every subcommand depended on it. If you were halfway through a broker edit and it had a syntax error, `pnpm dev stop` exited 1 and left the instance running. `status`, `logs` and `--dry-run` had the same problem. Now `package.json` runs the runner directly. `pnpm dev` (when it actually starts) and `pnpm dev reset` build the broker first, before they record, stop or wipe anything. A failed build prints esbuild's errors to stderr, then one `BrokerBuildFailed` line, and exits 1 with the instance and `.local/dev` untouched. Management commands and confirming a healthy instance never compile it. `docs/DEVELOPMENT.md` (under the subcommand table) and the `patchy-dev-loop` skill say so. **Tests.** `scripts/dev/src/main.test.ts` runs the root `dev` script, as pnpm does, in a throwaway worktree whose broker doesn't compile: - `stop` with a recorded idle process as the supervisor: on the old code it exited 1 and the process stayed alive; now it exits 0 and stops the process. - `reset` with the same recorded process: exits 1, the process stays alive, and `plan.json` is still there. On the first version of this PR it stopped the process and wiped the state. - A plain start: exits 1, stderr names `broker.ts`, and no `plan.json` is written. `pnpm typecheck` and `pnpm lint` are clean, and the `scripts/dev` tests pass (15/15). On the first commit, `pnpm test` passed 952 of 953. The one failure was `packages/integrations/src/postgres/Runtime.test.ts` timing out at 5s under machine load; on its own it passes. Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).
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 one `actionForm` helper that writes the ID, so a new form can't leave it out. The handler checks the ID once, before anything else: - If the ID is mismatched, it answers 409 on the card with "This name now belongs to a different patch. Nothing was done." - If the ID is missing (a tab opened before this change), it answers 409 with "This form is out of date. Nothing was done." - If it matches, only that ID reaches the `Patches` mutation. 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 verify` passes all 8 stages. 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]>
Stacked on #361 (branch fix/329-former-names).
Closes #339.
A Retire or Delete confirmation page looked up its patch by name when you submitted it. If the patch was renamed and another patch took its old name while the page was open, submitting the untouched form retired or deleted the other patch.
The confirmation form now carries the ID of the patch it was rendered for. Submitting it requires that ID. If the ID is missing (a tab opened before this change) or the name now belongs to a different patch, the request stops on the card with 409 and nothing is done. It never shows a fresh confirmation for whichever patch holds the name now. Only the checked ID reaches the existing mutation. The owner, state, dependant and typed-name checks are unchanged. Restore, Reassign and the card's inline forms still find their patch by name and are left for a follow-up.
Tests: a new portal test for both Retire and Delete takes the page's real hidden fields, renames the patch, publishes a new patch under the old name and posts the old form. On the old code it got 303 and retired or deleted the new patch. It now gets 409 on the card, with no confirmation form and both patches unchanged, whether the ID is mismatched or missing. The portal suite passes 51/51, and
pnpm typecheckandpnpm lintpass. In the fullpnpm testrun, 950 of 951 tests passed. The one failure was a 5-second timeout inpackages/integrations/src/postgres/Runtime.test.tswhile the machine was under load, and that file passes when run alone.Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).