Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,46 @@ Successful commands return exit code `0`; malformed input or failed verification
Per-command semantics are documented in the table above and in each command's own help
(`ecm-tqag <command> --help`).

### 8.1 Released verifier, and instruments published to be read

`experiments/census_5arm_framef/verify_reported_quantities.py` is the entry point for the
derived records. It is pinned by `experiments/census_5arm_framef/MANIFEST.json`
(49090 bytes, SHA-256 `20d68f6f…`) alongside the eight record files, so it is deliberately
not edited: its contract is stated here instead.

| Aspect | Behaviour |
|---|---|
| Input | `records/*.json` in that directory only. Standard library; no network, no credentials, no page image or source text. |
| `--check` | Recomputes every published quantity and compares. Prints `checked: 119 mismatches: 0` and a VERDICT line. |
| `--json` | Emits the recomputed structure instead: `admission`, `conditions`, `strata`, `judged`, `rated_vs_measured`, `ablation_generator_answerer`, `ablation_independent_answerer`, `answer_in_question`, `containment_rule_independent`, `mcq_generator_answerer`. |
| Exit `0` | All compared quantities match. |
| Exit `1` | At least one mismatch, **or** a released record is absent — the script fails closed with `missing released record: records/<name>` rather than reporting over data it could not read. |

The round-2 and six-arm instruments under `experiments/` are published so the procedure that
produced the released records can be read, not so it can be re-run from this checkout. As
section 10 states, the builder is not part of the release:

- the four `run_round2*_census.py` scripts and `audit_round2_duplicates.py` import
`ecm_tqag.judge_output_contract`, `official_credentials`, `official_outcomes`,
`official_transport`, `v310_*` and the `round2` package, none of which are present here, so
even `--help` fails at import — with the repository's own environment the missing submodule is
named, and in an environment without the `src/` package installed the missing package is named;
- `run_paid.py` and `run_smoke.py` need Pillow, which `pyproject.toml` does not declare
(`dependencies = []`), and run only from `experiments/six_arm`;
- `experiments/six_arm/tests/test_run_transport.py` is collected only when run from that
directory, because `pyproject.toml` sets `testpaths = ["tests"]`.

Each of those files carries an INPUT / OUTPUT / EXIT CODES block, and where it cannot run here,
a RUNNABILITY block naming exactly what is missing. `tools/machine_semantic_audit.py` is the one
tool that runs from a plain checkout with no extra dependency.

Any edit to a text file in this repository changes `repo_tree_digest`, so regenerate the receipt
in the same commit:

```bash
python tools/machine_semantic_audit.py --repo . --output machine-policy-audit.json
```

### 7.1 End-to-end generator

`generate` accepts the versioned `ecm-tqag.normalized-document.v2` JSON contract
Expand Down
25 changes: 25 additions & 0 deletions experiments/round2_evidence_contract/audit_round2_duplicates.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,31 @@
If they disagree, the recorded task outcome depends on which concurrent process
wrote last, i.e. the task was sampled twice and the surviving outcome may be the
luckier of two draws. That would contaminate the round-2 pass rates.

INPUT
No arguments. Reads, read-only:
experiments/runs/round2_exploratory_census_20260815T020000Z/state/transport/
CALL_LEDGER.jsonl the append-only transport ledger
experiments/dataset/dataset_manifest.json
the authoritative frame and the packages rebuilt from it

OUTPUT
stdout duplicate-call concordance tables: distinct tasks, tasks with more than one
paid call, generation and judge concordance, recorded status versus call
outcome, and each discordant generation task with both verdicts.
file runs/round2_exploratory_census_20260815T020000Z/DUPLICATE_CALL_AUDIT.json,
the same tables as a machine-readable record. Nothing else is written and
no released record is modified.

EXIT CODES
0 the audit ran and printed its tables (this is the only code main returns; a
missing ledger or manifest surfaces as an uncaught exception, non-zero)

