Skip to content

D-TEH-3: calibration math → jc (drift, quorum, lift-gate comparisons); lab cronbach.rs deleted - #1143

Merged
AdaWorldAPI merged 5 commits into
mainfrom
claude/medcare-rs-continue-6nhbxn
Sep 3, 2026
Merged

D-TEH-3: calibration math → jc (drift, quorum, lift-gate comparisons); lab cronbach.rs deleted#1143
AdaWorldAPI merged 5 commits into
mainfrom
claude/medcare-rs-continue-6nhbxn

Conversation

@AdaWorldAPI

@AdaWorldAPI AdaWorldAPI commented Sep 2, 2026

Copy link
Copy Markdown
Owner

What

W2 of thinking-engine-harvest-closure-v1, deliverable D-TEH-3 (math half): the calibration battery is split by NATURE per §1d and the ruling E-JC-IS-THE-HOME-OF-ALL-CALIBRATED-MATH-1 — MATH goes to jc, GLUE stays in the lab crate and calls jc, and every lab copy of a statistic dies in this PR.

jc (new surface, no existing estimator changed)

  • jc::driftreencode_drift(value, max_iterations, codec, round_trip) / reencode_batch (the re-encode convergence statistic; the round trip is a closure the caller supplies, so the statistic is codec-agnostic) and delta_summary(deltas, material, large) (mean / mean|δ| / max|δ| / population σ / fraction above two caller-named cut-offs). 8 tests.
  • jc::quorumpairwise_agreement_u8 (per-pair 1 − σ/σ_max(k) over k u8 lens tables, with max_u8_variance(k) the ceiling attainable for THAT k — NOT an α per pair, and the name now says so), QuorumLevel with its 230/179/128 floors, cronbach_report (α by delegation to reliability::cronbach_alpha + per-subject variances + the mean + σ disagreement count). 7 tests.
  • jc::reliability — two lift-gate tests only, carrying the retired lab forms verbatim so the comparison outlives the deleted source.

The lift gate — run on fixtures that can DISTINGUISH the copies

estimator plain fixture distinguishing fixture verdict
Cronbach α (lab f32 vs jc f64) agree to 1e-5 (0.984615) same data shifted by 1e7: jc moves < 1e-9 (α is affine-invariant), the f32 copy loses the fixture outright LIFT — same estimator; the copy dies
Spearman ρ (lab ordinal ranks vs jc average ranks) tie-free: agree to 1e-6 one tie, y = [1,2,2,3]: lab returns 1.000, jc returns the textbook 0.948683 PERFECT-IN-JC — the retired copy ranked ties by position; jc already had the correction
lens quorum odd k: [0, 0, 255] at k = 3 scored 15 under the lifted even-k ceiling, now 0 PERFECTED (Codex on this PR)
re-encode drift, delta summary LIFTED as-is, with the codec and the cut-offs turned into parameters

The Spearman result is the finding: the retired copy's own three tests were all tie-free, so "agrees on the existing tests" was true and meant nothing. A calibration battery comparing baked u8 lens distances against ground-truth cosines hits ties constantly, so the retired form was systematically optimistic exactly where it was used. Recorded as E-THE-LIFT-GATE-FOUND-A-TIE-BLIND-SPEARMAN-1.

Lab crate (excluded from the workspace)

cronbach.rs deleted; ground_truth.rs loses spearman_rank_correlation + ranks (+3 tests) and its calibration glue calls jc::reliability::spearman; reencode_safety.rs is glue over jc::drift (ReencodeSafety = jc::drift::ReencodeDrift, three codec wrappers pass closures, test_zipper_offsets + all 14 tests verbatim — the x256 proof runs through jc); silu_correction.rs has CorrectionStats = jc::drift::DeltaSummary with the cut-offs named MATERIAL_CORRECTION / LARGE_CORRECTION (kept f32 and promoted with the samples, so exactly 0.1f32 is not "more than" 0.1) and correction_stats -> Option (None = non-finite data, Some(empty) = genuinely empty); certify_jina_v5_7lane.rs calls jc's α (NoneNaN, which fails every >= verdict honestly). Cargo.toml gains jc = { path = "../jc" }.

Review folded in

Codex P2 ×3, all confirmed and fixed in cfb9b3b: the odd-k quorum ceiling, the f32 cut-off boundary, and the NaN-as-empty fallback — each with a two-sided test. The format job was red on the first heads because three lab files from #1142 merged unformatted (main is red on the same job); the rustfmt-only fix is ported here as 8c03eb5.

