Bot handoff: the daily check pulls Ken's bot repo; route model updates go to the bot by pull request
CI / test (pull_request) Successful in 39s

- update-sources: download DragonKind/DragonKind (read with ATLAS_BOT_TOKEN, or DRAGONKIND_TOKEN if set) and
  import it as the bot source. Needs DK_ACCOUNT_SALT (the same salt as earlier imports, so accounts keep their keys);
  without it the bot source is skipped as before.
- The bot load keeps one file, data/bot/trajectories-bot.jsonl: the bot's repo holds every account's full history,
  so each import is merged by attempt id (attempts already published stay; older per-import files are folded in).
  One copy of each attempt also keeps build-graph.js from counting an attempt twice.
- New workflow push-policy: when policy.json, solver.js or graph.js change on main, open (or update) a pull request
  on DragonKind/DragonKind that replaces vendor/threshing-atlas/ with them. Ken merges it.
- forge open-pr: --repo/--base for another repository, and reuse the open pull request for the same branch.

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 02:20:35 +00:00
co-authored by Claude Opus 5.5
parent f1027212b6
commit 78e069f03f
5 changed files with 119 additions and 10 deletions
+25 -4
View File
@@ -28,10 +28,33 @@ from datetime import datetime, timezone
from .etl import extract as E
from .etl import load as L
from .etl import codegen, metadata, report_form, runs, validate
from .etl.common import Report, path, pipeline
from .etl.common import Report, path, pipeline, read_jsonl
from .etl.transform import TRANSFORMS
BOT_FILE = "trajectories-bot.jsonl"
def merge_trajectories(target, new):
"""Every bot attempt ever imported, in one file (data/bot/trajectories-bot.jsonl), sorted by id. The bot's repo
holds each account's full history, so an import is a superset: a re-imported attempt replaces its old copy, and
attempts no longer in the bot's repo (an archived account) stay. Older per-import files are folded in."""
d = path(target)
olds = sorted(d.glob("trajectories-*.jsonl"))
by_id = {}
for f in olds:
for t in read_jsonl(f):
by_id.setdefault(t["id"], t)
for t in new:
by_id[t["id"]] = t
wrote = L.jsonl_file(f"{target}/{BOT_FILE}", [by_id[k] for k in sorted(by_id)])
for f in olds:
if f.name != BOT_FILE:
f.unlink()
wrote = True
return wrote
def update_source(name, spec, manifest, report, local_file=None, env=None):
env = os.environ if env is None else env
try:
@@ -54,9 +77,7 @@ def update_source(name, spec, manifest, report, local_file=None, env=None):
old = {"scenes": L.read_json(f"{target}/scenes.json") or {}}
lines = mod.describe(old, new)
wrote = L.json_file(f"{target}/scenes.json", mod.merge_scenes(old["scenes"], new["scenes"]), compact=False)
# one file per import (date + raw checksum), so two imports on the same day (yours, Ken's) never overwrite
tag = f"{ctx['changed']}-{manifest[name]['sha256'][:8]}"
wrote |= L.jsonl_file(f"{target}/trajectories-{tag}.jsonl", new["trajectories"])
wrote |= merge_trajectories(target, new["trajectories"])
elif target:
old = L.read_json(target)
lines = mod.describe(old, new)