Skip to content

Commit 86d5b26

Browse files
authored
feat(bench): harden PowerPlan and final benchmark gate (#18)
## Summary Separate benchmark power planning from final holdout evaluation and make both stages deterministic, digest-bound, and fail-closed. Calibration observations now produce an immutable PowerPlan before the final schedule is frozen. The final gate accepts only the exact scheduled holdout identities and suppresses economic statistics whenever the campaign, plan, schedule, observations, or quality contract is invalid. Closes #7. ## Implementation - Add an offline `experiment power-plan` entry point that: - accepts calibration observations only; - requires complete `FrontierDirect`/`NeedleMiss` pairs; - rejects missing, duplicate, mismatched, failed, non-positive, contaminated, non-beneficial, or zero-variance inputs; - emits a deterministic `needle.power-plan/2` artifact with canonical input and artifact digests. - Bind the PowerPlan to the frozen corpus and campaign commitment, and bind the final schedule to the exact serialized plan and required pair count for each route. - Harden `experiment final-report` so that it: - loads the frozen campaign, schedule, and PowerPlan using bounded reads; - verifies their raw digests and semantic commitments; - requires exactly one observation for every scheduled task, route, split, repetition, pair seed, and arm; - preserves infrastructure, quality, staleness, worker, discovery, and recomputation failures instead of filtering them; - calculates the paired cost ratio and deterministic two-sided 95% BCa interval only after the complete contract passes. - Add deterministic synthetic calibration and final-observation fixtures for both built-in routes, plus adversarial coverage for incomplete pairs, duplicated identities, stale artifacts, campaign mismatches, schedule count changes, calibration leakage, invalid costs, and failed evidence. - Update the public synthetic campaign, schedule, manifest, PowerPlan, benchmark documentation, and project status. This changes the PowerPlan schema from v1 to v2 and the machine-readable final-gate report to v3. Existing checked-in fixtures were migrated accordingly. ## Validation ```text cargo fmt --all -- --check passed cargo test --locked -p needle-bench final_gate 8 passed cargo test --locked -p needle-bench --test publication_surface 3 passed cargo test --locked -p needle-bench 53 passed cargo test --locked -p needle-app 84 passed cargo clippy --locked --workspace --all-targets -- -D warnings passed with no findings npm ci completed; reported 3 high-severity audit findings npm run build passed cargo run --locked -p needle-app -- experiment power-plan benchmarks/corpus/router-cache/synthetic-calibration-observations.jsonl --corpus benchmarks/corpus/router-cache/manifest.json --campaign benchmarks/corpus/router-cache/campaign.json emitted a deterministic synthetic PowerPlan with no planning failures and 3 required pairs per route cargo run --locked -p needle-app -- experiment final-report benchmarks/corpus/router-cache/synthetic-final-observations.jsonl --corpus benchmarks/corpus/router-cache/manifest.json --bootstrap-resamples 10000 --seed 42 verified 3/3 pairs per route and failed closed, as expected, because the public PowerPlan is synthetic cargo test --locked --workspace one needle-runtime cache-hit test failed during the aggregate run; the same test passed immediately when rerun in isolation ``` No provider calls or paid benchmark observations were executed. ## Risks/limitations The checked-in PowerPlan and observations are intentionally synthetic and remain ineligible for an economic claim. This change validates the benchmark protocol but does not establish real provider-backed savings. A production claim still requires private calibration and holdout material, a production-sealed PowerPlan, an approved provider budget, and a complete provider run. The aggregate workspace test run observed one isolated cache-hit failure outside the changed benchmark files. Its focused rerun passed, but the aggregate run was not fully green. Bootstrap work and observation inputs are bounded, and statistical work begins only after the complete frozen contract validates. ## Documentation/evidence Updated: - `docs/BENCHMARKING.md` - `benchmarks/README.md` - `PROJECT_STATUS.md` - public router-cache manifest, campaign, schedule, and PowerPlan - deterministic synthetic calibration and final-observation fixtures The synthetic fixtures are protocol-validation evidence only and are not published economic evidence. ## AI assistance and human verification ```text AI assistance: code, tests, and documentation — implemented the digest-bound PowerPlan and final-gate changes, generated the synthetic fixtures, and exercised the required deterministic and adversarial cases. Human verification: reviewed the complete 18-file diff, checked artifact and campaign bindings, inspected the fail-closed statistical path, verified the reported commands and outputs, and confirmed that no provider calls, credentials, unrelated edits, or live benchmark artifacts were included. ``` ## Ownership checklist - [x] I read and understand the complete diff and can explain every material change. - [x] I personally verified the reported tests and technical or performance claims. - [x] I finalized and personally published the commits and this pull request. - [x] I checked for unrelated edits, credentials, generated files, and live artifacts. - [x] Public documentation and `PROJECT_STATUS.md` are updated when applicable.
1 parent 0cc951b commit 86d5b26

18 files changed

Lines changed: 2185 additions & 448 deletions

PROJECT_STATUS.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,13 @@ validation.
142142
- Linux and macOS lack live platform evidence.
143143
- The accepted economic results are calibrations, not a powered corpus or
144144
general savings claim. The public v4 benchmark manifest is answer-free and
145-
synthetic; the offline protocol and synthetic evaluator fixture are complete,
146-
but real private material, a non-synthetic validated PowerPlan, and a
147-
provider run are absent. App provider execution remains fail-closed until an
148-
isolated executor/broker consumes only ArmLaunch. This does not prove
145+
synthetic. Deterministic power planning, exact schedule/observation binding,
146+
fail-closed paired analysis, and the two-sided 95% BCa report path are
147+
implemented and offline validated. The checked-in plan is reproducible from
148+
explicitly synthetic calibration observations and remains permanently
149+
claim-ineligible. Real private material, a non-synthetic validated PowerPlan,
150+
and a provider run are absent. App provider execution remains fail-closed
151+
until an isolated executor/broker consumes only ArmLaunch. This does not prove
149152
filesystem ACLs or process isolation; callers must keep private bundles
150153
unmounted and inaccessible to the runner identity.
151154
- No public beta, support channel, or compatibility window exists.

benchmarks/README.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ maintainers; no external bundle path is present in public manifests or arm
7272
launch projections. A real sealed bundle and validated production PowerPlan
7373
are absent from this checkout, so offline preflight remains fail-closed. The
7474
synthetic bundle is complete for evaluator tests but cannot enable a provider
75-
run. A future caller must keep private evaluator material unmounted and
76-
inaccessible to the runner identity; this protocol does not claim ACL or
77-
process-isolation proof.
75+
run. `router-cache/synthetic-calibration-observations.jsonl` deterministically
76+
reproduces the checked-in synthetic PowerPlan, while
77+
`router-cache/synthetic-final-observations.jsonl` exercises the exact paired
78+
holdout contract and its fail-closed synthetic boundary. None of these
79+
artifacts is economic evidence. A future caller must keep private evaluator
80+
material unmounted and inaccessible to the runner identity; this protocol does
81+
not claim ACL or process-isolation proof.

benchmarks/corpus/router-cache/campaign.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
{
22
"schema": "needle.multi-task-campaign/2",
3-
"schedule_digest": "b3:c853b4ed84d8e9119013d788a7c769c63fd77f63a947706fbe4c128b65ed51d5",
3+
"schedule_digest": "b3:3ae9b089ba4c7bee7b58ad562a5797872377ef2d986fba30d75651cc567210dd",
4+
"task_ids": [],
45
"paid_arms": [
56
"frontier_direct",
67
"needle_miss"
@@ -15,6 +16,7 @@
1516
"native_subagent",
1617
"escalation"
1718
],
19+
"repetitions_per_task": 0,
1820
"automatic_retries": false,
1921
"statistical_claim": false,
2022
"bootstrap_resamples": 10000,

benchmarks/corpus/router-cache/manifest.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@
1616
"next_pilot_path": "minimal-live-pilot.json",
1717
"next_pilot_digest": "b3:18a434227eb9abf2381eb0a65348f0dba66301ccba7dbdeb57c7933b078180cb",
1818
"campaign_path": "campaign.json",
19-
"campaign_digest": "b3:082239af1ebe785555801af74c817c5e49c143759cd3e62ef6607f54dadf5e1d",
19+
"campaign_digest": "b3:a434abd47f654b222576e60c29f1640fd311d7fa81fa66419018fb55b008329b",
2020
"schedule_path": "schedule.json",
21-
"schedule_digest": "b3:c853b4ed84d8e9119013d788a7c769c63fd77f63a947706fbe4c128b65ed51d5",
21+
"schedule_digest": "b3:3ae9b089ba4c7bee7b58ad562a5797872377ef2d986fba30d75651cc567210dd",
2222
"power_plan_path": "power-plan.json",
23-
"power_plan_digest": "b3:8605f040792744907aa94d3ce017a211b774c16521dbe744acb7a1b587647630",
23+
"power_plan_digest": "b3:0cfe45b5cca814731619776de15572959720cd576db2c0a8d8cf0bf8d0b561e6",
2424
"sealed_bundle_schema": "needle.sealed-oracle-index/1",
2525
"sealed_bundle_digest": "b3:3750e933fa1226fed1892dc4ba3ddad4f84fbf6bd58135d8f26355103dc681c7",
2626
"tasks": [
Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,33 @@
11
{
2-
"schema": "needle.power-plan/1",
3-
"plan_id": "synthetic-router-cache-v1",
2+
"schema": "needle.power-plan/2",
3+
"plan_id": "power-plan-1d6bfc9443debec0",
44
"manifest_digest": "b3:8be00a443b7e1a57813d8dbe25e6ea22a988f7536bc0f159fee8a58f0fa6cd7a",
5-
"campaign_digest": "b3:647300dac4ba3c304b4052a114f1e80b0eb214e278fd4415bbd576c369652864",
6-
"calibration_input_digest": "b3:4d27a8427bd3655d59e88c37efadcccfca4a7d82cd4a4324708180aea31289c0",
7-
"estimator_revision": "issue-7-structural-v1",
5+
"campaign_commitment": "b3:647300dac4ba3c304b4052a114f1e80b0eb214e278fd4415bbd576c369652864",
6+
"calibration_input_digest": "b3:1d6bfc9443debec09dab40fdd8b72bd78e6e5e5bf01075def337b31f92c4a104",
7+
"estimator_revision": "needle.paired-log-ratio-power/1",
88
"alpha_basis_points": 500,
99
"target_power_basis_points": 9000,
1010
"routes": [
1111
{
1212
"route": "locate_implementation",
1313
"baseline_arm": "frontier_direct",
1414
"treatment_arm": "needle_miss",
15-
"pair_key": "task_id:repetition",
16-
"observed_log_ratio_mean": -0.4,
17-
"observed_log_ratio_stddev": 0.2,
18-
"required_pairs": 1
15+
"pair_key": "corpus_digest:campaign_commitment:task_id:route:split:repetition:pair_seed",
16+
"observed_log_ratio_mean": -0.4337502838523616,
17+
"observed_log_ratio_stddev": 0.10900099103037066,
18+
"required_pairs": 3
1919
},
2020
{
2121
"route": "trace_state_flow",
2222
"baseline_arm": "frontier_direct",
2323
"treatment_arm": "needle_miss",
24-
"pair_key": "task_id:repetition",
25-
"observed_log_ratio_mean": -0.4,
26-
"observed_log_ratio_stddev": 0.2,
27-
"required_pairs": 1
24+
"pair_key": "corpus_digest:campaign_commitment:task_id:route:split:repetition:pair_seed",
25+
"observed_log_ratio_mean": -0.4337502838523616,
26+
"observed_log_ratio_stddev": 0.10900099103037066,
27+
"required_pairs": 3
2828
}
2929
],
3030
"validated": true,
31-
"synthetic": true
31+
"synthetic": true,
32+
"artifact_digest": "b3:88cadb0c43e0ac1a39566f5c76fa1a64949b2ab88bdb592aaaafc76b897b22fa"
3233
}

0 commit comments

Comments
 (0)