Refactor the Subject move: read the source page once, drop dead paths - #1361
Merged
Conversation
Member
Author
|
Ugh. Try to get claude to remove lines. 🤔 |
JeroenDeDauw
force-pushed
the
feature/1338-move-subject-to-page
branch
from
September 6, 2026 22:50
5c41fec to
583af10
Compare
PageSubjects::without() answers a copy without the given Subject. The move writes that copy and the rollback writes back the object it read, which nothing has mutated. The second read of the source page goes, and with it the reliance on repository reads handing out distinct objects, which SubjectRepository never promised. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
A source page that vanishes between the read check and its write is written first, so nothing has been written yet; from the caller's side the Subject is gone. presentSourcePageNotFound() goes. The response is still 404, with the message "Subject not found" instead of "Page not found". Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The production HTTP client rejects on every non-2xx status but 422, so a non-ok Response never carried a server message. moveSubject now fails generically on one, like every sibling method; the rejection path still delivers the server's own message to the dialog, unchanged. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
JeroenDeDauw
force-pushed
the
feature/1338-move-subject-simplify
branch
from
September 7, 2026 17:38
35c41b5 to
62ddb9f
Compare
JeroenDeDauw
marked this pull request as ready for review
September 7, 2026 17:57
Source-page 403, source untouched on an unreadable target, and the edit summary reaching both pages are each asserted in MoveSubjectActionTest; the target-page 403 test keeps proving the Authority wiring through the real stack. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
JeroenDeDauw
force-pushed
the
feature/1338-move-subject-simplify
branch
from
September 7, 2026 18:05
62ddb9f to
0cc21b4
Compare
Member
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.
Follows-up to #1356, rebased onto master after it merged. One commit per item, so any of them can be dropped on its own. User-visible behaviour is unchanged; the one API-visible difference is under the second item.
PageSubjects::without()answers a copy without the Subject. The move writes the copy, and the rollback writes back the object it read, which nothing has mutated. The second read of the source page goes, and with it the reliance on repository reads handing out distinct objects, whichSubjectRepositorynever promised.presentSourcePageNotFoundgoes. The response is still 404, with the messageSubject not foundinstead ofPage not found.moveSubjectno longer reads a server message off a non-ok Response. The production client rejects on every non-2xx but 422, so that branch never carried one. The rejection path still delivers the server's message to the dialog, unchanged.@group Databasetests dropped: source-page 403, source untouched on an unreadable target, edit summary on both pages.MoveSubjectActionTestcovers each; the target-page 403 test keeps proving the Authority wiring.Considered, omitted:
MoveSubjectDialoginto aPageCreatorservice behind the registry: it takes themw.Apicall and error-code parsing out of the Vue component, but costs an interface, a class and three registration points for one caller. Worth doing only together withMappingCreatorDialog, which has the same inlinemw.Api().create, as a second caller.dropFromRegistryOnceUnlistedwith a plain listing reload: the moved Subject's registry copy carries its old page, so dropping it does real work.PagePickerandSubjectPicker: the largest duplication in the original PR, but it means reworking SubjectPicker; a PR of its own.Production notes
Design, diff review and this text by
Fable 5.1 (max); implementation, tests and the rebase onto master byOpus 5 (max)subagents from written specs.