apiVersion: ops.aiwg.io/v1
kind: OpsCapability
metadata:
  name: bt6-release-readiness-flow
  labels:
    category: release-management
    scope: cross-repository
  annotations:
    blast-radius: "repository-local repairs only; tagging and publication are out of scope"
spec:
  description: Audit and harden an untagged candidate from the bounded PR bar to the exhaustive BT6 release bar.
  version: "0.3.0"
  inputs:
    - name: candidate
      type: string
      required: true
      description: Exact candidate commit to harden.
    - name: comparison_base
      type: string
      required: true
      description: Previous release or configured exact base used to inventory merged change.
  outputs:
    - name: gap_inventory
      type: list
      description: Failed gates, coverage regressions, untested behavior, and unavailable evidence.
    - name: repairs
      type: list
      description: Authorized code, test, documentation, and policy corrections with verification.
    - name: decision
      type: string
      description: ready-to-tag, not-ready, or hold.
  target_requirements:
    os: [linux, macos]
    capabilities: [git]
  agent: bt6-release-integrator
  idempotent: true
  steps:
    - name: resolve-candidate
      description: Bind repository authority, candidate, comparison base, profile, and authorization.
    - name: inventory-merged-risk
      description: Map merged production changes to relevant tests, owners, public contracts, and risk surfaces.
    - name: run-pre-tag-gates
      description: Run the full locally applicable release suite, coverage, quality-depth, packaging, and integrity checks.
    - name: repair-gaps
      description: Add outcome-oriented tests and correct underlying implementation or policy defects without weakening thresholds.
    - name: rerun-complete-gate
      description: Re-run focused checks and then the complete applicable pre-tag suite.
    - name: decide
      description: Declare ready-to-tag only with green pre-tag evidence; exact-tag validation remains mandatory.
  verification:
    command: "git rev-parse --verify <candidate>^{commit} >/dev/null"
    expect: "report binds the gap inventory, repairs, and final evidence to the exact candidate and comparison base"
