Skip to content

feat(api): default operator claiming to the operation level#431

Draft
Kiran01bm wants to merge 1 commit into
mainfrom
kiran01bm/operator-claim-operations-default-on
Draft

feat(api): default operator claiming to the operation level#431
Kiran01bm wants to merge 1 commit into
mainfrom
kiran01bm/operator-claim-operations-default-on

Conversation

@Kiran01bm

@Kiran01bm Kiran01bm commented Jun 19, 2026

Copy link
Copy Markdown
Collaborator

What

Make operation-level claiming the default for operator drivers. The
operator_claim_operations setting becomes a tri-state pointer:

  • unset (default) → claim at the apply_operations level via FindNextApplyOperation
  • explicit true → same operation-level path
  • explicit false → fall back to apply-level claiming via FindNextApply

A new ShouldClaimOperations() accessor centralizes the nil-means-on logic.

Why

The operation-level claim path is the foundation for multi-deployment applies.
While every apply still owns exactly one operation, the operation-scoped drive
resolves to the same work as the apply-scoped drive, so flipping the default is
behavior-preserving today while moving all new deployments onto the
multi-deployment-ready path without per-deployment config. The apply-level path
remains available via explicit false for fallback.

Flow

Before — drivers default to apply-level claiming:

                operator_claim_operations unset
                              │
                              ▼
                    ┌──────────────────┐
   driver ─────────▶│  FindNextApply   │  (apply-level claim)
                    └────────┬─────────┘
                             ▼
                    drive whole apply

After — drivers default to operation-level claiming:

                operator_claim_operations unset  ──▶ ShouldClaimOperations() = true
                              │                           explicit false ─┐
                              ▼                                           ▼
                  ┌─────────────────────────┐            ┌──────────────────┐
   driver ───────▶│ FindNextApplyOperation  │            │  FindNextApply   │
                  └───────────┬─────────────┘            └────────┬─────────┘
                              ▼                                    ▼
                  drive per-deployment operation          drive whole apply
                  (multi-deployment ready)                  (fallback)

References

Follow-up in the multi-deployment apply work stream; builds on the
operation-claim drive path landed in #429.

Copilot AI review requested due to automatic review settings June 19, 2026 00:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR flips operator drivers to default to operation-level claiming (via apply_operations / FindNextApplyOperation) by making operator_claim_operations a tri-state *bool and centralizing the nil-means-on behavior in ServerConfig.ShouldClaimOperations(). This aligns the default operator execution path with the multi-deployment-ready operation-scoped driver flow while preserving an explicit fallback to legacy apply-level claiming.

Changes:

  • Change ServerConfig.OperatorClaimOperations from bool to *bool and introduce ShouldClaimOperations() (nil/unset defaults to true).
  • Route operator recovery branching through ShouldClaimOperations() instead of directly reading the config field.
  • Update unit/integration tests to explicitly set operator_claim_operations: false where they require the legacy apply-level claim path, and add config accessor/YAML coverage.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
pkg/api/operator.go Switch operator claiming branch to use config.ShouldClaimOperations() for nil-safe default-on behavior.
pkg/api/handlers_test.go Force legacy apply-level claiming in tests that mock the apply-level claim path.
pkg/api/config.go Convert OperatorClaimOperations to *bool and add ShouldClaimOperations() with default-on semantics.
pkg/api/config_test.go Add unit + YAML tests covering ShouldClaimOperations() defaulting and opt-out behavior.
integration/workflow_test.go Update integration test server config construction for the new *bool field type.
integration/operator_test.go Explicitly select apply-level claiming for the stale-apply scenario that requires it.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Make operation-level claiming (FindNextApplyOperation) the default so new
deployments adopt the multi-deployment-ready drive path without explicit
config. operator_claim_operations is now a tri-state pointer: unset means
operation-level, explicit false preserves apply-level claiming.
@Kiran01bm Kiran01bm force-pushed the kiran01bm/operator-claim-operations-default-on branch from 5d11a1d to 03af67a Compare June 20, 2026 02:48
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.

2 participants