# Finite-frame experiment v2

Status: local experimental protocol, 14 November 2026. Namespace `overt.experimental.finite-frame.v2`. Version 2 adds a seed commitment to the signed plan and a strict ASCII-bytes rule for wire files; both are wire changes, so v1 bundles and trust roots are rejected. This is separate from OVERT's closed B.7 attestation and does not change its meaning, claim registration or establish conformance.

## Claim and population

The target is the number of binary **evaluator-judged violations in one already closed finite frame**, with a one-sided confidence bound under fixed-size simple random sampling without replacement. It is not the rate of true violations, future behavior, claims, loss or clinical error. It says nothing about actions outside the frame.

An observer supplies and signs the complete sorted list of frame entries. Each entry is exactly `{"event_id": string, "commitment": 32-byte-lowercase-hex}`. IDs are unique within the frame. Repeated payloads remain separate events with different IDs. Every submitted event must match exactly one observed event, including its commitment. Comparing counts alone is insufficient.

The demonstration generates keyed HMAC content commitments with a separate local random content key and never writes that key. A verifier sees only fixed-width commitments; the bytes alone do not establish that a proper hiding commitment was used. The demo is not a content opening or retention system. Content availability, authorized openings and evaluator access are external prerequisites.

## Roles and authority

Six Ed25519 roles are pinned outside the bundle: `plan`, `frame`, `submission`, `sample`, `label`, `result`. `frame` represents the observer; `submission` represents the producer; `sample` represents the sampling authority; `label` represents the evaluator. Keys must differ in this experiment. Distinct keys are a mechanical separation, not evidence of independence.

`trust-roots.json` has exactly `kind` and `keys`; kind is the namespace plus `/trust-roots`. `keys` has exactly those six role names and a raw 32-byte public key encoded in lowercase hexadecimal for each. No key URL or key carried in an evidence envelope is trusted. A relying party must authenticate the initial roots and determine real-world authority, independence, custody and revocation separately.

The verifier requires an independently supplied expected `run_id`, `scope` and SHA-256 digest of the approved complete signed plan envelope. Cross-run/scope reuse and alternate signed plans under the same run/scope fail. Duplicate IDs or labels fail. Stateless re-verification of the same run remains possible and is necessary for offline audit; one-time transactional consumption is outside this experiment.

## Wire grammar and signature scope

A bundle or trust file is **ASCII bytes only**. Both verifiers refuse any byte above 0x7F before JSON parsing, including a UTF-8, UTF-16 or UTF-32 byte-order mark; the file is then parsed as ASCII text, never by encoding auto-detection. UTF-16 or UTF-32 without a byte-order mark contains no byte above 0x7F for ASCII content, but its NUL bytes are not valid JSON and the parser rejects them. Lexical variants that decode to the same values are accepted because signatures and digests are computed over canonical form, not file bytes: insignificant whitespace (space, tab, CR, LF), `\uXXXX` escapes that decode to printable ASCII, an escaped solidus `\/`, and `-0` as an integer zero. Form feed or any other whitespace character, any non-whitespace byte after the value (including NUL), fractions, exponents and leading zeros are rejected.

Files are limited to 8 MiB, nesting to 32 levels and frame size to 1,000 entries. Decoded strings and property names contain printable ASCII only. Integers are within `[-(2^53-1), 2^53-1]`; field-level ranges are narrower. JSON floats, NaN, infinity, duplicate property names and unknown properties are rejected. Booleans are not accepted as numeric values. Schema validators reject unexpected null values.

Canonical bytes are compact JSON with object property names lexicographically sorted, arrays in their given order, no whitespace, and ordinary JSON string escaping. All accepted strings are ASCII, avoiding cross-runtime Unicode issues. Whole-envelope digests are SHA-256 of canonical bytes.

Each envelope has exactly `kind`, `payload`, `signature`. Kind is `namespace + '/' + role`. Signature is 64-byte Ed25519 in lowercase hex. Signed bytes are:

```text
ASCII(namespace + '/signature') || 0x00 ||
canonical({"kind": namespace + '/' + role, "payload": payload})
```

