Manual / Guides

Integrity: what runs is what was approved

From Pipewright 1.4.0, an approval records what it approved, and nothing is deployed, promoted or (optionally) scored unless it is still that. A changed model file, a moved image tag, a version nobody approved or a default made outside Pipewright is refused by default. The settings are the platform’s, in the manifest’s policies.integrity.

What an approval records

FieldWhat it holds
evaluationThe evaluation record the gates were checked against: location, Cloud Storage generation, SHA-256
filesEvery file in the version’s model folder: name, generation and SHA-256, and one digest over them all
serving_imageThe serving container and the digest its reference resolved to
bq_modelA BigQuery ML version: the model and its etag
rulesThe release whose rules judged the version, and digests of its gates and approvers
lockWith a lock configured: how many files were locked, until when, and how
feature definitionsWith features.check on: the definitions the model was trained on (1.4.1)

The rules are the released ones: the gates model approve re-checks and the approvers it allows come from the release that trained the version, not your working copy.

What is checked, and when

BeforeChecked
deploy-model (Agent Platform and KServe)The default version’s newest approval: evaluation record, every file, the serving image, a BigQuery ML model; a first version nobody approved; a default made outside Pipewright
promoteThe same, for the source version, before anything is copied
A scoring run (optional)The full check of the version it will use (inference); with pin, the run loads exactly the approved generations
Every KServe pod start (1.4.1)Each file of the approved copy the pod loads, before the server starts
model approve (1.4.1)That the model folder still holds the files Agent Platform copied at registration
rollback, loop rollback (1.4.1)What goes back into use, like a deploy
The launcher’s watch (1.4.1, optional)Every default and serving version, hourly by default, with an alert when a result changes
pipewright integrity check (1.4.1)The same as the watch, once, with an exit code for CI
pipewright lineageAll of it, shown, with each approval against Cloud Audit Logs

A file is compared by its generation first, then, if it was rewritten, by SHA-256, so a byte-identical rewrite still matches. A serving image registered by tag is resolved again: a tag that now points elsewhere is a change. Messages name records, files, digests, metrics and gates: never a row or a feature value.

The policy

policies:
  integrity:
    mode: refuse                    # the default; warn says what it found and goes on
    until: 2026-11-20               # with warn: the last day it applies, then refuse again
    reason: incident 4711           # why (recorded, alerted while it lasts)
    lock: { days: 30, mode: unlocked, renew: true, rollback_days: 30 }
    inference: off                  # off, warn or refuse: the scoring check
    pin: on                         # scoring and KServe load the approved generations
    watch: off                      # on: the launcher re-checks what is in use and alerts on a change
    watch_every: 1h                 # 1h, 6h, 1d
    features:                       # feature definitions against the feature contract, all off
      check: off
      built_tables: false
      record_reads: false
      fingerprint_rows: false
      snapshot_days: 0
  • mode: refuse is the default. Set warn for an environment that must keep going while you find out why, never as a standing setting in production. With until and reason the override is time-boxed, recorded as policy.override and alerted while it lasts.
  • Audit cross-check: deploy-model, KServe deploys and promote compare the newest approval with the Admin Activity entry its change made, which nobody can write. An approval event written by hand does not pass. The identity that deploys needs roles/logging.viewer; a log that cannot be read is a note, never a refusal.
  • Release contracts are locked like model files when a lock is configured, so nobody who may write the bucket can change what a live release runs.

Serving the approved bytes (1.4.1)

PathReads the model files fromSince 1.4.1
Agent Platform endpointIts own copy, taken at registrationmodel approve refuses a folder that changed since the copy
KServe on GKEThe model folder, at every pod startAn approved copy, checked by an init container; a swapped file stops the new pod while running pods keep serving
A scoring runThe model folder, on every runExactly the approved generations (approved_files), each SHA-256 checked

Your own scoring component reads the approved files with pipewright_runtime.approved_download(approved_files, dest, project).

Locks, and keeping them while in use

