Skip to content

feat(validity): add governed selection-validity analysis handoff - #57

Draft
seonghobae wants to merge 161 commits into
developfrom
feat/validation-analysis-handoff
Draft

seonghobae wants to merge 161 commits into
developfrom
feat/validation-analysis-handoff

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Buyer-visible scope

ValidationAnalysisHandoff binds one exact validation-study definition to immutable reviewed ContextualWisdomLab/fast-mlsirm evidence without copying raw person-level values, changing selection-decision authority, or mutating the numerical owner. The branch also carries #407 point-estimation provenance: final point-weight, eligibility, adjustment/correction lineage, variance-design correlation, calibration constraint/fallback evidence, and non-authorizing validation results.

Live authority — 2026-09-21

  • exact head: 6a3e2aa57e3f27a2a2f50ff4072c5634e949a23a
  • protected base: develop@eb9757f8649aaad026a9865508d9aad50c1a7a4f
  • fresh compare: 161 ahead / 0 behind, merge base exactly the protected base
  • live state: open · Draft · mergeable=true
  • ADR 0027 remains Proposed; active source is not protected/released truth
  • predecessor checks/reviews are historical only; current exact-head evidence must be reacquired

Scientific repair lineage retained

The branch preserves the earlier #407 repair that separates reviewed/requested calibration constraints from the actual generating constraints. CalibrationAdjustmentReceipt binds both digests and allows constraint drift only through the explicit fallback path; canonical #235/#248 must still independently resolve authoritative released evidence rather than trusting leaf caller coordinates.

The hosted repair sequence is also retained exactly:

  • 6c02fc0b6595f5cbe1d977bd10f5ad4d6083f741 reached hosted Foundation and exposed a stale root CHANGELOG.md tuple in manifest.json.
  • 9e334df37e9b3f2101f420e92c39098d7efabd68 resealed only the tracked changelog tuple. Foundation run 35329243313 then progressed further and exposed that the shared reference-namespace regex could not represent the governed weight_variance_compatibility_receipt namespace.
  • e22df241d3ef9a64724c76a434ecd94cdd7fc73f minimally widened that namespace bound while preserving total length, exact prefix, UUID/non-sentinel, temporal and scientific contracts.

Predecessor hosted RED and causal repair

Exact e22df241... Foundation run 35384159436, job 105727012005, passed exact checkout, compile, runner-image proof, Foundation validation, dependency hygiene and the surrounding package suites, then validity-analysis failed 1/177 tests at test_compatibility_receipt_rejects_foreign_point_weight_or_tenant.

The production WeightVarianceCompatibilityReceipt.__post_init__ already had exact-runtime FinalAnalysisWeightReceipt and tenant guards. The failure occurred earlier in the test helper: after deliberately injecting object() as analysis_weight_receipt, the helper dereferenced point_weight.sha256_digest() while synthesizing corroborating variance coordinates. It therefore raised raw AttributeError before production validation. Coverage ended at 99.61% (771 statements, two production guard lines unexecuted), with 1 failed, 176 passed.

6a3e2aa57e3f27a2a2f50ff4072c5634e949a23a is the minimal causal fixture repair. Production source is unchanged and the hostile assertion is not weakened. The helper now uses a valid canonical point-weight receipt solely to populate variance-side defaults when the deliberately supplied candidate is not an exact FinalAnalysisWeightReceipt; exact valid receipts remain their own variance basis. This lets malformed-object and foreign-tenant cases reach the production exact-type/tenant guards. Predecessor exact counts remain predecessor evidence only.

The same predecessor head exposed two independent central-owner failures that are not leaf-source findings:

  • Security run 35384159403: exact checkout succeeded, then the public-repository Dependency Review compare endpoint returned HTTP 403 with curl_exit=0; the central workflow correctly failed closed before the pinned action. Evidence was routed to ContextualWisdomLab/.github#810.
  • CodeQL PR run 35384159492: compatibility shards failed closed with VERDICT_STATE=pending; a later dispatch job succeeded, but the required run did not become terminal current-head CodeQL evidence. Evidence was routed to ContextualWisdomLab/.github#1929.

Scorecard/Trivy/OSV are not substitutes for missing Dependency Review evidence, and a dispatched CodeQL scan is not a terminal verdict. No leaf shim, manual success status, bypass or gate weakening is permitted.

The hosted log also emitted the known actions/setup-node Node-20 action-runtime deprecation and punycode warning; repository owner work remains #339/#340 rather than this scientific lane.

Exact-head acceptance — current 6a3e2aa...

Fresh current-head evidence has now advanced beyond the predecessor failure:

  • Foundation CI 35495945337 — completed / success. Job 106038771538 checked out and proved exact 6a3e2aa..., compiled owned Python boundaries, validated the Foundation pack and dependency hygiene, ran owned unit/service contracts, ran PostgreSQL contracts in isolated containers, and passed the final read-only checkout proof.
  • SAST Semgrep 35495945329 — completed / success.
  • Security Scan 35495945341 — queued / non-terminal at the latest fresh read.
  • CodeQL PR 35495945399 — queued / non-terminal at the latest fresh read.

