Record original-alignment implementation and traceability checkpoint
Capture current source, content data, tests, asset licenses, and original-specification traceability. Original implementation remains incomplete. The accepted matching UI generation passed 154 suites and 12,253 checks, with eight rendered staff-contract screens reviewed. Latest native Windows and full-original acceptance remain outstanding.
This commit is contained in:
@@ -8,6 +8,7 @@ func _initialize() -> void:
|
||||
|
||||
func _run() -> void:
|
||||
print("S0: domain events")
|
||||
_test_snapshot_id_cache()
|
||||
_test_single_publish_and_snapshot()
|
||||
_test_atomic_batch_and_reentrant_delivery()
|
||||
_test_batch_rejection_is_atomic()
|
||||
@@ -119,3 +120,25 @@ func _expect(condition: bool, label: String) -> void:
|
||||
return
|
||||
_failures += 1
|
||||
push_error(" ✗ %s" % label)
|
||||
|
||||
|
||||
func _test_snapshot_id_cache() -> void:
|
||||
var stream := DomainEventStream.new()
|
||||
var ids: Array[String] = ["z", "a", "A", "a10", "a2", String.chr(0x1f333), String.chr(0x3042)]
|
||||
_expect(stream.restore_snapshot({"version":1,"published_ids":ids,"recent_events":[]}), "restore unsorted history fixture")
|
||||
var expected := ids.duplicate()
|
||||
expected.sort_custom(func(a: String,b: String):return a < b)
|
||||
var first := stream.create_snapshot()
|
||||
_expect(first["published_ids"] == expected, "native string sort preserves reference order including Unicode")
|
||||
first["published_ids"].clear()
|
||||
_expect(stream.create_snapshot()["published_ids"] == expected, "returned ID array cannot corrupt cached history")
|
||||
var event := SimulationDomainEvent.new(&"new_id", &"TEST", 360, &"test", [], {}, 1)
|
||||
_expect(stream.publish(event), "publish invalidates cached IDs")
|
||||
expected.append("new_id");expected.sort()
|
||||
_expect(stream.create_snapshot()["published_ids"] == expected, "new ID appears once after cached snapshot")
|
||||
_expect(not stream.publish(event) and stream.create_snapshot()["published_ids"] == expected, "rejected duplicate preserves cached state")
|
||||
_expect(stream.restore_snapshot({"version":1,"published_ids":["replacement"],"recent_events":[]}), "replace history through restore")
|
||||
_expect(stream.create_snapshot()["published_ids"] == ["replacement"], "restore invalidates old sorted cache")
|
||||
var valid := stream.create_snapshot()
|
||||
_expect(not stream.restore_snapshot({"version":1,"published_ids":["duplicate","duplicate"],"recent_events":[]}), "invalid restore rejected")
|
||||
_expect(stream.create_snapshot() == valid, "failed restore preserves canonical snapshot")
|
||||
|
||||
Reference in New Issue
Block a user