Drop Members.Role and make Boards.Key required #234
No reviewers
Labels
No labels
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Grandiras/Ponente!234
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue-219-drop-role-key-required"
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?
Fixes #219.
Drops
Members.Roleand makesBoards.KeyNOT NULLin one migration,RequireBoardKeyDropMemberRole; removesWarnAboutUnconfiguredAdminsAsyncand the transitional notes in code anddocs/.EnsureBoardKeysAsyncnow runs beforeMigrateAsync(raw SQL onId/CreatedAt, only onceAddBoardKeysis applied), so a board a rolled-back release made without a key gets one before theALTER. The migration has no default on purpose: a''would trip the unique index rather than fail loudly.Tested against a database at
AddMemberBansholding two keyless boards and a role-1 member (keys backfilled, column NOT NULL, Role gone), against a fresh database, and throughDownand back.tools/verify.shgreen. No changelog line: maintainer-only.🤖 Generated with Claude Code
🤖 Reviewing this PR — the review will link the full session transcript.
📜 Live transcript — updating every ~5 minutes while the review runs.
💬 Verdict: comment — the reviewer did not submit a structured review; the raw output follows.
(empty)
⏱ 30m 3s · 14 steps · $0.0658 · tokens: 224.4k in / 826 out (+220.7k cache-read) · Go: 5h 4% · wk 2% · mo 84%
📜 Full session transcript
🤖 Reviewing this PR — the review will link the full session transcript.
📜 Live transcript — updating every ~5 minutes while the review runs.
✅ Verdict: approve — no blocking issues found.
This is a well-reasoned finalization of the two transitional shapes (
Boards.Keynullable,Members.Roleunread), and I verified the risky parts rather than assuming them:EnsureBoardKeysAsyncnow runs beforeMigrateAsync, guarded by a check that_AddBoardKeysis in the applied list. I checked EF Core'sHistoryRepository.GetAppliedMigrationsAsync()source: it callsExistsAsync()first and returns an empty list on a fresh database, so the guard short-circuits safely on first boot, and the raw SQL only runs once theKeycolumn actually exists. This correctly repairs a keyless board before theSET NOT NULLALTER.ExecuteSqlAsyncandSqlQueryRaw<T>exist in EF Core 7–10 (this repo is on 10.0.12); interpolated values are parameterized, and the values here are server-generated anyway. TheKeylessBoardrecord binds by column name through the ad-hoc mapper, and the PR's test against a database atAddMemberBanswith two keyless boards exercised exactly that path.Board.Keyhas a non-nullable initializer (= BoardKey.New()), soSeedDefaultBoardAsync,BoardService.CreateAsyncand tests are all covered by the now-required property.Upsets no default on purpose — correct, a''default would tripIX_Boards_Keyon the second keyless board.DownrestoresMembers.RoleasNOT NULL DEFAULT 0, which is the shapeAddBoardRolesleft (the rollback build doesn't map the column, so its INSERTs omit it and the default is what keeps them working), and makesKeynullable for the rollback build's model — both accurate perAddBoardRoles' own comments.Members.Roleis truly unread: grep confirms nothing outside migration history references it; the warning method removal is matched indocs/auth.md. Docs are updated in the same PR per convention; maintainer-only change, so no changelog line is right.One acknowledged trade-off, not a blocker: a database older than
AddBoardKeysthat jumps straight to this release (timer down for several releases) will fail its first boot loudly atSET NOT NULL, since the backfill can't run before the column exists; recovery is one boot of the intermediate release. The autoupdate timer makes that window narrow and the loud-failure stance is stated in the migration comment, so I take it as intended. My previous pass left no findings, so nothing was outstanding.⏱ 20m 23s · 14 steps · $0.0503 · tokens: 141.8k in / 2.0k out (+499.3k cache-read) · Go: 5h 0% · wk 2% · mo 84%
📜 Full session transcript