E5 follow-up: completion authority tightenings (#75)#82
Merged
Conversation
AtomicTrxn
force-pushed
the
e5-followup-completion-authority-tightenings
branch
from
May 17, 2026 04:27
85fe444 to
91a4942
Compare
Implements the five tightenings recommended in docs/architecture/completion-authority.md: 1. SolveScreen.dispose flushes the autosave when the puzzle is in a terminal state, backstopping the unawaited markComplete in SolveNotifier._persistCompletion so a normal screen tear-down still persists the completion to solve_sessions. 2. New solve_completion_roundtrip_test.dart drives the SolveNotifier through every terminal status (solved / solvedWithHelp / solvedWithReveal / revealed) against a real SolveRepositoryImpl, then disposes the container and resumes — locking the inverse-mapping invariant between _deriveCompletionType (notifier) and _statusFromDb (repo). 3. New reset-while-saving race test uses a gated SolveRepository spy that holds markComplete's Future open after its DB writes land, then triggers resetPuzzle and asserts puzzle_completions retains the completion row while solve_sessions and in-memory state reflect the reset. 4. solve_sessions_table.dart: doc comments on usedCheck / usedReveal marking them as session-state-only inputs to CompletionType derivation; reading them post-completion is a bug. 5. solve_sessions_table.dart: doc comment on completionType noting the intentional duplication with puzzle_completions.completion_type (hot read for Archive; puzzle_completions remains the history authority). No behavior changes visible to the user; flutter analyze clean, full flutter test passes (328 tests).
AtomicTrxn
force-pushed
the
e5-followup-completion-authority-tightenings
branch
from
May 17, 2026 04:36
91a4942 to
8c7a8f9
Compare
3 tasks
AtomicTrxn
added a commit
that referenced
this pull request
May 17, 2026
- Color Guide HTML version string 3.0 → 3.5 to match the v3.5 spec already in force across the codebase (issue #83, PR #84). - completion-authority.md: "Required tightenings (after this doc lands)" rewritten as "Tightenings (implemented)" with a link to PR #82, since all six tightenings have landed. Issue-ref format updated to current E-series naming (#59 Sprint E5 → #59 E5).
AtomicTrxn
added a commit
that referenced
this pull request
May 17, 2026
- Color Guide HTML version string 3.0 → 3.5 to match the v3.5 spec already in force across the codebase (issue #83, PR #84). - completion-authority.md: "Required tightenings (after this doc lands)" rewritten as "Tightenings (implemented)" with a link to PR #82, since all six tightenings have landed. Issue-ref format updated to current E-series naming (#59 Sprint E5 → #59 E5).
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.
Closes #75. Implements the five tightenings recommended in
docs/architecture/completion-authority.md(landed in #74).Summary
SolveScreen.disposenow flushes the autosave when the puzzle is in a terminal state, backstopping the unawaitedmarkCompleteinSolveNotifier._persistCompletionso a normal screen tear-down still persists the completion tosolve_sessionseven if the markComplete write is still in flight or fails.solve_completion_roundtrip_test.dartdrivesSolveNotifierthrough every terminal status (solved/solvedWithHelp/solvedWithReveal/revealed) against a realSolveRepositoryImpl, disposes the container, then resumes from the same in-memory DB. Locks the inverse-mapping invariant between_deriveCompletionType(notifier) and_statusFromDb(repo)._GatedMarkCompleteRepositoryspy that letsmarkComplete's inner DB writes complete but holds itsFutureopen. The test then triggersresetPuzzleand asserts:puzzle_completionsretains the completion row (append-only)solve_sessions.statusends inin_progress(reset wins the session-row race)SolveStatereflects the resetusedCheck/usedRevealinsolve_sessions_table.dartmarking them as session-state-only inputs toCompletionTypederivation. Reading them post-completion to infer the type is a bug.completionTypeinsolve_sessions_table.dartexplaining the intentional duplication withpuzzle_completions.completion_type(hot read for Archive;puzzle_completionsremains the history authority).Acceptance criteria
flushPendingSaveinvoked on solve-screen dispose when status is terminalusedCheck/usedRevealcompletionTypeduplicationflutter analyzecleanflutter testpasses (328 tests)Test plan
flutter analyze— no issuesflutter test— 328/328 passflutter test test/features/solve/solve_completion_roundtrip_test.dart— 5/5 passOut of scope (per issue)