Skip to content

core: validate rows read in briefing, hygiene and commands per the row convention #1368

Open

Description

@schlessera

Part of #1344.

Context

Core asserts row types instead of checking them: 124 single-line .get()/.all() ... as T casts in 32 files under packages/core/src at main d79eeed0a (the same count #1367 records). No as any remains on a core database read.

When this was filed, briefing read rows as any[] inside the command (packages/core/src/cli/commands/briefing.ts:220-295 at 572dd6d28). #1353 / PR #3293 (squash 003576188) moved that SQL out of the CLI, so the as any[] reads became typed but unchecked as T casts in packages/core/src/lib/briefing-reads.ts:

  • focusLinkedDocuments, packages/core/src/lib/briefing-reads.ts:18-28 (as FocusLinkedDocument[])
  • upcomingDeadlines, packages/core/src/lib/briefing-reads.ts:39-47 (as DeadlineRow[])
  • overdueReviewRows, packages/core/src/lib/briefing-reads.ts:57-65 (as OverdueReviewRow[])
  • documentUpdated, packages/core/src/lib/briefing-reads.ts:68-71 (as { updated: string | null } | null)

Hygiene's shared silent-edit query has the same shape (silentEdits, packages/core/src/lib/hygiene.ts:416-427, as SilentEdit[]). CLI commands no longer hold SQL. The largest remaining groups are packages/core/src/lib/db.ts (21), search-engine.ts (12), indexer/persist.ts (9) and stats.ts (8).

Blocked by #1367

Scope

Out of scope

Acceptance criteria

Verification

bun run test ./packages/core
git grep -n -E '\.(all|get)\([^)]*\) as ' -- packages/core/src

The grep's remaining hits are each an exemption the decision record names. Keep a failing-first receipt for the skewed-row test.

Contract impact

None. A malformed row in a disposable index fails typed instead of flowing on; supported result shapes are unchanged.

2026-10-09: sequenced against the other code-quality issues to avoid overlapping edits; see the epic's planned-order comment.

2026-10-09 triage at main 572dd6d285a2daaa27a6dea9c84d3d170425a001: verified the cited database-read casts and complete migration brief. #1367 owns the measured convention deliverable; migration follows that output rather than choosing a competing convention. #1353 must first move CLI SQL into its shared library owner. Added agent-ready while preserving blocked; implementation remains unpickable until the declared outputs are delivered. No migration or runtime proof is claimed by this triage.

2026-11-10 triage at main d79eeed0a: #1353 is closed as completed through PR #3293 (squash 003576188, on main), so its Blocked by line moved here as history. The briefing citation was re-anchored to briefing-reads.ts by named anchor, and the scope now names the unchecked as T casts the move left, since no as any row read remains. #1367 is still open, so blocked stays.

Activity

  1. added
    type: refactor
    area: core
    priority: p3
    blocked
    on Oct 9, 2026
  2. added
    agent-ready
    on Oct 9, 2026
  3. schlessera commented on Nov 10, 2026

    @schlessera
    OwnerAuthor

    2026-11-10 triage at main d79eeed0a: the body is re-anchored. #1353 / PR #3293 (squash 003576188) moved briefing's as any[] reads out of briefing.ts into packages/core/src/lib/briefing-reads.ts. There they became unchecked as T casts (focusLinkedDocuments, upcomingDeadlines, overdueReviewRows, documentUpdated), and hygiene's silentEdits has the same shape. No as any row read remains in core, so the scope and acceptance criteria now target the 124 unchecked .get()/.all() ... as T casts in core, starting with those reads, with #1367's documented exemptions allowed. ui-server's casts are out of scope. #1353 is satisfied and moved to history. #1367 is still open, so blocked stays, and so does priority: p3 (#1367 is p3, which meets the blocker rule). Labels are unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readyarea: coreblockedpriority: p3type: refactor

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions