Skip to content

fix(v5): reject weakened frozen power planning inputs - #327

Draft
TheHalfMoon wants to merge 7 commits into
quality/v5-manuscript-source-auditfrom
fix/v5-power-planner-contract-hardening
Draft

TheHalfMoon wants to merge 7 commits into
quality/v5-manuscript-source-auditfrom
fix/v5-power-planner-contract-hardening

Conversation

@TheHalfMoon

@TheHalfMoon TheHalfMoon commented Oct 10, 2026 •

Copy link
Copy Markdown
Owner

Purpose: stop silently weakening frozen V5 development power planning

This is a DRAFT code-quality successor to #325, with no change to the frozen scientific branch, the original 307 evidence entries, the official repo owner or main.

Reproduced defects on pre-fix planner

Before this patch, scripts/v5_power_margin_plan.py accepted all of:

  • desired_power=0.51 instead of the V5 frozen 0.90;
  • family_alpha=0.20 instead of the V5 frozen familywise 0.05;
  • planned_clusters=2 rather than the present prospective planning value 4096;
  • a one-character string masquerading as the domain-floor justification SHA-256;
  • paired_sd=false, interpreted as a spurious zero variance.

A fabricated arbitrary full-length 64-digit hash may still satisfy syntax; this utility cannot establish a reviewed file's identity or content without a separate source-bound review stage.

Corrective measures

  • Enforce exactly family_alpha=0.05, desired_power=0.90, planned_clusters=4096 for this frozen planning version. A different design/count requires review and explicit versioning under statistical gate V5 statistical family, seed variance and 90% power — decision gate #326.
  • Reject Boolean/numeric-string/overflow SD, floor and repeatability input rather than converting them.
  • Require syntactically valid, lowercase 64-character SHA-256 provenance fields for each metric. This is a syntax prerequisite, not standalone evidence verification.
  • Make the output explicitly declare family_membership_frozen_and_independently_reviewed=false, source_case_seed_nuisance_qualified=false, final_90_percent_power_qualified=false and confirmatory_execution_authorized=false, regardless of apparent illustrative planning success.
  • Add 16 synthetic negative regressions and a separate exact-PR-head GitHub CI with read-only contents permissions, no persisted checkout credentials, pinned pytest, no model/GPU/API/PHI or experimental data access.

Exact-head local evidence

  • macOS V5 specialized tests: 339 passed, 86 subtests passed (prior to the last additional overflow regression).
  • Complete repository suite after all new tests: 1,392 passed, 264 subtests passed.
  • Focused statistical guard suite after all new tests: 28 passed.
  • Frozen original file verification: 307/307 PASS.
  • Python/CI YAML parse and scope policy checks, git diff whitespace: PASS.
  • Alibaba OCR local delegate preview: 2 code/config files eligible. This is NOT an external independent OCR model review verdict.
  • GitHub cryptographic signature unverified until GitHub/appropriate independent gate says otherwise; commit is DCO-signed off only.

Scientific and governance boundaries

This change does not enumerate, freeze or approve the true Holm primary non-target hypothesis family/count. Three training seeds and 72 descriptive within-seed source-task SD cells are not a qualified crossed source-case × training-seed nuisance model. It does not calculate a final valid power certificate, prove clinical utility, permit confirmatory/reserve materialization, authorize independent-family replication, merge pending draft PRs, or publish a paper. All missing review/founder/signature/method steps are tracked transparently in #326.

Review request: verify the input trust-boundary correction and negative tests without promoting a syntactic validation PASS into scientific qualification.


Summary by cubic

Hardens the V5 development power planner so callers can no longer silently weaken frozen planning inputs, fabricate evidence identifiers, or mask a high-variance cell with another intervention's descriptive variance. Output moves to schema v2 with per-hypothesis plans and an explicit intersection aggregate.

  • Rejects any deviation from the frozen V5 constants (family_alpha 0.05, desired_power 0.90, planned_clusters 4096), and rejects Booleans, numeric strings, overflow, and non-SHA-256-shaped evidence identifiers.
  • Finite but unrepresentable nuisance values now raise a fail-closed PowerPlanContractError instead of an uncontrolled numeric error or fabricated success.
  • Replaces metric-level paired_sd with paired_nuisance_by_hypothesis, requiring one unqualified descriptive record per declared hypothesis so a shared metric SD cannot stand in for an intervention cell.
  • Requires primary_non_target_hypotheses to match primary_non_target_family_size, with validated unique IDs, metric presence, coupling tag, SOURCE_CASE unit, and primary flag; the ordered list is bound to a deterministic SHA-256.
  • Output emits explicit false flags for family freeze, nuisance qualification, power qualification, and confirmatory authorization, and the CLI reports PASS_DEVELOPMENT_ONLY_INPUT_CONTRACT.
  • The CLI now resolves the repository root directly, so it runs without PYTHONPATH.

New Features

  • Adds exact-PR-head CI with read-only permissions, pinned pytest, and no persisted credentials.
  • Adds synthetic negative regressions covering relaxed constants, forged hashes, typed inputs, overflow, and hypothesis/nuisance drift, plus a mechanics-only validation document.

Written for commit 9d7db0f. Summary will update on new commits.

View guided diff Turn on auto-fix

Signed-off-by: Gocceri <azialshehri@gmail.com>
@coderabbitai

coderabbitai Bot commented Oct 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copy link
Copy Markdown
Owner Author

Exact-head handoff, 2026-10-10: hypothesis-specific nuisance / direct CLI gate

Draft PR #327 advanced append-only to commit 5cd1de66c9158f8f3bf6a649d7089bb8cedae0da. This fixes another real inferential input-contract flaw in scripts/v5_power_margin_plan.py: an apparently favorable metric-level paired SD could have been reused for different interventions sharing that metric. Earlier illustrative all_metrics_meet_normal_approx_target could thus conceal an unfavorable intervention-specific hypothesis.

The breaking v2 input/output contract forbids metric-wide paired SD, retains floor/repeatability margins by metric, and requires exactly one paired_nuisance_by_hypothesis[ID] record for every declared primary cell (and no extras), with finite non-Boolean paired_sd, SHA-256-shaped nuisance evidence identity, and nuisance_scope=UNQUALIFIED_DEVELOPMENT_DESCRIPTIVE. hypothesis_plans[ID] computes illustrative per-cell N/MDE at frozen alpha/power/count; all_declared_hypotheses_meet_illustrative_normal_approx_target is the intersection of every listed hypothesis. Synthetic negative test proves a low-SD B1 canonical-NLL cell passes while an unfavorable high-SD C1 cell on the same metric fails the overall intersection. Missing/extra cells, invalid/falsely 'qualified' nuisance scope, malformed SD/hash and old metric-wide paired_sd are rejected.

The CLI itself previously failed with ModuleNotFoundError: src; it now resolves repo root and is tested by subprocess from an unrelated temp directory with no PYTHONPATH. Output schema changes to commandmed.v5.power-margin-plan.v2; status is PASS_DEVELOPMENT_ONLY_INPUT_CONTRACT (not a power certificate). All true qualification/authority fields remain hardcoded false.

Verified evidence: macOS 1,420 full-repo pytest PASS +264 subtests, 368 V5 PASS +86 subtests, 56 focused planner PASS, 307/307 original scientific file SHA bindings unchanged. Genuine GitHub Actions exact-head run #38030437031 on 5cd1de6 SUCCESS. No new model inference, GPU, Kaggle run, PHI, confirmatory or reserve identities. DCO sign-off exists but GitHub reports cryptographic signing unsigned, and Alibaba OCR preview/CodeRabbit are not independent scientific approval.

Still NOT qualified: the declared family may omit real primary cells; per-cell descriptive SD source hash is syntax-checked but not a reviewed causal/variance provenance binding; only three stochastic training seeds and crossed source-case × seed uncertainty remain scientifically unresolved; appropriate familywise Holm primary hypothesis/missingness/native effect margins and 90% sample power are not prospectively reviewed. #326 remains OPEN. No draft merge, claim promotion, clinical validation, publication or confirmatory access is authorized.

Signed-off-by: Gocceri <azialshehri@gmail.com>

Copy link
Copy Markdown
Owner Author

2026-10-10 — Fail-closed numerical overflow repair, exact-head CI PASS