Do not restate the predecessor 176/177 or 99.61% figures as current-head counts, and do not infer a current 100% statement/branch percentage from job-level success without the exact current-head coverage output. Foundation and SAST GREEN are current-head evidence, but Security/CodeQL remain incomplete.

Fresh formal-review inventory still contains COMMENTED submissions only and no qualifying APPROVED review. Fresh inline-thread inventory is fully resolved; resolved review discussion is not independent approval. Therefore this PR remains Draft and is not merge-authorized even if the remaining central workflows later turn GREEN.

Stack and owner discipline

PR #58 remains a dependency-first child on an older #57 snapshot and inherits neither this source nor evidence. Process #57 first; after normal protected integration, descendants must non-force adopt protected truth and reacquire exact-head evidence.

PR #235/#248 remain the canonical durable workforce_validation registry/service/API and persistence owner path. This scientific package creates no parallel service and reads no foreign application tables. The durable sequence remains #235 integration → #248 persistence → #426 governed/idempotent registration+lifecycle → #425 scientific design lineage. docs/product-technical-gap-baseline.md remains sole-writer-owned by PR #100 and must not represent this active branch as shipped truth.

Do not force-push, destructively rebase, self-approve, fabricate approval evidence, use routine administrator bypass, weaken a gate, transfer predecessor/child evidence, create no-op evidence churn, or mutate fast-mlsirm, central .github, contextual-orchestrator, or another dedicated-writer repository.

@coderabbitai

coderabbitai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: bf884076-63e7-428c-827b-0b628c9d24ff

📥 Commits

Reviewing files that changed from the base of the PR and between 5cbd155 and 2bf77d6.

📒 Files selected for processing (13)
  • docs/adr/0027-governed-selection-validity-analysis-handoff.md
  • docs/doctoring/validation-analysis-handoff-references.md
  • docs/traceability/validation-analysis-handoff.md
  • packages/validity-analysis/CHANGELOG.md
  • packages/validity-analysis/README.md
  • packages/validity-analysis/src/orgmetra_validity_analysis/__init__.py
  • packages/validity-analysis/src/orgmetra_validity_analysis/result.py
  • packages/validity-analysis/src/orgmetra_validity_analysis/weights.py
  • packages/validity-analysis/tests/test_analysis_weight_receipt.py
  • packages/validity-analysis/tests/test_analysis_weight_result_binding.py
  • packages/validity-analysis/tests/test_trimming_bounding_receipt.py
  • packages/validity-analysis/tests/test_weight_adjustment_semantics.py
  • packages/validity-analysis/tests/test_weight_eligibility_receipt.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • packages/validity-analysis/CHANGELOG.md
  • docs/doctoring/validation-analysis-handoff-references.md

Included review availability: Your plan provides up to 1 included review per hour; 0 remain after this review.


📝 Walkthrough

Walkthrough

Changes

선택 타당성 분석 핸드오프

Layer / File(s) Summary
패키지 계약과 공개 API
packages/validity-analysis/pyproject.toml, packages/validity-analysis/README.md, packages/validity-analysis/CHANGELOG.md, packages/validity-analysis/src/orgmetra_validity_analysis/__init__.py
패키지 메타데이터, 공개 API, 핸드오프·결과·가중치 계약 문서와 100% 커버리지 검증 명령을 추가합니다.
불변 핸드오프 생성과 검증
packages/validity-analysis/src/orgmetra_validity_analysis/handoff.py, packages/validity-analysis/tests/test_handoff.py, packages/validity-analysis/tests/test_host_resolution_contract.py
테넌트·증거 참조·고정 fast-mlsirm revision·요청자·검토자를 검증하고 canonical JSON과 SHA-256 다이제스트를 생성합니다.
수치 결과 봉투와 무결성 검증
packages/validity-analysis/src/orgmetra_validity_analysis/result.py, packages/validity-analysis/tests/test_result.py, packages/validity-analysis/tests/test_temporal_evidence_integrity.py, packages/validity-analysis/tests/test_numeric_overflow_contract.py, packages/validity-analysis/tests/test_analysis_weight_result_binding.py
집계 누락값, 수렴 진단, 유한 수치, UTC 시각, 런타임 타입과 weighted/unweighted 영수증 바인딩을 fail-closed 방식으로 검증합니다.
가중치 계보와 결과 바인딩
packages/validity-analysis/src/orgmetra_validity_analysis/weights.py, packages/validity-analysis/tests/test_analysis_weight_receipt.py, packages/validity-analysis/tests/test_weight_adjustment_semantics.py, packages/validity-analysis/tests/test_trimming_bounding_receipt.py, packages/validity-analysis/tests/test_weight_eligibility_receipt.py
비응답·보정·절삭/상한 조정 영수증과 WeightEligibilityReceipt를 추가합니다. 최종 가중치의 범위·모집단·기간·사례 집합·아티팩트 일치를 검증합니다.
거버넌스 문서와 추적성
docs/adr/0027-governed-selection-validity-analysis-handoff.md, docs/doctoring/validation-analysis-handoff-references.md, docs/traceability/validation-analysis-handoff.md, CHANGELOG.md, manifest.json
가중치 증거 경계, 전문 영수증 계약, 참고문헌, 추적성 문서, 변경 파일 메타데이터를 갱신합니다.
품질 게이트와 ADR 회귀
.github/workflows/foundation-ci.yml, packages/validity-analysis/tests/test_adr_numbering.py, packages/validity-analysis/tests/test_quality_workflow_trigger.py, packages/validity-analysis/tests/test_workflow_trigger_contract.py
Foundation CI에 validity-analysis 테스트를 추가하고 ADR 번호 중복과 워크플로 트리거 조건을 검증합니다.

