Skip to content

deploy(listen): take the Listen image by digest (image_reference) (SCA-4091) - #26730

Merged
Git-on-my-level merged 2 commits into
mainfrom
lane/sca4091-image-reference
Nov 29, 2026
Merged

Git-on-my-level merged 2 commits into
mainfrom
lane/sca4091-image-reference

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Nov 29, 2026 •

Copy link
Copy Markdown
Member

What changed and why

The Listen Helm workflow (gcp_backend_listen_helm.yml, an existing workflow) gains an opt-in, prod-only image_reference dispatch input: one gcr.io/<project>/backend@sha256:<digest> reference, in place of image_tag. The release tooling dispatches Listen with image_reference and refuses a workflow that lacks it, so today it cannot dispatch an image-plus-chart Listen roll (SCA-4091, SCA-5350).

What each input does in mode=deploy:

Dispatch Listen NEG coverage exporter
both blank unchanged: keeps the running tag or digest, same Helm argv unchanged: not deployed
image_tag unchanged: same checks, same Helm argv (image.tag=<sha7>) deployed by the digest that tag resolves to (was: by the tag)
image_reference new: image.digest=<digest> deployed by the same digest
both refused before checkout not reached

Rules for image_reference:

  • Before checkout or credentials (first step): the environment must be prod, it must be exactly gcr.io/<project>/backend@sha256:<64 hex>, and image_tag must be blank. rollback and private-env-migrate refuse it. evidence and image-only take it only when it equals the image their request already names; a tag-bound evidence request leaves it blank.
  • Before any mutation (the existing resolve step): it must be this deploy's own Listen repository, and its org.opencontainers.image.revision label must name a cohort-aware commit the checked-out source contains. These are the checks the kept-digest lane already applies. The commit then takes the explicit image_tag path, so prod still admits only ancestors of main and the Firestore index gate runs on that commit.
  • The step logs Deploying image digest <reference>, which the release tooling reads back from the run.

Supporting changes:

  • listen_overlay_evidence.py argv takes --image-reference (one full reference) and passes the tag or digest to helm_args. helm_args and the statement that calls it are untouched, so tag and kept-image runs build the same argv as before.
  • The evidence job no longer counts image_reference among the bound dispatch inputs (GitHub adds every declared input to the event); it must be blank or the request's image.
  • The exporter chart accepts image.digest, like the Listen chart. With no digest it still requires image.tag.
  • ci-budget.yaml: trigger inventory refreshed, one bookkeeping minute per job, rationales updated.

Four things a reviewer should know:

  • The exporter moves from tag to digest on the image_tag path. The predeploy drift gate models a workflow with an image_reference input as pinning both Listen and the exporter by digest, and refuses anything else. The digest is the one the tag resolves to in the resolve step, so it is the same image.
  • reviewed_scripts_tree is not updated. The pin in "Verify staged evidence scripts before Python" (686d4a44) already differs from .github/scripts on main (a7b1d1f6), and this PR changes that tree again. It gates only evidence runs for an image-only request. Whoever next uses that route needs to review and re-pin it.
  • Development refuses image_reference. Only prod's chart-only lane keeps a serving digest. A digest on development would make the next chart-only or automatic chart run fail until a tag is deployed again.
  • A development dispatch whose branch does not contain this change fails at the Helm dry-run step. The workflow now calls the argv builder with --image-reference, and the builder comes from the checked-out branch. Rebase the branch on main. Prod always checks out main. The builder line is the one the release drift gate expects, so it is not passed both ways.

Product invariants affected

  • INV-DATA-1: the workflow is on this invariant's path list. No routing authority changes: the workflow, cluster, namespace, release names and image repository are the same.

How it was verified

Not dispatched: no workflow run was started, so nothing here was exercised on a GitHub runner or against a cluster.

  • The first step and the resolve step were run as real bash against stubbed git, gcloud, kubectl and docker (test_listen_overlay_workflow.py, test_workflow_contracts.py): admitted digest, both inputs, development, wrong project, wrong image, tag-form reference, short digest, trailing text, missing or short label, commit not contained, pre-cohort commit, wrong mode, and a reference that differs from the request's image.
  • helm template on the exporter chart: digest form, tag form, and neither (refused).
  • listen_overlay_evidence.py argv --image-reference <ref> writes the same argv as --image-tag <pin> for a tag and for a digest. The Helm dry-run step was run as real bash through the real builder against a stub helm, once with a digest and once with a tag.
  • The release tooling's own checks, run against this commit from the tooling repository's main: the digest-input check accepts it and refuses origin/main; the drift gate's workflow qualification passes for backend-listen and neg-coverage-exporter, including its pinned hash of helm_args; its chart render produces gcr.io/based-hardware/backend@sha256:… for both charts and still renders a kept tag.
  • actionlint on the workflow, check_ci_budget.py, and the pre-push hook.

