From a7e3069b167511b3194242b3403fbcc35244a526 Mon Sep 17 00:00:00 2001 From: Agent Control Runner Date: Sat, 17 Oct 2026 17:21:43 +0900 Subject: [PATCH] =?UTF-8?q?P13-02-CODE1:=20P13-02=20=E8=83=8C=E9=9D=A2?= =?UTF-8?q?=E5=AF=BE=E8=B1=A1=E5=8F=82=E7=85=A7=E3=83=BB=E5=8D=A0=E6=9C=89?= =?UTF-8?q?=E3=83=BB=E4=BF=9D=E5=AD=98=E3=81=AE=E9=9D=9E=E6=8F=8F=E5=86=99?= =?UTF-8?q?=E6=A9=9F=E6=A7=8B=EF=BC=88=E5=85=A8=E5=8E=9F=E6=88=90=E6=9E=9C?= =?UTF-8?q?=E3=81=AE=E4=B8=80=E9=83=A8=E3=80=81=E5=8A=A0=E7=AE=97=E3=81=AA?= =?UTF-8?q?=E3=81=97=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../completion_marker_contracts.json | 2 +- tests/special/test_peeping_room_runtime.gd | 37 ++++++++++++++++++- 2 files changed, 36 insertions(+), 3 deletions(-) diff --git a/docs/plans/original-completion-2026-10-02/execution/completion_marker_contracts.json b/docs/plans/original-completion-2026-10-02/execution/completion_marker_contracts.json index 1158482..fce033f 100644 --- a/docs/plans/original-completion-2026-10-02/execution/completion_marker_contracts.json +++ b/docs/plans/original-completion-2026-10-02/execution/completion_marker_contracts.json @@ -3784,7 +3784,7 @@ "template": "Peeping room runtime: checks, failures", "required": true, "fixed_check_count_used": false, - "source_sha256_at_schema_audit": "30ed2fe11cc6b0353e9a3a6d995cf8690d322858d2c3dbb38ef32fd941072d2d", + "source_sha256_at_schema_audit": "924efd34414c12a325a1b700f799aef0396de9f15441fd88a3608292ff221657", "authority": { "path": "docs/plans/original-completion-2026-10-02/execution/p13-02/CODE1_TASK_SPEC.json", "scope": "new backend suite marker; native execution pending" diff --git a/tests/special/test_peeping_room_runtime.gd b/tests/special/test_peeping_room_runtime.gd index 34a6510..06ef0ea 100644 --- a/tests/special/test_peeping_room_runtime.gd +++ b/tests/special/test_peeping_room_runtime.gd @@ -12,10 +12,43 @@ func _run() -> void: expect(before == var_to_bytes(runtime.create_snapshot()), "validator changes no whole Runtime bytes") var public_validation: CommandResult = runtime.submit_command(&"peeping_room_validate", validation.payload) expect(public_validation.is_success(), "registered validation command runs through real queue") - var domain_before := [runtime.world_service.create_snapshot(), runtime.economy_service.create_snapshot(), runtime.id_generator.create_snapshot(), runtime.peeping_room_service.create_snapshot()] + var placement := SimulationCommand.new() + placement.command_type = &"peeping_room_place" + placement.payload = validation.payload.duplicate(true) + var placement_before := var_to_bytes(runtime.create_snapshot()) + var direct_unavailable: CommandResult = runtime._execute_peeping_room(placement) + expect(not direct_unavailable.is_success() and direct_unavailable.details[&"reason"] == &"BUILD_DEFINITION_PENDING_D04", "direct production placement unavailable with precise reason") + expect(placement_before == var_to_bytes(runtime.create_snapshot()), "direct placement adds no room, occupancy, cost or ID in whole typed Runtime") + var domain_before := var_to_bytes([runtime.world_service.create_snapshot(), runtime.economy_service.create_snapshot(), runtime.peeping_room_service.create_snapshot()]) + var ids_before: Dictionary = runtime.id_generator.create_snapshot() + var counters_before: Dictionary = ids_before["counters"] + var event_counter_before: int = counters_before.get("domain_event", 0) + var event_ids_before := {} + for event: SimulationDomainEvent in runtime.domain_events.recent_events(): + event_ids_before[event.event_id] = true var unavailable: CommandResult = runtime.submit_command(&"peeping_room_place", validation.payload) expect(not unavailable.is_success() and unavailable.details[&"reason"] == &"BUILD_DEFINITION_PENDING_D04", "production placement unavailable with precise reason") - expect(var_to_bytes(domain_before) == var_to_bytes([runtime.world_service.create_snapshot(), runtime.economy_service.create_snapshot(), runtime.id_generator.create_snapshot(), runtime.peeping_room_service.create_snapshot()]), "placement adds no room, occupancy, cost or ID (normal queue receipt only)") + expect(domain_before == var_to_bytes([runtime.world_service.create_snapshot(), runtime.economy_service.create_snapshot(), runtime.peeping_room_service.create_snapshot()]), "queued placement adds no room, occupancy or cost") + var ids_after: Dictionary = runtime.id_generator.create_snapshot() + var counters_after: Dictionary = ids_after["counters"] + expect(ids_before["version"] == ids_after["version"], "queued placement preserves ID generator version") + for prefix: Variant in counters_before: + if prefix != "domain_event": + expect(counters_after.has(prefix) and counters_after.get(prefix) == counters_before[prefix], "queued placement consumes no non-event ID or removes prefix: %s" % prefix) + for prefix: Variant in counters_after: + if prefix != "domain_event": + expect(counters_before.has(prefix), "queued placement adds no non-event ID prefix: %s" % prefix) + expect(counters_after.has("domain_event") and counters_after["domain_event"] == event_counter_before + 1, "queued placement allocates exactly one normal receipt event ID") + var new_events: Array[SimulationDomainEvent] = [] + for event: SimulationDomainEvent in runtime.domain_events.recent_events(): + if not event_ids_before.has(event.event_id): + new_events.append(event) + expect(new_events.size() == 1, "queued placement publishes exactly one new receipt event") + if new_events.size() == 1: + var receipt: SimulationDomainEvent = new_events[0] + expect(receipt.event_id == StringName("domain_event.%012d" % (event_counter_before + 1)), "placement receipt uses the next domain event ID") + expect(receipt.event_type == &"COMMAND_FAILED", "unavailable placement receipt is COMMAND_FAILED") + expect(receipt.causation_command_id == unavailable.command_id, "placement receipt causation matches rejected command") var room := place(f) enable_fixture(f, room) var blocked: CommandResult = runtime.submit_command(&"peeping_room_record_evidence", {&"room_id": room, &"source_event_key": &"fixture.command"})