Skip to content

W5b-13: FieldSemantics — engine filling + group-summary probability_status (step 2 complete) - #53

Merged
bnsd55 merged 4 commits into
mainfrom
w5b-semantics
Sep 19, 2026
Merged

bnsd55 merged 4 commits into
mainfrom
w5b-semantics

Conversation

@bnsd55

@bnsd55 bnsd55 commented Sep 18, 2026

Copy link
Copy Markdown
Owner

Steps 1+2 complete per the approved design note (GPT-REVIEW-2 §C9), rebased on main@bb86a3f (#51/#55/#58 in).

Engine filling (step 2):

  • _field_semantics() — the ONE constructor for the semantics record (dict; api coerces to frozen FieldSemantics; the import graph stays one-way).
  • score_scalar_field: score_source from the shared finalizer's evidence_source (batch → batched, batch1 → rescored_batch1); temperature = the fitted scalar T when the bundle applied it, else the caller T; prior_mode from prior_corrected. Cardinality-1: schema-determined (temperature None).
  • score_multi_field: rescored_batch1 when any Y/N pair was band-rescored; temperature None when the calibrated log-odds cut set the selection (it ignores T — exactly the §C9 mix the old global string lied about); calibrator_id from the bundle; constraint_changed from solve_multi_set's reconciled_by. Count row: temperature None (fixed T=1 buckets), its own constraint_changed.
  • reconcile_case_constraints + post-dependency MAP: flips set constraint_changed=True on exactly the changed fields.
  • _selective_second_pass: a dependency re-decide REPLACES the field's semantics (score_source dependency/oracle, dependency_rescored=True, earlier constraint_changed carried).
  • finalize_public_result: probability_status is the group-count summary — one clause per distinct (score_source, temperature, calibrator_id, prior_mode) group with its field count. The old global-only statement is deleted (fallback kept for fake/baseline paths without records).
  • api._build_field_results: coerces the record into frozen FieldSemantics; a missing record raises naming the field — 'required' is now true at every decide() return.

Verification: 746 passed -m 'not slow'; slow status pins green; end-to-end fake-engine probes confirm the calibrated-split summary (T=0.7 clause + calibrated (bundle …) clause), the dependency-group summary, and the constraint-flip record. One pin per behavior; xfail marks dropped; README carries the semantics + summary wording.

STATE: IDLE, awaiting #53 review

@bnsd55
bnsd55 marked this pull request as draft September 18, 2026 22:52
@bnsd55
bnsd55 marked this pull request as ready for review September 18, 2026 22:55
@bnsd55 bnsd55 changed the title W5b-13 step 1: FieldSemantics on the public API (engine-free) W5b-13: FieldSemantics — step 1 landed, step 2 pending '#51 merged' ping Sep 18, 2026
- jevmlx/api.py: frozen FieldSemantics dataclass (score_source / temperature /
  calibrator_id / prior_mode / constraint_changed / dependency_rescored) per
  the approved design note (GPT-REVIEW-2 §C9); FieldResult.semantics REQUIRED
  (keyword-only, no default) — constructing without it is a loud TypeError;
  _build_field_results passes telemetry.get('semantics') through (step 2
  fills it in the engine stages).
- README: FieldResult bullet documents semantics + the probability_status
  summary downgrade wording from the design note.
- tests/test_field_semantics.py: dataclass contract (frozen, field names,
  required kw-only), export surface (single import path — the module-eviction
  identity trap), and the engine-filling pins marked xfail(strict=True)
  reason 'W5b-13 step 2' (verified: a simulated step-2 pass XPASSes and
  fails the suite, so the flip is loud).

672 passed, 2 xfailed; ruff clean.
- F1: FieldResult is now @DataClass(frozen=True, kw_only=True) — semantics
  loses the kw_only-field + type: ignore hack; 'reason' loses its default
  (all fields kw_only). Callers updated; the one production constructor
  (_build_field_results) passes every field by name already.
- F2: placeholder summary test deleted; test_probability_status_is_a_summary
  rewritten cleanly against the step-2 behavior (helper returns the engine
  status, no duplicated fixture, no placeholder line).
- F3: README semantics bullet removed — ships with step 2.
- FieldResult.semantics docstring now states the draft truth: the PR does
  not leave draft until every decided field carries a real record.
- Kept: frozen FieldSemantics, the two contract tests, xfail(strict=True)
  pins (strictness re-verified: simulated step-2 pass XPASSes and fails).

672 passed, 2 xfailed; ruff clean.
…_status becomes the group summary

- engine: _field_semantics() is the ONE constructor for the semantics
  record (dict — the api import graph stays one-way; api.FieldSemantics
  coerces at the public boundary).
- score_scalar_field: score_source from the finalizer's evidence_source
  (batch -> batched, batch1 -> rescored_batch1); temperature = the fitted
  scalar T when the bundle applied it, the caller T otherwise; prior_mode
  from prior_corrected. _cardinality_one_outcome: schema-determined record
  (temperature None, nothing corrected).
- score_multi_field: score_source mirrors the scalar vocabulary
  (rescored_batch1 when any Y/N pair was band-rescored); temperature None
  when the calibrated log-odds cut set the selection (it ignores T);
  calibrator_id from the bundle; constraint_changed from solve_multi_set's
  reconciled_by. Count row: temperature None (fixed T=1 buckets), its own
  constraint_changed.
- reconcile_case_constraints + the post-dependency MAP: flips set
  constraint_changed=True on exactly the changed fields.
- _selective_second_pass: a dependency re-decide REPLACES the field's
  semantics (score_source dependency/oracle, dependency_rescored True,
  prior constraint_changed carried over).
- finalize_public_result: probability_status is the group-count SUMMARY —
  one clause per distinct (score_source, temperature, calibrator_id,
  prior_mode) group with its field count; the old global-only statement is
  deleted (kept only as the no-records fallback for fake/baseline paths).
- api._build_field_results: coerces telemetry['semantics'] into the frozen
  FieldSemantics; a missing record is a ValueError naming the field —
  'required' is now true at every decide() return.
- tests: conftest make_field_semantics factory (default record on every
  fake telemetry shape); test_field_semantics.py rewritten one-pin-per-
  behavior (decide coercion, loud missing-record failure, group summary +
  prior/calibrator clauses via finalize_public_result, engine shapes,
  constraint flips, calibrated split); old global-string pins updated;
  xfail marks dropped.
- README: semantics bullet + probability_status summary wording.

746 passed -m 'not slow', 2 slow pins green, ruff clean.
@bnsd55 bnsd55 changed the title W5b-13: FieldSemantics — step 1 landed, step 2 pending '#51 merged' ping W5b-13: FieldSemantics — engine filling + group-summary probability_status (step 2 complete) Sep 19, 2026
…5/F7/F10

- F1: the old global-only probability_status strings are DELETED; an empty
  semantics-group set now raises (every engine path sets records).
- F2: all four None-tolerant sites index directly — finalize_public_result
  (ft['semantics']), reconcile_case_constraints, the post-dependency MAP,
  _selective_second_pass (prev record + assignment), api boundary
  (telemetry['semantics']). grep 'get("semantics")' jevmlx/*.py is EMPTY.
- F3: count-row constraint_changed = reconciled_by == 'count' AND the
  trusted count actually ran (dropped_reason None); an untrusted count no
  longer claims a constraint.
- F4: multi constraint_changed compares the FINAL selection against the
  raw threshold proposal (solve_multi_set now records
  telemetry['threshold_proposal']); a trusted non-binding count no longer
  claims a change.
- F5: score_scalar_field no longer re-derives the applied temperature —
  the temperature argument IS the effective one (_load_calibration
  replaced it); cardinality-1 outcome built via _field_semantics.
- F6: three new engine-path pins (prior_correction -> neutral_v1 on a real
  run; count-row temperature None + copied score_source; uncalibrated
  multi carries caller T) + trusted/untrusted-count constraint_changed
  pin — each mutation-verified to fail when its setter is removed.
- F7: contradictory comment in test_engine_sets_semantics_on_all_shapes
  fixed (multi carries caller T=1.0 when uncalibrated).
- F8: CHANGELOG Unreleased entry for W5b-13.
- F9: ARCHITECTURE.md — probability_status row = group summary;
  'semantics' row in the field_telemetry table and the FieldResult table.
- F10: FieldResult.semantics docstring no longer says 'None until then'.

750 passed -m 'not slow', slow status pin green, ruff clean.
@bnsd55
bnsd55 merged commit 01436a6 into main Sep 19, 2026
2 checks passed
@bnsd55
bnsd55 deleted the w5b-semantics branch September 19, 2026 09:11
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.

1 participant