Skip to content

fix: don't silently skip unmarked migrations under --table (#36)#151

Open
alvarogar4 wants to merge 1 commit into
mainfrom
alvaro/chkit-table-scope-unmarked
Open

fix: don't silently skip unmarked migrations under --table (#36)#151
alvarogar4 wants to merge 1 commit into
mainfrom
alvaro/chkit-table-scope-unmarked

Conversation

@alvarogar4

Copy link
Copy Markdown
Member

Summary

  • migrate --apply --table <t> decided scope by parsing -- operation: markers. A hand-written migration with no markers was treated as affecting no tables and silently skipped, so the user believed all pending work had applied — a quiet correctness gap (audit finding fix: create database in e2e fixture to prevent flaky tests #36).
  • Fail-safe: such migrations are now included under --table and reported — a warning in human output, and a new undeterminedMigrations array in --json output. Documented in cli/migrate.md.

Test plan

  • New live e2e (table-scope-unmarked.e2e.test.ts): an unmarked migration applied under --table actually creates its table and appears in undeterminedMigrations.
  • Mutation-checked: reverting the fix makes the field absent and the table is never created.
  • typecheck + lint pass.

Part of NUM-7318 (Tier-3 safety/resilience polish). 2 of 4: #36.

🤖 Generated with Claude Code

`migrate --apply --table <t>` parsed `-- operation:` markers to decide
which pending migrations affect the selected tables. A hand-written
migration with no markers was treated as affecting no tables and
silently skipped, so the user believed all pending work had applied — a
quiet correctness gap.

Fail-safe: include migrations whose target tables can't be determined,
and surface them — a warning in human output and a new
`undeterminedMigrations` array in `--json` output. Documented in
cli/migrate.md.

Live-verified against the ObsessionDB test cluster (unmarked migration
is applied under --table and its table created; mutation-checked: the
field is absent and the table is never created without the fix).

Refs NUM-7318.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Vs5ZySdFPLkAz33L1TEEZk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant