Skip to content

Commit 3740cb3

Browse files
feat(runner): unify behavior version handling and update to 1.2.0
1 parent 1db1be1 commit 3740cb3

9 files changed

Lines changed: 18 additions & 14 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
## [Unreleased]
1+
## [1.2.0] - Unreleased - Runner compatibility precondition
22

33
### 🚀 Improvements
44

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.1.0
1+
1.2.0

bot-api/typescript/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ npm install @robocode.dev/tank-royale-bot-api
2626
To install a specific version:
2727

2828
```bash
29-
npm install @robocode.dev/tank-royale-bot-api@1.1.0
29+
npm install @robocode.dev/tank-royale-bot-api@1.2.0
3030
```
3131

3232
The `ws` package is required at runtime in a Node.js environment:

bot-api/typescript/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bot-api/typescript/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@robocode.dev/tank-royale-bot-api",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"description": "Tank Royale Bot API for TypeScript/JavaScript",
55
"license": "Apache-2.0",
66
"homepage": "https://robocode-dev.github.io/tank-royale/",

bot-api/typescript/src/version.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
* Do not edit manually — the version is controlled by the /VERSION file in the repository root
55
* and stamped into this file by the Gradle `syncVersion` task (same mechanism as package.json).
66
*/
7-
export const API_VERSION = "1.1.0";
7+
export const API_VERSION = "1.2.0";

docs/decisions/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,11 @@ Writing guidelines: be specific (technical detail, not concepts); show your work
5454
- [ADR-043 — Rumble Client Trust Boundary](ADR-043-rumble-client-trust-boundary.md) · `verified`
5555
- [ADR-044 — Durable Rumble Result Acknowledgement](ADR-044-durable-rumble-result-acknowledgement.md) · `verified`
5656
- [ADR-045 — Official Bot API Language Set Is Closed](ADR-045-official-bot-api-language-set.md) · `verified`
57+
- [ADR-046 — Battle Runner enforces an expected behavior version before bot boot](ADR-046-runner-behavior-version-precondition.md) · `verified` — Ranked Rumble execution must compare the synchronized engine epoch with the running server's handshake before untrusted bot code starts.
5758
- [IDR-001 — npmPack is the TypeScript publish preview](IDR-001-npm-publish-dry-run.md) · `inferred` — The never-built `npmPublishDryRun` task duplicated the package artifact inspection already provided by `npmPack`.
5859
- [IDR-002 — TypeScript npm publishing reads the Gradle credential property](IDR-002-npm-publish-credential.md) · `inferred` — Publishing credentials for the repository's package ecosystems are kept in user Gradle properties rather than repository environment configuration.
5960
- [IDR-003 — The corpus identity ledger is repaired from its own history](IDR-003-identity-ledger-repair.md) · `inferred` — The `CH` counter had drifted from the change identities already bound by the corpus, causing the allocator to reserve an identity that was already in use.
61+
- [IDR-004 — Rumble client uses the released Battle Runner dependency](IDR-004-rumble-client-battle-runner-dependency.md) · `verified` — CAP-016 requires the Rumble client to execute pinned battles through the Battle Runner API.
6062
- [PDR-001 — Authorized simple pushes remain distinct from full changes](PDR-001-authorized-simple-pushes.md) · `inferred` — The review boundary must keep accepted-contract changes behind a human-merged pull request while allowing explicitly authorized maintenance work to follow a lighter route.
6163
- [PDR-002 — Release tooling uses the repository version and verifies documentation locally](PDR-002-release-version-source-and-verification.md) · `inferred` — The Gradle build already owns the repository release version, while generated Pages output is not a checked-in artifact and direct `main` mutation is human-gated.
6264
- [PDR-003 — The Rumble client waits for the official engine release](PDR-003-rumble-client-release-gate.md) · `inferred` — Ranked Rumble battles must target a published immutable engine distribution rather than unreleased source or a partial runtime contract.
@@ -69,6 +71,4 @@ Writing guidelines: be specific (technical detail, not concepts); show your work
6971
- [PDR-010 — Design records use the architecture type](PDR-010-design-record-typing.md) · `inferred` — The corpus needs one vocabulary for documents that describe system structure, including the debugging guide and health reports.
7072
- [PDR-011 — Empty extracted specifications create no capability](PDR-011-empty-extraction-directory.md) · `inferred` — The `browser-sample-bots` OpenSpec directory contained no requirements to preserve.
7173
- [PDR-012 — Typed decision records replace the legacy decision log](PDR-012-typed-decision-record-carrier.md) · `inferred` — The legacy decision log mixed architecture, process, implementation, and routine history in one carrier that obscured the enduring subject of each choice.
72-
- [IDR-004 — Rumble client uses the released Battle Runner dependency](IDR-004-rumble-client-battle-runner-dependency.md) · `inferred` — CAP-016 requires the Rumble client to execute pinned battles through the Battle Runner API.
73-
- [ADR-046 — Battle Runner enforces an expected behavior version before bot boot](ADR-046-runner-behavior-version-precondition.md) · `verified` — Ranked Rumble execution must compare the synchronized engine epoch with the running server's handshake before untrusted bot code starts.
7474
<!-- clue:index:end -->

runner/src/main/kotlin/dev/robocode/tankroyale/runner/BattleRunner.kt

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ import java.util.logging.Logger
5252
*/
5353
class BattleRunner private constructor(
5454
val config: Config,
55-
internal val requiredBehaviorVersion: Int?,
5655
) : AutoCloseable {
5756

5857
private val logger = Logger.getLogger(BattleRunner::class.java.name)
@@ -149,7 +148,7 @@ class BattleRunner private constructor(
149148
logger.fine("Connecting to server at ${serverManager.serverUrl}...")
150149
ensureConnected()
151150
val conn = connection!!
152-
requiredBehaviorVersion?.let(conn::requireBehaviorVersion)
151+
config.requiredBehaviorVersion?.let(conn::requireBehaviorVersion)
153152

154153
// Capture pre-existing bots (for external server mode)
155154
val preExistingBots = conn.latestBotList.get().map { it.botAddress }.toSet()
@@ -381,6 +380,11 @@ class BattleRunner private constructor(
381380
* Defaults to 30 000 ms (30 seconds).
382381
*/
383382
val botConnectTimeoutMs: Long = 30_000L,
383+
/**
384+
* Behavior compatibility version the connected server must advertise, or `null` when the
385+
* runner accepts any server. Defaults to `null` (unpinned).
386+
*/
387+
val requiredBehaviorVersion: Int? = null,
384388
)
385389

386390
/** Describes how the server is acquired for this runner instance. */
@@ -500,8 +504,8 @@ class BattleRunner private constructor(
500504
recordingPath = recordingPath,
501505
captureServerOutput = captureServerOutput,
502506
botConnectTimeoutMs = botConnectTimeoutMs,
507+
requiredBehaviorVersion = requiredBehaviorVersion,
503508
),
504-
requiredBehaviorVersion = requiredBehaviorVersion,
505509
)
506510
}
507511

runner/src/test/kotlin/dev/robocode/tankroyale/runner/BattleRunnerTest.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,15 +172,15 @@ class BattleRunnerTest {
172172
fun `behavior version is unpinned by default`() {
173173
runner = BattleRunner.create { embeddedServer() }
174174

175-
assertThat(runner!!.requiredBehaviorVersion).isNull()
175+
assertThat(runner!!.config.requiredBehaviorVersion).isNull()
176176
}
177177

178178
@Test
179179
@Tag("Unit")
180180
fun `requireBehaviorVersion stores a positive precondition`() {
181181
runner = BattleRunner.create { embeddedServer(); requireBehaviorVersion(7) }
182182

183-
assertThat(runner!!.requiredBehaviorVersion).isEqualTo(7)
183+
assertThat(runner!!.config.requiredBehaviorVersion).isEqualTo(7)
184184
}
185185

186186
@Test

0 commit comments

Comments
 (0)