chore: add row types to mission/store.ts + assertion budget test (AC-491)#592
Merged
jayscambler merged 2 commits intomainfrom Mar 31, 2026
Merged
chore: add row types to mission/store.ts + assertion budget test (AC-491)#592jayscambler merged 2 commits intomainfrom
jayscambler merged 2 commits intomainfrom
Conversation
…491) Added typed row interfaces (MissionRow, StepRow, SubgoalRow, VerificationRow) and mapper functions (missionFromRow, stepFromRow, subgoalFromRow) to mission/store.ts, replacing inline 'as string'/'as number' casts. mission/store.ts: 45 → 31 assertions (31% reduction) TDD: Added type-assertions.test.ts with 3 budget tests: - Total assertion count stays under 520 (baseline enforcement) - mission/store.ts stays under 35 assertions - storage/index.ts stays under 25 assertions 2 files changed, 148 insertions, 24 deletions
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.
Summary
Added typed SQLite row interfaces and mapper functions to
mission/store.ts, reducing inline type assertions from 45 to 31. Added a budget test to prevent regression.Problem
mission/store.tshad 45 type assertions (as string,as number) becausebetter-sqlite3returnsunknownfor row values. Each query result was manually cast field-by-field.Changes
Row types added to
mission/store.tsMissionRow,StepRow,SubgoalRow,VerificationRow— typed interfaces for SQLite query resultsmissionFromRow(),stepFromRow(),subgoalFromRow()— mapper functions replacing inline castsBudget test (
type-assertions.test.ts)3 contract tests to prevent assertion count regression:
mission/store.ts≤ 35storage/index.ts≤ 25Verification
tsc --noEmit— zero errorsvitest run tests/type-assertions.test.ts— 3 passedIssue
Partially resolves AC-491