Shay
|
44c0aa2896
|
feat(ADR-0169/CC-2+CC-3): CompositionClaim ratification handler + decomposer heuristic tightening (#393)
PR-β of the CompositionClaim wave (CC-2 + CC-3 bundled per the brief
pack — CC-3's heuristic depends on CC-2's new change_kind Literal value).
Mirrors the F1 / ADR-0168 FrameClaim template 1:1 with composition-specific
substitutions.
CC-2 — handler implementation
- teaching/math_composition_proposal.py — MathCompositionClaimProposal
adapter per ADR-0169.1 §"Data shape". Frozen dataclass, deterministic
proposal_id / claim_signature, source="math_audit" pin at the
proposal layer (rejects "corpus" laundering).
- teaching/math_composition_ratification.py — apply_composition_claim()
handler. SAFE_COMPOSITION_CATEGORIES = {multiplicative,
additive, subtractive}_composition per ADR-0169 §"Initial safe
category scope". New WrongCompositionCategory exception per
ADR-0169.1 §"Trip-wires" #8. Writes only to
language_packs/data/en_core_math_v1/compositions/{category}.jsonl;
no solver / parser / decomposer / runtime mutation.
- workbench/readers.py — _HANDLER_DISPATCH now routes
composition_reclassification → CompositionClaim; suggested_cli
branch added for both read_math_proposal and ratify_math_proposal.
- teaching/math_contemplation_proposal.py — ChangeKind Literal +
_VALID_CHANGE_KINDS frozenset extended with
composition_reclassification.
- language_packs/data/en_core_math_v1/compositions/.gitkeep —
reviewed-pack scaffold.
- tests/test_math_composition_ratification.py — 22 tests including
case 0050 hazard pin, cross-process replay equivalence, queue-order
independence, partition, no-corpus-laundering, dispatch wire,
Literal acceptance, JSONL round-trip.
- tests/test_adr_0172_w1_shape_proposal.py — parametrize round-trip
over all 5 change_kinds.
- core/cli.py — teaching suite tuple includes new test file.
CC-3 — decomposer heuristic tightening
- teaching/math_contemplation.py::_CHANGE_KIND_BY_PAIR:
+ (incomplete_operation, quantity_extraction) → composition_reclassification
+ (incomplete_operation, multi_quantity_composition) → composition_reclassification
- (unexpected_category, multi_subject_sentence) demoted to injector_sub_shape
(was frame_reclassification; FrameClaim SAFE_FRAME_CATEGORIES doesn't
cover this — needs ReferenceClaim/CompositionClaim)
- (unexpected_category, descriptive_frame_question) demoted to injector_sub_shape
(was frame_reclassification; needs SlotClaim, not FrameClaim)
Updated hypothesis-step justification text to reflect new dispatch
table.
- tests/test_adr_0172_w2_decomposer.py — distribution assertion
tightened from "≥3 matcher, ≥2 frame" to exact counts:
3 matcher / 2 composition / 3 injector / 0 frame. New
per-pair tests for the four CC-3 dispatch changes.
Verification on real audit_brief_11.json (20 of 47 highest-leverage
refusals now routable):
2 composition_reclassification (12 quantity_extraction + 8 multi_quantity_composition)
3 injector_sub_shape (2 multi_subject + 2 descriptive_frame + 4 unattached_quantity)
3 matcher_extension (9 pre_frame_filler + 4 fraction_percentage + 4 pronoun)
0 frame_reclassification (the two prior misroutes are gone)
Workbench POST /math-proposals/{id}/ratify on either composition
proposal now returns 200/routed with a real apply_composition_claim()
command instead of 501.
Suites green:
- core test --suite teaching -q → 71 passed
- core test --suite runtime -q → 20 passed
Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
|
2026-05-27 15:15:11 -07:00 |
|