Skip to content

fix: scope status Applied count to the project's own migrations (#31)#150

Open
alvarogar4 wants to merge 1 commit into
mainfrom
alvaro/chkit-status-applied-scope
Open

fix: scope status Applied count to the project's own migrations (#31)#150
alvarogar4 wants to merge 1 commit into
mainfrom
alvaro/chkit-status-applied-scope

Conversation

@alvarogar4

Copy link
Copy Markdown
Member

Summary

  • status computed Applied from the whole journal table. On a shared ObsessionDB journal that counts other tenants'/projects' rows, so Applied could exceed Total and erode trust in the bookkeeping (audit finding refactor: rename CLI package from @chkit/cli to chkit #31).
  • Scope Applied (and the --json applied field) to migrations present in this project's migrations directory — always an intersection with the local files, so it can never exceed Total.

Test plan

  • New live e2e (status-applied-scope.e2e.test.ts): two independent projects share one journal table; after both apply, project B's status must report applied=1 (its own), not 2.
  • Mutation-checked: reverting to the global count makes the test fail (Applied=2).
  • typecheck + lint pass.

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

🤖 Generated with Claude Code

On a shared ObsessionDB journal table the `Applied` count was read
globally from the journal, counting other tenants'/projects' rows and
sometimes showing `Applied` greater than `Total`. Scope it (and the
--json `applied` field) to migrations present in this project's
migrations directory, so the count is always an intersection and never
exceeds `Total`.

Live-verified against the ObsessionDB test cluster with a two-project
shared-journal e2e test (mutation-checked: fails as Applied=2 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