Core: coding rules as declarative form.yaml + Python package (atlas.coding) (#9)

Step 1 of moving the repo to Python with declarative rules.

- core/spec/form.yaml: every question (how it is found in an export), every answer and what it
  is coded as, missing answers, email redaction, burn order, first-dragon pools.
- core/atlas/coding.py reads it and replaces core/python/clean.py (python -m atlas.coding).
- tests/core/test_coding.py: 16 rule tests, one hand-written row per rule, checking the rules
  are right rather than only that JS and Python agree.
- analysis/stats/analyze.py takes the colours and missing answers from the spec instead of its
  own copy; the daily update job codes rows through the package.
- pyproject.toml for the package; pyyaml and pytest added to requirements.

The coded runs are byte-identical to before (5,988 runs); all parity checks still match.


Claude-Session: https://claude.ai/code/session_01UCzTd31GphpMXDhQqWrCMQ

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
ekcSchiano
2026-11-03 15:27:13 -05:00
committed by GitHub
co-authored by Claude Opus 5.5
parent 432e04c2c7
commit 3536007ade
19 changed files with 680 additions and 427 deletions
+1 -1
View File
@@ -7,7 +7,7 @@ Rules every part of the project follows. If a change would break one, stop and a
- **Code** is MIT (`LICENSE`). **Data this project produces** is CC BY 4.0 (`DATA_LICENSE.md`). Third-party
sources keep their own terms.
- **Community form responses:** published as exported, with email addresses in free-text answers redacted by
the coding rules (`core/engine.js`, `core/python/clean.py`).
the coding rules (`core/spec/form.yaml`, `core/atlas/coding.py`).
- **Dragon Register:** only `data/public/register.json`. The raw export has rider names and stays local
(`data/raw/register/` is git-ignored).
- **The community route PDF:** never committed or redistributed. Only a fingerprint
+14
View File
@@ -23,3 +23,17 @@ policy that maximises the chance of bonding it, with honest uncertainty.
policy overlay for a chosen colour, and untested branches marked.
6. **Bot loop** (advisor and sync published, see `docs/BOT_INTEGRATION.md`; experiments.json to do): the atlas publishes `policy.json` and `experiments.json` (ranked by value of
information); the private DragonKind bot consumes them and returns anonymised runs.
## Python first, declarative rules (November 2026)
The repo is moving to Python, with the rules and the game written as declarative spec files. JavaScript stays
only where it has to run: the site's drawing and interaction, and a small route advisor the site and Ken's bot
share.
1. Coding rules: `core/spec/form.yaml` + `core/atlas/coding.py`, with rule tests. **Done.**
2. Route model in Python, built from `core/spec/game.yaml`; bot text in `core/spec/crosswalk.yaml`.
3. Fix the coding bugs found in the core review (letting the Red pass, "left your squadmates" before the
redesigned form, missing bot text), each with a rule test.
4. The site shows precomputed statistics with fixed filter presets; the upload button and `engine.js` go; a small
JS advisor that reads the Python-built model replaces `solver.js`.
5. `data/dictionary.yaml` for every published column, and Croissant metadata for the datasets.