Skip to content

feat(migrations): freeze cumulative schema drafts at release - #2713

Merged
AlexStocks merged 22 commits into
masterfrom
codex/cumulative-schema-migration
Nov 20, 2026
Merged

AlexStocks merged 22 commits into
masterfrom
codex/cumulative-schema-migration

Conversation

@Zxf-xufeng

@Zxf-xufeng Zxf-xufeng commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Which issue or RFC does this PR close?

Refs #2673, #2692 and RFC #1771.

Rationale for this change

Schema-changing PRs contribute to one shared unpublished 000 migration. Each merged result is validated before release preparation freezes that cumulative migration as v<major>_<minor>_<patch>. This avoids assigning a new revision per PR and avoids assembling independent SQL files at publication time.

Only supported released-version upgrades are promised. Development databases and recovery plans created by mutable 000 must be rebuilt when it changes or freezes; no development-to-release compatibility bridge or stamp operation is provided.

What changes are included in this PR?

  • Add make schema-check, make schema-freeze VERSION=X.Y.Z, and make schema-release-check.
  • Validate matching SQLite/native linear chains and consistent heads across registered Server source overlays. PR CI compares frozen scripts, native scripts, fingerprints and revision resource checksums with the PR base. Newly frozen revision names must match the declared release target.
  • Freeze the shared draft only after both release declarations match VERSION. Stage and validate the transformed bundle before writing; rename draft-owned resource paths and literal identity/path references, preserve SQL and data defaults, reject collisions and preserve historical revision checksums. Refresh the persistence digest without treating it as upgrade acceptance. With no draft, freezing is a no-op.
  • Replay the registered SQLite source paths, with and without vectors, in CI preflight. Keep installed-release acceptance in the existing selected upgrade jobs and include the new tooling in CI selection.
  • Reject mutable drafts in release source checks and the actual wheel. Publication staging checks the wheel even for the explicit new-database-only upgrade bypass.
  • Parse frozen vX_Y_Z names while preserving legacy sequence names and PR-based names. 000 has no software version; both draft and frozen cumulative names have a null sequence.
  • Fall back to the alternate Maven Central endpoint when OpenAPI Generator downloads fail after bounded retries, while preserving the pinned version and mandatory SHA-256 verification.
  • Give the statistics persistence/restart acceptance flow explicit test-only accounting budgets so slow CI writes can settle; retain exact inventory/usage assertions and production timeout defaults.
  • Document development, conversion of open schema PRs, merge validation, disposable development databases, release freezing and the next development cycle in AGENTS.md and both migration guides.

Are there any user-facing changes?

New schema work uses server_resources/versions/000.py and the corresponding native entry plus registered snapshots, data tasks and recovery resources. After make version-bump VERSION=X.Y.Z, the release PR runs make schema-freeze VERSION=X.Y.Z, reviews compatibility and release notes, and validates the final artifacts.

Existing production scripts, frozen resources, database IDs and plans are unchanged; the current registered Server head remains v1_5_2_pr2639, following v1_5_0_005. This PR adds no empty production draft because it introduces no storage change. Development upgrades between different contents of 000 are explicitly unsupported.

GitHub required-check and up-to-date-branch/merge-queue settings must be configured by repository administrators; this PR does not change branch protection. Existing PR installed-release acceptance selects SQLite; native acceptance remains scheduled/manual and release-gated.

Transition and merge coordination

This policy can merge before an open schema PR such as #2674. After updating against master containing this policy, that PR must fold its unpublished v1_5_2_pr2674 changes into the existing shared 000, or create 000 after the latest frozen head if absent. Keep only changes not already in master, reconcile SQL order and dependencies, replace the superseded unpublished SQLite/native entries, and update resource names, manifests, fingerprints, checkpoints, domain tasks and source/vector/Code registrations together. Rebuild development databases and plans created from the unpublished revision, then run baseline comparison, migration tests and selected upgrade acceptance on the merged result before merging.

Legacy revisions already in the master baseline, including v1_5_2_pr2639, retain their IDs, resources and dependencies. If a legacy revision was merged before policy adoption, it is protected baseline history. Published revisions must never be renamed to 000. PR opening dates grant no exemption: the gate continues to accept only the shared draft or its release-frozen identity as new revisions. No merge-first requirement or revision-name allowlist is introduced. AGENTS.md and both migration guides document this transition; release PRs freeze the cumulative draft normally.