The top-level bundle has exactly `kind`, `plan`, `frame`, `submission`, `sample`, `labels`, `result`; its kind ends `/bundle`. `labels` is a list of signed label envelopes; all other evidence members are signed envelopes. Fields are defined directly and checked in `protocol.py`; the following specifies their meaning and dependencies.

## Plan, closure and ordering

The plan binds `run_id`, `scope`, UTC `period_start`, `period_end`, `label_cutoff`, `requested_n`, `sample_size_rule`, reduced rational `alpha_numerator/alpha_denominator`, `policy_hash`, `evaluator_config_hash`, `method`, `selection_algorithm`, `seed_commitment` and the exact mandatory `assumptions` list. Times have format `YYYY-MM-DDTHH:MM:SSZ`; start < end <= cutoff. Requested n is between 0 and 1,000. Alpha is positive and <= 1/2, with denominator <= 1,000,000.

The sample-size rule is exactly `min(requested_n,population_size)`. This contingency is predeclared, so small realized populations trigger a census, not post-outcome sample-size choice. The bound method is `finite-population-hypergeometric-upper-count-v1`. The selection algorithm is `hmac-sha256-partial-fisher-yates-rejection-v1`.

The signed observer frame binds run, signed plan digest, scope, period and entries. The producer submission binds run, plan digest, signed frame digest and its own complete entries. Every entry and its commitment must match the observer frame. This detects omission/substitution by the producer relative to that frame. It does not detect a dishonest or incomplete observer frame.

The signed sampler record binds run, signed plan/frame/submission digests, seed, algorithm and selected IDs. The seed must be exactly 32 bytes in lowercase hex.

## Seed commitment

The intended ceremony is commit, then reveal:

1. The sampler generates one secret uniform 32-byte seed and gives only its commitment to the plan signer.
2. The plan, containing `seed_commitment`, is signed. In real use the relying party pins that signed plan's digest before the observation period begins.
3. The observer frame and producer submission are fixed and signed.
4. The sampler record reveals the seed. Both verifiers check that it opens the plan's commitment, rejecting the bundle if not, before recomputing the selection.

The commitment is 32-byte lowercase hex:

```text
seed_commitment = SHA-256( ASCII(namespace + '/seed-commitment') || 0x00 || seed )
```

where `seed` is the 32 raw seed bytes. Test vector: for seed bytes `0x00, 0x01, ..., 0x1f` the commitment is `184539b071bd02143ba54d40c32c168a85ad71c29e6e1be8f53dd7d79ef5b5d1` (computed with `shasum -a 256`, outside both implementations, and checked by the Python unit tests and the Node self-test). Selection, its context and the algorithm name are unchanged from v1.

What this prevents: a sampler acting alone can no longer choose its seed after seeing the frame. The verifier requires the revealed seed to open the commitment in the pinned plan, and the commitment is modeled as binding, so the sampler cannot find a second seed that opens it. This holds only if the plan, and with it the commitment, really was fixed before the frame existed; the verifier checks the opening, not the timing (assumption 2). A ground seed such as the v1 counterexample used is rejected by both verifiers (differential case `seed_does_not_open_commitment`).

What it does not prevent:

- **Collusion and early disclosure.** A sampler that tells the observer or producer its seed before the frame is fixed lets that party choose event identifiers or content commitments, and so the selection. Both verifiers accept the result (`../evidence/assumption_counterexamples.json`, case `sampler_discloses_seed_and_colluder_rekeys_commitments`). Hiding the seed until reveal is assumption 3, not a verified property.
- **Ordering.** Signatures bind artifacts to each other, not to wall-clock time. Nothing in the bundle proves that the plan was pinned before the observation period, that the seed was generated before the frame, or that it was not disclosed early. These remain assumptions 2 and 3.
- **Selective abort.** A party that dislikes how a run is going can withhold the bundle and start again under a new plan with a new commitment. The abandoned plan produces no accepted bundle, so no verifier output can show the abort; it cannot be demonstrated as an accepted bundle. The relying party must account for every plan it pinned and report a pinned plan with no accepted bundle as a failed run, not let a later plan replace it (assumption 4).
- **A dishonest seed.** The commitment does not show that the seed was drawn uniformly or kept secret; it is only modeled as hiding and binding under SHA-256. A sampler that generated a nonrandom seed before committing is not detected (assumptions 2 and 8).

