Skip to content

Add CLEARDATA to the RoboRumble client - #118

Merged
flemming-n-larsen merged 2 commits into
robo-code:mainfrom
Chase-san:rumble-clear-data
Nov 1, 2026
Merged

flemming-n-larsen merged 2 commits into
robo-code:mainfrom
Chase-san:rumble-clear-data

Conversation

@Chase-san

@Chase-san Chase-san commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Robots keep what they save in the robot data directory from one battle to the next. When enemy names are hidden, a file saved for #1 gets read in the next battle against a different robot.

With CLEARDATA=YES the client deletes the robot data directory before each battle, so saved data lasts between rounds but not between battles. Data in a robot's jar is safe, because a robot gets it back when a battle starts. Uploads say cleardata=YES, so a server can refuse results from clients that keep data.

Robots keep what they save in the robot data directory from one battle to
the next. When enemy names are hidden, a file saved for robo-code#1 gets read in the
next battle against a different robot.

With CLEARDATA=YES the client deletes the robot data directory before each
battle, so saved data lasts between rounds but not between battles. Data in
a robot's jar is safe, because a robot gets it back when a battle starts.
Uploads say cleardata=YES, so a server can refuse results from clients
that keep data.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Copilot AI balanced review requested due to automatic review settings November 1, 2026 02:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Results can be incorrectly uploaded as cleardata=YES because uploads use the current configuration instead of each battle’s clearing status, and cleanup failures still allow battles to run with leftover data.

2 open issues
What changed in this PR

Adds an opt-in CLEARDATA setting to RoboRumble to prevent saved robot data from carrying across battles while preserving it between rounds.

Changes:

  • Clears the robot data directory before each battle when enabled.
  • Adds cleardata=YES to uploads when configured.
  • Documents the setting in all four client configurations and adds cleanup unit tests.
File Description
robocode.roborumble/​src/​test/​java/​net/​sf/​robocode/​roborumble/​battlesengine/​BattlesRunnerTest.java Tests recursive cleanup and missing-directory handling.
robocode.roborumble/​src/​main/​java/​net/​sf/​robocode/​roborumble/​netengine/​ResultsUpload.java Adds the clearing flag to upload metadata.
robocode.roborumble/​src/​main/​java/​net/​sf/​robocode/​roborumble/​battlesengine/​BattlesRunner.java Implements optional data cleanup before battles.
robocode.roborumble/​build.gradle.kts Adds the JUnit test dependency.
robocode.content/​src/​main/​resources/​roborumble/​twinduel.txt Documents CLEARDATA, disabled by default.
robocode.content/​src/​main/​resources/​roborumble/​teamrumble.txt Documents CLEARDATA, disabled by default.
robocode.content/​src/​main/​resources/​roborumble/​roborumble.txt Documents CLEARDATA, disabled by default.
robocode.content/​src/​main/​resources/​roborumble/​meleerumble.txt Documents CLEARDATA, disabled by default.

Review effort: Balanced

The upload read CLEARDATA from the configuration, but results can wait in the
results file until a later upload. If the setting changed in between, those
results were labelled with the new setting instead of the one they were played
with. BattlesRunner now saves the setting in each battle's header, and the
upload reads it from there. A header saved by an earlier client has no setting,
which counts as NOT.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@flemming-n-larsen
flemming-n-larsen merged commit af1c837 into robo-code:main Nov 1, 2026
1 check passed
@flemming-n-larsen

Copy link
Copy Markdown
Member

Thanks, this is great work. Merged, with a small follow-up:

  • Robocode now closes files a robot left open when the battle ends and logs a warning naming the robot and file, since an open file could block CLEARDATA on Windows.
  • If the data still can't be deleted, the client skips the battle and logs which file it was, so results never claim the data was cleared when it wasn't.
  • Enemy names no longer leak through bullet events when the robot firing is on a team.

We've also proposed both as per-rumble settings in LiteRumble (robo-code/literumble#9), so its existing rumbles only take results with them off.

This ships as 1.12.0, so AutoRumble's allowed_clients needs that version. I tested the client against a small stub server, not AutoRumble itself, so a run against the real thing would be welcome. Before we release: is there anything else you need in the client, such as batch uploads, since your configs already have RESULTSBATCHURL? I've also linked AutoRumble from the README, the ReadMe and the release notes, as a server people can run themselves. Is that ok with you, and is there a public server we should point to?

@Chase-san

Copy link
Copy Markdown
Contributor Author

I don't yet currently have a public server set up for this, you can remove my name from the base documentation read me. I am not quite ready with the autorumble, it was being developed for AI robots and for open source only robots (hence openrumble and autorumble).

I do plan to host it but I don't currently have that set up and it might not be until tomorrow.

@flemming-n-larsen

Copy link
Copy Markdown
Member

Update: I've now run the 1.12.0 client against AutoRumble itself (fa7b8d6), and it works once allowed_clients includes 1.12.0. Robots downloaded from the server, results were stored, and clients with the wrong HIDENAMES or CLEARDATA were rejected with a clear message. This was only a small test with two robots that don't fire.

One small thing: the HTTP tests fail on Windows, because tests/http.rs:521 puts a Windows path in a TOML string, where \U is read as an escape. The server itself ran fine on Windows.

@Chase-san

Copy link
Copy Markdown
Contributor Author

As for the batch stuff, I do have some code for that but it's mostly just written by Claude and I haven't had a chance to really review it yet.

@flemming-n-larsen

Copy link
Copy Markdown
Member

Done, your name is out of the README and ReadMe, and I've taken AutoRumble out of them too until it's ready. The 1.12.0 release notes credit you as Chase-san. Batch uploads can wait for a later version, so no rush on reviewing that code. Let me know when the server is up, and we'll add the link then.

@Chase-san

Chase-san commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor Author

Ah, I meant like using it everywhere rather than using my real name. That's entirely fine. You can use my real name. I mean like having it in the main README. E.g. "Autorumble is made by Robert Maupin" and so on. That credit there felt like too much. Sorry for any confusion.

@Chase-san

Copy link
Copy Markdown
Contributor Author

As for autorumble I am testing 1.12.0 against my local copy now and working on figuring out modern vps services.

@jkflying

jkflying commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Feel free to add an autorumble to literumble btw. It will be automatically created if you try to upload battles for it.

I think the steps would be:

  1. Make wiki page with participants (maybe seed with old rumble?)
  2. Make the new config file and runner script in robocode
  3. Run it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants