Skip to content

Commit e509d79

Browse files
test: make EVT-015 control window explicit
1 parent dbf051b commit e509d79

5 files changed

Lines changed: 44 additions & 12 deletions

File tree

compat-test/conformance-robots/conformance/probes/EventPriorityProbe.java

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,17 @@
44
import robocode.HitWallEvent;
55
import robocode.ScannedRobotEvent;
66

7-
/** Records only a scan handler entered while the higher-priority wall handler is blocked. */
7+
/** Controls scan dispatch inside and outside a higher-priority wall handler. */
88
public class EventPriorityProbe extends AdvancedRobot {
99

1010
private boolean wallHandlerActive;
11+
private boolean controlWindow = true;
1112

1213
@Override
1314
public void run() {
14-
// Establish a scan control before the wall-handler window; the full sweep reaches the
15-
// stationary sample.Target regardless of the engines' unseeded starting positions.
16-
turnRadarRight(360);
15+
// First make scans higher priority than HitWallEvent. A radar sweep in that handler
16+
// must enter onScannedRobot, proving the same window can generate a scan on both engines.
17+
setEventPriority("ScannedRobotEvent", 40);
1718
while (true) {
1819
ahead(10);
1920
}
@@ -23,7 +24,15 @@ public void run() {
2324
public void onHitWall(HitWallEvent event) {
2425
wallHandlerActive = true;
2526
try {
27+
if (!controlWindow) {
28+
out.println("SuppressionWindowEntered!!!");
29+
}
2630
turnRadarRight(360);
31+
if (controlWindow) {
32+
// Subsequent wall handlers exercise the classic lower-priority expiry rule.
33+
setEventPriority("ScannedRobotEvent", 10);
34+
controlWindow = false;
35+
}
2736
} finally {
2837
wallHandlerActive = false;
2938
}
@@ -33,7 +42,11 @@ public void onHitWall(HitWallEvent event) {
3342
public void onScannedRobot(ScannedRobotEvent event) {
3443
out.println("ScanObserved!!!");
3544
if (wallHandlerActive) {
36-
out.println("ScannedDuringWallHandler!!!");
45+
if (controlWindow) {
46+
out.println("ScanControlDuringWallHandler!!!");
47+
} else {
48+
out.println("ScannedDuringWallHandler!!!");
49+
}
3750
}
3851
}
3952
}

conformance-test/src/test/java/dev/robocode/tankroyale/bridge/conformance/EventPriorityConformanceTest.java

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,17 @@
99
/**
1010
* Acceptance evidence for EVT-015 — the classic event-priority filter expectation.
1111
*
12-
* The probe moves until it hits a wall, then blocks while turning its radar. Its lower-priority
13-
* scan handler prints a marker only if it is entered during that handler. Classic's authoritative
14-
* EventPriorityFilter test asserts the same boundary through its observable marker; this probe
15-
* makes the handler window explicit for an unseeded Tank Royale battle.
12+
* The probe first raises scan priority and proves that a radar sweep enters the scan handler
13+
* while the wall handler is blocked. It then lowers scan priority and proves the same sweep does
14+
* not enter that handler, matching classic's authoritative EventPriorityFilter boundary.
1615
*/
1716
class EventPriorityConformanceTest extends ConformanceTestBase {
1817

1918
private static final String ROBOT = "conformance.probes.EventPriorityProbe";
2019
private static final String ENEMY = "sample.Target";
2120
private static final String SCAN_OBSERVED = "ScanObserved!!!";
21+
private static final String SCAN_CONTROL = "ScanControlDuringWallHandler!!!";
22+
private static final String SUPPRESSION_WINDOW = "SuppressionWindowEntered!!!";
2223
private static final String SCANNED = "ScannedDuringWallHandler!!!";
2324
private static final java.nio.file.Path SOURCE = ConformanceHarness.repoRoot()
2425
.resolve("compat-test/conformance-robots/conformance/probes/EventPriorityProbe.java");
@@ -30,6 +31,12 @@ void testEVT015_IntegrationPositive_LowerPriorityScanIsSuppressedOnBothEngines()
3031
assertTrue(outcome.anyConsoleContains(SCAN_OBSERVED),
3132
() -> "the priority probe observed no scan on " + engine
3233
+ " (" + outcome.summary() + ")");
34+
assertTrue(outcome.anyConsoleContains(SCAN_CONTROL),
35+
() -> "the priority probe found no high-priority scan during the wall handler on " + engine
36+
+ " (" + outcome.summary() + ")");
37+
assertTrue(outcome.anyConsoleContains(SUPPRESSION_WINDOW),
38+
() -> "the priority probe did not reach the lower-priority window on " + engine
39+
+ " (" + outcome.summary() + ")");
3340
assertFalse(outcome.anyConsoleContains(SCANNED),
3441
() -> "the lower-priority scan handler ran on " + engine
3542
+ " (" + outcome.summary() + ")");
@@ -50,6 +57,18 @@ void testEVT015_IntegrationNegative_BridgeDoesNotReportAScanClassicDidNotSee() {
5057
() -> "the classic priority probe observed no scan (" + classic.summary() + ")");
5158
assertTrue(bridge.anyConsoleContains(SCAN_OBSERVED),
5259
() -> "the bridge priority probe observed no scan (" + bridge.summary() + ")");
60+
assertTrue(classic.anyConsoleContains(SCAN_CONTROL),
61+
() -> "the classic priority probe found no high-priority scan during the wall handler ("
62+
+ classic.summary() + ")");
63+
assertTrue(bridge.anyConsoleContains(SCAN_CONTROL),
64+
() -> "the bridge priority probe found no high-priority scan during the wall handler ("
65+
+ bridge.summary() + ")");
66+
assertTrue(classic.anyConsoleContains(SUPPRESSION_WINDOW),
67+
() -> "the classic priority probe did not reach the lower-priority window ("
68+
+ classic.summary() + ")");
69+
assertTrue(bridge.anyConsoleContains(SUPPRESSION_WINDOW),
70+
() -> "the bridge priority probe did not reach the lower-priority window ("
71+
+ bridge.summary() + ")");
5372
assertFalse(classic.anyConsoleContains(SCANNED),
5473
() -> "the classic priority-probe baseline reported a scan ("
5574
+ classic.summary() + ")");

docs/capabilities/CAP-001-event-dispatch-parity/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ The physics the events describe. That a `ScannedRobotEvent` arrives at the right
3535

3636
`draft`. The redesign that routed events through the Bot API's own event queue is implemented and believed correct, but it was verified by running battles and reading scores. Every criterion here is unproven in the sense that matters: nothing would tell us if it broke again. `M-001` is the plan door.
3737

38-
The conformance tier now reaches some of them. `EVT-004`, `EVT-011`, `EVT-012`, `EVT-013`, `EVT-014`, and `EVT-015` are active — the tests that already proved them were retagged after [`G-002`](../../goals/G-002-conformance-evidence-proves-the-criterion-it-names.md) found them mistagged, and `EVT-001`/`EVT-003`/`EVT-007` retired rather than be credited with evidence they cannot honestly claim ([`IDR-003`](../../decisions/IDR-003-evt-003-scoped-to-what-classic-actually-proves.md), [`IDR-004`](../../decisions/IDR-004-evt-007-scoped-to-observable-survivor-delivery.md), [`IDR-005`](../../decisions/IDR-005-evt-001-scoped-to-classic-filter-behavior.md)). `EVT-004` and `EVT-014` are proven with a locally built matched Tank Royale Bot API and runner pair under [`PDR-002`](../../decisions/PDR-002-locally-built-tank-royale-artifacts-for-conformance.md), which contains the server repair [`AN-009`](../../analysis/AN-009-the-server-never-sends-a-death-to-any-bot.md) identified. `EVT-015` is proven with the same matched pair and a bridge-owned probe that observes only the blocked-handler boundary. The capability still holds at `draft` because most criteria remain unproven.
38+
The conformance tier now reaches some of them. `EVT-004`, `EVT-011`, `EVT-012`, `EVT-013`, `EVT-014`, and `EVT-015` are active — the tests that already proved them were retagged after [`G-002`](../../goals/G-002-conformance-evidence-proves-the-criterion-it-names.md) found them mistagged, and `EVT-001`/`EVT-003`/`EVT-007` retired rather than be credited with evidence they cannot honestly claim ([`IDR-003`](../../decisions/IDR-003-evt-003-scoped-to-what-classic-actually-proves.md), [`IDR-004`](../../decisions/IDR-004-evt-007-scoped-to-observable-survivor-delivery.md), [`IDR-005`](../../decisions/IDR-005-evt-001-scoped-to-classic-filter-behavior.md)). `EVT-004` and `EVT-014` are proven with a locally built matched Tank Royale Bot API and runner pair under [`PDR-002`](../../decisions/PDR-002-locally-built-tank-royale-artifacts-for-conformance.md), which contains the server repair [`AN-009`](../../analysis/AN-009-the-server-never-sends-a-death-to-any-bot.md) identified. `EVT-015` is proven with the same matched pair and a bridge-owned two-phase probe: a higher-priority scan callback is required inside `onHitWall`, then a lower-priority scan callback is required to be absent. The capability still holds at `draft` because most criteria remain unproven.

docs/capabilities/CAP-001-event-dispatch-parity/criteria.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ Feature: Event dispatch and timing parity
9494
Given a priority probe runs against sample.Target, moves to a wall, and turns its radar from onHitWall
9595
When the same battle runs on classic Robocode and on Tank Royale through the bridge
9696
Then neither engine's robot output contains the scan marker
97-
# Proven by EventPriorityConformanceTest with a bridge-owned probe and sample.Target fixture. The probe observes the same handler boundary as classic's EventPriorityFilter test without depending on an unseeded pre-handler scan. Successor to EVT-001; see IDR-005. Plan door: M-001.
97+
# Proven by EventPriorityConformanceTest with a bridge-owned probe and sample.Target fixture. The probe first raises scan priority and requires a scan callback inside onHitWall, then lowers scan priority and requires that callback to be absent. Successor to EVT-001; see IDR-005. Plan door: M-001.
9898
9999
@EVT-008 @draft
100100
Scenario: Skipped turns are reported to the robot

docs/decisions/IDR-005-evt-001-scoped-to-classic-filter-behavior.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Retire `EVT-001` and mint `EVT-015`: a lower-priority scan handler is not entere
1616

1717
## Context
1818

19-
The named classic robot prints a scan marker and its authoritative test asserts that the marker is absent while running against `sample.Target`; it does not record a handler order. A criterion about recorded order therefore claims behavior that its source evidence cannot observe. The conformance harness stages that opponent fixture for both engines and resets classic's deterministic test seed for this fixture. Because Tank Royale has no battle seed, the conformance test uses a bridge-owned probe that records only a scan entered during the blocked wall-handler window, avoiding unrelated scans before that window.
19+
The named classic robot prints a scan marker and its authoritative test asserts that the marker is absent while running against `sample.Target`; it does not record a handler order. A criterion about recorded order therefore claims behavior that its source evidence cannot observe. The conformance harness stages that opponent fixture for both engines and resets classic's deterministic test seed for this fixture. Because Tank Royale has no battle seed, the conformance test uses a bridge-owned two-phase probe: it first raises scan priority and requires a scan callback inside the blocked wall-handler window, then lowers scan priority and requires that callback to be absent.
2020

2121
## Consequences
2222

0 commit comments

Comments
 (0)