Skip to content

core: move raw SQL out of CLI commands and keep one silent-edit query #1353

Closed

Description

@schlessera

Part of #1341.

Context

Delivered prerequisite outputs: #1349. Their output references remain relevant, but they are no longer active blockers.

Five command files run SQL directly: packages/core/src/cli/commands/accept-mtime.ts:20-33, briefing.ts:220-295, doctor.ts:318, eval.ts, tags.ts. The silent-edit query exists twice with different column lists and ordering (packages/core/src/cli/commands/briefing.ts:286-295, silentEdits at packages/core/src/lib/hygiene.ts:383-392).

Scope

  • Move each statement into a named function under packages/core/src/lib/ (or queries/ where it is a supported read).
  • Briefing uses silentEdits (with a limit option) instead of its own query.

Out of scope

  • Row validation (E4).
  • Changing what briefing or doctor print.

Acceptance criteria

  • No file under packages/core/src/cli/commands/ calls .prepare(, .query( or .run( on a database handle; a lint or test enforces it.
  • One silent-edit query; briefing's output on the fixture corpus is unchanged.

Verification

bun run test packages/core
bun run lint

Contract impact

None.

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

Updated 2026-10-12: removed completed blocker declarations, retained delivered-output context and all remaining prerequisites; readiness and existing rulings preserved.

Activity

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

    @schlessera
    OwnerAuthor

    Unblocked: #1349 merged in #1468 (62cf4d6), its only listed blocker.

  4. self-assigned this
    on Nov 2, 2026
  5. schlessera commented on Nov 2, 2026

    @schlessera
    OwnerAuthor

    Claimed (claim-1341-1353-b6cc1a1f) as part of the #1341 integration lane. Branch refactor/1353-cli-sql-extraction, targeting the epic integration branch epic/1341-shared-core-ops; the epic branch merges into main in one go once every ready child has landed there. Collision report: open PR #3288 also edits packages/core/src/lib/hygiene.ts; whichever lands second rebases. #1352 also touches briefing.ts (different lines).

  6. added this to the 0.45.0 milestone on Nov 3, 2026
  7. schlessera commented on Nov 3, 2026

    @schlessera
    OwnerAuthor

    Delivered on main by the epic #1341 landing, #3505: merge commit 06473ef31, parents 559fe7b41 (main) and bd2decac7 (epic tip). This issue's change is #3293, squashed into the epic branch as 003576188 after passing ready proof on its exact head against the epic tip. The acceptance criteria and failing-first/mutation receipts are in that PR. Milestone 0.45.0. Closing manually: closing keywords do not fire for PRs that target a non-default branch.

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

Metadata

Metadata

Assignees

Labels

agent-readyarea: corepriority: p3type: refactor

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions