Skip to content

feat(config): gate MySQL-only features for postgres targets - #993

Merged
Kiran01bm merged 2 commits into
mainfrom
kiran01bm/pg-capability-gating
Aug 11, 2026
Merged

feat(config): gate MySQL-only features for postgres targets#993
Kiran01bm merged 2 commits into
mainfrom
kiran01bm/pg-capability-gating

Conversation

@Kiran01bm

@Kiran01bm Kiran01bm commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator

Summary

Gates deferred cutover — a MySQL-dialect feature — at apply request time with a typed, named-feature rejection instead of the generic no-engine failure that postgres targets previously fell through to. Also corrects Strata's advertised capability: it never executed deferred cutover, so it no longer claims it. MySQL and Vitess behavior is unchanged.

What

  • pkg/schema/dialect.go: SupportsFeature(databaseType, feature) — deferred cutover is supported by MySQL and Vitess only; unknown database types and unknown features fail closed.
  • pkg/api/plan_handlers.go: apply queueing rejects a deferred-cutover request against an unsupported target with a typed UnsupportedFeatureError, translated to HTTP 400 invalid_request naming the feature and database (previously a 500). Span status, apply metric, and triage log context are recorded on rejection.
  • pkg/webhook: the apply PR comment renders the actionable named-feature message instead of a generic failure.
  • Deliberately no config-time gate: pending drops is global server behavior, not a per-apply option — gating it at config validation would fail startup for existing mixed-type configs that never exercise it against postgres. Its gate belongs with the postgres engine work, where the feature is actually executed.

Why

Deferred cutover is a semantic of the Spirit/MySQL engine (gh-ost-style cutover deferral); it has no meaning for the planned Postgres engine's native path. Until the feature has a Postgres design of its own, the honest behavior is an explicit "not supported for this database type" at the earliest point the intent is visible — the apply request — not a generic routing error at execution time. The gate is additive: no engine exists for postgres yet, so nothing that works today changes.

Before                                  After

apply --defer-cutover                   apply --defer-cutover
  on postgres target                      on postgres/strata target
        │                                       │
        ▼                                       ▼
queue → execute → "no engine"           queue-time capability check
        → HTTP 500, generic error               │
        → PR comment: opaque failure            ▼
                                        UnsupportedFeatureError
                                        → HTTP 400 invalid_request,
                                          names feature + database
                                        → PR comment: actionable message

Copilot AI lite review requested due to automatic review settings August 10, 2026 04:20

Copilot AI 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.

Pull request overview

Adds explicit gating for MySQL-dialect-only features (pending drops, deferred cutover) so Postgres targets fail early with a named-feature error rather than falling through to a generic “no engine” style failure.

Changes:

  • Introduces schema.SupportsFeature(databaseType, feature) and Feature identifiers to centralize dialect feature support checks.
  • Adds validateDatabaseFeatures(...) and hooks it into server config validation and apply queueing.
  • Expands tests to cover the new feature predicate and validation behavior.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
pkg/schema/dialect.go Adds feature identifiers and a predicate to check feature support per database type/dialect.
pkg/schema/dialect_test.go Adds unit coverage for SupportsFeature across supported/unsupported database types/features.
pkg/api/plan_handlers.go Adds apply-time gating for unsupported feature usage based on plan/request options.
pkg/api/config.go Adds config-time validation helper to reject unsupported feature + database type combinations.
pkg/api/config_test.go Updates config validation coverage and adds tests for validateDatabaseFeatures.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread pkg/api/plan_handlers.go
Comment thread pkg/api/config.go Outdated
Comment thread pkg/api/config_test.go Outdated
Pending drops and deferred cutover are Spirit/MySQL semantics. Fail
closed with a named-feature error at config validation and apply
request time for postgres databases instead of the generic no-engine
error. MySQL and Vitess behavior is unchanged.
Scope feature checks to apply options so existing PostgreSQL configs remain valid.
@Kiran01bm
Kiran01bm force-pushed the kiran01bm/pg-capability-gating branch from 5824604 to c384cea Compare August 10, 2026 08:00
@Kiran01bm
Kiran01bm marked this pull request as ready for review August 10, 2026 08:21
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@Kiran01bm
Kiran01bm merged commit 50d0b5a into main Aug 11, 2026
32 checks passed
@Kiran01bm
Kiran01bm deleted the kiran01bm/pg-capability-gating branch August 11, 2026 00:29
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.

3 participants