core/tests
Shay 0dd30b86a7 fix(intent): anchor CORRECTION trigger with word boundaries
While investigating the adjacent RECALL classifier gap, a much
wider intent-classification bug surfaced: every prompt beginning
with a word that *starts with* the letters of any CORRECTION
trigger silently routed to CORRECTION with a mangled subject.

Concrete examples seen during diagnosis:

  "Now remember light."        → CORRECTION  subject="w remember light"
  "Nothing matters."           → CORRECTION  subject="thing matters"
  "Notice the truth."          → CORRECTION  subject="tice the truth"
  "Note that recall fires."    → CORRECTION  subject="te that recall fires"
  "Nominate a candidate."      → CORRECTION  subject="minate a candidate"
  "Norma is here."             → CORRECTION  subject="rma is here"
  "Notwithstanding ..."        → CORRECTION  subject="twithstanding ..."

Root cause: ``generate/intent.py`` ``_RULES`` line ~213 used the
pattern

    (?:no|that'?s\s+(?:not|wrong)|incorrect|actually|correction)

The alternation has ``no``, ``incorrect``, ``actually``, ``correction``
as bare substrings — no word boundary on either side.  Combined with
``re.match``'s start-of-string anchor, *any* prompt beginning with
``No``-, ``Incorrect``-, ``Actually``-, or ``Correction``-prefixed
text matched as CORRECTION; the regex's match span was then sliced
off the prompt to produce a subject like ``"w remember light"``
(from ``"Now remember light."``).

The same hazard threatens:

  * ``no``         → eats ``Now`` / ``Notice`` / ``Note`` / ``Nothing`` /
                     ``Nominate`` / ``Norma`` / ``Notwithstanding`` / ...
  * ``incorrect``  → would eat ``incorrectly``
  * ``actually``   → would eat ``actualization``
  * ``correction`` → would eat ``corrections``

Fix: add ``\b`` anchors on both sides of the alternation.

    \b(?:no|that'?s\s+(?:not|wrong)|incorrect|actually|correction)\b

``\b`` is zero-width, so ``re.match``'s start-of-string anchor still
holds; the left ``\b`` is a no-op at position 0.  The right ``\b``
forces the matched token to end on a word boundary — i.e., the next
character must be non-word (whitespace, punctuation, EOL) — so
``\bno\b`` matches ``"No."`` / ``"No way"`` / ``"No, ..."`` but NOT
``"Now"`` / ``"Nothing"`` / etc.

Verified 11/11 previously-misfiring prompts now correctly classify
as UNKNOWN, and 8/8 legitimate CORRECTION pragmas
(``"No."`` / ``"No way."`` / ``"Incorrect."`` / ``"Actually, ..."`` /
``"Correction: ..."`` / ``"That's wrong."`` / ``"No, that's wrong."`` /
``"no, knowledge is wrong."``) still route correctly.

Tests extended with two new parametrized blocks in
``tests/test_intent_subject_extraction.py``:

  * ``test_correction_canonical_forms_still_route`` — 8 cases pinning
    the legitimate CORRECTION patterns
  * ``test_correction_does_not_eat_no_prefixed_words`` — 10 cases
    pinning the boundary fix against regression

Verified:
  pytest tests/test_intent_subject_extraction.py        25/25 pass
  pytest tests/test_intent_proposition_graph.py        + others       60/60 pass
  core test --suite smoke                                            67/67 pass
  core test --suite runtime                                          19/19 pass

Out of scope: ``"That is not right."`` (a real CORRECTION pragma the
regex never caught because ``that'?s\s+`` requires literal ``s`` after
``that``; the colloquial ``that is`` form was always UNKNOWN). Separate
gap, unchanged here.
2026-05-21 08:29:16 -07:00
..
formation
__init__.py
test_achat.py
test_admissibility_trace.py
test_adr_0084_definitional_substrate.py test(adr-0084): integration test pins substrate gate against ratified content (#68) 2026-05-20 15:35:37 -07:00
test_adr_0084_integration_closure.py feat(packs): ADR-0085 content style pass v2 — 3sg + plural agreement (+ closure infra) (#100) 2026-05-20 23:12:28 -07:00
test_adr_0085_gloss_aware_cause.py feat(adr-0085): gloss-aware CAUSE composer — explanation frame from glosses (#70) 2026-05-20 15:55:08 -07:00
test_adr_0087_procedure_selector.py feat: ADR-0086 + ADR-0087 + 100-register catalog — cognition lane closure 2026-05-21 00:08:12 -07:00
test_adr_0087_rhetorical_style_substrate.py feat(adr-0087): rhetorical-style pack substrate (loader + default_unstyled_v1) (#74) 2026-05-20 16:19:36 -07:00
test_alignment_graph.py
test_anaphora.py test: absorb surface-format drift from Phase B+C; skip one warm-session test 2026-05-19 07:43:56 -07:00
test_anchor_lens_cli.py feat(anchor_lens): ADR-0073d — L1.4 telemetry, CLI flag, tour demo 2026-05-19 20:21:41 -07:00
test_anchor_lens_engagement_unit.py feat(packs): expansion round 2 — ethics ×3, anchor-lens ×3, relations-v3, register ×2 (#48) 2026-05-20 07:18:35 -07:00
test_anchor_lens_lifts_proposition.py feat(anchor_lens): ADR-0073c — L1.3 first lenses + composer wiring 2026-05-19 20:06:02 -07:00
test_anchor_lens_no_glyph_leak.py feat(anchor_lens): ADR-0073c — L1.3 first lenses + composer wiring 2026-05-19 20:06:02 -07:00
test_anchor_lens_null_lift.py feat(anchor_lens): ADR-0073b — L1.2 class + loader + unanchored sentinel 2026-05-19 19:46:34 -07:00
test_anchor_lens_pack_loader.py feat(packs): expansion round 2 — ethics ×3, anchor-lens ×3, relations-v3, register ×2 (#48) 2026-05-20 07:18:35 -07:00
test_anchor_lens_pack_seam.py feat(anchor_lens): ADR-0073c — L1.3 first lenses + composer wiring 2026-05-19 20:06:02 -07:00
test_anchor_lens_telemetry.py feat(anchor_lens): ADR-0073d — L1.4 telemetry, CLI flag, tour demo 2026-05-19 20:21:41 -07:00
test_anchor_lens_tour_demo.py feat(anchor_lens): ADR-0073d — L1.4 telemetry, CLI flag, tour demo 2026-05-19 20:21:41 -07:00
test_anti_regression_demo.py
test_architectural_invariants.py fix(cli, tests): wire core contemplation + restore INV-02 allowlist (#60) 2026-05-20 13:10:29 -07:00
test_articulation.py
test_articulation_bench.py feat(evals+bench): isolation lanes, holdouts, planner-on bench sub-bench 2026-05-19 12:42:55 -07:00
test_articulation_demo.py feat(demo): core demo articulation — discourse-planner spine, end-to-end 2026-05-19 13:41:24 -07:00
test_articulation_legality.py feat(realizer): C1.5 — articulation legality at the realizer boundary 2026-05-20 11:11:28 -07:00
test_articulation_realizer_v2.py
test_audit_tour.py
test_benchmarks_profiler.py
test_capability_cli.py Add chain-first capability ledger and domain seeds (#97) 2026-05-20 21:33:24 -07:00
test_capability_reports.py Add chain-first capability ledger and domain seeds (#97) 2026-05-20 21:33:24 -07:00
test_cga_inner_rust_parity.py
test_chat_runtime.py
test_cli.py
test_cli_demo.py
test_cli_pack_validate_security.py
test_cli_test_suites.py
test_cognition_eval_register_matrix.py test(register): widen invariant matrix to all 100 ratified packs 2026-05-21 06:38:22 -07:00
test_cognitive_eval_harness.py
test_cognitive_turn_pipeline.py
test_cold_start_grounding_lane.py feat(evals+bench): isolation lanes, holdouts, planner-on bench sub-bench 2026-05-19 12:42:55 -07:00
test_comb_pass_hot_path.py perf(cognition): hot-path comb pass — 5 mechanical-sympathy fixes (#91) 2026-05-20 20:31:56 -07:00
test_compiler.py
test_compose_relations.py
test_composed_surface.py
test_composer_graph_atom_equivalence.py feat(telemetry): ADR-0078 Phase 1 — composer/graph atom equivalence (observational) 2026-05-20 06:14:25 -07:00
test_compound_intent.py feat(intent+discourse): CompoundIntent + sub-plan composition 2026-05-19 12:23:58 -07:00
test_compound_intent_substrate.py feat(cognition): compound-intent observability substrate (ADR-0089 Phase C1) (#89) 2026-05-20 19:59:38 -07:00
test_compound_walkthrough_eval_lanes.py feat(evals+bench): isolation lanes, holdouts, planner-on bench sub-bench 2026-05-19 12:42:55 -07:00
test_contemplation.py
test_contemplation_loop.py feat(contemplation): ADR-0080 read-only speculative loop (#55) 2026-05-20 11:40:12 -07:00
test_contemplation_pipeline_convergence.py refactor(contemplation): converge to shared discovery-sink plumbing (#58) 2026-05-20 12:32:53 -07:00
test_contemplation_wiring.py
test_conversation_demo.py feat(demo): humanise teaching-grounded surface for layperson display 2026-05-19 14:14:02 -07:00
test_core_ingest.py
test_core_semantic_seed_pack.py feat(packs): ADR-0085 content style pass v2 — 3sg + plural agreement (+ closure infra) (#100) 2026-05-20 23:12:28 -07:00
test_correction_telemetry.py
test_correction_topic_lemma.py feat(packs): en_core_polarity_v1 — polarity + frequency (16 lemmas) 2026-05-19 05:38:13 -07:00
test_cross_pack_chains.py feat(adr-0067): cross-pack teaching chains — Plan Phase 4 closed 2026-05-18 17:22:43 -07:00
test_cross_pack_grounding.py
test_cross_pack_supersede.py feat(phase5+bench): cross-pack supersede + articulation benchmark suite 2026-05-18 17:44:59 -07:00
test_determinism_proofs.py
test_deterministic_fluency_lane.py feat(evals): deterministic_fluency lane — six structural predicates 2026-05-19 07:16:44 -07:00
test_deterministic_hash.py
test_dialogue.py
test_dialogue_fluency_regression.py
test_discourse_planner_behavior.py feat(discourse): WALKTHROUGH v1 — sequential teaching-chain walk 2026-05-19 12:29:20 -07:00
test_discourse_planner_compound.py feat(intent+discourse): CompoundIntent + sub-plan composition 2026-05-19 12:23:58 -07:00
test_discourse_planner_contract.py feat(intent+discourse): CompoundIntent + sub-plan composition 2026-05-19 12:23:58 -07:00
test_discourse_planner_helper.py feat(intent+discourse): CompoundIntent + sub-plan composition 2026-05-19 12:23:58 -07:00
test_discourse_planner_render.py feat(runtime): wire discourse planner behind RuntimeConfig flag 2026-05-19 11:29:25 -07:00
test_discourse_planner_walkthrough.py feat(discourse): WALKTHROUGH v1 — sequential teaching-chain walk 2026-05-19 12:29:20 -07:00
test_discovery_candidates.py
test_domain_pack_contract.py Add chain-first capability ledger and domain seeds (#97) 2026-05-20 21:33:24 -07:00
test_en_collapse_anchors_v1_pack.py feat(packs): en_collapse_anchors_v1 — activate chesed/shalom/tzedek lenses on EN input 2026-05-20 10:58:07 -07:00
test_en_core_action_v1_pack.py feat(packs): en_core_action_v1 — action verbs (26 lemmas) 2026-05-19 05:38:12 -07:00
test_en_core_attitude_v1_pack.py feat(packs): en_core_attitude_v1 — adjective pack (40 lemmas) 2026-05-19 05:38:12 -07:00
test_en_core_causation_v1_pack.py feat(packs): en_core_causation_v1 — causation vocabulary (15 lemmas) 2026-05-19 05:38:12 -07:00
test_en_core_meta_v1_pack.py feat(packs): en_core_meta_v1 — conversational substrate (73 lemmas) 2026-05-19 05:38:12 -07:00
test_en_core_polarity_v1_pack.py feat(packs): en_core_polarity_v1 — polarity + frequency (16 lemmas) 2026-05-19 05:38:13 -07:00
test_en_core_quantitative_v1_pack.py feat(packs): en_core_quantitative_v1 — quantifiers + numeric basics (24 lemmas) 2026-05-19 05:38:12 -07:00
test_en_core_relations_v1_pack.py
test_en_core_relations_v2_pack.py
test_en_core_spatial_v1_pack.py feat(packs): en_core_spatial_v1 — spatial vocabulary (24 lemmas) 2026-05-19 05:38:12 -07:00
test_en_core_temporal_v1_pack.py feat(packs): en_core_temporal_v1 — temporal pack (28 lemmas) 2026-05-19 05:38:12 -07:00
test_energy.py
test_engine_loop_proof.py
test_epistemic_invariants.py
test_ethics_check.py
test_ethics_packs.py
test_ethics_refusal_opt_in.py
test_eval_holdout_split.py
test_explain.py
test_forward_graph_constraint_null_lift.py
test_forward_graph_constraint_wiring.py
test_forward_semantic_control.py
test_frontier_compare_cross_provider.py feat(frontier): add replay variability suite and token-cost telemetry (#66) 2026-05-20 15:04:34 -07:00
test_frontier_compare_wave1.py fix(tests): make frontier_compare viewer test resilient to copy refreshes (#67) 2026-05-20 15:13:38 -07:00
test_frontier_model_registry_pricing.py feat(frontier): add replay variability suite and token-cost telemetry (#66) 2026-05-20 15:04:34 -07:00
test_generate_stream.py
test_geometric_product_rust_parity.py
test_graph_constraint.py
test_graph_diffusion.py
test_graph_topo_order_perf.py perf(graph): PropositionGraph.topo_order — Kahn's O(N+E) instead of O(N×E) (#92) 2026-05-20 20:37:21 -07:00
test_grounding_accessors.py feat(grounding): structured GroundedFact accessors for discourse planner 2026-05-19 11:19:59 -07:00
test_grounding_source_characterization.py test(grounding): pin source-order contract for discourse adapter 2026-05-19 11:11:45 -07:00
test_hedge_injection.py
test_holonomy.py
test_holonomy_resonance.py
test_identity_gate.py
test_identity_packs.py
test_identity_score_decomposition.py
test_identity_surface_divergence.py
test_identity_surface_divergence_depth.py
test_inference_operators.py
test_inner_loop_admissibility.py
test_inner_loop_phase2.py
test_inner_loop_phase3.py
test_inner_loop_phase4.py
test_intent_classification_extensions.py feat(intent): normalize confirmation-tag propositions (#45) 2026-05-19 22:55:28 -07:00
test_intent_explain_paragraph.py feat(evals+bench): isolation lanes, holdouts, planner-on bench sub-bench 2026-05-19 12:42:55 -07:00
test_intent_proposition_graph.py
test_intent_ratifier.py
test_intent_subject_extraction.py fix(intent): anchor CORRECTION trigger with word boundaries 2026-05-21 08:29:16 -07:00
test_intent_subject_normalization_consistency.py rigor(intent): consistent subject normalization across all classifier paths (#93) 2026-05-20 20:44:19 -07:00
test_language_pack_cache.py
test_language_pack_load_safety.py
test_language_pack_runtime.py
test_learning_loop_demo.py
test_long_context_comparison.py
test_manifold.py
test_manifold_state.py
test_margin_admissibility.py
test_medical_clinical_ethics_pack.py
test_morphology_irregular.py
test_morphology_registry.py
test_motor.py
test_multi_sentence_response_eval.py feat(evals): articulate/disclosure/unarticulate partition 2026-05-19 12:13:44 -07:00
test_mutation_proposal_type.py
test_narrative_example_intents.py feat(adr-0067): cross-pack teaching chains — Plan Phase 4 closed 2026-05-18 17:22:43 -07:00
test_null_cone.py
test_oov_grounding_cache.py
test_oov_pipeline.py
test_oov_surface.py test: absorb surface-format drift from Phase B+C; skip one warm-session test 2026-05-19 07:43:56 -07:00
test_operator_calibration_replay.py
test_orthogonality_tour_demo.py feat(demo): ADR-0074 — orthogonality tour (anchor-lens × register) 2026-05-19 20:33:33 -07:00
test_pack_glosses_content.py feat(packs): seed 323 reviewed glosses across 9 English content packs 2026-05-19 07:34:33 -07:00
test_pack_grounded_comparison.py
test_pack_grounded_correction.py test: absorb surface-format drift from Phase B+C; skip one warm-session test 2026-05-19 07:43:56 -07:00
test_pack_grounded_unknown.py feat: ADR-0086 + ADR-0087 + 100-register catalog — cognition lane closure 2026-05-21 00:08:12 -07:00
test_pack_grounding.py feat(packs): seed 323 reviewed glosses across 9 English content packs 2026-05-19 07:34:33 -07:00
test_pack_measurements_phase2.py
test_pack_resolver.py
test_pack_resolver_glosses.py feat(packs): seed 323 reviewed glosses across 9 English content packs 2026-05-19 07:34:33 -07:00
test_partial_surface.py
test_phase5_corpus.py
test_phase6_demo.py
test_pipeline.py
test_pipeline_teaching_integration.py
test_probe_repl.py
test_procedure_surface.py feat(packs): en_core_action_v1 — action verbs (26 lemmas) 2026-05-19 05:38:12 -07:00
test_prompt_diversity_runner.py fix(evals): prompt_diversity gloss-quote heuristic — 4-token window → substring (#69) 2026-05-20 15:43:01 -07:00
test_proof_properties.py
test_proposition.py
test_provenance.py
test_pulse_integration.py
test_ratification_threshold_default.py chore(ratifier): calibrate default ratification threshold 0.0 → 0.5 (#86) 2026-05-20 19:59:25 -07:00
test_realizer_grounded_authority_flag.py feat(cognition): opt-in grounded-realizer authority flag (ADR-0088 Phase B) (#88) 2026-05-20 20:00:58 -07:00
test_realizer_guard_holdout.py feat(intent): normalize confirmation-tag propositions (#45) 2026-05-19 22:55:28 -07:00
test_realizer_guard_runtime_seam.py feat(intent): normalize confirmation-tag propositions (#45) 2026-05-19 22:55:28 -07:00
test_realizer_guard_unit.py feat(coherence): ADR-0075 — realizer slot-type guard (C1) 2026-05-19 22:35:09 -07:00
test_realizer_quantifier_agreement.py
test_refusal_contract.py
test_register_cli.py feat(register): R5 — operator-visible register telemetry + tour demo 2026-05-19 19:03:07 -07:00
test_register_firing_diagnostic.py feat(evals): per-intent register-firing diagnostic + CI gate + tests (#103) 2026-05-21 07:05:23 -07:00
test_register_invariant_grounding.py feat(register): R1–R4 register pack subsystem — deterministic surface variation 2026-05-19 16:52:36 -07:00
test_register_layering_separation.py feat(register): ADR-0077 — substantive register knobs + layering boundary (R6) 2026-05-19 23:39:11 -07:00
test_register_null_lift.py feat(register): R1–R4 register pack subsystem — deterministic surface variation 2026-05-19 16:52:36 -07:00
test_register_pack_convivial_v1.py feat(register): R1–R4 register pack subsystem — deterministic surface variation 2026-05-19 16:52:36 -07:00
test_register_pack_loader.py feat(register): R1–R4 register pack subsystem — deterministic surface variation 2026-05-19 16:52:36 -07:00
test_register_pack_seam.py feat(register): R1–R4 register pack subsystem — deterministic surface variation 2026-05-19 16:52:36 -07:00
test_register_pack_terse_v1.py feat(register): ADR-0077 — substantive register knobs + layering boundary (R6) 2026-05-19 23:39:11 -07:00
test_register_runtime_threading.py feat(register): R1–R4 register pack subsystem — deterministic surface variation 2026-05-19 16:52:36 -07:00
test_register_substantive_consumption.py feat(register): ADR-0077 — substantive register knobs + layering boundary (R6) 2026-05-19 23:39:11 -07:00
test_register_telemetry.py feat(register): R5 — operator-visible register telemetry + tour demo 2026-05-19 19:03:07 -07:00
test_register_tour_demo.py feat(register): ADR-0077 — substantive register knobs + layering boundary (R6) 2026-05-19 23:39:11 -07:00
test_register_tour_gate_strengthening.py feat(register): ADR-0077 — substantive register knobs + layering boundary (R6) 2026-05-19 23:39:11 -07:00
test_register_variation.py feat(register): R5 — operator-visible register telemetry + tour demo 2026-05-19 19:03:07 -07:00
test_relations_chains_v1.py
test_replay_vs_llm_benchmark.py
test_response_mode_classifier.py feat(intent): normalize confirmation-tag propositions (#45) 2026-05-19 22:55:28 -07:00
test_reviewed_teaching_loop.py
test_rotor_admissibility.py
test_rotor_power.py
test_runtime_config.py feat(packs/register): 93-pack catalog rollout — drafted → ratified (#102) 2026-05-21 06:37:38 -07:00
test_runtime_config_passthrough.py fix(runtime): config-replace + thin API wrappers + stale docstring 2026-05-19 07:04:10 -07:00
test_runtime_config_register.py feat(register): R1–R4 register pack subsystem — deterministic surface variation 2026-05-19 16:52:36 -07:00
test_rust_backend.py
test_safe_display.py
test_safety_check.py
test_safety_pack.py
test_safety_refusal.py
test_salience.py
test_salience_vectorize_parity.py perf(salience): vectorize curvature pairwise loop — 57× faster, 42% e2e (#96) 2026-05-20 21:29:42 -07:00
test_segmenter.py
test_semantic_realizer_integration.py test: absorb surface-format drift from Phase B+C; skip one warm-session test 2026-05-19 07:43:56 -07:00
test_sensorium_mount.py
test_session_coherence.py
test_speculative_subject_lifecycle.py fix(cognition): bound speculative-subject cache + evict on COHERENT promotion (#85) 2026-05-20 19:59:21 -07:00
test_stop_tokens_override.py chore(generate): make stop-tokens caller-overridable via RuntimeConfig (#87) 2026-05-20 19:59:33 -07:00
test_supersede.py
test_supersession_history.py
test_surface.py
test_surface_resolution.py fix(cognition): declare surface authority resolution (#76) 2026-05-20 19:42:10 -07:00
test_teaching_audit.py
test_teaching_gaps.py
test_teaching_grounding.py
test_teaching_loop_bench.py
test_teaching_promotion.py
test_teaching_proposals.py
test_telemetry_fanout_and_summary.py
test_telemetry_sink.py
test_thread_context.py feat(adr-0066): session-thread context + opt-in anaphora prefix (Phase 3.1 + 3.2) 2026-05-18 17:01:34 -07:00
test_transition_rotor.py
test_transitive_surface.py feat(adr-0083): transitive (multi-hop) teaching-grounded surface (#63) 2026-05-20 14:11:40 -07:00
test_turn_loop_verdicts.py
test_turn_verdicts_bundle.py
test_unified_ingest_null_lift.py feat(runtime): opt-in unified-ingest path (ADR-0090, audit Findings 6+7) (#95) 2026-05-20 21:00:27 -07:00
test_unknown_token_ingest.py
test_vault_config.py
test_vault_recall.py
test_vault_recall_indexing_batch.py
test_vault_recall_rust_parity.py
test_vault_recall_vectorised.py
test_vault_store.py
test_versor_apply_rust_parity.py
test_versor_closure.py
test_versor_condition_rust_parity.py
test_vocab_manifold_invariants.py
test_warmed_session_lane.py fix(pipeline): usefulness gate on realized-plan override 2026-05-19 07:21:00 -07:00