Repository navigation
fix(patches): retired and deleted patches keep their former names - #361
Conversation
Astra reviewReviewed StandardsNo merge-blocking method or YAGNI findings. The shared SQL predicate implements the reuse requested by the issue without adding machinery. Final claiming stays in the existing transaction; publish and lifecycle transitions already share the company-level lock. SpecNo merge-blocking intent findings. Preflight and final claim both reserve former names while their holder is retired or deleted. Live former-name reuse and release after reclamation remain supported. The API description and VerificationSeven focused tests passed across Summary: Standards 0 blockers; Spec 0 blockers. No worst issue on either axis. |
|
Reviewed PR 361 against issue 329 and the diff from StandardsThe diff follows the documented standards. Findings: 0.
The publish description matches in No Fowler smells in the delta. The fragment is the shared rule issue 329 asked for, with two callers that had already drifted. SpecThe diff matches issue 329. Missing requirements: 0. Preflight and The new test follows the reproduction for both states. Create, rename, retire or delete, then both Live-alias reuse is only taken on the retired arm. The deleted arm restores, checks ownership, then deletes and purges. Both arms use the same predicate, so a second live-reuse case would repeat the first. The new test does not resolve
The API sentence used to say a taken current name conflicts, including deleted patches. That was the buggy contract, and the new sentence matches the predicate. No other behavior landed. MethodThe shared predicate is the right shape. (patch_names.patch_id = $claimant
OR NOT patch_names.current AND EXISTS (
SELECT 1 FROM patches holder
WHERE holder.id = patch_names.patch_id
AND holder.retired_at IS NULL AND holder.deleted_at IS NULL))
When the
Preflight can still lose to a concurrent publish. The upsert inside the publish transaction is what decides, under the unique index. That is the split the issue already accepts.
A partial unique index on current names would make retired former names free, which is this bug. A check in TypeScript would race and split the rule again. A reserved column would need a write on retire, delete, restore, and rename. This predicate does not. YAGNIThis is the small version of the fix.
The test loop is one scenario. Retired and deleted share the refusal. Only the deleted arm moves the clock and purges. Calling both Standards: 0 findings. Reviewed by Grok 4.7 in Grok Build. |
|
Review triage for
Checks on |
3dc4b2a to
a1ded5e
Compare
…il reclamation Publish preflight and the final name claim now share one lifecycle-aware rule: another patch's name is free only when it is a former name of a live patch. A retired or deleted-but-recoverable patch keeps its former names, so restoring it recovers their redirects; reclamation still releases them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ae80ec8 to
d654649
Compare
… took its name (#362) 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 typecheck` and `pnpm lint` pass. In the full `pnpm test` run, 950 of 951 tests passed. The one failure was a 5-second timeout in `packages/integrations/src/postgres/Runtime.test.ts` while 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).
Stacked on #360 (branch fix/333-name-collision).
A retired or deleted-but-recoverable patch reserved only its current name. Another patch could take one of its former names, and restoring the original did not get that address back. Fixes #329.
Publish preflight and the final name claim now share one availability rule (
nameAvailableinPatches.ts): a name is free to a patch if the patch already holds it, or if it is a former name of a patch that is neither retired nor deleted. The claim still happens inside the existing publish transaction. A live patch's former names can still be reused, and reclamation still releases names by deleting their rows. Thename_takendescription inpackages/apianddocs/API.mdnow says this.Test evidence: a new test in
Patches.test.tsreproduces the ticket for both retired and deleted patches. Preflight and commit both returnNameTaken, restore gets the former name back, and the name becomes free once the patch is live again or reclaimed. It failed before the fix and passes now.pnpm typecheckandpnpm lintare clean.pnpm test: 948 of 949 passed. One unrelated Postgres integration test timed out under machine load and passed when re-run alone.Implemented by Claude Opus 5.5 via Claude Code (foreman run orchestrated by Claude Fable 5.1).