RUNNABILITY IN THIS RELEASE
Not runnable as shipped: it imports ecm_tqag.official_outcomes,
ecm_tqag.v310_runner, ecm_tqag.v310_validation and round2.round2_validation, none
of which are present in this release, and it reads a run directory that is not
redistributed. --help fails at import with ModuleNotFoundError.
"""
from __future__ import annotations

Expand Down
34 changes: 34 additions & 0 deletions experiments/round2_evidence_contract/run_round2_census.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@
sealed as terminal failures (no retry).

Offline import performs no credential or network access.

INPUT
--phase qualification | census required; no other argument is accepted.
Reads experiments/dataset/dataset_manifest.json and the authoritative frame, and
hashes round2/round2_validation.py (plus this round's prompt module where one
applies) to bind the plan.

OUTPUT
Everything is written under experiments/runs/round2b_exploratory_census_20260815T030000Z, created 0700:
ROUND2_PLAN.json, ROUND2_QUALIFICATION_PLAN.json, ROUND2_REPORT.json
state/<case>.json one record per qualification probe
state/responses/<sha256> raw provider envelopes, via private_write
state/tasks/, state/transport/ task claims and the append-only call ledger
stdout carries the per-call progress lines. No path outside the run directory is
written.

EXIT CODES
0 the requested phase completed
1 qualification stopped on its first failure, or a previously recorded probe was
not PASS (stop-first-failure is deliberate: the phase is not resumable past a
failed probe)
2 ConcurrentRunBlocked -- another process holds the run lock
Any other failure propagates as an uncaught exception (traceback, non-zero).

RUNNABILITY IN THIS RELEASE
Not runnable as shipped. Import time needs ecm_tqag.judge_output_contract,
official_credentials, official_outcomes, official_transport, v310_contracts,
v310_execution, v310_runner, v310_validation, v3102_endpoint_contract and the
round2 package; none are present under src/ or experiments/six_arm/ here, and
README section 10 states the builder is not part of the release. Invoking this
file -- including --help -- therefore fails at import with ModuleNotFoundError
before any argument is parsed. Execution additionally requires provider
credentials and network access. It is published so the instrument that produced
the released records can be read, not so it can be re-run from this checkout.
"""
from __future__ import annotations

Expand Down
34 changes: 34 additions & 0 deletions experiments/round2_evidence_contract/run_round2c_census.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@
sealed as terminal failures (no retry).

Offline import performs no credential or network access.

INPUT
--phase qualification | census required; no other argument is accepted.
Reads experiments/dataset/dataset_manifest.json and the authoritative frame, and
hashes round2/round2_validation.py (plus this round's prompt module where one
applies) to bind the plan.

OUTPUT
Everything is written under experiments/runs/round2c_exploratory_census_20260815T041500Z, created 0700:
ROUND2_PLAN.json, ROUND2_QUALIFICATION_PLAN.json, ROUND2_REPORT.json
state/<case>.json one record per qualification probe
state/responses/<sha256> raw provider envelopes, via private_write
state/tasks/, state/transport/ task claims and the append-only call ledger
stdout carries the per-call progress lines. No path outside the run directory is
written.

EXIT CODES
0 the requested phase completed
1 qualification stopped on its first failure, or a previously recorded probe was
not PASS (stop-first-failure is deliberate: the phase is not resumable past a
failed probe)
2 ConcurrentRunBlocked -- another process holds the run lock
Any other failure propagates as an uncaught exception (traceback, non-zero).

RUNNABILITY IN THIS RELEASE
Not runnable as shipped. Import time needs ecm_tqag.judge_output_contract,
official_credentials, official_outcomes, official_transport, v310_contracts,
v310_execution, v310_runner, v310_validation, v3102_endpoint_contract and the
round2 package; none are present under src/ or experiments/six_arm/ here, and
README section 10 states the builder is not part of the release. Invoking this
file -- including --help -- therefore fails at import with ModuleNotFoundError
before any argument is parsed. Execution additionally requires provider
credentials and network access. It is published so the instrument that produced
the released records can be read, not so it can be re-run from this checkout.
"""
from __future__ import annotations

Expand Down
34 changes: 34 additions & 0 deletions experiments/round2_evidence_contract/run_round2d_census.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@
sealed as terminal failures (no retry).

Offline import performs no credential or network access.

INPUT
--phase qualification | census required; no other argument is accepted.
Reads experiments/dataset/dataset_manifest.json and the authoritative frame, and
hashes round2/round2_validation.py (plus this round's prompt module where one
applies) to bind the plan.

OUTPUT
Everything is written under experiments/runs/round2d_exploratory_census_20260815T044500Z, created 0700:
ROUND2_PLAN.json, ROUND2_QUALIFICATION_PLAN.json, ROUND2_REPORT.json
state/<case>.json one record per qualification probe
state/responses/<sha256> raw provider envelopes, via private_write
state/tasks/, state/transport/ task claims and the append-only call ledger
stdout carries the per-call progress lines. No path outside the run directory is
written.

EXIT CODES
0 the requested phase completed
1 qualification stopped on its first failure, or a previously recorded probe was
not PASS (stop-first-failure is deliberate: the phase is not resumable past a
failed probe)
2 ConcurrentRunBlocked -- another process holds the run lock
Any other failure propagates as an uncaught exception (traceback, non-zero).

RUNNABILITY IN THIS RELEASE
Not runnable as shipped. Import time needs ecm_tqag.judge_output_contract,
official_credentials, official_outcomes, official_transport, v310_contracts,
v310_execution, v310_runner, v310_validation, v3102_endpoint_contract and the
round2 package; none are present under src/ or experiments/six_arm/ here, and
README section 10 states the builder is not part of the release. Invoking this
file -- including --help -- therefore fails at import with ModuleNotFoundError
before any argument is parsed. Execution additionally requires provider
credentials and network access. It is published so the instrument that produced
the released records can be read, not so it can be re-run from this checkout.
"""
from __future__ import annotations