Tests

  • backend/tests/unit/test_listen_overlay_workflow.py: pre-checkout validation per mode and environment, evidence and image-only binding.
  • backend/tests/unit/test_workflow_contracts.py: digest admission and refusals in the resolve step, exporter digest from an explicit tag, exporter job pinned by digest only, dry-run step argv for a digest and a tag.
  • backend/tests/unit/test_listen_overlay_evidence.py: --image-reference argv equivalence and refusals, evidence dispatch binding.
  • backend/tests/unit/test_neg_coverage_exporter.py: chart image by digest and by tag.

UI evidence

UI-Evidence: none -- workflow, deploy script and chart change only

🤖 Generated with Claude Code

…A-4091)

The Listen Helm workflow gains an opt-in image_reference dispatch input:
one gcr.io/<project>/backend@sha256:<digest> reference, in place of
image_tag. The release tooling dispatches Listen with image_reference and
refuses a workflow that lacks it.

- Refused before checkout unless it is exactly a digest reference, never
  together with image_tag; rollback and private-env-migrate take none, and
  evidence and image-only take only the image their request already names.
- A deploy admits it with the kept-digest lane's checks: this deploy's own
  Listen repository, a revision label naming a cohort-aware commit the
  checked-out source contains, then the explicit image_tag path (prod: an
  ancestor of main, Firestore index gate on that commit).
- The deploy argv builder takes one full reference (--image-reference);
  helm_args is unchanged and tag and kept-image runs build the same argv.
- The NEG coverage exporter is pinned by the same digest (the digest an
  explicit image_tag resolves to); its chart accepts image.digest.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 29, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T19:04:20.028194Z 4a74ce8 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4a74ce8d72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +499 to +501
if [[ -n "$REQUESTED_DIGEST" ]]; then
echo "Deploying image digest ${LISTEN_REPOSITORY}@${REQUESTED_DIGEST} (currently ${IMAGE:-<none>})"
echo "BACKEND_LISTEN_IMAGE_DIGEST=$REQUESTED_DIGEST" >> "$GITHUB_ENV"

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve development digests on subsequent chart-only deploys

When environment=development, the new image_reference path successfully installs a digest, but subsequent chart-only dispatches and automatic chart-change pushes cannot preserve it. In this workflow's resolver, the kept-digest branch at lines 451–465 is restricted to production; development instead extracts the 64-character digest as RUNNING_TAG and fails the cohort-aware commit lookup. This leaves automatic development chart deployments blocked until an operator explicitly deploys a tag again. Extend kept-digest resolution to development using the environment's repository, or reject development digest deployments until that path is supported.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Fixed in 71fdea7: image_reference is refused for development before checkout, so a digest can no longer reach an environment whose chart-only lane cannot keep it. Extending the kept-digest lane to development is left out of this change. Covered by test_development_refuses_image_reference_and_keeps_its_other_dispatches.

python3 .github/scripts/listen_overlay_evidence.py argv \
--overrides-file "$LISTEN_HELM_ENV_OVERRIDES_ARGV" --output "$ARGV_FILE" \
--image-tag "${BACKEND_LISTEN_IMAGE_DIGEST:-$BACKEND_LISTEN_IMAGE_TAG}" --environment "${{ vars.ENV }}" \
--image-reference "$BACKEND_LISTEN_IMAGE_REFERENCE" --environment "${{ vars.ENV }}" \

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Keep the argv invocation compatible with selected development sources