The commitment narrows one assumption. It does not make the sampler trustless.

Signature dependencies bind the same artifacts. The demo follows the ceremony order in memory; real evidence of the ceremony is outside scope and remains an explicit signed assumption.

## Deterministic selection

Start with lexicographically sorted unique frame IDs. Let n = min(requested_n,N). Let context be the canonical object with exactly `run_id`, `plan_digest`, `frame_digest`.

For each requested random word, compute:

```text
HMAC-SHA256(seed,
  ASCII(namespace + '/selection') || 0x00 ||
  uint64_big_endian(byte_length(context)) || context ||
  uint128_big_endian(counter))
```

Counter begins at zero and advances after every word, including rejected words. Interpret the digest as unsigned big-endian integer x. To draw below b, calculate `limit = 2^256 - (2^256 mod b)`; reject x >= limit, otherwise return x mod b. For i from 0 through n-1, swap positions i and `i + draw_below(N-i)`. The selected IDs are the first n elements, sorted for canonical transport. No draw occurs for n=0.

Rejection removes modulo bias assuming uniform PRF words. HMAC is modeled as a pseudorandom function; a finite seed and a computational primitive do not prove ideal information-theoretic SRS across every possible subset. Statistical guarantees below are conditional on the SRS model and honest ceremony, including the seed staying secret until the frame and submission are fixed.

## Labels and missingness

Each evaluator-signed label binds run, signed plan digest, signed frame digest, signed sample digest, evaluator configuration digest, selected event ID, `verdict` and `reported_at`. Verdict is exactly `violation` or `non_violation`. The timestamp is constrained to `period_end <= reported_at <= label_cutoff`.

These timestamps are source assertions. A valid signature does not prove the clock, actual evaluation time, correct content, correctness of the evaluator, or that a favorable later retry was not substituted. Those conditions are recorded in the mandatory assumptions, not mislabeled verified.

Duplicate labels, labels outside the selected set, wrong evidence/configuration bindings, unknown fields, malformed signatures and out-of-window timestamps reject the bundle. A structurally eligible label with an invalid signature is counted as an **invalid label and a violation**; the sample denominator does not shrink. An absent label is counted as **missing and a violation**. An attacker can cause rejection or a worse bound, but cannot improve the bound by removing an unfavorable outcome.

Let v be valid signed violation labels, u missing labels and z invalidly signed eligible labels. The calculation uses `effective_k = v + u + z`, with n unchanged. This is conservative under the fixed-frame target and truthful valid labels because the hypergeometric upper bound is monotone in the observed violation count.

## Mandatory assumptions

The plan and the result both carry exactly these ten strings, in this order; both verifiers compare them for equality. They are signed statements of what the verifier cannot check, not verified facts.

1. Independent observer truthfully enumerated the declared closed frame; actions outside it are not covered.
2. The sampler generated one secret uniform 32-byte seed, and its commitment was fixed in the signed plan that the relying party pinned before the observation period began; signatures do not prove that ordering.
3. The sampler did not disclose the seed to the observer, producer or evaluator before the frame and submission were fixed; a sampler colluding with a party that fixes event identifiers or commitments can still bias selection.
4. Every pinned plan is accounted for: a pinned plan with no accepted bundle is a failed run to be reported, not replaced by a later plan.
5. The named evaluator produced the first eligible verdict before the cutoff on the committed content and configuration.
6. Evaluator reported_at timestamps are signed source assertions, not independent proof of time or first execution.
7. Pinned role keys and their real-world authority, independence, custody, timing and revocation status were separately established.
8. HMAC selection is modeled as uniform sampling without replacement and the SHA-256 seed commitment as hiding and binding; exhaustive statistical checks do not prove cryptographic assumptions.
9. The bound concerns evaluator-judged violations within this fixed frame, not clinical correctness, safety, future risk or insurance coverage.
10. Local signatures and this experimental bundle do not establish OVERT conformance, profile registration or organizational independence.