Expand Down
34 changes: 34 additions & 0 deletions experiments/round2_evidence_contract/run_round2e_census.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,40 @@
sealed as terminal failures (no retry).

Offline import performs no credential or network access.

INPUT
--phase qualification | census required; no other argument is accepted.
Reads experiments/dataset/dataset_manifest.json and the authoritative frame, and
hashes round2/round2_validation.py (plus this round's prompt module where one
applies) to bind the plan.

OUTPUT
Everything is written under experiments/runs/round2e_exploratory_census_20260815T051500Z, created 0700:
ROUND2_PLAN.json, ROUND2_QUALIFICATION_PLAN.json, ROUND2_REPORT.json
state/<case>.json one record per qualification probe
state/responses/<sha256> raw provider envelopes, via private_write
state/tasks/, state/transport/ task claims and the append-only call ledger
stdout carries the per-call progress lines. No path outside the run directory is
written.

EXIT CODES
0 the requested phase completed
1 qualification stopped on its first failure, or a previously recorded probe was
not PASS (stop-first-failure is deliberate: the phase is not resumable past a
failed probe)
2 ConcurrentRunBlocked -- another process holds the run lock
Any other failure propagates as an uncaught exception (traceback, non-zero).

RUNNABILITY IN THIS RELEASE
Not runnable as shipped. Import time needs ecm_tqag.judge_output_contract,
official_credentials, official_outcomes, official_transport, v310_contracts,
v310_execution, v310_runner, v310_validation, v3102_endpoint_contract and the
round2 package; none are present under src/ or experiments/six_arm/ here, and
README section 10 states the builder is not part of the release. Invoking this
file -- including --help -- therefore fails at import with ModuleNotFoundError
before any argument is parsed. Execution additionally requires provider
credentials and network access. It is published so the instrument that produced
the released records can be read, not so it can be re-run from this checkout.
"""
from __future__ import annotations

Expand Down
17 changes: 17 additions & 0 deletions experiments/six_arm/ecm_tqag/stats/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@
2. **Fail-closed composition.** The artifact cannot be built with a partial
primary table, cannot present a suppressed ``Delta_perm`` as an estimate, and
cannot mark an exploratory judge dimension as a secondary claim.

ROLE: LIBRARY MODULE, NOT A COMMAND-LINE TOOL
This file has no __main__ block and no argument parser, so it has no exit codes and
cannot be invoked. It is imported by the six-arm runner and by the release tooling.

INPUT
Function arguments only. build_primary_statistics and analyze_run are pure functions
of what they are passed: the preregistered statistics inputs, and for analyze_run the
run artifacts. Every bootstrap seed is a required argument, so no input is read from
the environment, the network or an implicit default.

OUTPUT
A JSON-serialisable dict; serialize renders it and stamps artifact_digest as a
canonical-JSON SHA-256 over the payload. verify_digest recomputes that digest from the
artifact so a replay either matches exactly or the difference is visible. No file is
written by this module: the caller decides where the artifact goes and may attach a
timestamp outside the digested payload.
"""
from __future__ import annotations

Expand Down
30 changes: 30 additions & 0 deletions experiments/six_arm/run_paid.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,36 @@
The command is intentionally boring and fail-closed: it imports the verified smoke,
then runs extraction -> construction -> sensitivity -> probes -> audit -> judging.
It never starts a later phase when a prerequisite is incomplete.

INPUT
Required: --freeze, --smoke, --manifest, --controls, --run-dir, --openrouter-key,
--omniproxy-key, --openrouter-url, --omniproxy-url.
Optional: --execute (without it the execution gate blocks), and the paired import
arguments --import-extraction-run/--import-extraction-freeze and
--import-construction-run/--import-construction-freeze/--import-construction-task-id,
which must be supplied as complete pairs.
Key arguments are paths to credential files, never key material.