For a development dispatch whose branch selects a commit or branch predating this change, the checkout at lines 195–199 supplies the older .github/scripts/listen_overlay_evidence.py, while this workflow now unconditionally invokes it with --image-reference, even for ordinary tag or kept-image deployments. The parent commit's argument parser advertises only --image-tag IMAGE_TAG and rejects the new invocation with unrecognized arguments: --image-reference (exit 2), so previously supported development source selections fail at the Helm dry-run step. Continue passing the already-supported tag/digest pin via --image-tag, or stage the argv builder from the workflow's immutable source rather than the selected deployment branch.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Not changed, and now stated in the PR description. This affects a development dispatch whose branch does not contain this commit: it fails at the Helm dry-run step until the branch is rebased on main. Prod always checks out main. The builder line has to be the single --image-reference invocation, because the release drift gate matches that exact line once the workflow declares image_reference; passing the pin through --image-tag as well would make the gate refuse every Listen roll.

A later chart-only run keeps a serving digest only in prod, so a digest
deployed to development would block that environment's chart-only and
automatic chart runs until a tag is deployed again. Refuse image_reference
for development before checkout.

Also test the dry-run step's reference composition through the real argv
builder, for a digest and for a tag, and say in the validation comment that
a tag-bound evidence request leaves image_reference blank.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
@Git-on-my-level
Git-on-my-level merged commit ee048b6 into main Nov 29, 2026
73 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/sca4091-image-reference branch November 29, 2026 19:54
Git-on-my-level added a commit that referenced this pull request Nov 29, 2026
…26732)

## What changed and why

Re-pin `reviewed_scripts_tree` in
`.github/workflows/gcp_backend_listen_helm.yml` from
`686d4a44e3041439050d65e39c2aca271f562386` to
`3562810cd1cfd3a0ca13f71ae0f2bdcb630f781e`, the `.github/scripts` tree
of `origin/main` at `54b8f17e013c84aedddc805e6eac3761afdb7c65`
(SCA-4091, SCA-5350).

The step `Verify staged evidence scripts before Python` runs for
image-only evidence requests and refuses unless `HEAD:.github/scripts`
equals the pinned tree. The pin was last set in `06bd2aaf3c4`
(2026-11-27). 24 commits have changed `.github/scripts` on main since
then, so the guard now refuses every image-only evidence request,
including the one #26730 (`image_reference`) needs. This PR changes that
one line and nothing under `.github/scripts`.

### What the pin now vouches for

The pin covers exactly this diff, `git diff --stat
686d4a4
3562810` (paths relative to
`.github/scripts`):

```
 check-deployment-concurrency.py              |  88 +++++++++++++++-
 check-mobile-changelog.py                    |   4 +-
 check_firestore_collection_budget.py         |   9 +-
 check_ui_evidence.py                         |  82 ++++++++++++---
 dead_code/backend.allowlist.json             |  20 ----
 failure_class_guard_ratchet_allowlist.json   |   8 +-
 listen_overlay_evidence.py                   |  18 +++-
 notification_dispatch_boundary_baseline.json |   2 +-
 pusher_canary_inverse.py                     |   8 +-
 pusher_image_only.py                         |  68 +++++++-----
 pusher_image_only_detect.py                  |   2 +-
 pusher_image_rehearsal.py                    |  33 ++++--
 test_check_firestore_collection_budget.py    |   3 +-
 test_check_ui_evidence.py                    |  84 ++++++++++++++-
 test_mobile_changelog.py                     |  10 ++
 test_pusher_image_rehearsal.py               |  53 +++++++---
 test_worker_image_only.py                    |  34 +++---
 tests/ui-author-approval.test.cjs            | 149 ++++++++++++++++++++++++++-
 ui-author-approval.cjs                       |  78 +++++++++++---
 19 files changed, 625 insertions(+), 128 deletions(-)
```

**Executed by the Listen evidence and image-only route.** The route runs
`listen_runtime.py reconstruct` and then `listen_overlay_evidence.py`
(`job`, `apply-image-only`, `verify-image-only`), which imports
`listen_runtime` and `listen_helm_env_overrides`. Of those, only one
file changed:

