# VERA by Prepaire: installation and operational qualification

| | |
|---|---|
| Document | VERA-VAL-IQOQ-001, version 0.3 (draft) |
| Date | 16 November 2026 |
| Owner | The quality manager, named on the signed approval (section 8) |
| Approver | The laboratory director, named on the signed approval (section 8) |
| Status | Draft for review. Not approved. The scripts write the records; people sign them. |
| Needed | IQ and OQ records signed for each node and release before VERA issues a result (master plan, section 4) |

## 1. When

On every node that will release clinical results (the production node first), for every numbered release, before the PQ counts,
and again after a restore of the node, a hardware change, or any change the change rule says needs it (master plan,
section 7). spark-8 runs the same steps as a rehearsal: its records say "rehearsal" and are never signed.

## 2. Who

The tester runs the scripts and is named in the record (`--performed-by`, a governed id): IT, a laboratory scientist
or the quality manager, never the developer of the code. The quality manager reviews the record and the laboratory
director approves it, each on the printed page that names the record's digest. Nobody reviews or approves a record they
performed: when the quality manager ran the tests, the laboratory director reviews and approves, and a second
reviewer, named on the printed page they sign, reviews as well. VERA does not tie `--performed-by` to a sign-in: the
scripts run in the tools container, which has none. The name is the tester's own statement, and the signatures on the
printed page are what bind it.

## 3. Before the IQ

1. The release is cut (`scripts/release/cut.sh`, tag `vera-YYYY.MM.DD-n`) and its images built and signed in CI.
2. The release's **scope sheet** is written from the release commit, with the image digests of the build:

   ```
   node --import tsx scripts/validation/iq.ts sheet --out scope-sheet-vera-YYYY.MM.DD-n.json \
     --platform-image-digest sha256:... --worker-image-digest sha256:...
   ```

   It holds the commit and release, the image digests, the SHA-256 of every file under `config/`, the content digest of
   every clinical table and every migration. The quality manager keeps it with the release; its SHA-256 is printed.
3. The release is deployed on the node, and the deploy starts the platform and the worker with `VERA_IMAGE_DIGEST` and
   `VERA_WORKER_IMAGE_DIGEST` set to the digests of the images it started (docs/validation/README.md).
4. The platform connects to the database as a runtime role that owns no table and cannot set the triggers aside, and
   the migrations run as the owner (docs/golive/operations-and-data.md, step 3). On the Sparks today the platform
   connects as the owner of the tables: IQ-07 fails until IT has made this change.

## 4. The IQ

From the tools image of the release, on the node. What the platform and the worker run as is read from them, never from
the tools container's own environment (which on a Spark holds the database address and nothing else):

- **the platform** answers in its health answer (`GET /api/v1/health`, signed in with a full-detail role through
  VERA_IQ_ACCESS_TOKEN, contract 1.4.0, field `validation`; without that sign-in the answer gives only a summary, R13): its mode, node, the image digests it was started with, its retention, one digest over its configuration
  files and one over its clinical tables, the names of the keys it needs that are not set, and its kept-key sources;
- **the worker** writes the same facts beside each of its heartbeats (`ProcessHeartbeat.facts`), which the IQ reads
  from the node's database. A worker whose newest heartbeat is more than 300 seconds old is not running, and fails;
- **the images** are the digests IT reads from the running containers (`docker inspect`);
- **the database role** the platform connects as is named by IT (`--runtime-role`) and confirmed against the
  database's live sessions.

On a Spark, from the `seed` service (the tools image, on the node's network, with the database address and nothing
else), with the records in a folder the image's `node` user can write [folder and owner to confirm with IT]:

```
docker compose -f deployment/dgx-spark/compose.yaml run --rm --no-deps -v /srv/vera/validation-records:/records seed \
  node --import tsx scripts/validation/iq.ts check --expect /records/scope-sheet-vera-YYYY.MM.DD-n.json \
  --performed-by <governed id> --platform-url http://platform:8010 --runtime-role <role> \
  --platform-image-digest sha256:... --worker-image-digest sha256:... --node <node id> --out /records
```

Since 20 Nov 2026 the health answer names the keys that are not set only to a sign-in with the role of platform admin,
security auditor, QA officer or laboratory director (red-team R13). Pass that person's access token to the run as
`-e VERA_IQ_ACCESS_TOKEN`; without it the platform's facts are not read, and IQ-01, IQ-03 to IQ-05 and IQ-09 fail.

