Implement the lazy singleton that starts the Tank Royale Java server on first use with -I flag, manages the process, and kills it on exit. Needs to find the server JAR, pick a free port, wait for ready.
Blocked by: nothing
Grilling Revisions
MAJOR CHANGE: External server, not embedded. The original spec assumed embedded server. Initial positions (-I flag) are incompatible with embeddedServer() mode — -I is a server CLI flag, not a BattleRunner API property.
Revised lifecycle:
Framework starts java -jar $TANK_ROYALE_JAR -I --tps -1 --port PORT as a subprocess
Random free port selected to avoid conflicts
Trust BattleRunner's internal readiness wait (designed for external server). Add manual WebSocket poll only if proven flaky.
Server stays alive for process lifetime (lazy singleton)
addQuitProc kills server process on exit
JAR location: TANK_ROYALE_JAR env var. Fail fast with clear message if not set or JAR not found.
No -I flag on BattleRunner API — it's a server startup flag only. This is why external server is required.
**Wayfinder child of:** #126
Implement the lazy singleton that starts the Tank Royale Java server on first use with `-I` flag, manages the process, and kills it on exit. Needs to find the server JAR, pick a free port, wait for ready.
**Blocked by:** nothing
### Grilling Revisions
**MAJOR CHANGE: External server, not embedded.** The original spec assumed embedded server. Initial positions (`-I` flag) are incompatible with `embeddedServer()` mode — `-I` is a server CLI flag, not a BattleRunner API property.
**Revised lifecycle:**
1. Framework starts `java -jar $TANK_ROYALE_JAR -I --tps -1 --port PORT` as a subprocess
2. Random free port selected to avoid conflicts
3. Trust BattleRunner's internal readiness wait (designed for external server). Add manual WebSocket poll only if proven flaky.
4. Server stays alive for process lifetime (lazy singleton)
5. `addQuitProc` kills server process on exit
**JAR location**: `TANK_ROYALE_JAR` env var. Fail fast with clear message if not set or JAR not found.
**No `-I` flag on BattleRunner API** — it's a server startup flag only. This is why external server is required.
Server startup timeout: 15s default. If server doesn't print ready signal within this, raise error.
Use addExitProc to kill server process on program exit (covers normal exit, exceptions, signals).
Use defer in any proc that starts the server as additional safety net.
## Spec additions from grilling
- Server startup timeout: **15s** default. If server doesn't print ready signal within this, raise error.
- Use `addExitProc` to kill server process on program exit (covers normal exit, exceptions, signals).
- Use `defer` in any proc that starts the server as additional safety net.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Wayfinder child of: #126
Implement the lazy singleton that starts the Tank Royale Java server on first use with
-Iflag, manages the process, and kills it on exit. Needs to find the server JAR, pick a free port, wait for ready.Blocked by: nothing
Grilling Revisions
MAJOR CHANGE: External server, not embedded. The original spec assumed embedded server. Initial positions (
-Iflag) are incompatible withembeddedServer()mode —-Iis a server CLI flag, not a BattleRunner API property.Revised lifecycle:
java -jar $TANK_ROYALE_JAR -I --tps -1 --port PORTas a subprocessaddQuitProckills server process on exitJAR location:
TANK_ROYALE_JARenv var. Fail fast with clear message if not set or JAR not found.No
-Iflag on BattleRunner API — it's a server startup flag only. This is why external server is required.Spec additions from grilling
addExitProcto kill server process on program exit (covers normal exit, exceptions, signals).deferin any proc that starts the server as additional safety net.Dependency addition
Blocks: #130 (runBattle orchestrator), #134 (BattleRunner process lifecycle). Server must be running before either can operate.
Implemented in commit
57a1915.