- `listen_overlay_evidence.py` (+17/-1, #26730). `produce()` leaves the
new `image_reference` dispatch input out of the bound-inputs equality
and instead requires it to be blank or exactly the `image` the evidence
request names (`dispatch_binding` otherwise). A new `image_pin()`
accepts only `gcr.io/<deploy project>/backend:<7-40 hex>` or
`@sha256:<64 hex>` and returns the tag or digest. A new
`--image-reference` argument is accepted only in `argv` mode and only
without `--image-tag`; it feeds the same `helm_args()` the deploy
already used. `listen_runtime.py`, `listen_helm_env_overrides.py` and
`listen_private_env.py` are unchanged.

**Not executed by the Listen route** (in the tree, so covered by the
hash):

- `check-deployment-concurrency.py` (#26599): the Pusher lock contract
sends the isolated canary and image-only preview/promote/rollback lanes
to `deploy-gke-pusher-prod` instead of `prod-train`, with a validator
and self-test cases for those lanes.
- `pusher_image_only.py` (#26610, #26710, #26602): a read-only server
dry-run probe re-reads the Deployment and retries up to 3 times on a
stale snapshot, a live write is never retried; `BASELINE` moves to the
live digest `sha256:fd5fb969…`;
`backend/scripts/pusher_canary_from_live.py` joins `CONTROL_PATHS`.
- `pusher_image_only_detect.py` (#26710): the same `BASELINE` digest.
- `pusher_image_rehearsal.py` (#26560): provenance no longer requires an
unchanged Pusher source closure between the candidate and main; it
requires the development qualification receipt to be at most 24 hours
old (`qualification_stale`).
- `pusher_canary_inverse.py` (#26602): docstring only.
- `check_ui_evidence.py` (#26692): screenshots are required for rendered
UI paths and for Swift or Dart files whose content declares UI, not for
all client code; tests and the generated API file are exempt.
- `ui-author-approval.cjs` (#26655, #26691): test sources and
import-only Swift no longer count as UI; an approval carries to a later
head when the PR's own UI hunks are the same at both heads.
- `check-mobile-changelog.py` (#26341): `app/test/spine/` needs no
changelog entry.
- `check_firestore_collection_budget.py` (#26638): skips
`backend/.venv-eval`.
- `dead_code/backend.allowlist.json`,
`failure_class_guard_ratchet_allowlist.json`,
`notification_dispatch_boundary_baseline.json` (SCA-5535 Episodes
removal, #26630): five allowlist entries removed, one failure class
grandfathered, one baseline count 4 to 3.
- Tests only: `test_check_firestore_collection_budget.py`,
`test_check_ui_evidence.py`, `test_mobile_changelog.py`,
`test_pusher_image_rehearsal.py`, `test_worker_image_only.py`
(publish-only mode conditions and step digests, #26648),
`tests/ui-author-approval.test.cjs`.

The pin goes stale again whenever a later merge changes any file under
`.github/scripts`. If main's tree moves before this merges, the PR is
rebased and re-pinned, and only the new hunks are reviewed.

## Product invariants affected

INV-DATA-1: preserves the existing authority. The change edits one
constant in a guard step of `gcp_backend_listen_helm.yml`; it changes no
routing, service ownership, deploy target or admission rule.

## How it was verified

- `git rev-parse origin/main:.github/scripts` is
`3562810cd1cfd3a0ca13f71ae0f2bdcb630f781e` at `54b8f17e013c`, and
`HEAD:.github/scripts` on this branch equals the pinned value.
- `backend/tests/unit/test_listen_overlay_evidence.py`: 121 passed. It
includes `test_evidence_bootstrap_refuses_added_script_before_python`,
which runs this guard step's own script against a fixture tree.
- `backend/tests/unit/test_listen_overlay_workflow.py`: 40 passed.
- `backend/tests/unit/test_listen_runtime_workflow.py`: 2 passed.
- `backend/tests/unit/test_workflow_contracts.py`: 141 passed.
- `.github/scripts/test_listen_control_pin.py`: 1 passed.

Not verified here: a real image-only evidence run. No workflow was
dispatched; the guard can only pass on main after this merges.

## Tests

No test change. No test asserts the pinned hash; the guard's behaviour
is covered by
`test_evidence_bootstrap_refuses_added_script_before_python`, which
substitutes its own fixture tree hash.

## UI evidence

UI-Evidence: none -- workflow constant only

## Failure class (fixes)

Failure-Class: none

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/26732?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="View guided diff"
src="https://www.cubic.dev/buttons/review-in-cubic-light.svg"></picture></a>
<a
href="https://www.cubic.dev/action/auto-fix/pr/BasedHardware/omi/26732?returnTo=https%3A%2F%2Fgithub.com%2FBasedHardware%2Fomi%2Fpull%2F26732&source=description"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"><img
alt="Turn on auto-fix"
src="https://www.cubic.dev/buttons/turn-on-auto-fix-light.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->
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.

1 participant