Gates

jc lib 136/136 + doctests; drift / quorum / reliability clippy -D warnings clean (the remaining clippy hits in jc are pre-existing files this PR does not touch); cargo fmt --all -- --check clean. Lab: cargo check --lib --examples clean except the pre-existing tts_stream_hhtld example break (a bgz-tensor private fn, untouched, already under TD-THINKING-ENGINE-EXCLUDED-DEBT-1); lab tests for the three modules 24/24. CI: all eight checks green on 8c03eb5.

Not in this PR

  • The semantic_chunker / spiral_segment halves of D-TEH-3 — gated on their own falsifiers, separate.
  • silu and cosine_f32 stay in the lab (activation and vector glue, not calibrated math).
  • ndarray::hpc::reliability and perturbation-sim::stats carry the same four estimators (both tie-aware, both correct in the sense above). Filed as TD-RELIABILITY-COPIES-OUTSIDE-JC-1: the ruling names the ndarray direction as a deliberate PR with a bit-exactness gate, not a drive-by.

Board

Records the #1142 merge in LATEST_STATE; EPIPHANIES entry; PR_ARC entry (with the review round); STATUS_BOARD + plan §5 D-TEH-3 (math half Shipped) + §3 W2 result addendum; TECH_DEBT entry; SUPERSESSION-INDEX regenerated last (byte-identical).

🤖 Generated with Claude Code

https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK

…:reliability

The calibration MATH of the thinking-engine battery moves to jc per the
ruling that jc is the single home of calibrated math (lift if correct,
perfect in jc if not).

- jc::drift: reencode_drift / reencode_batch (the re-encode convergence
  statistic, codec-agnostic — the round trip is a closure the caller
  supplies) and delta_summary (mean / mean|d| / max|d| / population sigma /
  fractions above two caller-named cut-offs). 8 tests.
- jc::quorum: pairwise_agreement_u8 (per-pair 1 - sigma/sigma_max over k
  u8 lens tables), QuorumLevel with its 230/179/128 floors, and
  cronbach_report (alpha by delegation to reliability::cronbach_alpha +
  per-subject variances + the mean+sigma disagreement count). 6 tests.
- jc::reliability: two lift-gate tests carrying the retired lab forms
  verbatim. Cronbach: same estimator, agrees to 1e-5 on the known-value
  fixture, the f32 copy loses the 1e7-shifted fixture the f64 form holds
  to 1e-9 (LIFT). Spearman: the retired copy ranked ties by position;
  tie-free fixtures cannot separate them, one tie does (1.000 vs
  0.948683) (PERFECT-IN-JC, already there). No estimator changed.

jc lib 135/135; the new modules are clippy -D warnings clean; fmt clean.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK
…eted

- cronbach.rs deleted (cronbach_alpha / variance_agreement_scores /
  QuorumLevel / cronbach_analysis now live in jc::reliability + jc::quorum).
- ground_truth.rs: the private ordinal-rank Spearman and its three tests
  deleted; calibration::spearman_vs_ground_truth calls
  jc::reliability::spearman (tie-corrected), keeping its 0.0 fallback.
- reencode_safety.rs: glue over jc::drift — the three codec wrappers pass
  round-trip closures, ReencodeSafety = jc::drift::ReencodeDrift,
  test_reencode_batch keeps its tuple shape; test_zipper_offsets and all
  14 tests unchanged (the x256 proof runs through jc).
- silu_correction.rs: CorrectionStats = jc::drift::DeltaSummary;
  correction_stats is an adapter with the cut-offs named
  MATERIAL_CORRECTION = 0.01 / LARGE_CORRECTION = 0.1.
- examples/certify_jina_v5_7lane.rs: jc::reliability::cronbach_alpha,
  None -> NaN so an undefined alpha fails every >= verdict.
- Cargo.toml: jc path dep; Cargo.lock adds jc and drops entries cargo no
  longer needs.

Lab: cargo check --lib --examples clean except the pre-existing
tts_stream_hhtld break (bgz-tensor private fn, untouched); tests for the
three modules 23/23.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK
…y, status/plan rows, TD for the copies outside jc