How was this change tested?

  • uv run --locked pytest tests/test_release_version.py tests/test_schema_release.py tests/test_schema_draft.py -q — 50 passed.
  • uv run --locked prek run --files AGENTS.md docs/en/docs/operate/database-migrations.md docs/zh/docs/operate/database-migrations.md — passed, including type checks.
  • node --test desktop/scripts/prepare-openapi-generator.test.mjs — 8 passed, including primary 404/429 fallback, checksum rejection and cleanup when both endpoints fail.
  • Targeted Prettier, oxlint and pre-commit checks for the generator scripts — passed.
  • uv run --locked pytest tests/e2e/test_statistics_flow.py tests/builtin/runtime/test_model_usage_recorder.py -q — 42 passed, 2 skipped.
  • A local 1.2-second delayed-write probe reproduced the statistics count failure with default budgets and passed with the explicit acceptance-test budgets; this probe verifies local timing behavior, not an external database.
  • git diff --check — passed.
  • Full CI run 44554897502 passed on 0ca58ec14, including all Python test versions, website checks and selected SQLite installed-release upgrade acceptance. CI for the current head, including the generator download fallback and statistics acceptance budget, is tracked on this PR.

Regression coverage executes real SQLite SQL before and after freezing, preserves historical rows and literal 000 defaults, validates source overlays and native checkpoint registrations, rejects historical resource changes and collisions, rejects mutable drafts in wheels, rejects empty baseline arguments, and exercises reuse of 000 in the next development cycle. Native layout checks verify registration consistency; they do not establish live seekDB/OceanBase upgrade acceptance. Branch protection still requires repository administration.

AI usage statement

OpenAI Codex assisted with implementation, documentation, regression tests and local review. Executed checks and remaining validation limits are listed above.

@AlexStocks AlexStocks added the 1.6.0 v1.6.0 release tracking label Nov 18, 2026

@AlexStocks AlexStocks left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查了 5ce729af。本地跑过:schema_release.py check exit 0、check --release exit 0、check --base-ref f6eed7d0 exit 0,pytest tests/test_schema_release.py tests/test_schema_draft.py 33 passed,upgrade_release_gate.py exit 0;preserve_history 用变异测试验证过有效(往 v1_5_0_005_plugin_interfaces.py 追加内容 → 报 Frozen migration resources changed: server/v1_5_0_005、exit 1),check_release_wheel 也确实接在了 run_upgrade_release_gate.py 与 upgrade_release_gate.py 两处。整体方向没问题。

下面一条是门禁本身的 fail-open 缺口。另外提请作者注意:本 PR 当前 mergeable = dirty(与 master 有冲突),CI 的 CI result / script-installation / installation (macos-latest) 还是红的,需要先解决冲突再重跑一次。

Comment thread scripts/schema_release.py Resolved
…hema-migration

# Conflicts:
#	docs/en/docs/operate/database-migrations.md
#	docs/zh/docs/operate/database-migrations.md
#	release/upgrade-support.json
Comment thread scripts/schema_release.py Resolved
Comment thread scripts/schema_release.py Resolved
@AlexStocks
AlexStocks merged commit 6763b07 into master Nov 20, 2026
13 checks passed
@Zxf-xufeng
Zxf-xufeng deleted the codex/cumulative-schema-migration branch November 20, 2026 07:09
@hidb4ai

hidb4ai commented Nov 25, 2026

Copy link
Copy Markdown
Contributor

Post-merge validation note for e0bf754: the empty-baseline and native-checkpoint findings are fixed, but the final-head Main run is not green. The vector upgrade job failed while uploading evidence (Failed to CreateArtifact: ECONNRESET), and the matrix verifier subsequently reported missing case results. Other failures include installer downloads and Helm TLS errors. These logs do not establish a migration-code regression, but they also do not provide complete final-artifact acceptance. Please rerun the affected checks and retain the complete upgrade evidence before relying on this run as release qualification.

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

Labels

1.6.0 v1.6.0 release tracking

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants