Skip to content

Prototype durable recovery for failed ordinary-run rewrites - #6262

Draft
mday-io wants to merge 1 commit into
SQLMesh:mainfrom
mday-io:prototype/ordinary-run-rewrite-recovery
Draft

mday-io wants to merge 1 commit into
SQLMesh:mainfrom
mday-io:prototype/ordinary-run-rewrite-recovery

Conversation

@mday-io

@mday-io mday-io commented Nov 25, 2026

Copy link
Copy Markdown
Collaborator

Description

A failed ordinary-run lookback rewrite can delete rows while retaining successful interval coverage. A later run can skip the damaged range and propagate the gap downstream. Related to #5843.

This prototype saves owned rewrite attempts separately in the native state DB. Confirmed local failures repair their exact ranges before downstream evaluation. Uncertain writes or executor death leave a durable hold that blocks subsequent protected runs.

This is a draft for design discussion, based on v0.236.4. Current main has scheduler changes that require integration. It is not ready to merge or use in production.

The opt-in prototype supports PostgreSQL state and existing SQL time-range tables in one persistent local DuckDB warehouse. It uses scratch tables without a release migration and requires the janitor to be skipped. Protected plans and lifecycle operations are refused. Remote engines, crash adoption, fencing, and timeout takeover remain unimplemented. Raw adapter SQL and older clients are outside protection.

See the scope and reproduction guide.

Test Plan

  • All 32 focused tests passed from this checkout with private PostgreSQL and DuckDB, including ownership races, completion rollback, repair ordering, uncertain writes, retained evaluators, and CLI exits.
  • Changed-file Ruff checks and whitespace checks passed. The eight native files match the independently reviewed prototype.
  • Integrate and validate against current main.
  • Run the full upstream suites and whole-project style/type checks.

Checklist

  • I have run make style and fixed any issues
  • I have added tests for my changes (if applicable)
  • All existing tests pass (make fast-test)
  • My commits are signed off (git commit -s) per the DCO
Signed-off-by: Michael Day <mdaytn@gmail.com>
@coderabbitai

coderabbitai Bot commented Nov 25, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

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

Labels

None yet

1 participant