OUTPUT
Under --run-dir: SENSITIVITY_VERDICT.json, JUDGING_FRAME.json and
PAID_RUN_SUMMARY.json (schema ecm-tqag.paid-run.v1), plus the per-phase reports the
runner writes. stdout gets one JSON line:
{"status": "COMPLETE", "http_attempts_used": N, "sensitivity_passed": true}

EXIT CODES
0 every phase completed and the summary was written
non-zero main has no try block, so a blocked run ends as an uncaught exception:
PaidRunBlocked (e.g. BLOCKED_PAID_RUN:sensitivity_floor_failed) or
ValueError with a BLOCKED_PAID_CLI:... reason such as key_invalid,
provider_invalid or import_arguments_must_be_paired. There is no separate
numeric code per failure class; the reason is in the exception text.

RUNNABILITY IN THIS RELEASE
Runs only from experiments/six_arm (or with that directory on sys.path) and needs
Pillow for image handling. pyproject.toml declares dependencies = [], so a fresh
environment fails at import with ModuleNotFoundError: No module named 'PIL'; with
Pillow present --help exits 0 and prints 31 lines. Provider credentials, network
access and a frozen plan are required for execution.
"""
from __future__ import annotations

Expand Down
29 changes: 29 additions & 0 deletions experiments/six_arm/run_smoke.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,33 @@
#!/usr/bin/env python3
"""Run the six frozen role-specific smoke calls that authorize a paid run.

INPUT
Required: --freeze, --run-dir, --openrouter-key, --omniproxy-key, --openrouter-url,
--omniproxy-url. Optional: --execute; validate_pre_smoke_gate authorizes only this
smoke phase and raises BLOCKED_PRE_SMOKE:<reasons> when the frozen plan does not
permit it. Key arguments are paths to credential files, never key material.
The prompt image is generated in memory (a 640x240 PNG carrying the verification
code), so no image file is read from disk.

OUTPUT
--run-dir/SMOKE_RESULTS.json, plus one JSON line on stdout with status,
passed_roles and http_attempts_used. The run ledger under --run-dir records every
HTTP attempt against the cap.

EXIT CODES
0 all six role smokes passed
non-zero failures raise rather than return: ValueError BLOCKED_SMOKE:<role>:<outcome>:<reason>
for a failed call, BLOCKED_SMOKE:<role>:missing_response_sidecar, and
BLOCKED_SMOKE:unsupported_provider / current_ledger_cap_missing /
invalid_current_ledger_cap for a malformed frozen plan. The reason is in
the exception text; there is no numeric code per class.

RUNNABILITY IN THIS RELEASE
Runs only from experiments/six_arm (or with that directory on sys.path) and needs
Pillow. pyproject.toml declares dependencies = [], so a fresh environment fails at
import with ModuleNotFoundError: No module named 'PIL'; with Pillow present --help
exits 0 and prints 16 lines. Credentials and network access are required.
"""
from __future__ import annotations

import argparse
Expand Down
23 changes: 23 additions & 0 deletions experiments/six_arm/tests/test_run_transport.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
"""Transport invariants for the six-arm runner: idempotency, budget, identity.

ROLE: PYTEST MODULE, NOT A COMMAND-LINE TOOL
No __main__ block and no argument parser, so there are no exit codes to document;
pytest's own status is the result.

INPUT
pytest fixtures tmp_path and monkeypatch. urllib.request.urlopen is monkeypatched in
every test, so no network access occurs and no credential is read: _config writes a
throwaway key file under tmp_path.

OUTPUT
The pytest report. The only files written are RUN_LEDGER.jsonl and the key file, both
under tmp_path, which pytest removes.

HOW TO RUN IT
cd experiments/six_arm && PYTHONPATH=.:../../src python -m pytest tests/test_run_transport.py
Verified: 4 passed. Running it as `pytest experiments/six_arm/tests/test_run_transport.py`
from the repository root fails during collection, because the module imports the
experiments/six_arm-local ecm_tqag package rather than the src/ one. Note also that
pyproject.toml sets testpaths = ["tests"], so the CI invocation of plain `pytest` does
not collect this file at all.
"""
from __future__ import annotations

import json
Expand Down
2 changes: 1 addition & 1 deletion machine-policy-audit.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"audit_kind": "deterministic-string-and-boundary-check",
"checked_file_count": 203,
"findings": [],
"repo_tree_digest": "96445d36995f3ec2d8962365ffd9723838eefd93b546b7306f4c9d72ad96d4a3",
"repo_tree_digest": "421d39fd0cb8c296fe52a69b04ee945ea86031f7f7340d6c0cbc54b657607594",
"schema": "ecm-tqag.machine-policy-audit.v1",
"semantic_validation": false,
"status": "PASS"
Expand Down
Loading
Loading