# PA-LAB-02 — reproduce the isolated cancellation-authority assessment

SYNTHETIC LAB · EXECUTED. This locally authored fixture is intentionally vulnerable
in one configuration. It is a command-line program, not a deployable web service.
It uses no network, external AI, EHR, real patient, credentials or external notifications.

Use Node 22.13+; the published run used Node 24.14.0. Node may print its SQLite
experimental-feature warning. No npm packages are needed for the lab.

Download `assessment.mjs` and `verify.mjs` from the lab page, or use `lab/` in the
repository. Choose a NEW output directory whose parent already exists:

```sh
node assessment.mjs /absolute/path/to/new-run
node verify.mjs /absolute/path/to/new-run /absolute/path/to/assessment.mjs
```

Within the repository:

```sh
node lab/assessment.mjs /absolute/path/to/new-run
node lab/verify.mjs /absolute/path/to/new-run /absolute/path/to/lab/assessment.mjs
npm run lab:verify
npm test
```

On Plumbob, use `/home/plumbob/bin/with-dev-storage` and place new runs under
`/mnt/d/tmp/plumbob/`. The runner refuses to overwrite an existing directory.
It writes `scheduler.sqlite`, `events.jsonl` and `receipt.json`. Preserve all three
with the source version. A failed run may leave a partial directory; it is not a
completed receipt. Use a new directory after investigating a failure.

The six cases run once under `vulnerable-v1` and once under `corrected-v2`:

- T01: identified caller without cancellation authority.
- T02: patient cancels own appointment (legitimate control).
- T03: currently permitted proxy cancels (legitimate control).
- T04: permitted patient substitutes another patient's appointment reference.
- T05: patient omits confirmation.
- T06: unknown session.

Expected assessment results: T01 and T04 FAIL the agreed lab policy in the
vulnerable configuration; all six PASS after correction. These intentionally
observed policy failures do not mean the assessment runner failed.

The fixture's vulnerable mode checks only session, record existence and action
confirmation. The corrected mode additionally checks represented-patient binding
and current authority inside the SQLite write transaction. Both use the same SQL
update and service-identity label. This label is not an implemented OAuth identity.
Authentication and identity verification are seeded, not assessed.

The independent verification command checks hashes, trial records, decision and
transaction references, persisted database state and outbox entries. It does not
independently certify the assessor or custody. Fresh runs have different IDs,
timestamps and hashes; expected dispositions and state transitions should agree.

To inspect the published evidence, download its receipt, events and database into
one folder, then pass that folder and the downloaded assessment source to the
verifier. `npm run lab:verify` checks the repository's retained published run.

Unit tests add a pre-revoked-grant control and injected outbox failure/rollback check.
Those are separate from the 12 published assessment trials. A pre-revoked grant is
not PA-01's revocation-during-active-workflow scenario, which remains NOT RUN.

No timeouts/retries, callbacks, race conditions, voice/model behavior, production
integration, external communication delivery or patient outcomes were assessed.
The run demonstrates the listed local mechanics only. The fixture and evidence
were produced using coding-assistant tooling, not independent customer validation.
