feat(engineering): enforce V1-0 write invariants
This commit is contained in:
@@ -143,8 +143,11 @@ def test_requirement_name_conflict_detected(tmp_data_dir):
|
||||
r2 = create_entity("requirement", "Surface figure < 25nm",
|
||||
project="p-test", description="Different interpretation")
|
||||
|
||||
detected = detect_conflicts_for_entity(r2.id)
|
||||
assert len(detected) == 1
|
||||
# V1-0 synchronous hook: the conflict is already detected at r2's
|
||||
# create-time, so a redundant detect call returns [] due to
|
||||
# _record_conflict dedup. Assert on list_open_conflicts instead —
|
||||
# that's what the intent of this test really tests: duplicate
|
||||
# active requirements surface as an open conflict.
|
||||
conflicts = list_open_conflicts(project="p-test")
|
||||
assert any(c["slot_kind"] == "requirement.name" for c in conflicts)
|
||||
|
||||
@@ -191,8 +194,12 @@ def test_conflict_resolution_dismiss_leaves_entities_alone(tmp_data_dir):
|
||||
description="first meaning")
|
||||
r2 = create_entity("requirement", "Dup req", project="p-test",
|
||||
description="second meaning")
|
||||
detected = detect_conflicts_for_entity(r2.id)
|
||||
conflict_id = detected[0]
|
||||
# V1-0 synchronous hook already recorded the conflict at r2's
|
||||
# create-time. Look it up via list_open_conflicts rather than
|
||||
# calling the detector again (which returns [] due to dedup).
|
||||
open_list = list_open_conflicts(project="p-test")
|
||||
assert open_list, "expected conflict recorded by create-time hook"
|
||||
conflict_id = open_list[0]["id"]
|
||||
|
||||
assert resolve_conflict(conflict_id, "dismiss")
|
||||
# Both still active — dismiss just clears the conflict marker
|
||||
|
||||
Reference in New Issue
Block a user