Normal append-only update of this still-DRAFT PR #327 to 9c55c233be9e932557e2de109b852a0265f51772. A model-free adversarial input probe found the planner raised a raw OverflowError: cannot convert float infinity to integer for a finite IEEE-754 descriptive paired SD 1e308 when the unchanged normal-approximation helper formed an unrepresentable required-source-cluster count. The caller now fails closed with a PowerPlanContractError clearly stating that the numerical power-planning result is unrepresentable; a nonfinite MDE is also rejected. Added negative regression coverage including direct contract-specific repeatability of the case and the evidence-bound source note. The original scientific/frozen 307-entry statistics mechanics and V5 research results were not modified.

Exact local evidence (Mac only): focused planner 58 passed, V5 suite 370 passed +86 subtests, complete repo 1,422 passed +264 subtests, original 307 frozen file hashes 307/307 pass, source compilation and git diff --check pass. The separate exact-head GitHub Actions run #38031217628 at 9c55c23 is COMPLETED SUCCESS, including pinned focused contract regressions and exact-head read-only checkout.

Boundary: This is numerical input robustness, not a demonstrated true 90% power estimate. PR remains DRAFT/UNMERGED. No model inference/GPU/PHI/confirmatory/reserve identities, no clinical/paper claim. DCO signed off but GitHub cryptographic signature still unsigned; local OCR preview is not independent model/research peer review; methodology/family/seed-variance/decision gates are tracked in #326.

@TheHalfMoon

Copy link
Copy Markdown
Owner Author

2026-10-10 — Reproducible input-provenance review finding: ambiguous duplicate JSON keys

Scope: source-quality finding against current PR #327 exact remote HEAD 9c55c233be9e932557e2de109b852a0265f51772. This is NOT an independent Alibaba OCR model verdict or a scientific approval.

The development-only CLI's main() loads its caller-provided planning specification with standard json.loads(...) (in scripts/v5_power_margin_plan.py). Standard Python JSON parsing silently retains the last value for a duplicate object key instead of rejecting conflicting declarations. This applies to the top-level Holm family size, to primary_non_target_hypotheses entries and to nested per-cell nuisance descriptors.

Reproduced on Mac without modifying any repo or frozen artifact: formed a syntactically valid JSON spec from the current #327 test fixture and appended duplicate "primary_non_target_family_size": 1, then "primary_non_target_family_size": 4 (three total occurrences counting the original). The direct CLI returned code 0 and emitted PASS_DEVELOPMENT_ONLY_INPUT_CONTRACT, with resulting size 4, despite the contradictory entries. The final-power-qualified and confirmatory-authorized flags remained false (so do NOT characterize this as actual confirmatory authorization).

This is an audit-trace ambiguity at the input trust boundary. A human reviewing one occurrence of an allegedly prospectively frozen family or seed nuisance could see a contradictory meaning from the one actually consumed by the tool. It also undermines canonical content identity if some external parser handles duplicate keys differently.

Suggested narrow remedy: make the JSON reader fail closed on duplicate keys at every object nesting level using a strict object_pairs_hook, raising an explicit PowerPlanContractError and not creating an output file. Test top-level family-size duplication and a nested duplicate per-hypothesis paired_sd or hypothesis_id from real subprocess execution (no PYTHONPATH), plus a normal valid single-key control. Keep original 307 frozen source artifacts and research protocol unchanged; prevent changing scientific qualification flags. Avoid relying only on json.dumps(sort_keys=True) of the already-lossy parsed object.

Worktree ownership: ~/CommandMed-power-contract currently has another session's uncommitted planner/test edits (numeric repeatability overflow), so I deliberately did not modify, stage, reset, commit or push into that worktree. This is an actionable review finding to address in the existing #327 successor, not grounds for a redundant new branch. Independent code/scientific peer review and issue #326 remain OPEN.

@TheHalfMoon

Copy link
Copy Markdown
Owner Author

2026-10-10 — Duplicate-JSON trust-boundary finding addressed in isolated draft successor #328

The confirmed duplicate-key source ambiguity from this earlier review finding has now been fixed in a separate stacked DRAFT PR #328, precisely because ~/CommandMed-power-contract on #327 contains independently owned uncommitted code/test changes that must not be overwritten or staged by this session.