Records the #1142 merge in LATEST_STATE; EPIPHANIES
E-THE-LIFT-GATE-FOUND-A-TIE-BLIND-SPEARMAN-1; PR_ARC entry; STATUS_BOARD
and plan §5 D-TEH-3 math half Shipped + §3 W2 result addendum;
TECH_DEBT TD-RELIABILITY-COPIES-OUTSIDE-JC-1 (ndarray::hpc::reliability
and perturbation-sim::stats); SUPERSESSION-INDEX regenerated last.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK
@coderabbitai

coderabbitai Bot commented Sep 2, 2026

Copy link
Copy Markdown

Warning

Review limit reached

Next included review available in 9 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available. Your 80 included PR review attempts over the past 7 days set your current allowance at 1 review per hour.

Your organization has reached its usage spending cap. Adjust your spending cap in the billing tab.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Essentials

Run ID: 01cf1d4a-fb87-40f8-8d68-6bd196ba411a

📥 Commits

Reviewing files that changed from the base of the PR and between 3c5f040 and 8c03eb5.

⛔ Files ignored due to path filters (1)
  • crates/thinking-engine/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (21)
  • .claude/board/EPIPHANIES.md
  • .claude/board/LATEST_STATE.md
  • .claude/board/PR_ARC_INVENTORY.md
  • .claude/board/STATUS_BOARD.md
  • .claude/board/TECH_DEBT.md
  • .claude/plans/thinking-engine-harvest-closure-v1.md
  • crates/jc/src/drift.rs
  • crates/jc/src/lib.rs
  • crates/jc/src/quorum.rs
  • crates/jc/src/reliability.rs
  • crates/thinking-engine/Cargo.toml
  • crates/thinking-engine/examples/certify_jina_v5_7lane.rs
  • crates/thinking-engine/examples/silu_crosscheck.rs
  • crates/thinking-engine/src/awareness_dto.rs
  • crates/thinking-engine/src/cronbach.rs
  • crates/thinking-engine/src/ground_truth.rs
  • crates/thinking-engine/src/lib.rs
  • crates/thinking-engine/src/persona.rs
  • crates/thinking-engine/src/reencode_safety.rs
  • crates/thinking-engine/src/silu_correction.rs
  • crates/thinking-engine/src/world_model.rs

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

@cursor

cursor Bot commented Sep 2, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_da9bf458-0f7e-4792-8ffa-0338f771696e)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: be8b1677f5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/jc/src/quorum.rs Outdated
Comment thread crates/thinking-engine/src/silu_correction.rs Outdated
Comment thread crates/thinking-engine/src/silu_correction.rs Outdated
…ta None

- jc::quorum: max_u8_variance(k) = 255^2 * floor(k/2) * ceil(k/2) / k^2
  replaces the even-k constant. The lifted source normalised every k by
  (255/2)^2, so a maximally split three-lens cell [0, 0, 255] scored 15
  instead of 0; perfected in jc per the ruling. New two-sided test
  (k = 3 maximal -> 0, k = 2 maximal -> 0, k = 3 half-split strictly
  between) + doctest. 7/7 + doctests green.
- lab silu_correction: MATERIAL_CORRECTION / LARGE_CORRECTION are f32 and
  promoted with the samples, so a correction of exactly 0.1f32 stays
  'not more than' 0.1 as the retired code had it; correction_stats
  returns Option — None for a non-finite correction (an invalid run),
  Some(empty) only for an empty set. Test pins both; silu_crosscheck
  adapts (expect + one f32 cast). 10/10 green, both examples compile.
- Board: LATEST_STATE / PR_ARC same-PR lines updated.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK
…n main)

awareness_dto.rs / persona.rs / world_model.rs were edited in #1142 and
never run through rustfmt; the style workflow's format job walks the lab
crate too, so main has been red on it since that merge. Formatting only.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01PFnYKqw6d7TTiB9cT8eFdK
@AdaWorldAPI

Copy link
Copy Markdown
Owner Author

CI note — format on cfb9b3b. The failing diffs were all in crates/thinking-engine/src/{awareness_dto,persona,world_model}.rs, which this PR does not touch: they were edited in #1142 and merged unformatted, so main has been red on the same job since that merge (the style workflow's format step walks the lab crate). Ported the fix here as 8c03eb5 (rustfmt only, 7+/6−); cargo fmt --all -- --check is clean locally on this head. It no-ops once main carries it.


Generated by Claude Code

@AdaWorldAPI
AdaWorldAPI merged commit a56d0f6 into main Sep 3, 2026
9 checks passed
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