lock.days puts Cloud Storage object retention on each approved file (on a bucket created with object retention; otherwise an unlocked lock is a temporary hold). unlocked can be shortened by someone with storage.objects.overrideUnlockedRetention; locked cannot be shortened by anyone, including project owners. The lock keeps the approved bytes; the checks catch a new version written over a file and refuse until the approved bytes are back.

With lock.renew (1.4.1, the default), a separate renewer identity (pipewright integrity renew, a daily Cloud Run job) extends retention on everything an active version needs: approved files, the previous default for rollback_days, KServe copies and live release contracts. It never shortens a lock, records each change, and is watched by another identity. A retired version stops being renewed (pipewright model retire); Pipewright never deletes model files.

The watch and the CI gate

With watch: on, the launcher re-checks every watch_every each default version, every deployed version and every KServe service, and records model.integrity only when a result changes: changed, unapproved, cannot_check, restored. A heartbeat (model.integrity.check) every run means a broken watch alerts instead of looking like "unchanged".

pipewright integrity check --env prod [--usecase churn] [--json]   # exit 0 unchanged, 1 changed, 2 cannot check

Feature definitions (1.4.1)

With features.check: on, training refuses a feature definition that differs from the release’s feature contract; approvals and promotions record the definitions; deploy, scoring, the watch and rollbacks compare with what was approved. built_tables checks tables built by a query by the SQL of the job that last wrote them; record_reads, fingerprint_rows and snapshot_days record what each scoring run read.

A runner that cannot move a model’s default (1.4.3)

Every runner can upload model versions, and an upload can move any model’s default alias, other teams’ too; no IAM role can scope uploads to one model. Deploy, promote and the watch catch a default nobody approved, but by default nothing prevents it. policies.registration: launcher (off by default) does:

  • Runners get roles/aiplatform.user without model upload, update and delete.
  • The register step asks the launcher, which checks that the request comes from the run it names, that the model folder is under the use case’s pipeline root and the evaluation record is the one the step wrote (by SHA-256), and recomputes the gates before it uploads. It moves the default only where the release’s policy says so. A refusal is a model.registration_refused event and fails the run.
  • BigQuery ML registers the same way; operators keep approving, promoting and retiring.

Turn it on after every use case is released with 1.4.3 or later: an older register step uploads directly and fails. validate and release refuse a use case whose components still write the registry themselves, naming each file, and doctor fails while a runner can still upload. A file that only mentions an upload (a comment or help text) can carry # pipewright: not-a-registry-write <reason>; validate then lists it as a warning with the reason, and the runner still cannot write the registry. It costs nothing.

What each setting costs

Google list prices, europe-west2, 2026-11-06:

SettingDefaultMonthly cost
pinonabout $0; a KServe copy is $0.023 per GiB per version kept
inference: warn or refuseoffabout $0
watch: on, hourlyoffabout $0.20 (5 use cases) to $1.91 (100 use cases); every 15 minutes about 4x
lock.days with renewoffabout $0.08 for 100 versions, plus retired files kept longer
The renewer jobwith renewabout $0.05, plus $0.10 for a Scheduler job beyond the free 3
DATA_WRITE logsstarter off, Enterprise onusually inside Cloud Logging’s free 50 GiB
audit_retention_days0cents a year
features.check: onoff$0
features.built_tablesoffabout $0.00015 a check

When something changes: the response plan

  1. Who is told: the use case’s owners (alerts sync on model.integrity and run.integrity) and the platform team.
  2. What refuses: under refuse, deploys, promotions, rollbacks and scoring runs of the changed version; KServe pods with a changed copy do not start.
  3. Find out: pipewright integrity check, then pipewright lineage --version N, which shows what changed and, with DATA_WRITE logs, who wrote it.
  4. Restore: pipewright model restore-files --env prod --usecase churn --version N (dry run, then --confirm) writes the approved generations back and records model.restored. For a KServe copy, deploy-model rewrites it.
  5. Override, time-boxed, if production must keep going first: mode: warn with until and reason.