- src/types.hpp: complete UCWM type system in C++20 — 19 enums, 11 facet data types, all core structs (CanonicalObject, Constraint, Facet, GateSignal, WorldState, etc.) with full JSON round-trip serialization - src/main.cpp: smoke test — constructs apple-problem WorldState by hand, serializes to JSON - tests/test_types.cpp: 19 tests, 123 assertions, all passing - CMakeLists.txt: CMake + CPM build with nlohmann/json, spdlog, Catch2 - schemas/: JSON Schema contracts for all UCWM data types - gates/, specialists/, resolver/, synthesis/: language-agnostic interface contracts and domain specs for all pipeline layers - docs/: architecture, vocabulary, decision matrices, roadmap (6 phases, 28 sprints), sprint_001, implementation_constraints Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
3.0 KiB
3.0 KiB
Resolver Contract Tests
Tests that any resolver implementation must pass.
RT_001 — Arithmetic resolution
Input WorldState:
Objects: Q1 (value=5, unit=apples), Q2 (value=2, unit=apples), Q_result (value=null)
Constraints: C1 = quantity_difference(Q_result, Q1, Q2), status=unresolved
Expected resolved WorldState:
Q_result.QuantityFacet.value = 3
Q_result.QuantityFacet.is_exact = true
Q_result.QuantityFacet.unit = "apples"
C1.status = "resolved"
resolution_log contains entry for "resolve_arithmetic" affecting Q_result
RT_002 — Coreference merge
Input WorldState:
Objects: E1 (Alice, confidence=0.97), E_she (She, confidence=0.72)
Constraints: C_coref = same_entity(E1, E_she), status=resolved
Expected resolved WorldState:
E_she.status = "merged"
E_she.merged_into = "E1"
E1.aliases contains "She"
All facet_refs and constraint_refs from E_she transferred to E1
resolution_log contains entry for "merge_coreference"
RT_003 — Contradiction detected and logged
Input WorldState:
Constraints:
C1 = before(EV1, EV2), strength=hard, status=unresolved
C2 = before(EV2, EV1), strength=hard, status=unresolved
Expected:
C1.status = "contradicted"
C2.status = "contradicted"
open_contradictions contains record with constraint_refs = ["C1", "C2"]
NO silent resolution
RT_004 — Soft constraint suspended by hard conflict
Input WorldState:
C1 = quantity_equals(Q1, 5), strength=hard, status=resolved
C2 = quantity_equals(Q1, 7), strength=soft, status=unresolved
Expected:
C2.status = "suspended"
resolution_log contains "suspend_soft" entry for C2
Q1.value = 5 (unchanged)
RT_005 — No new objects created
Input WorldState: N objects
Expected: resolved WorldState has <= N objects (merges reduce count; splits would increase but must be explicitly supported)
RT_006 — Resolution log completeness
For any non-trivial WorldState:
Every object status change must have a log entry
Every constraint status change must have a log entry
resolution_log must be non-empty
RT_007 — Stage check
Input: WorldState with stage = "post_gate"
Expected: resolver raises error or returns error state, does not produce resolved output
RT_008 — Idempotency
Call resolver(WorldState) → resolved_1
Call resolver(resolved_1) → resolved_2
Expected: resolved_1 and resolved_2 are logically equivalent (no new changes on second pass)
RT_009 — Confidence propagation bounds
Given any resolved constraint affecting object O:
O.confidence must not increase by more than 0.15 from a single constraint
O.confidence must not decrease by more than 0.15 from a single contradiction
O.confidence must remain in [0.0, 1.0]
RT_010 — Resolver interface replaceability
Given a resolver interface: resolve(world_state) → world_state
Any implementation that passes RT_001 through RT_009 is a valid resolver.
The rest of the pipeline must not depend on resolver internals.