← Back to Pull requests

refactor: persist structured version profiles on fleet rollouts #7399

Closed
unknown closed this pull request without merging on Oct 08, 2026 02:53 UTC
View on GitHub
unknown unknown commented on Oct 07, 2026 00:13 UTC
Author

Why

Fleet rollout documents currently encode their minor version and channel group only in the resource name. Persisting that identity explicitly lets later consumers use structured fields without coupling their behavior changes to a storage migration.

This extracts the storage foundation from #7332, following the rollout implementation in #6577. No separate tracking ticket exists for this extraction; it isolates the schema and migration work for independent review.

Scope

  • Add ControlPlaneVersionRollout.Spec.Version using the existing coreapi.VersionProfile type.

  • Populate the field when the existing cluster-watching seeder creates a rollout. Preserve its cached existence checks, triggers, skips, and create-conflict handling.

  • Normalize absent legacy profiles at the shared Cosmos read boundary and require name/profile agreement on writes. Reuse the previously accepted canonical channel-name format without adding support-floor policy.

  • Consolidate existing channel-name parsing on the shared profile-returning helper; keep document validation in the validation package.

  • Add the independent backend CosmosRolloutVersionMigration controller using the existing rollout watcher, five workers, and five-minute resync/cooldown.

  • Update migration tests, integration-test wiring, and lifecycle documentation.
  • Existing rollout consumers continue using channel names. There are no changes to selection, assignment, cluster validation, public APIs, discovery, catalog publication, retirement, generic controller abstractions, or the subscription migration controller. No pipeline, IAM, or physical-container changes.

    Migration Contract

  • Reads populate legacy profiles in memory without writing Cosmos, so existing readers and writers work before persistence completes.

  • Migration performs a live Get and validated ETag-protected Replace, preserving selection and rollout status. Conflict retries re-read; missing/deleted documents are not recreated.

  • Each rollout key is marked complete only after successful replacement, once per process. Failed keys use normal queue retries; already-structured documents are also rewritten once.

  • An old binary can subsequently remove the new field. Reads remain compatible, but durable persistence requires old writers to stop and an ordinary write or migration after restart to persist it again.
  • Verification

  • Repository-wide make lint-fix and make lint passed with GOFLAGS=-p=2 to stay within local temporary-storage limits.

  • Race-enabled tests passed for Fleet helpers, Cosmos conversion/storage mocks, validation, rollout controllers, migration, backend registration, and integration mutation helpers.

  • Tests cover raw legacy reads versus persisted migration, ordinary writers preserving the profile, ETag conflicts, deletion/tombstones, per-key completion, and late old-format writes.

  • Security and functional diff reviewed; git diff --check passed.

  • Full repository tests, live Cosmos integration tests, and E2E were not run for this standalone branch.
  • Suggested reviewer: @deads2k for migration and rollout lifecycle.

    Commit Guide

    1. b4ed12e35 Structured profile, conversion, creation, and migration implementation, with focused boundary tests.
    2. c44e1d7fc Separate migration-controller tests. The commit explains the existing subscription-test precedent and the additional persistence, conflict, deletion, and per-key completion coverage.
    3. d2c4601b2 Separate current-writer/legacy-document test. The commit explains its limited cross-layer value and overlap with conversion and existing writer tests. It tests current binaries on old documents, not old binaries.

    The two additional test commits can be reviewed or dropped independently of the implementation.

    Checklist

  • Single schema/migration concern; existing consumer behavior unchanged

  • Related work linked and motivation explained

  • Focused tests and lint passed

  • Documentation updated and self-reviewed

  • CI checks passing

  • Human review
  • Diff: 505 lines (+378 / -127) across 6 files Reviewer: deads2k Review duration: 1600m
    All Vouch review confidence checks passed
    Residual risk 0.21 = Change Risk (0.48) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.48 · 505 lines diff across 6 files
    0.48
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.373
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #7399"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 47.6% (MEDIUM) · Higher = larger blast radius
    47.6%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 20.6% · Safe to merge
    20.6%
    Repository