At #328 exact head 61231565e3bf79770b79eef334f4225cbf28c05d, a strict nested object_pairs_hook rejects duplicate keys even after Unicode escape decoding, and the CLI rejects nonstandard NaN/Infinity constants, malformed UTF-8/JSON and array roots with no output. Subprocess tests from a foreign working directory with no PYTHONPATH demonstrate top-level size, nested nuisance and nested hypothesis duplicate rejection while normal valid input still passes with all scientific/confirmatory authorization fields false.

Local Mac verification: 1,430 full-repository tests PASS +264 subtests, 378 V5 tests PASS +86 subtests, 66 focused planner tests PASS, original frozen evidence hashes 307/307 PASS, Python compilation and diff checks PASS. The separate exact-head GitHub Actions run is #38033628810, and was QUEUED at the time of writing—check the final result before considering this code qualified.

This is parsing integrity only; genuine independent Alibaba OCR/medical statistical review, cryptographic signing, prospective Holm family completeness and source×training-seed variance, true 90% power, founder merge/confirmatory authority remain OPEN, tracked under #326. Neither #327 nor #328 has been merged. No model, GPU, PHI, paid API or confirmatory/reserve access occurred.

…acts

Normal merge of already-qualified model-free PR325 evidence packet and CI into the draft power planner branch. Preserve all source hashes, negative development results, original 307 frozen files and unresolved Holm, 90 percent power and governance gates.

Signed-off-by: Gocceri <azialshehri@gmail.com>

Copy link
Copy Markdown
Owner Author

2026-10-11 — reconcile old power-contract ancestry with latest immutable development evidence

Exact head: 9d7db0f55479f59070f64303317a28590db2e9fc is a normal two-parent merge commit, retaining original PR #327 head 9c55c233be9e932557e2de109b852a0265f51772 as first parent and latest source-audited PR #325 head 534120efd04482c4bbd4f73d1add2fc0f624ed0b as second parent. The latter includes all 307 frozen-source verifications, 72-cell ICC and paired SD evidence, the source-bound reviewer packet and independent replay/negative tests. GitHub PR #327 now correctly uses this exact latest #325 base head. No rebase, force-push, unnecessary PR, new experiment, change to frozen scientific branch or main, or merge to main.

Actual Mac qualification in a fresh, isolated detached worktree: git merge --no-ff --no-commit had no conflicts, 81 focused tests PASS, 1,450 full repository tests + 264 subtests PASS. Source-bound review packet --verify and manuscript 307-entry evidence audit PASS. After tests, committed signed+DCO two-parent normal merge and fast-forward pushed fix/v5-power-planner-contract-hardening. The original local worktree for this branch contains unrelated preexisting uncommitted owner changes in two power-planner files and was left completely untouched; it remains locally behind the updated remote branch pending careful owner-aware reconciliation.

Hosted exact-head CI: run #38090138595, COMPLETED SUCCESS at 9d7db0f55479f59070f64303317a28590db2e9fc.

Scope: This is branch/provenance integration, NOT reviewed primary Holm family membership, qualified crossed source-case/calculator/seed nuisance, final 90% power or confirmatory authority. Real independent scientific/statistical and code reviews remain outstanding under issue #326; locally good SSH signatures for new merges are still unknown_key on GitHub. The PR stays OPEN DRAFT.

Copy link
Copy Markdown
Owner Author

2026-10-11 — Mac owner-worktree sync completed with exact byte preservation

This is a local-state correction only: GitHub PR #327 remains at 9d7db0f55479f59070f64303317a28590db2e9fc, correctly based on PR #325. The authorized Mac checkout ~/CommandMed-power-contract had been behind at 9c55c233be9e932557e2de109b852a0265f51772 with two preexisting unstaged user changes: 12 insertion/3 deletion in scripts/v5_power_margin_plan.py plus 10 added regression-test lines.

