Test the bot's call chain in CI; send the experiment plan and screen tree to the bot (#26)
CI / test (pull_request) Successful in 45s

tests/core/bot_contract.test.js copies the bot's AtlasPolicy.advise (DragonKind
src/atlasPolicy.js at ebe134a2) and plays the bot's own recorded screens through it
for every colour, sample and goal; checks the Black is routed through both gates and
up the tree; checks every assignment of the experiment plan is playable; checks the
known answers' shape. Added to npm run test:unit.

push-policy now also sends data/public/experiments.json and tree.json, which
docs/BOT_INTEGRATION.md says the bot reads (Solver.assign, screenPick) but which were
never delivered.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ
This commit is contained in:
2026-11-19 21:47:24 +00:00
co-authored by Claude Opus 5.5
parent 44ccd7f760
commit 77ce54acec
3 changed files with 158 additions and 6 deletions
+10 -5
View File
@@ -1,7 +1,9 @@
# When the route model changes on main, send it to the bot: open (or update) a pull request on the bot's repo,
# DragonKind/DragonKind, that replaces vendor/threshing-atlas/{policy.json,solver.js,graph.js,known_answers.json} with
# this repo's data/public/policy.json, core/solver.js, core/graph.js and data/public/known_answers.json. They always travel together, so the policy and the
# solver that reads it never get out of step. Ken reviews and merges it; the running bot reloads the files after a pull.
# DragonKind/DragonKind, that replaces vendor/threshing-atlas/{policy.json,solver.js,graph.js,known_answers.json,
# experiments.json,tree.json} with this repo's data/public/policy.json, core/solver.js, core/graph.js,
# data/public/known_answers.json, data/public/experiments.json and data/public/tree.json. They always travel together, so
# the policy, the experiment plan and the solver that reads them never get out of step (docs/BOT_INTEGRATION.md).
# tests/core/bot_contract.test.js runs the bot's own call chain against them in CI. Ken reviews and merges it; the running bot reloads the files after a pull.
#
# Secrets: ATLAS_BOT_TOKEN (repository: read and write, with write access to DragonKind/DragonKind).
name: Send the route model to the bot
@@ -13,6 +15,8 @@ on:
- core/solver.js
- core/graph.js
- data/public/known_answers.json
- data/public/experiments.json
- data/public/tree.json
workflow_dispatch:
jobs:
send:
@@ -35,7 +39,8 @@ jobs:
GIT_CONFIG_VALUE_0="AUTHORIZATION: token $ATLAS_BOT_TOKEN"
git clone --quiet --depth 1 https://git.kenschiano.net/DragonKind/DragonKind.git "$dst"
mkdir -p "$dst/vendor/threshing-atlas"
cp data/public/policy.json core/solver.js core/graph.js data/public/known_answers.json "$dst/vendor/threshing-atlas/"
cp data/public/policy.json core/solver.js core/graph.js data/public/known_answers.json \
data/public/experiments.json data/public/tree.json "$dst/vendor/threshing-atlas/"
id=$(python3 -c "import json; print(json.load(open('data/public/policy.json')).get('id', ''))")
sha=$(git rev-parse --short HEAD)
cd "$dst"
@@ -52,7 +57,7 @@ jobs:
printf '%s\n' \
"The Threshing Atlas route model changed (policy \`$id\`, atlas commit \`$sha\`)." \
"" \
"This replaces \`vendor/threshing-atlas/\` (policy.json, solver.js, graph.js) together, as \`npm run atlas:sync\` would." \
"This replaces \`vendor/threshing-atlas/\` (policy.json, solver.js, graph.js, known_answers.json, experiments.json, tree.json) together, as \`npm run atlas:sync\` would." \
"This pull request is updated in place each time the model changes. After merging, pull on the bot's machine:" \
"the running bot reloads the files on its next decision." \
"" \