Priority: ⬇️ Low

Estimated code review effort: 4 (Complex) | ~60 minutes

Change: Feature

Sequence Diagram(s)

sequenceDiagram
  participant Host
  participant Handoff
  participant Worker
  participant WeightReceipt
  participant Result
  Host->>Handoff: 핸드오프 생성 요청
  Handoff->>Worker: 고정 revision과 증거 경계 전달
  Worker->>WeightReceipt: 최종 가중치 계보 영수증 제공
  Worker->>Result: 집계 결과와 진단 제공
  Result->>Host: 검증된 canonical JSON과 다이제스트 반환
Loading

Merge Risk: ⚪ Minimal · up to 2bf77

No concrete current implementation defect remains from the assessed concerns.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed Docstring coverage is 97.83% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 138 functions across 17 files. (5 skipped: …
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 제목은 거버넌스 적용 selection-validity analysis handoff 추가라는 주요 변경을 정확히 요약합니다. 가중치 계보와 결과 계약 확장까지 모두 포함하지는 않지만, 제목에 요구되는 수준으로 간결하고 구체적입니다.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/validation-analysis-handoff

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
Contributor Author

Exact-current-head local refresh: remote head is now c38151852d95ff1256012d31c179a898bbc1c11e after protected-develop integration. On that exact tree, validity-analysis tests pass 44 passed with 100% statement and branch coverage. No submitted review or inline thread is present; hosted checks remain queued and this is not merge evidence.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-head local evidence for d0c06d2: the validity-analysis suite passed 72 tests with 100% owned statement and branch coverage on CPython 3.14.6. The package now validates a digest-linked ValidationAnalysisResult envelope for the pinned fast-mlsirm revision, Rust CPU/GPU backend, precision, finite estimate/interval, aggregate missingness, and explicit convergence/nonconvergence diagnostics. Repository validation passed. This remains an active PR boundary: no numerical model was executed, no protected-branch truth or approval is claimed, and the result remains scientific evidence requiring accountable human review.

@seonghobae

Copy link
Copy Markdown
Contributor Author

Exact-current-head local refresh for 081942a (pushed to the PR branch): the previous b33cbda tree had 74 passing tests but failed its 100% coverage gate because the criterion-overlap guard was unreachable under the test input that also triggered the predictor-overlap guard. The targeted test input now reaches the second guard. Post-fix validity suite: 74 passed, 100% owned statement and branch coverage; repository validation and foundation contract passed. A separate exploratory run of exact pinned fast-mlsirm revision 04d0bc2 used the Rust backend and returned max_iter_reached at 101 iterations; this is recorded as an open P0-3 signal, not Orgmetra estimator acceptance, GPU parity, protected runtime, approval, or merge evidence.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head a78256396c17fc3a4a2ccbe69748e3606b65098c, focusing on the new calibration fallback provenance boundary: primary-failure reason, immutable fallback rule, actual fallback calibration algorithm/version/configuration, converged-state exclusion, canonical evidence minimization, and malformed/missing hostile cases. Treat predecessor review results as historical only.

@coderabbitai

coderabbitai Bot commented Sep 17, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='a78256396c17fc3a4a2ccbe69748e3606b65098c'

echo '== Exact target identity =='
git cat-file -t "$target"
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$target"
echo '== Pull request metadata =='
gh pr view 57 --repo ContextualWisdomLab/Orgmetra \
  --json number,state,isDraft,mergeable,headRefOid,baseRefName,baseRefOid,url
echo '== Parent-relative changed files =='
git diff-tree --no-commit-id --name-status -r "$target"
echo '== Requested parent-relative delta =='
git diff --unified=100 "$target^" "$target" -- \
  packages/validity-analysis/src/orgmetra_validity_analysis/weights.py \
  packages/validity-analysis/src/orgmetra_validity_analysis/__init__.py \
  packages/validity-analysis/tests \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md \
  docs/doctoring/validation-analysis-handoff-references.md \
  packages/validity-analysis/README.md \
  packages/validity-analysis/CHANGELOG.md \
  CHANGELOG.md

echo '== Exact source outline =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" > /tmp/weights.py
ast-grep outline /tmp/weights.py --items all --type class,function

echo '== Exact CalibrationAdjustmentReceipt implementation =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" \
  | nl -ba | sed -n '100,400p'

echo '== Exact fallback fields, validation, and serialization references =='
git grep -n -i -C 8 -E 'fallback|primary.failure|CalibrationAdjustmentReceipt|canonical_json|sha256_digest' \
  "$target" -- packages/validity-analysis docs CHANGELOG.md || true

echo '== Exact relevant test files =='
git ls-tree -r --name-only "$target" packages/validity-analysis/tests \
  | grep -i -E '(calibration|adjustment|weight)' \
  | sort \
  | while IFS= read -r path; do
      echo "---- $path ----"
      git show "$target:$path" | nl -ba
    done

echo '== Construction sites outside tests =='
git grep -n -C 6 'CalibrationAdjustmentReceipt(' "$target" -- ':!packages/validity-analysis/tests' || true

echo '== Exact documentation fallback passages =='
for path in \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md \
  docs/doctoring/validation-analysis-handoff-references.md \
  packages/validity-analysis/README.md \
  packages/validity-analysis/CHANGELOG.md \
  CHANGELOG.md
do
  echo "---- $path ----"
  git show "$target:$path" | nl -ba \
    | rg -i -C 8 'calibration|fallback|primary.failure|algorithm|configuration|canonical|auxiliary' || true
done

Length of output: 203168


🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='a78256396c17fc3a4a2ccbe69748e3606b65098c'

echo '== Calibration class declaration and implementation =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" \
  | nl -ba \
  | sed -n '95,440p'

echo '== Fallback test module, complete =='
git show "$target:packages/validity-analysis/tests/test_calibration_fallback_provenance.py" \
  | nl -ba

echo '== Exact calibration constructor and canonical serialization evidence =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" \
  | nl -ba \
  | rg -C 35 'class CalibrationAdjustmentReceipt|fallback_reason_code|fallback_rule_reference|fallback_algorithm_reference|def canonical_json|def sha256_digest'

echo '== Fallback documentation delta from parent =='
git diff --unified=30 "$target^" "$target" -- \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md \
  packages/validity-analysis/README.md \
  packages/validity-analysis/CHANGELOG.md

echo '== Any direct construction sites and fallback field references outside tests =='
git grep -n -C 4 -E 'CalibrationAdjustmentReceipt\(|fallback_(reason_code|rule_reference|rule_digest|algorithm_reference|algorithm_version|configuration_digest)' \
  "$target" -- ':!packages/validity-analysis/tests' || true

Length of output: 71166


@seonghobae I reviewed exact head a78256396c17fc3a4a2ccbe69748e3606b65098c only. I used the retained exact-head isolation guidance. I did not transfer predecessor findings, test evidence, or readiness status.

I found one issue.

  • P1 — Revalidate fallback-state invariants during canonical serialization. CalibrationAdjustmentReceipt.__post_init__() correctly requires all fallback fields for fallback_applied and rejects them for converged. However, canonical_json() decides whether to emit fallback fields only from fallback_rule_reference is not None. See packages/validity-analysis/src/orgmetra_validity_analysis/weights.py, Lines 377-383. A caller can use object.__setattr__ after construction to add fallback_rule_reference to a valid converged receipt. The canonical payload then contains fallback fields, including null values, despite the converged-state exclusion. The caller can also corrupt a fallback_applied receipt after construction and serialize malformed fallback evidence.

    Recheck the complete fallback tuple and the termination_code relationship in canonical_json(), or canonicalize from immutable validated snapshots. Add hostile-state regressions that use object.__setattr__ to:

    1. inject fallback data into a converged receipt; and
    2. remove or corrupt a required fallback field in a fallback receipt.

The requested constructor validation is otherwise present. It requires the primary-failure reason, fallback rule reference/digest, fallback algorithm reference/version, and fallback configuration digest. It rejects incomplete and malformed values. The canonical payload includes the required fallback fields for valid fallback receipts. The documentation is consistent with this boundary and remains value-minimized.

I performed static inspection only. I did not execute repository code. This review does not provide approval or protected-branch readiness evidence.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/Orgmetra/pull/57

Timestamp: 2026-09-16T22:11:05.131Z
Learning: For ContextualWisdomLab/Orgmetra PR `#57`, review conclusions and test or readiness evidence apply only to the explicitly requested exact head. Predecessor-head findings and GREEN status are historical and must not be transferred to a later head.

Learnt from: seonghobae
Repo: ContextualWisdomLab/Orgmetra PR: 57
File: packages/validity-analysis/src/orgmetra_validity_analysis/result.py:195-195
Timestamp: 2026-08-29T14:50:22.935Z
Learning: In `packages/validity-analysis/src/orgmetra_validity_analysis/result.py`, `ValidationAnalysisResult` is an estimator-agnostic result envelope. It must validate aggregate missingness consistency and sample-size alignment, but it must not require `MissingnessSummary.complete_observations > 0` for converged results. `docs/adr/0027-governed-selection-validity-analysis-handoff.md` assigns estimator identification and missing-data treatment to the referenced reviewed analysis plan and pinned numerical-worker contract.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head 6c02fc0b6595f5cbe1d977bd10f5ad4d6083f741, especially the new reviewed-versus-applied calibration constraint contract and primary-convergence/fallback boundary.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='6c02fc0b6595f5cbe1d977bd10f5ad4d6083f741'

echo '== Exact commit identity =='
git cat-file -t "$target"
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$target"

echo '== Pull request state =='
gh pr view 57 --repo ContextualWisdomLab/Orgmetra \
  --json number,state,isDraft,mergeable,headRefOid,baseRefName,baseRefOid,url

echo '== Files changed by exact commit =='
git diff-tree --no-commit-id --name-status -r "$target"

echo '== Parent-relative requested delta =='
git diff --unified=100 "$target^" "$target" -- \
  packages/validity-analysis/src/orgmetra_validity_analysis/weights.py \
  packages/validity-analysis/tests \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md \
  docs/doctoring/validation-analysis-handoff-references.md \
  packages/validity-analysis/README.md \
  packages/validity-analysis/CHANGELOG.md \
  CHANGELOG.md

echo '== Source outline =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" > /tmp/weights.py
ast-grep outline /tmp/weights.py --items all --type class,function

echo '== Calibration implementation at exact head =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" \
  | nl -ba | sed -n '90,460p'

echo '== Exact constraint and fallback references =='
git grep -n -i -C 8 -E 'CalibrationAdjustmentReceipt|reviewed.*constraint|applied.*constraint|constraint.*digest|primary.*convergen|primary.*failure|fallback|termination_code|canonical_json|sha256_digest' \
  "$target" -- packages/validity-analysis docs CHANGELOG.md || true

echo '== Relevant tests at exact head =='
git ls-tree -r --name-only "$target" packages/validity-analysis/tests \
  | grep -i -E '(calibration|fallback|constraint|weight.*adjustment)' \
  | sort \
  | while IFS= read -r path; do
      echo "---- $path ----"
      git show "$target:$path" | nl -ba
    done

echo '== Construction sites outside tests =='
git grep -n -C 6 'CalibrationAdjustmentReceipt(' "$target" -- ':!packages/validity-analysis/tests' || true

echo '== Contract documentation passages =='
for path in \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md \
  docs/doctoring/validation-analysis-handoff-references.md \
  packages/validity-analysis/README.md \
  packages/validity-analysis/CHANGELOG.md \
  CHANGELOG.md
do
  echo "---- $path ----"
  git show "$target:$path" | nl -ba \
    | rg -i -C 8 'calibration|reviewed|applied|constraint|primary|convergen|fallback|canonical|auxiliary' || true
done

Length of output: 203176


🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='6c02fc0b6595f5cbe1d977bd10f5ad4d6083f741'

echo '== CalibrationAdjustmentReceipt: exact class, validation, canonicalization =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" \
  | nl -ba | sed -n '90,435p'

echo '== Complete reviewed/applied constraint regression =='
git show "$target:packages/validity-analysis/tests/test_calibration_constraint_application.py" \
  | nl -ba

echo '== Complete fallback-provenance regression =='
git show "$target:packages/validity-analysis/tests/test_calibration_fallback_provenance.py" \
  | nl -ba

echo '== Canonicalization hostile-state regressions for calibration receipts =='
git grep -n -i -C 8 -E 'CalibrationAdjustmentReceipt|object\.__setattr__|canonical_json\(\).*fallback|fallback.*canonical_json|applied_constraints_digest.*canonical_json|constraints_digest.*canonical_json' \
  "$target" -- packages/validity-analysis/tests || true

echo '== Parent-relative source delta with line numbers =='
git diff --unified=50 "$target^" "$target" -- \
  packages/validity-analysis/src/orgmetra_validity_analysis/weights.py \
  packages/validity-analysis/tests/test_calibration_constraint_application.py \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md \
  packages/validity-analysis/README.md \
  packages/validity-analysis/CHANGELOG.md

Length of output: 78378


@seonghobae I reviewed exact head 6c02fc0b6595f5cbe1d977bd10f5ad4d6083f741 only. I used the retained exact-head isolation guidance. I did not transfer predecessor findings, test evidence, or readiness status.

I found one issue.

  • P1 — Revalidate the constraint and fallback state during canonicalization. CalibrationAdjustmentReceipt.__post_init__() correctly requires identical constraints_digest and applied_constraints_digest for termination_code="converged". See packages/validity-analysis/src/orgmetra_validity_analysis/weights.py, Lines 307-313. However, canonical_json() serializes the current attributes without revalidating that relationship. See Lines 341-392. A caller can create a valid converged receipt, then use object.__setattr__ to replace applied_constraints_digest with a different valid digest. The receipt then serializes a changed applied constraint set with "termination_code":"converged". The same path can inject incomplete fallback fields into a converged receipt or remove required fields from a fallback receipt. This bypasses the reviewed-versus-applied constraint boundary.

    Revalidate termination_code, both constraint digests, and the complete fallback tuple in canonical_json(), or serialize only immutable validated snapshots. Add hostile-state regressions that mutate:

    1. applied_constraints_digest on a converged receipt;
    2. fallback fields onto a converged receipt; and
    3. a required fallback field off a fallback_applied receipt.

The constructor contract otherwise separates reviewed and applied constraint digests. It rejects constraint drift on the converged path. It requires a complete fallback provenance tuple on the fallback path. The ADR, traceability record, README, and package changelog describe the same contract.

I performed static inspection only. I did not execute repository code. This review does not provide approval or protected-branch readiness evidence.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/Orgmetra/pull/57

Timestamp: 2026-09-16T22:11:05.131Z
Learning: For ContextualWisdomLab/Orgmetra PR `#57`, review conclusions and test or readiness evidence apply only to the explicitly requested exact head. Predecessor-head findings and GREEN status are historical and must not be transferred to a later head.

Learnt from: seonghobae
Repo: ContextualWisdomLab/Orgmetra PR: 57
File: packages/validity-analysis/src/orgmetra_validity_analysis/result.py:195-195
Timestamp: 2026-08-29T14:50:22.935Z
Learning: In `packages/validity-analysis/src/orgmetra_validity_analysis/result.py`, `ValidationAnalysisResult` is an estimator-agnostic result envelope. It must validate aggregate missingness consistency and sample-size alignment, but it must not require `MissingnessSummary.complete_observations > 0` for converged results. `docs/adr/0027-governed-selection-validity-analysis-handoff.md` assigns estimator identification and missing-data treatment to the referenced reviewed analysis plan and pinned numerical-worker contract.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Please review exact head 9e334df37e9b3f2101f420e92c39098d7efabd68, especially the hosted Foundation RED RCA and the manifest-only reseal. Verify that manifest.json now matches the tracked root CHANGELOG.md tuple and that no workflow/scientific gate was weakened.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='9e334df37e9b3f2101f420e92c39098d7efabd68'
repo='ContextualWisdomLab/Orgmetra'

echo '== Exact target identity =='
git cat-file -t "$target"
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$target"

echo '== PR metadata =='
gh pr view 57 --repo "$repo" --json number,state,isDraft,mergeable,headRefOid,baseRefName,baseRefOid,url

echo '== Parent-relative changed files =='
git diff-tree --no-commit-id --name-status -r "$target"

echo '== Parent-relative reseal and RCA diff =='
git diff --unified=100 "$target^" "$target" -- \
  manifest.json \
  CHANGELOG.md \
  .github/workflows/foundation-ci.yml \
  packages/validity-analysis \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md

echo '== Exact target root CHANGELOG tuple =='
git show "$target:CHANGELOG.md" > /tmp/root-changelog
printf 'sha256='
sha256sum /tmp/root-changelog | awk '{print $1}'
printf 'bytes='
wc -c < /tmp/root-changelog
printf 'lines='
wc -l < /tmp/root-changelog

echo '== Exact target manifest entry for root CHANGELOG =='
git show "$target:manifest.json" > /tmp/manifest.json
jq -c '.files[] | select(.path == "CHANGELOG.md")' /tmp/manifest.json

echo '== Manifest schema and all changed manifest entries =='
jq -r 'keys[]' /tmp/manifest.json
git diff --unified=20 "$target^" "$target" -- manifest.json

echo '== Foundation workflow at exact target and parent delta =='
git show "$target:.github/workflows/foundation-ci.yml" | nl -ba
git diff --unified=60 "$target^" "$target" -- .github/workflows/foundation-ci.yml

echo '== Scientific gate and coverage configuration at exact target =='
git show "$target:packages/validity-analysis/pyproject.toml" | nl -ba
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/weights.py" \
  | rg -n -C 5 'CalibrationAdjustmentReceipt|FinalAnalysisWeightReceipt|WeightEligibilityReceipt|correction_sequence|canonical_json|fallback|constraints_digest' || true

echo '== Cumulative changes since merge base in gate/workflow/scientific files =='
base=$(git merge-base origin/develop "$target")
printf 'merge_base=%s\n' "$base"
git diff --name-status "$base...$target" -- \
  .github/workflows/foundation-ci.yml \
  packages/validity-analysis/pyproject.toml \
  packages/validity-analysis/src/orgmetra_validity_analysis \
  manifest.json \
  CHANGELOG.md
git diff --unified=35 "$base...$target" -- \
  .github/workflows/foundation-ci.yml \
  packages/validity-analysis/pyproject.toml \
  manifest.json \
  CHANGELOG.md

echo '== Manifest generator or validation references =='
git grep -n -i -C 4 -E 'manifest\.json|sha256|line_count|byte_count|CHANGELOG\.md' "$target" -- \
  ':!manifest.json' ':!CHANGELOG.md' || true

Length of output: 203216


🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='9e334df37e9b3f2101f420e92c39098d7efabd68'

echo '== Commit =='
git show -s --format='commit=%H%nparent=%P%nsubject=%s' "$target"

echo '== Exact changed files =='
git diff-tree --no-commit-id --name-status -r "$target"

echo '== Exact manifest delta =='
git diff --unified=12 "$target^" "$target" -- manifest.json

echo '== Root CHANGELOG tuple using validator semantics =='
git show "$target:CHANGELOG.md" > /tmp/CHANGELOG.md
python3 - <<'PY'
from hashlib import sha256
from pathlib import Path
data = Path("/tmp/CHANGELOG.md").read_bytes()
print({
    "path": "CHANGELOG.md",
    "sha256": sha256(data).hexdigest(),
    "bytes": len(data),
    "lines": len(data.decode("utf-8").splitlines()),
})
PY

echo '== Manifest CHANGELOG entry =='
git show "$target:manifest.json" | jq -S -c '.files[] | select(.path == "CHANGELOG.md")'

echo '== Exact comparison =='
git show "$target:manifest.json" > /tmp/manifest.json
python3 - <<'PY'
import json
from hashlib import sha256
from pathlib import Path
data = Path("/tmp/CHANGELOG.md").read_bytes()
actual = {
    "path": "CHANGELOG.md",
    "sha256": sha256(data).hexdigest(),
    "bytes": len(data),
    "lines": len(data.decode("utf-8").splitlines()),
}
manifest = json.loads(Path("/tmp/manifest.json").read_text())
entry = next(item for item in manifest["files"] if item["path"] == "CHANGELOG.md")
print("match=", entry == actual)
print("different_fields=", {key: (entry.get(key), actual[key]) for key in actual if entry.get(key) != actual[key]})
PY

echo '== Workflow and scientific contract files changed by reseal commit =='
git diff --name-status "$target^" "$target" -- \
  .github/workflows/foundation-ci.yml \
  packages/validity-analysis/pyproject.toml \
  packages/validity-analysis/src/orgmetra_validity_analysis \
  packages/validity-analysis/tests \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md

echo '== Foundation workflow relevant gates at exact target =='
git show "$target:.github/workflows/foundation-ci.yml" \
  | nl -ba \
  | rg -n -C 3 'pull_request|branches:|validate|foundation|validity-analysis|pytest|coverage|fail-under|uv lock'

echo '== Package coverage gate at exact target =='
git show "$target:packages/validity-analysis/pyproject.toml" | nl -ba

echo '== Foundation RCA references in exact commit and parent =='
for rev in "$target^" "$target"; do
  echo "-- $rev CHANGELOG references --"
  git show "$rev:CHANGELOG.md" | rg -n -i -C 3 'foundation|manifest|RED|RCA|reseal|validity.analysis' || true
done

echo '== Any scientific source changes in exact commit =='
git diff --numstat "$target^" "$target" -- packages/validity-analysis/src/orgmetra_validity_analysis

Length of output: 39613


@seonghobae I reviewed exact head 9e334df37e9b3f2101f420e92c39098d7efabd68 only. I used the retained exact-head isolation guidance. I did not transfer predecessor findings or readiness evidence.

I found no new correctness issue in the hosted Foundation RED RCA and manifest-only reseal.

The commit changes only manifest.json. The root CHANGELOG.md entry now matches the tracked file under the repository validator’s line-count rule:

  • SHA-256: 1985ccaf0dfa0fbf095e88998cfcfdac6f245525ac6ff0131d9f29ed43d97b93
  • Bytes: 17846
  • Lines: 78

The independent comparison reported match=True with no differing fields.

The reseal commit does not modify .github/workflows/foundation-ci.yml, packages/validity-analysis/pyproject.toml, scientific source files, tests, ADRs, or traceability records. The Foundation workflow still validates the exact candidate SHA, runs npm run validate, runs dependency hygiene, runs the validity-analysis suite, and verifies a clean worktree after validation. The validity-analysis coverage gate remains --cov-branch with --cov-fail-under=100.

I performed static inspection only. I did not execute repository code. This review is not approval or protected-branch readiness evidence.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/Orgmetra/pull/57

Timestamp: 2026-09-16T22:11:05.131Z
Learning: For ContextualWisdomLab/Orgmetra PR `#57`, review conclusions and test or readiness evidence apply only to the explicitly requested exact head. Predecessor-head findings and GREEN status are historical and must not be transferred to a later head.

You are interacting with an AI system.

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

Current-head review target: e22df241d3ef9a64724c76a434ecd94cdd7fc73f.

Please review the ordinary-forward repair for the hosted Foundation RED: the governed namespace weight_variance_compatibility_receipt exceeded the shared reference validator's previous 32-character namespace bound. Verify that expanding only the namespace bound to 64 preserves the existing total-length, exact-prefix, canonical UUIDv4/non-sentinel, temporal, point/variance, and evidence contracts, and report any current-head blocking regression. Do not treat predecessor reviews or checks as evidence for this SHA.

@coderabbitai

coderabbitai Bot commented Sep 18, 2026

Copy link
Copy Markdown

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='e22df241d3ef9a64724c76a434ecd94cdd7fc73f'
repo='ContextualWisdomLab/Orgmetra'

echo '== Exact target identity =='
git cat-file -t "$target"
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$target"

echo '== Pull request metadata =='
gh pr view 57 --repo "$repo" \
  --json number,state,isDraft,mergeable,headRefOid,baseRefName,baseRefOid,url

echo '== Parent-relative changed files =='
git diff-tree --no-commit-id --name-status -r "$target"

echo '== Parent-relative delta =='
git diff --unified=100 "$target^" "$target" -- \
  packages/validity-analysis \
  .github/workflows/foundation-ci.yml \
  manifest.json \
  CHANGELOG.md \
  docs/adr/0027-governed-selection-validity-analysis-handoff.md \
  docs/traceability/validation-analysis-handoff.md

echo '== Candidate reference validation source and tests =='
git grep -n -i -C 8 -E 'namespace.{0,40}(32|64)|.{0,40}namespace|weight_variance_compatibility_receipt|reference.{0,40}(length|uuid|prefix)|UUID|uuid4|sentinel|temporal|point.*variance|variance.*point' \
  "$target" -- packages/validity-analysis || true

echo '== Exact validity-analysis source/test inventory =='
git ls-tree -r --name-only "$target" packages/validity-analysis | sort

echo '== Outlines for exact candidate modules =='
git ls-tree -r --name-only "$target" packages/validity-analysis/src \
  | grep -E '\.py$' \
  | while IFS= read -r path; do
      git show "$target:$path" > "/tmp/$(basename "$path")"
      echo "---- $path ----"
      ast-grep outline "/tmp/$(basename "$path")" --items all --type class,function || true
    done

echo '== All exact construction and validation sites =='
git grep -n -C 6 -E 'weight_variance_compatibility_receipt|_validate.*reference|validate.*reference|reference.*namespace|[A-Za-z_]+Receipt\(' \
  "$target" -- packages/validity-analysis || true

echo '== Exact targeted tests and nearby contract assertions =='
git ls-tree -r --name-only "$target" packages/validity-analysis/tests \
  | grep -E '\.py$' \
  | while IFS= read -r path; do
      if git show "$target:$path" | grep -qiE 'namespace|weight_variance_compatibility_receipt|reference|uuid|variance|temporal'; then
        echo "---- $path ----"
        git show "$target:$path" | nl -ba
      fi
    done

echo '== Documentation references in exact target =='
git grep -n -i -C 5 -E 'weight_variance_compatibility_receipt|namespace|reference validator|Foundation RED|point.*variance|variance.*point' \
  "$target" -- CHANGELOG.md docs packages/validity-analysis || true

Length of output: 203077


🏁 Script executed:

#!/bin/bash
set -euo pipefail

target='e22df241d3ef9a64724c76a434ecd94cdd7fc73f'

echo '== Commit and changed files =='
git show -s --format='commit=%H%nparents=%P%nsubject=%s' "$target"
git diff-tree --no-commit-id --name-status -r "$target"

echo '== Parent-relative focused diff =='
git diff --unified=50 "$target^" "$target" -- \
  packages/validity-analysis/src/orgmetra_validity_analysis/handoff.py \
  packages/validity-analysis/src/orgmetra_validity_analysis/compatibility.py \
  packages/validity-analysis/src/orgmetra_validity_analysis/result.py \
  packages/validity-analysis/tests/test_weight_variance_compatibility_receipt.py \
  packages/validity-analysis/tests/test_analysis_weight_result_binding.py \
  packages/validity-analysis/tests/test_handoff.py \
  packages/validity-analysis/tests/test_temporal_evidence_integrity.py

echo '== Shared reference validator at exact target =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/handoff.py" \
  | nl -ba | sed -n '35,105p'

echo '== Compatibility validation and canonicalization at exact target =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/compatibility.py" \
  | nl -ba | sed -n '45,220p'

echo '== Result point/variance compatibility validation at exact target =='
git show "$target:packages/validity-analysis/src/orgmetra_validity_analysis/result.py" \
  | nl -ba | sed -n '180,370p'

echo '== Exact compatibility regression file =='
git show "$target:packages/validity-analysis/tests/test_weight_variance_compatibility_receipt.py" \
  | nl -ba

echo '== Reference-length and namespace-bound test matches =='
git grep -n -i -C 8 -E '160|64|32|namespace|length|weight_variance_compatibility_receipt' \
  "$target" -- packages/validity-analysis/tests packages/validity-analysis/src/orgmetra_validity_analysis/handoff.py

echo '== All shared validator call sites =='
git grep -n -C 3 '_validate_reference(' "$target" -- packages/validity-analysis/src/orgmetra_validity_analysis

echo '== Exact source comparison of limit-related tokens =='
for rev in "$target^" "$target"; do
  echo "---- $rev ----"
  git show "$rev:packages/validity-analysis/src/orgmetra_validity_analysis/handoff.py" \
    | nl -ba | sed -n '55,90p'
done

Length of output: 184933


@seonghobae I reviewed exact head e22df241d3ef9a64724c76a434ecd94cdd7fc73f only. I used the retained exact-head isolation guidance. I did not use predecessor findings, checks, or readiness status.

I found no current-head blocking regression.

The commit changes only packages/validity-analysis/src/orgmetra_validity_analysis/handoff.py. It expands the _REFERENCE_PATTERN namespace limit from 32 characters to 64 characters. This accepts weight_variance_compatibility_receipt without changing the other validator conditions.

_validate_reference() still:

  • Limits the complete reference to 160 characters.
  • Requires the exact declared prefix through value.startswith(f"{prefix}:").
  • Requires a full pattern match.
  • Requires a canonical UUIDv4 suffix.
  • Rejects Nil and Max UUID sentinels.

The point/variance contracts remain intact. WeightVarianceCompatibilityReceipt still rejects a variance digest that equals the point-weight digest. It still requires the variance lineage to match the exact point-weight receipt, analytic case set, eligibility receipt, correction sequence, and final weight artifact. It still rejects a compatibility receipt that predates its point-weight receipt.

ValidationAnalysisResult still requires distinct point-weight and variance-design digests. It also requires the matching WeightVarianceCompatibilityReceipt for weighted_design_based output and rejects a compatibility receipt constructed after the result.

I performed static inspection only. I did not execute repository code or hosted checks. This review is not approval or protected-branch readiness evidence.


🧠 Learnings used
Learnt from: seonghobae
URL: https://github.com/ContextualWisdomLab/Orgmetra/pull/57

Timestamp: 2026-09-16T22:11:05.131Z
Learning: For ContextualWisdomLab/Orgmetra PR `#57`, review conclusions and test or readiness evidence apply only to the explicitly requested exact head. Predecessor-head findings and GREEN status are historical and must not be transferred to a later head.

You are interacting with an AI system.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant