Short Loop & Result Cache

2files
8min read
Sheet 34 of 47 · Automation

Filesserver.properties · result-cache.json

Fileserver.propertiesFileresult-cache.jsonFor a shell script or an AI agent that edits a plugin and wants to know whether it still works. The tool runs once, headless or with its window, and the same jar is the client. With --cache, files that already passed against the same inputs are skipped. A rebuilt plugin jar still reruns everything; with code coverage on, a round runs only what an edit can reach.

java -jar IgniteTestTool.jar --headless --data-dir D:/itt/data          # once, stays up
java -jar IgniteTestTool.jar run suite/ --cache --data-dir D:/itt/data

Config keyapi-port.txtConfig keyapi-token.txtThe client finds the tool through api-port.txt and api-token.txt in the data dir, so --data-dir is all it needs. A relative scenario path is resolved where the command runs.

The loop

ITT="java -jar IgniteTestTool.jar"          # add --data-dir <dir> when the tool runs with one
$ITT check suite/                           # parse only, finds typos in under a second
$ITT run suite/ --cache                     # runs what changed, skips what already passed
$ITT run suite/30-shop.yml                  # one file, always runs
$ITT run suite/ --failed                    # only what failed last time
$ITT run suite/ --cache --deploy            # build, swap the jar, restart the server, then run
$ITT last                                   # the last report again
$ITT call rcon c="list"                     # any endpoint, parameters as key=value
$ITT usage                                  # calls and bytes per endpoint, what the session cost so far
$ITT coverage                               # line coverage of the plugin, coverage <Class> for its missed lines
$ITT panel                                  # the same in a browser tab

Commands

CommandWhat it does
run [file|dir]runs the scenarios and prints the short report. --cache skips unchanged files that passed, --failed runs only what failed last time, --deploy builds, swaps the jar and restarts the server first (--no-build only swaps and restarts), --times <n>, --json for the full report
check [file|dir]parses without running: unknown steps, missing parameters, broken includes, an action the bots do not have, an agent endpoint that does not exist (both with the closest name), a parameter the action does not list, and ${names} nothing ever sets
lastthe last report again
call <path> [key=value ...]any endpoint, call rcon c="list". The path works without its slash, since Git Bash turns /rcon into a Windows path
guidethe scenario reference on one page, written to be read once
usagecalls, answer bytes and rough tokens per endpoint since the tool started
coverage [class]line coverage of the plugins under test, with a class name the lines no scenario reached
panelopens the browser panel, --no-open only prints its address

Exit codes: 0 when everything passed, 1 when something failed, 2 when the tool is not reachable.

The short report

FAIL 1 of 10 run(s) in 96.4 s, 8 unchanged and skipped
same 30-solo-game.yml  passed 14:02 in 75.0 s
pass 32-leave-lobby.yml  41.2 s, 187 steps
FAIL 34-shops-weapons.yml  52.8 s, 121 passed, 2 failed, 9 skipped
  x 14.3 expectChat regex=bought [ZShop]
    no chat matching /bought/ within 3000 ms, last lines: [Not enough points]
    after 14.1 chat c=/z shop -> sent /z shop
    after 14.2 click slot=11 -> clicked 11
    ZShop online at 151.5 -39.0 -52.5 in minecraft:overworld, health 20 food 20, holding wooden_sword
    window 'Weapon Shop' 11=Python, 13=Olympia, 15=M14
    chat: Round 1 | +50 points | Not enough points
  x server error 2x NullPointerException: price is null [IgniteZombies]

One line per file. The first word is PASS or FAIL and the exit code follows it. Under a failed file: the step, the three steps before it, the bot at that moment (position, health, held item, open window, last chat lines) and the server errors the watcher logged while it ran. Group steps that only repeat "something inside failed" are left out, and long messages are cut. /suite/run?format=text returns the same text over HTTP.

That report is meant to be enough. Read it before asking the server or the bot anything else.

Result cache

Every file that passes is remembered with a fingerprint of what it ran against:

  • its own text
  • every file it includes
  • the jars in the server folder and in plugins/
  • the tool's own jar

A run with --cache (cache=1 over HTTP) skips a file whose fingerprint is the same and reports it as same. Anything else runs: a changed scenario, a changed include, a rebuilt plugin. A file that fails is forgotten. A run without --cache runs everything and refreshes the cache.

Config files

Config edits are seen without listing anything. A pass remembers the hash of every config file of the server and its plugins (.yml, .json, .toml, .properties, .conf up to 512 KB, four folders deep under plugins/) that read the same before and after the run. One of them edited later brings the file back, and the report says which: ran again, plugins/Shop/config.yml changed.

Fileserver.propertiesFiles the server rewrites on its own do not count. The tool reads the configs right before and after every server start and stop it does itself, and whatever differs is left out from then on: the date in server.properties, an arena file saved on every shutdown. /cache lists them as ignored.

Per scenario