Safe reconciliation actually performed: copied complete original git diff --binary to the Mac-only recovery path ~/CommandMed-Recovery/pr327-owner-edits-9c55c233be9e932557e2de109b852a0265f51772/owner-uncommitted.diff, SHA-256 7db75d9c850a4c480cfbe2baf4011e1ea5fb903ae0b8d5f87f30b367de809976. Before touching the owner checkout, applied that exact patch to a separate throwaway detached worktree at the newest PR #327 head and passed 75 targeted tests, with git apply --check and git diff --check PASS. Then saved an additional recoverable Git stash, did normal fast-forward-only sync of the local branch from 9c55c23 to 9d7db0f, and reapplied the stash without dropping it. The resulting two unstaged edits exactly match the original patch SHA-256 and re-passed 75 target tests. No reset/rebase/force push, owner edits discarded, science freeze changes, new PR or accidental owner commit. The other worktree's separately staged inventory file was untouched.

Future reviewer boundary: those two local owner edits remain deliberately uncommitted and are not being represented as reviewed/merged. Equivalent numerical overflow protection already exists on the strict-JSON successor PR #328, but independent reconciliation/decision on the owner edits has not been assumed. GitHub PR #327 head and scientific decision gates remain unchanged.

Carry SHA-bound 56-slot non-target reviewer coverage from PR325 to planner draft without treating slots as approved tests, altering the frozen science, or modifying other unstaged worktrees.

Signed-off-by: Gocceri <azialshehri@gmail.com>

Copy link
Copy Markdown
Owner Author

2026-10-11 — latest source-bound reviewer coverage integrated without touching owner edits

Exact PR head: d113d4e8937587a94f4dad0f38b0520785054ceb, normal two-parent merge from original PR #327 head 9d7db0f55479f59070f64303317a28590db2e9fc plus exact PR #325 6fdc33c77fa072e47efb056bf505a75dc005bd45. The 56 source-bound undecided candidate slots are review coverage only; not actual Holm family membership. No branch rebase/force push.

Mac real tests: 81 focused + 1,458 full-repository tests and 264 subtests PASS; source-bound 72-cell reviewer packet and new 56-slot coverage replay both PASS. Hosted GitHub exact-head run #38165761036 COMPLETED SUCCESS.

Local owner preservation: existing PR #327 checkout fast-forwarded to the exact remote commit after making a second recoverable stash; original two unstaged files were re-applied byte-for-byte from old patch SHA-256 7db75d9c850a4c480cfbe2baf4011e1ea5fb903ae0b8d5f87f30b367de809976, with source preserved in ~/CommandMed-Recovery and two retained stashes. 68 targeted tests PASS on the now-current local checkout with owner changes still UNCOMMITTED. This is not independent owner signoff.

No scientific gate closure: prospective actual family, reviewed seed covariance, 90% power, GitHub recognized signatures and independent review remain missing. PR DRAFT/unmerged.

Merge source-bound PR325 complete development evidence publication and failure regressions without changing Holm review, frozen original inputs or owner worktree changes.

Signed-off-by: Gocceri <azialshehri@gmail.com>

Copy link
Copy Markdown
Owner Author

2026-10-11 — safely merge exact current evidence artifact publisher, owner edits preserved

Exact head: a8f821612c4b0b402f9a4ea47e03aa68e5fe336f, normal two-parent merge from original PR #327 d113d4e8937587a94f4dad0f38b0520785054ceb and latest model-free PR #325 d1a805f769536e7892b4ad2336f4907596ee6ce7. No force, rebase, new PR or main merge.

Mac evidence: 88 focused tests PASS, 1,465 full-repo tests plus 264 subtests PASS; both 56-slot candidate coverage and 72-cell evidence packet replay PASS, scientific approval flags false. Exact-head GitHub CI run 38169522263 COMPLETED SUCCESS.

Nonowned Mac changes preserved: PR #327 local checkout fast-forwarded with a recoverable stash, then exact same original two uncommitted owner modifications re-applied. git diff --binary SHA-256 remains 7db75d9c850a4c480cfbe2baf4011e1ea5fb903ae0b8d5f87f30b367de809976, backed up at ~/CommandMed-Recovery; 67 local targeted tests PASS after sync. Other staged owner inventory untouched. All independent methodology, external code review, GH key registration and 90% power gates remain OPEN. PR is DRAFT.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants