WIP: fix(contract) Make ShoppingListItemReasonDto.addedBy optional for deleted accounts #57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix-reason-deleted-user-contract"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Contract fix for recipe-backend#35 (deleting a user leaves shopping list items without any reason).
Change (
api-contract/src/shopping-lists.ts)ShoppingListItemReasonDto.addedByis now optional: absent when that user's account has been deleted; the reason itself stays. Same rule asCommentDto.createdByUser, ratings and tags.ShoppingListItemDto.tickedBy: doc only. Absent also on a ticked item when the ticker's account has been deleted (the backend already behaves that way).Base and merge order
004-fill-list-from-meal-plan-contract(cf101fc), so until #004's contract PR merges this diff also shows the 004 contract. Only commit18f9b60belongs to this fix.maininto this branch (merge, never rebase; siblings pin it), merge this PR, re-runcontract_pin, then merge the sibling PRs.fix-reason-deleted-userand a recipe-app PR both pin this branch's commit (releases need equal pins).Breaking for siblings
addedByis now optional: code readingreason.addedBy.<field>must handle its absence (compile error until it does).tickedBy(runtime only, not caught by the compiler): never assumeticked ⇒ tickedBy. No non-null assertions; "ticked off by" text needs a fallback (e.g.getUserDisplayName()→ "Unbekannt").ADR
A cross-cutting ADR recording the rule and partially superseding
docs/adr/2026-09-27-shopping-list-contract.mdcomes in a separate docs PR againstmain(branchfix-reason-deleted-user), together with a convention paragraph indocs/api-conventions.md.Clean contract review (
review-contract, working tree vs HEAD) and decisions:149:addedBychanges fromCompactUserDtotoaddedBy?: CompactUserDto; sibling code readingreason.addedBy.<field>stops compiling. Suggestion: move both siblings'contract.reftogether and handle the absent case.Decision: rejected (no contract change). Deliberate, agreed with the product owner. Both siblings move their pin to this commit and handle the absent case; noted above.
:188-192:tickedBy's guarantee changes from "present when ticked" to "may be absent even when ticked"; the compiler does not catch it. Suggestion: call it out in the PR.Decision: acted. Called out in "Breaking for siblings" above.
:149,:192: the accepted ADR2026-09-27-shopping-list-contract.mdgivesaddedBy: CompactUserDtoand saystickedAt/tickedByare both present while ticked; no ADR records the change, and the deleted-author rule is not written down as a general rule.Decision: asked; product owner chose a new ADR. The cross-cutting ADR partially supersedes those two statements, and the rule goes into
docs/api-conventions.md, in a separate docs PR.:145-149: theShoppingListItemSourcedisplay strings ("... by on ") don't cover the absent-user case.Decision: rejected. Agreed to leave them: the field doc states when the user is absent, and what to display then is the app's concern (as for comments and ratings).
:146-147: wording differs from the comments/ratings/tags pattern.Decision: acted. The
tickedBywording is aligned ("..., and absent then too when that user's account has been deleted.");addedByalready follows the "Absent when ...'s account has been deleted" pattern. Not re-reviewed: the only change from the findings is that one rephrased sentence.🤖 Generated with Claude Code
View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.Merge
Merge the changes and update on Forgejo.Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.