In the scenarioEffect
cache: {inputs: [plugins/Shop/schematics]}adds what is not a config. Paths are relative to the server folder, a folder counts with everything in it
cache: {ignore: [plugins/Shop/data]}drops a config that should not matter
cache: falsekeeps that file out, for anything that reads the clock or random state
setup: truea file that prepares the server for the others. Never skipped
  • times above 1 never skips. A flaky hunt wants every run.
  • Fileresult-cache.jsonThe cache lives in result-cache.json in the data dir and keys on the server folder from the settings. With no server folder set nothing is skipped.
  • call cache/clear forgets everything.

With code coverage

With code coverage on (call coverage/code/on plugins=<part of the jar name>, then restart the server) a pass also holds through a new build that changed no method the file ran. run --cache --deploy then reruns only the files an edit can reach, and the report says new build, no method it runs changed for the rest. See Coverage.

In parallel

/suite/run?shard=2/3 and --shard 2/3 run every third file starting with the second.

A file that prepares the server for the others, turning cooldowns off or building fixtures, says setup: true at its top. It is part of every share, runs first there, and is never skipped by the cache.

--workers 3 in CI mode does the whole split on one machine: three copies of the server, three tool processes, one merged JUnit file. The IgniteZombies suite, ten files, takes 19 minutes in a row and 9 on three workers.

  • Each worker keeps its own cache file. Those also say how long each file took, which the next run uses to share the work out evenly.
  • A server that dies while it starts gets one more try, and the note says what its crash report said.

One call per round

run suite/ --cache --deploy is the whole edit and test round: build, copy the jar, restart, wait for Done, run what changed. The project comes from the Hot Deploy settings, set once:

java -jar IgniteTestTool.jar call workflow/set deployProject=<dir> deployBuild="gradlew build -x test" deployArtifacts="build/libs/*.jar"

A build that fails prints its error lines and nothing runs.

What a session costs

Every answer the API gives is counted by endpoint. usage prints the calls, the bytes and a rough token count (bytes / 4), biggest first, so it is plain which call fills an agent's context. The panel's own polling is left out.

41 calls since 14:02:11, 182.3 kB, about 46667 tokens
   96.2 kB    12 calls  largest   14.1 kB  /suite/run
   51.0 kB     3 calls  largest   40.2 kB  /server/entities

call already cuts lists at 100 items and text at 4000 characters and says how much it left out ("+37 more").

ParameterEffect
fields=type,health,pos.ykeeps only those keys of every row
cap=5shortens lists and maps
chars=200sets a character limit
--fulllifts the limits

Over HTTP the same three parameters work on every endpoint that answers JSON, and nothing is cut unless they are sent.

Rules that keep a session short

  • Run a folder with --cache instead of picking files by hand.
  • Ask call for less with fields and cap. usage shows which endpoint cost the most.
  • check knows the bot actions and the agent endpoints. A typo in action: or path: fails there, with the closest name, instead of minutes into a run.
  • --deploy needs the project set once with call workflow/set. A failed build prints its error lines and nothing runs.
  • Do not sleep. expectChat, expectWindow, expectSlot, assertServer and assertPos poll until their timeout, action: waitFor blocks on an event. wait is for a cooldown the plugin really has.
  • Do not read the server log for errors. With call watch/start on, a stack trace during a scenario fails it and shows up in the report with the plugin it came from.
  • Probing by hand is for finding out how something behaves, a few calls at most. Put several into one request: POST /batch with [{"path": "/chat", "params": {...}}, ...].

Browser panel

The panel is this loop in a browser tab. It is one HTML page served by the API, nothing to install, and it talks to the tool that is already running.

java -jar IgniteTestTool.jar panel --data-dir D:/itt/data

This opens http://127.0.0.1:<port>/panel for the running tool. panel --no-open only prints the address.

What is on it

  • A field for a scenario file or folder, with Run, Check and Last report.
  • The same short report as on the command line, see the short report.
  • The switches for skipping unchanged files, running only what failed and deploying first.
  • A console command box.
  • The server, with start and stop.
  • The bots.
  • What the result cache holds.

The token

The address carries the API token once. The page keeps it for the tab and takes it out of the address bar. Without a token /panel answers 401 like any guarded endpoint.

The API still refuses requests from other web pages, see HTTP API. The panel's own polling is left out of usage.

Over HTTP

EndpointParametersReturns
/suite/runfile= or dir= (default: the scenario folder), times=1, wait=1, junit=<file>, cache=1, failed=1, deploy=1, build=0, shard=i/n, format=textevery run with its report, or started; junit writes JUnit XML there when the run ends, with or without wait; report=<file> writes the HTML report the same way, embed=1 puts the images inside it
/suite/status, /suite/cancelwhat is running now / stops it
/suite/lastformat=textthe report of the last run of this session
/suite/checkfile= or dir=, format=textparses the files without running them
/cache, /cache/clearwhat the result cache holds / empties it
/usage, /usage/clearcalls, bytes and rough tokens per endpoint

Loading the index

Enter openUp Down moveEsc close