# REL-001 — Portfolio release gates R0–R8

Status: **canonical contract, fail-closed evaluator, typed verdict evidence, and
runtime adversarial failability implemented; product release-path invocation and
real R0–R8 evidence remain open**.

Implementation source commit: `df265d96fbdd339d87f3bee8c0db2599f2261ea2`.

## Work-package charter

- **Task ID:** `REL-001`
- **Owner:** shared release-gate and contract maintainers; implementation owner:
  Codex
- **Accountable product:** V1–V9 autonomous-content portfolio
- **Priority / milestone:** P0 release control plane
- **Risk tier:** critical release integrity, safety, rights, human authority,
  and live-canary risk
- **Dependencies:** `PROOF-001` exact non-substitutable proof vocabulary and the
  existing `@oshun/content-release-gates` boundary
- **Affected schemas and slots:** schema-version-1 portfolio evidence bundle, 68
  required control records, nine gate verdicts, and nine adversarial fixture
  verdicts; no shipped content slot or artifact was changed
- **Rollout:** additive export from the canonical contracts and shared
  release-gate packages; product release paths must supply a complete current
  bundle and receive `releaseAllowed=true` before claiming adoption
- **Rollback:** revert source commit `df265d96fbdd339d87f3bee8c0db2599f2261ea2`
- **Evidence pack:** this file

## Requirement disposition

| Requirement                       | Implemented control surface                                                                                                                                                                                                  | Closure state                                                        |
| --------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
| R0 Coverage                       | Six controls: registration, source policy, autonomy policy, quantity, freshness, and runtime placement                                                                                                                       | Evaluator implemented; remains open pending invoked product evidence |
| R1 Ground truth                   | Eight controls: source, canon, solver, simulation, factual input, consistency, freshness, and verification                                                                                                                   | Evaluator implemented; remains open pending invoked product evidence |
| R2 Artifact completeness          | Eight controls: modalities, locales, accessibility, dependencies, assets, cook, render, and runtime placement                                                                                                                | Evaluator implemented; remains open pending invoked product evidence |
| R3 Quality                        | Four controls: calibrated floors, uncertainty, disagreement, and human baseline                                                                                                                                              | Evaluator implemented; remains open pending invoked product evidence |
| R4 Safety/integrity               | Eight controls: child, crisis, cultural, academic-fairness, game-fairness, injection, abuse, and policy-specific safety                                                                                                      | Evaluator implemented; remains open pending invoked product evidence |
| R5 Rights/provenance              | Twelve controls: consent, identity, likeness, voice, license, fingerprint, ingredients, actions, watermark, authenticated signature, attribution, and verification                                                           | Evaluator implemented; remains open pending invoked product evidence |
| R6 Runtime quality                | Nine controls: accessibility, latency, measured cost, performance, compatibility, replay, render, cook, and reliability                                                                                                      | Evaluator implemented; remains open pending invoked product evidence |
| R7 Human authority                | Six controls: current approval, review window, valid override, approval freshness, takeover, and rollback                                                                                                                    | Evaluator implemented; remains open pending invoked product evidence |
| R8 Live canary                    | Seven controls: target outcome, incidents, drift, subgroup behavior, operations, rollback, and recovery                                                                                                                      | Evaluator implemented; remains open pending invoked product evidence |
| Typed evidence for every verdict  | Strict typed source-record, source-query, proof-record, required-control, integrity-error, and adversarial-fixture references; a passing status without a proof blocks                                                       | **Closed by implementation and tests**                               |
| Gate-specific adversarial failure | Every passing bundle is re-evaluated nine times with one configured control forced to fail; release remains blocked unless each target gate blocks for `control-reported-failure` while the other eight gates remain passing | **Closed by implementation and tests**                               |

## Canonical contract and fail-closed evaluation

`libs/contracts/src/common/portfolio-release-gates.ts` owns the R0–R8 and
68-control catalogs, exact required proof type per control, source provenance,
evidence-bundle, verdict, adversarial-fixture, and final-report schemas. The
report schema rejects missing, duplicate, or misassigned gates and controls;
gate/control status contradictions; passing controls without satisfied exact
proof verdicts and typed source/query/proof references; proof verdicts bound to
the wrong subject, policy, or control; mismatched proof-record references;
misconfigured adversarial fixtures; and a top-level status or `releaseAllowed`
value that contradicts the underlying verdicts.