## Exact finite-population bound

For each candidate total violation count K, define the hypergeometric lower tail:

```text
F_K(k) = sum_{j=max(0,n-(N-K))}^{min(k,K,n)}
         choose(K,j) * choose(N-K,n-j) / choose(N,n)
```

The reported upper count U is the largest integer K in [0,N] with `F_K(effective_k) > alpha`. A binary search uses the monotonicity in K. The comparison is exact integer arithmetic:

```text
tail_numerator * alpha_denominator >
alpha_numerator * choose(N,n)
```

Strict `>` is intentional: candidates whose exact tail is <= alpha are rejected. Inverting these lower-tail tests yields coverage at least 1-alpha under fixed-size SRS for every fixed N and K. The Python test suite exhaustively enumerates 2,457 combinations across N<=12, all n and K, and alpha in {1/20,1/10,1/2}; the independent Node verifier's `--self-test` separately enumerates 3,311 combinations across N<=20 at alpha 1/20 using linear rather than binary-search inversion. This checks the implementations over those ranges, not every cryptographic assumption.

At a census (n=N), U=effective_k. With n=0 and N>0, U=N and the bound is 1 with `no_sample` status. With N=0, U=0 but `upper_rate=null` and `empty_frame` status: this must not be read as evidence of a zero violation rate.

## Final result and acceptance

The result signer signs the **entire** result, including run/scope/period/cutoff; plan/frame/submission/sample/label-list digests; policy/evaluator hashes; N, requested_n, n, valid-label violations, missing/invalid counts, effective_k; upper violation count; exact rational upper rate or null; rational alpha; method and selection versions; outcome status; the fixed `EXPERIMENTAL_NOT_OVERT_CONFORMANCE` evidence status; and every mandatory assumption.

A verifier recomputes these fields from upstream evidence and demands exact equality. A result signer cannot omit or alter qualifiers, lower missingness, change the denominator, substitute an upper rate or reuse another run's result and still obtain acceptance from this verifier. Merely checking the result signature is insufficient.

The default CLI prints the complete accepted result, not a bare low percentage. A consumer can always misquote output in prose; this protocol prevents a stripped or altered signed artifact from passing the complete verification procedure.

## Tests and cross-implementation checks

`test_protocol.py` has 37 tests, including the seed-commitment vector, a seed that does not open the commitment, a plan without the commitment, and rejection of a non-ASCII byte, a byte-order mark and UTF-16/UTF-32 input by `load_json`. `../tools/differential_check.py` runs 51 cases through both verifiers: 12 accepted with identical results and 39 rejected, each rejection checked against a substring of both verifiers' own reasons so that a rejection for an unintended reason fails the harness. It also verifies three generated 1,000-event bundles (n=100; n=500 with 250 missing labels; n=1000), which both verifiers must accept with identical results; those fixtures are not stored. Results are in `../evidence/differential_results.json`.

`../tools/assumption_counterexamples.py` shows three bundles that both verifiers accept although an external assumption is false: an observer omitting real violating events, a sampler disclosing its committed seed to a party that re-keys content commitments until the selection avoids the violations, and an authorized evaluator signing false labels in a full census. Selective abort is described above; it cannot be shown as an accepted bundle. No private keys are persisted by either tool.

## Explicitly not implemented

Production admission/atomic execution mediation; real independent organizations; distributed or verifiable randomness (beyond the single-party seed commitment); proof of ceremony ordering; protection against seed disclosure or collusion; tracking of abandoned plans; third-party time; a key enrollment, rotation and revocation system; content retrieval/opening and data retention; execution proofs for evaluators; clinical validity; ongoing streams, stratification, adaptive sampling or multi-window inference; a durable one-time result-consumption service; public registry operations; OVERT conformance. This companion makes the smaller experiment inspectable while leaving those requirements visible.