| Check | Pass rule | Requirements |
|---|---|---|
| IQ-01 | The platform (its health answer) and the worker (its heartbeat facts) each say it runs as an operational node | 043, 195 |
| IQ-02 | The running platform answers health with 200, records its commit, and runs the sheet's commit and release | 045, 184, 127 |
| IQ-03 | The platform and worker images are the sheet's; the platform states its own digest and names the worker's, and the worker states its own, each equal to the image IT read | 023, 185, 127 |
| IQ-04 | Every file under `config/` of the tools image is the sheet's, byte for byte, and the platform's and the worker's configuration digests are the sheet's | 019, 044 |
| IQ-05 | Every clinical table of the tools image is the sheet's, and the platform's and the worker's clinical table digests are the sheet's | 185, 019 |
| IQ-06 | The database's migration history is exactly the build's migrations: each applied, finished and with the same checksum, none extra, all additive | 193, 044 |
| IQ-07 | `scripts/verify-database-controls.ts --runtime-role <role>` (read-only) exits 0: every required trigger present and enabled, every regulated table refusing TRUNCATE, and the named role neither a superuser, nor an owner of a regulated table, nor holding TRUNCATE, nor able to set `session_replication_role`; and the database's sessions show the named role connected. Unnamed, the check fails | 187, 028 |
| IQ-08 | `scripts/verify-chains.ts` (read-only) exits 0: every chain re-walks intact | 187 |
| IQ-09 | Every key the platform and the worker need is present, as each states it; the platform's kept keys are configured from the host's secrets and the same in every process. The record says present or missing; it never holds a value or a length | 191 |
| IQ-10 | The platform and the worker each keep evidence at least 9,132 days | 188 |

The record also lists what still stands before patient results without failing the IQ: each clinical table not yet
signed, and why the build may not yet decide a clinical result (the table of validated releases lists it only after the
IQ, OQ and PQ). The IQ passes only when every check passes; a check that could not run counts as not passed. The record
is a rehearsal unless the platform and the worker both say they run as an operational node.

## 5. The OQ

After a passed IQ, from the same tools image, on the node:

```
docker compose -f deployment/dgx-spark/compose.yaml run --rm --no-deps -v /srv/vera/validation-records:/records seed \
  node --import tsx scripts/validation/oq.ts --iq /records/IQ-<node>-<time>.json --performed-by <governed id> \
  --platform-url http://platform:8010 --out /records
```

The script refuses an IQ record that did not pass, is a rehearsal, or was changed since it was written (its digest),
and runs the 29 cases of `config/validation/oq-protocol.v1.json`, with vitest's JSON and JUnit reports kept beside the
record. The tools image runs as the `node` user over a root-owned `/app`: vitest reads its configuration in memory
(`--configLoader runner`) and writes only the reports, to the mounted folder, and the system's temporary folder. A copy
of exactly the tools image's files with every folder read-only runs all 27 release-path cases
(`src/lib/validation/oq-read-only.test.ts` keeps the same check in every test run).

The cases are of two kinds, and the record says which is which:

- **Release-path cases (OQ-01 to OQ-27)** run the release's own acceptance and refusal tests on synthetic samples
  through the real code of the release path: the route, the gates, the review and release rules. They show what the
  installed code does. They give the same answer on any machine that runs the same image, whatever the node's settings,
  database or signed tables: those are the IQ's and the node cases'. The stand-ins are listed in 5.1.
- **Node cases (OQ-28, OQ-29)** ask the installed platform itself, read-only and without a sign-in, so their answer
  depends on the node. OQ-28: the platform answering now is the one the IQ record qualified (commit, release, image,
  configuration and clinical table digests, each in the platform's own words), running as an operational node. OQ-29:
  each clinical route of `SIGN_IN_PROBES` (release, review, critical call, report issue, the stored report's two reads,
  worklist, campaign decision, scope approval, table attestation, scope) refuses a request with no sign-in with 401. Each
  route authorises before it reads its body or the database, and the ids do not exist, so no probe can write anything.

Whether the node is operational, and so whether the OQ record may be signed rather than being a rehearsal, is the
platform's own answer, never the tools container's environment. The record is a rehearsal unless the IQ passed, is not
a rehearsal, the platform says it is operational and OQ-28 found nothing.

### 5.1 What the release-path cases stand in for, and why

| Stand-in | In which cases | Why |
|---|---|---|
| The database (`m.db`, the release's transaction): the run, its QC history, reviews, critical calls, campaigns and attestations are synthetic rows | All | No synthetic row may reach the node's append-only ledgers, and a release queues the Malaffi result message: a synthetic release through the node's own database would stay there for 25 years |
| The object store (`readVerifiedJsonObject`): the synthetic bundle | All | As above |
| Identity (`authorize`): synthetic staff | All | No account is made for a test; the sign-in gate itself is OQ-29 |
| The environment (`environment()`): a synthetic operational environment in OQ-08 to OQ-11, OQ-26, OQ-27; vitest's setup clears the mode variables in every file | All | So each case runs the mode it is about; the node's own mode is IQ-01 and OQ-28 |
| The build stamp and the table of validated releases | OQ-08 to OQ-11, OQ-26, OQ-27 | The tools image has no build record; the node's build is IQ-02 and OQ-28 |
| The QC rules, critical values, delta checks, analyser flags, catalogue, standard ranges and order rules: synthetic signed tables | All but OQ-05 | The shipped tables are unsigned until the laboratory director signs them, and every clinical result is held while they are (OQ-05 runs on the release's own tables, whatever their state) |
| The profile registry, the instrument activation policy and the partner settings | All | The analyser's own activation is the laboratory's step; the partners integration is off |
| The pipeline steps' execution | All | Pipelines run on the worker; the bundle is their output |

What this leaves out, by decision: no synthetic subject is released through the running platform process. F02 step 4
asks for the acceptance and refusal tests "on the installed node in operational mode with synthetic subjects"; VERA's
ledgers are append-only and a release queues a Malaffi message, so a synthetic release on the node's own database is
not done. The node cases ask the node what can be asked without writing. If the laboratory director wants a synthetic
release on the node itself, IT starts a second platform from the same image with the node's settings and a separate,
throwaway database and object store, and the OQ's release-path cases are run against it [to decide by the laboratory
director; to confirm with IT].

### 5.2 The cases

| Case | What it shows | Requirements | Pass rule |
|---|---|---|---|
| OQ-01 | A clinical run whose every result is in control and independently approved is released, with the build and scope recorded | 029, 164, 166 | Released; the manifest names the build and the scope |
| OQ-02 | The run's submitter cannot release it | 029 | 403 INDEPENDENT_REVIEW_REQUIRED |
| OQ-03 | The reviewer of a result does not release it | 165 | 403 INDEPENDENT_RELEASE_REQUIRED |
| OQ-04 | A seeded QC failure blocks the release | 161, 043 | 409, every failure a QC rejection |
| OQ-05 | The release's own rule tables decide: each one its file leaves unsigned holds every clinical result, a signed one holds none for that reason | 186, 050 | While a table is unsigned: 409 RESULT_GATES_FAILED naming it |
| OQ-06 | A bundle from another analyser is refused | 122, 004 | 409 KG_BUNDLE_RECONCILIATION_FAILED |
| OQ-07 | An observation citing evidence outside the run is refused | 018, 134 | 409 KG_BUNDLE_RECONCILIATION_FAILED |
| OQ-08 | On an operational copy a build that is not a validated release does not release | 184 | 409 VERA_BUILD_NOT_VALIDATED |
| OQ-09 | On an operational copy no release without a scope the laboratory director approved; none after a withdrawal or a later rejection | 185, 043 | 409 VALIDATION_SCOPE_NOT_APPROVED |
| OQ-10 | Another image, another worker image, an unstated image or a changed clinical table refuses the release | 185, 120, 044 | 409 VALIDATION_SCOPE_MISMATCH, each difference named |
| OQ-11 | The validated release in its approved scope releases, naming the campaign and the director's approval | 185, 157 | Released; manifest and audit name the campaign and the approval |
| OQ-12 | A clinical release queues its one Malaffi message in the same transaction | 174 | One message per release |
| OQ-13 | A critical value is held until the call is logged with read-back | 162 | A failed call does not clear the hold |
| OQ-14 | Every person gets the standard range for their sex and age, and the report prints the same | 167 | 100% of test persons |
| OQ-15 | A Malaffi message is sent at most once | 174 | Nothing sent twice |
| OQ-16 | The listener captures byte for byte and sends nothing to an analyser | 176, 123, 154 | No byte sent |
| OQ-17 | Replayed fixtures give identical SHA-256 | 155, 017 | Identical digests |
| OQ-18 | 100% of seeded QC failures are blocked | 161 | Every reject rule and calibration lockout blocks |
| OQ-19 | The report carries every HAAD CLS p13 item | 172 | Every item, in PDF, ORU^R01 and FHIR |
| OQ-20 | A correction keeps the original and retracts under the first identifiers | 173, 015 | Case opened; retraction exact |
| OQ-21 | An order without a clinician or consent, or for a minor, is refused | 169 | Refused |
| OQ-22 | Past incidents stay caught (the August 2026 export, the calcium unit) | 107 | Quarantined |
| OQ-23 | The shadow comparator lists exactly a dropped and an altered message | 177, 133 | Exactly those two |
| OQ-24 | VERA hosts an analyser's link only on the laboratory director's recorded decision | 178, 123 | No host without it |
| OQ-25 | The database refuses a release by a reviewer and an edit of a decision record | 165, 187 | Refused by the database |
| OQ-26 | A clinical table without its attested approvals refuses the release, whatever its file says | 196, 186 | 409 TABLES_NOT_ATTESTED; a revoked approval or one of other content does not count |
| OQ-27 | A withdrawal or revocation committed while a release is prepared stops it, in the release's own transaction | 196, 185 | Refused; nothing written |
| OQ-28 | Node: the platform answering is the one the IQ record qualified, running as an operational node | 195, 043, 185 | The platform's own answer matches the IQ record |
| OQ-29 | Node: every clinical route refuses a request with no sign-in, before anything is read or written | 179, 029 | Each answers 401 |

A case passes when every test it names ran and passed, or when its node check found nothing. The OQ passes when every
case passes.

## 6. After the IQ and OQ: the campaign and the director's approval

The campaign is what the release route checks (master plan, section 2.1). Once the IQ and OQ records are signed, the
quality manager or the laboratory director opens the scope's campaign with exactly what the IQ recorded:

```
GET  /api/v1/validation/scope                      (the running scope: image digests, build, each table's digest and state)
POST /api/v1/validation/campaigns                  { softwareBuildId, instrumentProfileKey, protocolVersion, fixtureManifestSha256,
                                                     scope: { instrumentAssetId, assayProtocol, pipelineDefinitionSha256,
                                                              veraImageDigest, veraWorkerImageDigest, clinicalTablesSha256 } }
```

The scope must name the pipeline definition and the worker image; VERA refuses a scope the copy does not run (409
SCOPE_CHANGED) and fixes it once written. The PQ then posts its trials to the campaign (docs/validation/pq-protocol.md):
one trial per fixture, kind, operator, lot and site (a second posting is refused, and the score counts each once). A
quality officer or the laboratory director records the campaign's evidence decision
(`POST /api/v1/validation/campaigns/{campaignId}/decision`), which VERA computes. That decision is evidence, not the
approval of the scope. The laboratory director records the approval (`POST .../{campaignId}/approval` with
`decision: APPROVED` and the decision's id), as a member of the attested signatory register who recorded none of the
campaign's trials, and may withdraw it (`decision: WITHDRAWN`). On an operational copy a clinical run is released only
under a scope whose latest word is the director's current approval; a withdrawal, or a later campaign of the same scope
that VERA rejects, ends it at once (OQ-09, OQ-27).

## 7. The records

Each script writes `validation-records/<IQ|OQ>-<node>-<UTC time>.json` and the same record as a page to print
(`.md`). A record holds its checks with the requirements each gives evidence for, who performed it and when, what it
was compared with (the scope sheet or the IQ record, by SHA-256), a rehearsal flag, an empty signature block, and its
own SHA-256 (`recordSha256`, over the canonical JSON without that field).

The digest is not a signature. It is an unkeyed SHA-256: it shows an accidental change, or an edit whose digest was not
computed again, and the OQ refuses such an IQ record. Someone who edits a record and computes its digest again is not
stopped by it. What binds a record: the printed page the quality manager and the laboratory director sign, which names
the digest; the evidence store's lock once IT copies the record there (docs/validation/README.md); and, for the OQ, the
platform itself, which OQ-28 asks again rather than trusting the IQ record's word. A record signed with a key of the
node is not built: the tools container holds no key [to decide by the quality manager whether one is wanted].

Signing: the quality manager and the laboratory director sign the printed page, which names the record's digest. A
record with a failed check is signed only with the deviation and its disposition attached (master plan, section 8).
The quality manager then lists the signed record in `config/validation/records.v1.json` against REC-195-1.

## 8. Approval

- Prepared by (developer): Prepaire engineering, 16 November 2026
- Reviewed by (quality manager): name ______________________ date __________ signature ______________________
- Approved by (laboratory director): name ______________________ date __________ signature ______________________

## Change history

| Version | Date | Change | By |
|---|---|---|---|
| 0.1 | 15 Nov 2026 | First draft (F02 of the readiness fix list) | Prepaire engineering |
| 0.2 | 16 Nov 2026 | The IQ reads the platform and the worker in their own words and names the runtime role; the OQ's two kinds of case, its stand-ins, its node cases and the tools image; the director's approval of a scope; the record digest is not a signature | Prepaire engineering |
| 0.3 | 16 Nov 2026 | The owner, the approver and the second reviewer are named where they sign, not in advance | Prepaire engineering |