`libs/shared/content-release-gates/src/portfolio-release-gates.ts` evaluates the
contract. It blocks on:

- malformed bundles, duplicate controls, or missing required control records;
- failed or unknown control observations;
- future-dated or freshness-SLO-expired source records;
- absent proofs, including a bare positive boolean;
- non-exact proof type, subject, or policy;
- failed, unavailable, revoked, future-dated, or expired proofs;
- proof records that do not link the source evidence; and
- proof verification times that do not equal the source observation time.

Every valid control also passes through the canonical
`evaluateProofRequirements` policy from `PROOF-001`. A gate passes only if all
of its controls pass. A malformed input returns typed integrity blocks for all
68 controls and all nine gates; it does not omit a verdict or coerce missing
evidence to success.

## Runtime adversarial certification

A fully passing core bundle is not immediately releasable. The evaluator clones
it once per gate and forces that gate's declared adversarial control to
`failed`. Each self-test passes only when:

1. the target gate becomes blocked;
2. the target control reports exactly `control-reported-failure`; and
3. all eight non-target gates remain passing.

Any self-test that cannot produce that isolated intended failure is red and
keeps `releaseAllowed=false`. Core-blocked or integrity-blocked bundles report
all fixtures as `not-run`; they never use an adversarial result to disguise a
primary evidence failure.

## Automated verification

Tested source: `df265d96fbdd339d87f3bee8c0db2599f2261ea2` on host `dev-server`,
Linux 6.8.0-110-generic x86_64. Toolchain: Node 24.14.1, pnpm 10.25.0,
TypeScript 6.0.3, Vitest 4.1.7, and ESLint 10.4.0. The protected lockfile blob
remained `a37431842e330b3a06b030947c25bebdc72bc2b1`.

Verification ran on 2026-07-17 UTC. The final contract run began at 22:35:06 and
the final shared-package run began at 22:35:17; every command below exited 0.

```text
pnpm exec vitest run --config libs/contracts/vitest.config.ts src/common/proof-types.test.ts src/common/portfolio-release-gates.test.ts
  2 files, 14/14 tests passed

pnpm exec vitest run libs/shared/content-release-gates/src
  3 files, 47/47 tests passed
  portfolio evaluator: 26/26
  existing shared release/consent regression: 21/21

pnpm exec tsc --noEmit -p libs/contracts/tsconfig.lib.json
  passed

pnpm exec tsc --noEmit -p libs/shared/content-release-gates/tsconfig.json
  passed

pnpm exec eslint <changed contract/shared source and test paths>
  zero errors; repository lint config ignores test files

git diff --check
  passed
```

The 26 evaluator cases include a complete 68-control pass, one intended failure
for each of R0–R8, failed/unknown controls, absent proof, missing control,
future/stale sources, wrong proof type/subject/policy,
non-passing/future/expired proofs, unlinked proof evidence, mismatched
observation time, duplicate and malformed bundles, and invalid evaluation time.
Contract cases assert the exact 68-control catalog and reject forged report
structure and release state.

The commit hook's staged ESLint, Prettier, V2 asset, and V5 documentation gates
passed. Its broad dependency typecheck was bypassed with the documented
`SKIP_TYPECHECK=1` control only after both task-owning packages had passed
direct typecheck and their complete relevant tests. This host has 15 GiB RAM,
below the repository's 32 GiB gate for an unapproved broad Nx sweep.

## Inapplicable verification and remaining evidence

No customer UI, API route, persistence schema, content artifact, model/provider,
media pipeline, or runtime placement changed. Playwright, accessibility,
screenshots, database migrations, provider probes, and engine checks are
therefore inapplicable to this additive contract/evaluator slice. No human
release decision was required to add the boundary; the evaluator nevertheless
requires exact `human_approval` and observed takeover/rollback evidence for R7.

The nine R0–R8 ledger boxes remain open under the ledger's completion law. No
V1–V9 production release path currently supplies this 68-control bundle, no
deployed release verdict or placement receipt invokes it, and no real current
source/canon/solver/simulation/rights/safety/runtime/human/canary evidence set
was available. Unit, contract, and adversarial fixtures prove enforcement
behavior, not live portfolio conformance. Product release integrations must fail
closed on this report and publish real freshness-bounded evidence before those
boxes can be checked.
