Skip to content

feat(migrations): declared forward fix for a dependency whose verification failed - #78

Merged
davdxpx merged 1 commit into
mainfrom
feat/forward-fix-dependency
Nov 17, 2026
Merged

davdxpx merged 1 commit into
mainfrom
feat/forward-fix-dependency

Conversation

@davdxpx

@davdxpx davdxpx commented Nov 17, 2026

Copy link
Copy Markdown
Owner

Why

On production, migration.dependencies-verified requires a break-glass grant once a dependency's latest verification has failed. Break-glass activation is refused while OD-21 is open. So the forward fix that failure-and-recovery.md E2 names as the preferred remedy cannot be planned: the fix depends on the failed migration, and the rule blocks it.

Observed on REOSA production (2026-11-14). Bundle 01M76JKS9J8RSPSP0861X70T1P was applied, but its verification failed: service_role received UPDATE from the owner's default privileges. Its forward fix 01M7D3F0E372H8X02M2QX1BFEK is verified on staging, yet the production plan requires break_glass for migration.dependencies-verified. Eleven more bundles are blocked behind the same dependency.

What

  • Request: MigrationPlanRequest.forwardFixFor (1 to 10 migration ids), CLI exponetdb migration plan … --forward-fix-for <id,…>.

  • Planner (forwardFixProblems): each id must meet all of the following, or the plan is refused with VALIDATION_FAILED:

    • the target applied it through ExponetDB and did not revert it;
    • its latest verification on the target is failed;
    • a planned migration names it directly in dependsOn.

    The error codes are not_a_direct_dependency, not_applied, not_failed and baseline. dependenciesVerified() skips exactly the accepted ids, and the plan facts carry forwardFixFor.

  • Rule migration.dependencies-verified version 3: it passes for a declared forward fix and names it, so the approval shows it. Production approval, staging evidence and verify digest, and re-authentication stay unchanged.

  • Not changed:

    • The repaired migration keeps its failed verification until migration.verify passes, so its other dependents stay blocked until then.
    • A dependency that was never verified, the baseline, and one reached only through other migrations stay blocked as before.
    • Re-verifying the dependency inside the forward-fix operation is out of scope (failure-and-recovery.md §3.1, [NON-GOAL]).
  • Docs: failure-and-recovery.md (E2, new §3.1), verification.md, staging-production-policy.md, policy-engine.md, 15-cli/reference.md (regenerated).

Tests

  • packages/migrations-engine/test/baseline-chain.test.ts: the exception applies only to the named dependency; direct dependencies only; passed, never verified, not applied, reverted and baseline are refused. 15 tests pass.
  • packages/policy/test/migration-rules.test.ts: the rule passes and names the fix; without the declaration it still fails; a malformed fact is denied (fail closed). 25 tests pass.
  • apps/cli: 231 tests pass, including the generated reference.
  • Typecheck for migrations-engine, policy, contracts, cli and sdk passes. generate --check, golden:check and biome on the changed files pass.
  • Not run: the full bun run verify with integration and e2e tests against real PostgreSQL. The change involves no PostgreSQL behavior; the planner path is covered by the pure functions.

Rollout

The server has to be deployed for this. The production server currently reports 0.2.0. After the deploy, for REOSA:

  1. exponetdb migration plan 01M7D3F0E372H8X02M2QX1BFEK --stored --target reosa/platform/production --forward-fix-for 01M76JKS9J8RSPSP0861X70T1P, then approve.
  2. exponetdb migration verify 01M76JKS9J8RSPSP0861X70T1P --target reosa/platform/production.

Developed by @davdxpx

…ation failed

On production, rule migration.dependencies-verified asked for a break-glass
grant as soon as a dependency's latest verification failed. Break-glass
activation is refused while OD-21 is open, so the forward fix that
failure-and-recovery.md E2 prescribes could not be planned at all.

A plan may now declare forwardFixFor (CLI: migration plan --forward-fix-for).
The planner accepts the claim only for a migration the target applied through
ExponetDB, not reverted, whose latest verification failed and which a planned
migration names directly in dependsOn; anything else is VALIDATION_FAILED. The
rule (version 3) then passes for exactly those dependencies and names them;
approval, staging evidence and the other requirements stay. The repaired
migration keeps its failed verification until migration.verify passes again.

Owner decision of 2026-11-17.

Developed by @davdxpx
@davdxpx
davdxpx merged commit f7e630c into main Nov 17, 2026
14 of 18 checks passed
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