feat(ci): gate trusted pipeline environment provisioning by phase

AG
5h ago
+288-2

Adds a manual-only Infra plan/apply path for the pinned github-trusted-pipeline-ci root. Plan identity, run attempt, workflow, phase, input version, commit and digest are verified before apply. The phase gate and target preflight run twice. The environment and sealed bindings require separate plans and protected credentials.

Offline verification: three fixture tests (including negative cases), existing hosted runner smoke suite and shell syntax checks. No workflow dispatch or infrastructure changes performed. Requires protected environment setup, private backend and sealed inputs. Code review only, held pending exact-head review and CI.


Prove it works
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.


Summary by cubic

Adds a manual-only Infra plan/apply path for the pinned github-trusted-pipeline-ci root with phase-gated provisioning. Plan identity, run attempt, workflow, phase, input version, commit, and digest are verified before apply.

  • New trusted-pipeline-provision.yml workflow with separate plan/apply jobs, both restricted to main, using distinct protected environments.
  • trusted-pipeline-gate.py enforces an exact per-phase plan shape and values; trusted-pipeline-preflight.sh checks live target state before plan and apply.
  • session-pipeline-ci.sh gains trusted-environment and trusted-bindings targets; apply also requires independent review and no admin bypass.
  • Offline fixture tests cover positive and negative gate cases; existing hosted runner smoke suite and shell checks pass.

Migration

  • Requires separately configured protected environments, private backend, OIDC roles, and a scoped TARGET_REPOSITORY_TOKEN.
  • Plan and bindings phases must be run separately with sealed inputs; no workflow dispatch or infra changes performed.