A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.
content: a person's sign-off beside a status, reviewed_by and reviewed_on, humans only (refs #375) (#629)
Eyal Golan835760f5cb83
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex 74a3c72cc..fb38035d6 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -106,3 +106,10 @@ jobs:HEAD_SHA: ${{ github.event.pull_request.head.sha }}SKIP_LABEL: ${{ contains(github.event.pull_request.labels.*.name, 'no-changelog') }}run: uv run scripts/oss/changelog_check.py --base "$BASE_SHA" --head "$HEAD_SHA" --skip-label "$SKIP_LABEL"+ # Only a person signs a row off (#375): no commit with an AI co-author trailer may add, change or remove a reviewed_by+ # or reviewed_on line in content/. It needs every commit of the PR (fetch-depth 0 above) and fails closed.+ - name: Only a person signs a row off (reviewed_by and reviewed_on)+ env:+ BASE_SHA: ${{ github.event.pull_request.base.sha }}+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}+ run: uv run scripts/oss/reviewed_by_guard.py --base "$BASE_SHA" --head "$HEAD_SHA"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4dd7d4256..e2b054492 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -8,6 +8,15 @@ adds a line under **Unreleased**; CI's `Changelog` job checks this (see `CONTRIB## [Unreleased]### Added+- A person's sign-off beside a status (refs #375, #564, #611; owner, 15 October 2026: "Yes, humans only"): every status+ row takes `reviewed_by` (the reviewer's GitHub handle, never an email) and `reviewed_on` (the day), both or neither.+ The sim's loader, the map's readers (localities, the 1945 populations, units) and `tools/routes_1948.py` refuse a+ half, blank or malformed sign-off. `scripts/oss/reviewed_by_guard.py`, in CI's Changelog job, fails a pull request in+ which a commit with an AI co-author trailer adds, changes or removes either line, or a person's `reviewed_on` is+ after their commit; it fails closed. It also fails a pull request in which such a commit edits any field of a signed+ row, the id included, until a person signs the row again or removes its sign-off (owner: "Block it in CI"). The review+ queue leaves signed-off rows out and counts them.+ `docs/HISTORIAN_REVIEW.md` records the reversal of its old "no reviewed_by keys" rule. No row is signed off yet.- Hebrew names wait for a person (refs #582, #564; owner, 15 October 2026): every Hebrew name #582 added, which only anAI agent checked against its sources, now carries `*_review: agent-checked` (`title_he_review`, `title_he_f_review`,`name_he_review`, `body_he_review`; 100 flags: offices, parties, governments, legislatures, the game settlements anddiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex 2d6cb6dfa..2b895fdb7 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -90,7 +90,7 @@ AI-assisted work is welcome. Say so in the pull request: which parts, and how yo## What CI runs-Every pull request and every push to `main` runs `Sim (dotnet test)`, `Tools (pytest)`, `Repo policy`, and, on pull requests, `Changelog`. The jobs use no secrets, call no paid API, run no AI agent and push nothing.+Every pull request and every push to `main` runs `Sim (dotnet test)`, `Tools (pytest)`, `Repo policy`, and, on pull requests, `Changelog`. The `Changelog` job also runs `scripts/oss/reviewed_by_guard.py`: a commit with an AI co-author trailer may not add, change or remove a `reviewed_by` or `reviewed_on` line in `content/` (only a person signs a row off, #375). The jobs use no secrets, call no paid API, run no AI agent and push nothing.**Unity EditMode tests are not in CI.** Running Unity in CI needs the maintainer's Unity account credentials stored as repository secrets. GitHub never gives secrets to pull requests from forks, so the job could not run on the pull requests that most need it, and those credentials would sit on machines that run outside code. So the Unity tests are a local gate: paste their result in your PR, and the maintainer re-runs them before merging any change under `unity/`. A future Unity job must run Unity with `-CI false -GITHUB_ACTIONS false -TF_BUILD false` (runners set `CI=true`, and GitHub Actions and Azure Pipelines also set `GITHUB_ACTIONS=true` or `TF_BUILD=true`; the Unity-MCP plugin treats any of them as CI, then skips its NuGet download and fails to compile), or commit the plugin's DLLs.diff --git a/content/map/localities_1948.yaml b/content/map/localities_1948.yamlindex fe9725cb8..9d01acfca 100644--- a/content/map/localities_1948.yaml+++ b/content/map/localities_1948.yaml@@ -26,6 +26,8 @@# Thirteen villages have no Hebrew label or article and no name_he: the map keeps the English (#558).# name_he_review: agent-checked on those five rows: an AI agent checked the name against its sources and no# person has read it yet (owner, 2026-10-15); a native speaker reviews it (#564) and removes the flag.+# reviewed_by/on a person's sign-off beside status (a place or a camp row), their GitHub handle and the day, both or+# neither; only that person writes them (owner, 15 October 2026, #375; docs/HISTORIAN_REVIEW.md).# kind/type finer kind and the repo's settlement type; the kit archetype follows type (village and arab_town:# Arab village houses; town, kibbutz, moshav: red-roofed Jewish settlement, moshav as a ring);# kind mixed_locality (Nesher): both, side by side.diff --git a/content/map/routes_1948.yaml b/content/map/routes_1948.yamlindex 8728a39f2..6f75eea95 100644--- a/content/map/routes_1948.yaml+++ b/content/map/routes_1948.yaml@@ -14,6 +14,9 @@# trace: the map symbol the trace follows when it is not the kind's own (the 1,050 mm narrow-gauge lines are a thin# line on the 1946 map, so they trace as `track`).# status: draft = traced and checked by eye against the 1946 map (route previews), not yet by a historian.+# reviewed_by and reviewed_on (both or neither, beside status): a person's sign-off, their GitHub handle and the day; only+# that person writes them (owner, 15 October 2026, #375; docs/HISTORIAN_REVIEW.md). tools/routes_1948.py checks them; the+# traced route_paths_1948.yaml does not carry them.# to_verify: what the sources leave open; a route with a to_verify line is not to be relied on beyond it.# opened: the year a cited source gives for the route's opening; left out where no source states it. Every route# except the Burma Road (1948) is on the 1946 map, so it ran by 1946 at the latest.diff --git a/content/map/units_1948.yaml b/content/map/units_1948.yamlindex 977e0a1b6..84c16beb4 100644--- a/content/map/units_1948.yaml+++ b/content/map/units_1948.yaml@@ -32,6 +32,8 @@# steel helmet, bush hat; docs/units.md).# hidden: a unit the sources name but do not place; the map does not draw it (owner ruling, 2026-10-11).# status: draft = sourced and checked against the cited text, not yet by a historian.+# reviewed_by and reviewed_on (both or neither, beside status): a person's sign-off, their GitHub handle and the day; only+# that person writes them (owner, 15 October 2026, #375; docs/HISTORIAN_REVIEW.md).units:# --- Army: the twelve brigades of 1948 -------------------------------------------------------------------------------- id: golanidiff --git a/content/schema/event.schema.json b/content/schema/event.schema.jsonindex 015d2d662..e278e0e50 100644--- a/content/schema/event.schema.json+++ b/content/schema/event.schema.json@@ -82,6 +82,8 @@}}},- "status": { "enum": ["draft", "fact-checked", "historian-reviewed", "sensitivity-reviewed"], "description": "The review status. Default draft." }+ "status": { "enum": ["draft", "fact-checked", "historian-reviewed", "sensitivity-reviewed"], "description": "The review status. Default draft." },+ "reviewed_by": { "type": "string", "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$", "description": "The GitHub handle of the person who signed this row off (#375): written only by that person, never by an AI agent (scripts/oss/reviewed_by_guard.py); never an email. Needs reviewed_on." },+ "reviewed_on": { "$ref": "#/definitions/date", "description": "The day of that sign-off. Needs reviewed_by." }}}diff --git a/content/schema/people.schema.json b/content/schema/people.schema.jsonindex 804b8bb21..7800c8b7f 100644--- a/content/schema/people.schema.json+++ b/content/schema/people.schema.json@@ -74,7 +74,9 @@}}},- "status": { "enum": ["draft", "fact-checked", "historian-reviewed", "sensitivity-reviewed"] }+ "status": { "enum": ["draft", "fact-checked", "historian-reviewed", "sensitivity-reviewed"] },+ "reviewed_by": { "type": "string", "pattern": "^[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}$", "description": "The GitHub handle of the person who signed this row off (#375): written only by that person, never by an AI agent (scripts/oss/reviewed_by_guard.py); never an email. Needs reviewed_on." },+ "reviewed_on": { "$ref": "#/definitions/date", "description": "The day of that sign-off. Needs reviewed_by." }}}}diff --git a/docs/CONTENT_POLICY.md b/docs/CONTENT_POLICY.mdindex fc3010910..7dd699757 100644--- a/docs/CONTENT_POLICY.md+++ b/docs/CONTENT_POLICY.md@@ -44,6 +44,15 @@ These rules protect the game and the people in it. They are not a viewpoint:`status` says about its English facts (owner, 15 October 2026). A native Hebrew speaker reviews these names (#564)and then removes the line; the loader accepts only `agent-checked` (a blank value is an error), and only next to aname.+7. **A sign-off names a person.** A row a person has reviewed carries, beside its `status`, `reviewed_by` (the+ reviewer's GitHub handle, never an email) and `reviewed_on` (the day), both or neither (owner, 15 October 2026,+ #375: "Yes, humans only"). Only that person writes the two lines, in their own commit; an AI agent never adds, changes+ or removes them, and `scripts/oss/reviewed_by_guard.py` fails any pull request where a commit with an AI co-author+ trailer does. A signed row is closed to agents too (owner, 15 October 2026, on #629: "Block it in CI"): the guard+ fails a pull request where a commit with an AI co-author trailer changes any field of a signed row, the `id`+ included, until a person signs the row again or removes its sign-off in a commit of their own. How to sign off:+ [HISTORIAN_REVIEW.md](HISTORIAN_REVIEW.md#sign-the-row-off). A row with a sign-off leaves the review queue+ ([review-queue.md](review-queue.md)).## 3. How to dispute a factdiff --git a/docs/HISTORIAN_REVIEW.md b/docs/HISTORIAN_REVIEW.mdindex f6063c32b..2189d403a 100644--- a/docs/HISTORIAN_REVIEW.md+++ b/docs/HISTORIAN_REVIEW.md@@ -12,16 +12,18 @@ plans `draft` -> `fact-checked` -> `historian-reviewed`, then `sensitivity-revieHistorian review is planned for M4 and is not yet a gate. The current code and policy take precedence over the planned pipeline:- [ContentLoader.cs](../sim/Statecraft.Sim/ContentLoader.cs) accepts all four status values, but rejects unknown YAML keys.- [GameEvent](../sim/Statecraft.Sim/Content.cs) has `sources` and `status`, not fields for a reviewer or review date.+ Beside `status`, every status row (an event, a person, a legislature, a government, an aliyah or population row, a+ site, and the map files' rows) takes a person's sign-off: `reviewed_by` (their GitHub handle) and `reviewed_on` (the+ day), both or neither (see "Sign the row off" below).- [RealContentTests.cs](../sim/Statecraft.Sim.Tests/RealContentTests.cs) currently requires non-sensitive events to be exactly`fact-checked` and sensitive events to be exactly `sensitivity-reviewed`. Changing one to `historian-reviewed` fails that test.- [ReleaseGate.cs](../sim/Statecraft.Sim/ReleaseGate.cs) checks sensitivity review, not historian review.A green release gate is not evidence that a historian checked the content.-Record an actual historian review now in the PR and YAML comments as described below, leaving `status` unchanged.-Before changing a status, a separate implementation must update tests and decide how historian and sensitivity sign-offs-are preserved together. Do not weaken the sensitivity gate to make a historian status pass. No new machine-read fields-or extra status values are defined by this guide.+Record an actual historian review now in the PR, with the sign-off and a pointer comment in the YAML as described below,+leaving `status` unchanged. Before changing a status, a separate implementation must update tests and decide how historian+and sensitivity sign-offs are preserved together. Do not weaken the sensitivity gate to make a historian status pass. This+guide defines no extra status values.## Who reviews and what is being reviewed@@ -53,18 +55,45 @@ do not reproduce a book or source packet whose rights do not permit sharing it.still need the maintainer's separate sensitivity review. A historian cannot sign that off on the maintainer's behalf.- [ ] List any omitted context that makes the text misleading, each correction needed, and any claim left outside the review scope.-## Record the result without changing the schema+## Record the resultThe reviewer comments on the PR for each event, giving: file/id, reviewed commit, review date, agreed public identity andrelevant expertise, claim/source/page list, scope limits, outcome and corrections. Use `accepted`, `changes requested`, or`unable to verify` as **record outcomes**, not YAML `status` values. An accepted result needs an actual affirmative human review.A contributor's or AI's summary is not a substitute for the reviewer's record. GitHub code-owner approval is a different check.-After the reviewer confirms acceptance, put a comment block next to `sources` in the event YAML. Replace every placeholder-with facts from the real review; never commit this unfilled example as a sign-off:+### Sign the row off++**Changed on 15 October 2026.** Until then this guide said to record a review in comments only, "without adding unsupported+keys such as `reviewed_by` or `reviewed_on`". The [owner decision, 15 October 2026, #375](https://github.com/eyalgolan/statecraft-israel/issues/375#issuecomment-6184126823) reverses that: "Yes, humans only". A row a person has+reviewed now carries, beside its `status`:++- `reviewed_by`: the reviewer's GitHub handle (letters, digits and single hyphens, at least one letter), never an email or+ a display name;+- `reviewed_on`: the day of the review, exactly `YYYY-MM-DD`, not after the day of the commit that adds it.++Both or neither: the loader (and the map's readers in Unity, and `tools/routes_1948.py`) refuses one without the other, a+blank value, or a value of the wrong shape. **Only the reviewer writes these two lines, in a commit of their own.** An AI+agent never does, not even to copy a sign-off it was told about: `scripts/oss/reviewed_by_guard.py` fails a pull request+in which a commit with an AI co-author trailer adds, changes or removes either line, and it fails closed. A row with a+whole sign-off leaves the review queue (`tools/review_queue.py`, `docs/review-queue.md`).++**A signed row is closed to agents** (owner, 15 October 2026, on #629: "Block it in CI"). A sign-off vouches for the text+the reviewer read, so the same guard also fails a pull request in which a commit with an AI co-author trailer changes any+line of a row that carries a whole sign-off, any field, the `id` included, or adds a key inside it. It stays failed until+a person, in a later commit of their own in the same pull request, reads the row again and signs it again (a new+`reviewed_by` / `reviewed_on`) or removes its sign-off. Only the row whose own sign-off lines that commit changes is+released, and a merge commit releases nothing. Any change to the row's `reviewed_by` or `reviewed_on` line counts, even+a comment added to it, so change those lines only after reading the row again. A row also covers what it pulls in from+elsewhere through a YAML alias or merge key (`*gov1_k`, `<<: *d`): an agent editing the anchor edits the row. An agent that needs to change a signed row proposes the change+in words, and a person makes it. Merging `main` into a branch does not count as an edit: the guard reads a merge commit's+combined diff, so lines it takes unchanged from `main` are not its own.++After the reviewer confirms acceptance, they add the two keys and a comment block next to `sources` that points to the+record. Replace every placeholder with facts from the real review; never commit this unfilled example as a sign-off:```yaml-# Historian review record (not a new YAML field):+# Historian review record:# Reviewer: <agreed public name/handle>; expertise: <confirmed relevant scope># Reviewed: <YYYY-MM-DD>; content commit: <full reviewed SHA># Record: <URL of the actual per-event review comment>@@ -72,12 +101,14 @@ with facts from the real review; never commit this unfilled example as a sign-of# Scope: <covered claims and any exclusions>; outcome: accepted# Sensitivity: <separate maintainer record if applicable; otherwise not applicable># status remains at its existing value until the M4 implementation supports the transition.+# reviewed_by: <the reviewer's GitHub handle> (the reviewer's own two lines, uncommented, beside status)+# reviewed_on: <YYYY-MM-DD>```-Comments are not a machine-enforced certificate: anyone can edit them, and no test reads them. The reviewer's PR comment-is the record; the YAML comment only points to it, without adding unsupported keys such as `reviewed_by` or `reviewed_on`.-A comment-only edit still changes the content hash (`ContentLoader` hashes the text of every content file), so a save made-before it loads with the "different game content" warning. It does not change any parsed value, so the golden hashes in+The comments are not a machine-enforced certificate: anyone can edit them, and no test reads them. The reviewer's PR+comment is the record; the comments point to it, and `reviewed_by` and `reviewed_on` say who signed the row off and when.+An edit that adds only comments and these two keys still changes the content hash (`ContentLoader` hashes the text of every content file), so a save made+before it loads with the "different game content" warning. It changes no game state, so the golden hashes in[determinism.md](determinism.md) stay the same. If they move, the edit changed more than comments: find out what before going on.## Corrections, disagreements and changed contentdiff --git a/docs/WRITING_EVENTS.md b/docs/WRITING_EVENTS.mdindex bf1b232bf..fdf75291c 100644--- a/docs/WRITING_EVENTS.md+++ b/docs/WRITING_EVENTS.md@@ -176,6 +176,15 @@ flag: `*_review: agent-checked` while only an AI agent has checked the name agairemoves the line once they have reviewed the name (#564); a blank value is an error, not a review. It does not changethe row's `status`.+### reviewed_by and reviewed_on++A person's sign-off beside `status`: `reviewed_by` is the reviewer's GitHub handle (never an email), `reviewed_on` the+day, `YYYY-MM-DD`. Both or neither; the loader refuses a blank or malformed value. **Only the reviewer writes them**, in a+commit of their own: never add, change or remove them yourself on someone's behalf, and an AI agent never does+(`scripts/oss/reviewed_by_guard.py` fails such a pull request; owner, 15 October 2026, #375). An agent may not edit any+field of a signed row either, until a person signs it again ("Block it in CI", owner, 15 October 2026). See+[HISTORIAN_REVIEW.md](HISTORIAN_REVIEW.md#sign-the-row-off).+## What the loader rejectsErrors are printed as `file: field: message`. These are the messages you are most likely to see:diff --git a/docs/review-queue.md b/docs/review-queue.mdindex c72e58d93..30c5fd648 100644--- a/docs/review-queue.md+++ b/docs/review-queue.md@@ -1,15 +1,16 @@# Human-review queue-Generated by `uv run tools/review_queue.py --write` at commit `441fd483`. Do not edit by hand: rerun the tool.+Generated by `uv run tools/review_queue.py --write` at commit `82ab0365`. Do not edit by hand: rerun the tool.It changes no status. Clearing an entry is a content change in its own pull request: a native speaker deletes aname's `*_review: agent-checked` line once they have read it against its source (#564); a person who has checked-every claim of a listed row records it as `docs/HISTORIAN_REVIEW.md` describes.+every claim of a listed row signs it off beside its status with `reviewed_by` (their GitHub handle) and+`reviewed_on` (the day), as `docs/HISTORIAN_REVIEW.md` describes; only a person writes those (#375).**This list is over-inclusive, and it is not a verdict on who checked anything.** The second table lists everyreviewed status whose line was last written by a commit with an AI co-author trailer. Some of those record aperson's decision that an agent only typed in, such as the owner's sensitivity sign-offs; they are listed-anyway, because the repository holds no reviewer record to tell them apart (`docs/HISTORIAN_REVIEW.md` keeps it-in the pull request). It also misses things: an agent whose commits carry no such trailer (another tool, or an+anyway until a person signs them off with `reviewed_by` and `reviewed_on`, the only reviewer record the queue+reads. It also misses things: an agent whose commits carry no such trailer (another tool, or anoutside contributor who does not mark AI use) is counted as a person, and a person who set a status withoutchecking is not caught. Blame ignores whitespace and follows moved lines, but a key reordering too small for gitto match, or a reflow between flow and block style, makes that commit the line's author. The heuristic in full:@@ -19,6 +20,7 @@ to match, or a reflow between flow and block style, makes that commit the line's- Hebrew names flagged `agent-checked`: **100**- `fact-checked`, `historian-reviewed` or `sensitivity-reviewed` statuses last written by a commit with an AI co-author trailer, or not committed yet: **103**- the same statuses last written by a commit without one (not listed): 0+- signed off by a person (`reviewed_by` and `reviewed_on`; not listed): 0## Hebrew names to review (#564)@@ -48,11 +50,11 @@ to match, or a reflow between flow and block style, makes that commit the line's| Line | Row | Field | Value | Sources | Checked by ||---|---|---|---|---|---|-| [166](../content/map/localities_1948.yaml#L166) | al_majdal | name_he | אל-מג'דל | <https://he.wikipedia.org/wiki/אל-מג'דל_(אשקלון)> | an AI agent (the `agent-checked` flag) |-| [472](../content/map/localities_1948.yaml#L472) | pardes_hanna_karkur | name_he | פרדס חנה | <https://he.wikipedia.org/wiki/פרדס_חנה-כרכור> | an AI agent (the `agent-checked` flag) |-| [551](../content/map/localities_1948.yaml#L551) | beit_shean | name_he | ביסאן | <https://he.wikipedia.org/wiki/העיר_העתיקה_של_בית_שאן> | an AI agent (the `agent-checked` flag) |-| [860](../content/map/localities_1948.yaml#L860) | tarshiha | name_he | תרשיחא | <https://he.wikipedia.org/wiki/מעלות-תרשיחא> | an AI agent (the `agent-checked` flag) |-| [3395](../content/map/localities_1948.yaml#L3395) | kiryat_ata | name_he | כפר אתא | <https://he.wikipedia.org/wiki/קריית_אתא> | an AI agent (the `agent-checked` flag) |+| [168](../content/map/localities_1948.yaml#L168) | al_majdal | name_he | אל-מג'דל | <https://he.wikipedia.org/wiki/אל-מג'דל_(אשקלון)> | an AI agent (the `agent-checked` flag) |+| [474](../content/map/localities_1948.yaml#L474) | pardes_hanna_karkur | name_he | פרדס חנה | <https://he.wikipedia.org/wiki/פרדס_חנה-כרכור> | an AI agent (the `agent-checked` flag) |+| [553](../content/map/localities_1948.yaml#L553) | beit_shean | name_he | ביסאן | <https://he.wikipedia.org/wiki/העיר_העתיקה_של_בית_שאן> | an AI agent (the `agent-checked` flag) |+| [862](../content/map/localities_1948.yaml#L862) | tarshiha | name_he | תרשיחא | <https://he.wikipedia.org/wiki/מעלות-תרשיחא> | an AI agent (the `agent-checked` flag) |+| [3397](../content/map/localities_1948.yaml#L3397) | kiryat_ata | name_he | כפר אתא | <https://he.wikipedia.org/wiki/קריית_אתא> | an AI agent (the `agent-checked` flag) |### [content/map/settlements_1948.yaml](../content/map/settlements_1948.yaml) (25)diff --git a/scripts/check.sh b/scripts/check.shindex 296e503db..23b3d6912 100755--- a/scripts/check.sh+++ b/scripts/check.sh@@ -35,6 +35,7 @@ run() {}run "changelog (against $base)" uv run scripts/oss/changelog_check.py --base "$base" --skip-label "$skip"+run "reviewed_by guard (against $base)" uv run scripts/oss/reviewed_by_guard.py --base "$base"run "gdd lint" uv run scripts/oss/gdd_lint.pyrun "policy checker tests" uv run --with pytest==9.1.1 --with pyyaml==6.0.3 --with requests==2.32.5 pytest scripts/oss/tests -qrun "repo policy" uv run scripts/oss/check_repo.pydiff --git a/scripts/oss/reviewed_by_guard.py b/scripts/oss/reviewed_by_guard.pynew file mode 100644index 000000000..d1c4a6e9d--- /dev/null+++ b/scripts/oss/reviewed_by_guard.py@@ -0,0 +1,283 @@+# /// script+# requires-python = ">=3.11"+# dependencies = ["pyyaml==6.0.3"]+# ///+"""Only a person signs a row off, and an agent may not edit a row a person has signed off. For every commit in a pull+request's range this fails when:++1. a commit that an AI agent co-wrote adds, changes or removes a `reviewed_by` or `reviewed_on` line in a content/ YAML+ file (owner, 15 October 2026, #375: "Yes, humans only");+2. a commit that an AI agent co-wrote changes any line, the id included, of a row that carries a person's whole sign-off+ in that commit's parent (so on the base, or signed earlier in the same pull request) (owner, 15 October 2026, on #629: "Block it in CI"), unless a later commit of the same pull+ request with no AI trailer changes that row's own reviewed_by / reviewed_on lines (signs it again or removes its+ sign-off; a merge commit releases nothing);+3. a person's added `reviewed_on` is after the day of their own commit.++"Co-wrote" is the trailer test of tools/review_queue.py (AI_MARK: "Co-Authored-By: Claude / Codex / Copilot / GPT ...",+"Generated with [Claude Code]" or "Generated with Codex"), read from each commit's full message. For (1) any non-comment+line that names either key counts, quoted or not, block or flow style. A row's span is its mapping's lines+(tools/review_queue.py, signed_rows), plus the spans of nodes it reaches through an alias or a merge key; a block inserted+right after a block row belongs to it when its first line that is neither blank nor a comment is at the row's keys'+indent or deeper; a comment inside a signed row counts as part of it. Known limit: a row stored under a mapping key (not+in a list) has its id on the key line, outside its span, so renaming that key passes; no content file has such a status+row today. A commit is diffed against its parent with renames followed; a merge+commit by its combined diff (--cc), so lines it takes unchanged from one parent (a person's sign-off merged in from main)+are not its own.++The diff is read with every option that could change its shape pinned (no colour, no external diff or textconv, text even+where .gitattributes says binary, a/ and b/ prefixes, unquoted paths, no relative paths) and a pathspec for content/*.yaml+and *.yml, so a path with a space or a non-Latin letter, a -diff attribute or a local git setting cannot hide a line.++It fails closed: a base or head that does not resolve, a range git cannot list, a shallow clone, a commit whose message,+diff or files cannot be read, a content YAML file that does not parse, and a path git had to quote are failures, never+passes.++Usage: uv run scripts/oss/reviewed_by_guard.py --base <base-sha> [--head HEAD] [--repo .]"""+from __future__ import annotations++import argparse+import datetime+import re+import subprocess+import sys+from dataclasses import dataclass, field+from pathlib import Path++sys.path.insert(0, str(Path(__file__).resolve().parents[2] / "tools"))+import yaml # noqa: E402+from review_queue import AI_MARK, signed_rows # noqa: E402 (one definition of the trailer test and of a signed row)++EMPTY_TREE = "4b825dc642cb6eb9a060e54bf8d69288fbee4904"+PATHSPEC = [":(glob)content/**/*.yaml", ":(glob)content/**/*.yml"]+CONFIG = ["-c", "core.quotePath=false", "-c", "color.ui=never", "-c", "diff.noprefix=false", "-c", "diff.mnemonicPrefix=false",+ "-c", "diff.relative=false", "-c", "diff.external=", "-c", "core.attributesFile=/dev/null"]+DIFF = ["--no-color", "--no-ext-diff", "--no-textconv", "--text", "--src-prefix=a/", "--dst-prefix=b/", "--unified=0"]+NAMES = re.compile(r"reviewed_(?:by|on)")+ON_VALUE = re.compile(r"""["']?reviewed_on["']?\s*:\s*["']?([^,}\s#"']*)""")+HUNK = re.compile(r"^(@+) (.*?) @+")+++class GuardError(Exception):+ """Something the guard cannot determine: a failure, never a pass."""+++def _git(args: list[str], cwd: Path) -> str:+ return subprocess.run(["git", *CONFIG, *args], cwd=cwd, check=True, capture_output=True, text=True).stdout+++def _resolve(repo: Path, ref: str) -> str:+ try:+ return _git(["rev-parse", "--verify", "--quiet", ref + "^{commit}"], repo).strip()+ except subprocess.CalledProcessError as e:+ raise GuardError(f"cannot resolve {ref!r} to a commit") from e+++@dataclass+class Hunk:+ old: list[tuple[int, int]] # per parent: (start, count) as in the hunk header+ new: tuple[int, int]+ lines: list[tuple[str, str]] = field(default_factory=list) # (the parents' columns, the line's text)+++def hunks(diff: str) -> list[Hunk]:+ """The hunks of a unified (one parent) or combined (--cc) diff of one file, with the -U0 ranges."""+ out: list[Hunk] = []+ cols = 1+ for line in diff.splitlines():+ m = HUNK.match(line)+ if m:+ cols = len(m.group(1)) - 1+ ranges = m.group(2).split()+ def rng(r):+ a, _, b = r[1:].partition(",")+ return int(a), int(b) if b else 1+ out.append(Hunk([rng(r) for r in ranges[:-1]], rng(ranges[-1])))+ continue+ if out and line[:cols].strip(" +-") == "" and len(line) >= cols and any(c in "+-" for c in line[:cols]):+ out[-1].lines.append((line[:cols], line[cols:]))+ return out+++def _named(text: str) -> bool:+ return not text.lstrip().startswith("#") and NAMES.search(text) is not None+++def _touches(row, start: int, count: int, inserted: list[str]) -> bool:+ """True when a change at old lines [start, start+count) (count 0: an insertion after line start) is inside the row, or+ inside a node the row reaches through an alias or a merge key."""+ for first, last in [(row.first, row.last), *row.extra]:+ if count > 0 and start <= last and start + count - 1 >= first:+ return True+ if count == 0 and first <= start < last:+ return True+ if count == 0 and start == row.last and not row.flow:+ # A line inserted right after the row belongs to it when the first line that says anything (not blank, not a+ # comment) is indented as the row's keys or deeper and does not start a new item.+ text = next((t for t in inserted if t.strip() and not t.lstrip().startswith("#")), None)+ if text is not None:+ indent = len(text) - len(text.lstrip(" "))+ return indent >= row.key_column and not text.lstrip().startswith("- ")+ return False+++def _show(repo: Path, rev: str, path: str) -> str | None:+ try:+ return _git(["show", f"{rev}:{path}"], repo)+ except subprocess.CalledProcessError:+ return None+++def _signed(repo: Path, rev: str, path: str, must_exist: bool):+ """The signed rows of a file at a revision. A file the diff says was there but git cannot show is a failure."""+ text = _show(repo, rev, path)+ if text is None:+ if must_exist:+ raise GuardError(f"cannot read {path} at {rev[:10]}")+ return []+ try:+ return signed_rows(text)+ except yaml.YAMLError as e:+ raise GuardError(f"cannot parse {path} at {rev[:10]}") from e+++@dataclass+class Change:+ path: str # the file after the commit (or before, for a deletion)+ old_paths: list[str] # per parent: the file before the commit ("" when it did not exist)+ hunks: list[Hunk]+++def changes(repo: Path, sha: str, parents: list[str]) -> list[Change]:+ """The content YAML files a commit changes, with their hunks against each parent."""+ if len(parents) <= 1:+ parent = parents[0] if parents else EMPTY_TREE+ names = _git(["diff", "--name-status", "-z", "-M", "--no-ext-diff", parent, sha, "--", *PATHSPEC], repo).split("\0")+ out, i = [], 0+ while i < len(names) - 1:+ status = names[i]+ if status[:1] in "RC":+ old, new, i = names[i + 1], names[i + 2], i + 3+ else:+ old = new = names[i + 1]+ i += 2+ if status[:1] == "A":+ old = ""+ spec = [f":(literal){p}" for p in {old, new} if p]+ diff = _git(["diff", *DIFF, "-M", parent, sha, "--", *spec], repo)+ out.append(Change(new, [old], hunks(diff)))+ return out+ diff = _git(["diff-tree", *DIFF, "--cc", sha, "--", *PATHSPEC], repo)+ out = []+ for block in re.split(r"(?m)^diff --cc ", diff)[1:]:+ path = block.split("\n", 1)[0]+ if path.startswith('"'):+ raise GuardError(f"cannot read the quoted path {path} in merge {sha[:10]}")+ out.append(Change(path, [path] * len(parents), hunks(block)))+ return out+++def check(repo: Path, base: str, head: str) -> list[str]:+ """The problems in base..head, one line each; raises GuardError for anything it cannot determine."""+ repo = Path(repo)+ try:+ if _git(["rev-parse", "--is-shallow-repository"], repo).strip() != "false":+ raise GuardError("cannot judge a shallow clone (fetch the full history: fetch-depth: 0)")+ except subprocess.CalledProcessError as e:+ raise GuardError("cannot read the repository") from e+ b, h = _resolve(repo, base), _resolve(repo, head)+ try:+ shas = _git(["rev-list", "--reverse", "--topo-order", f"{b}..{h}"], repo).split()+ except subprocess.CalledProcessError as e:+ raise GuardError(f"cannot list the commits in {base}..{head}") from e+ problems: list[str] = []+ edited: dict[tuple[str, str], str] = {} # (file, row) an agent edited while signed -> the commit, until a person re-signs+ for sha in shas:+ try:+ message = _git(["log", "-1", "--format=%B", sha], repo)+ day = datetime.date.fromisoformat(_git(["log", "-1", "--format=%as", sha], repo).strip())+ parents = _git(["rev-list", "--parents", "-n", "1", sha], repo).split()[1:]+ files = changes(repo, sha, parents)+ except (subprocess.CalledProcessError, ValueError) as e:+ raise GuardError(f"cannot read commit {sha[:10]}") from e+ agent = AI_MARK.search(message) is not None+ for ch in files:+ named = [(cols, text) for hk in ch.hunks for cols, text in hk.lines if _named(text)]+ if agent:+ if named:+ problems.append(f"{sha[:10]}: a commit with an AI co-author trailer changes a reviewed_by / reviewed_on line "+ f"in {ch.path}; only a person signs a row off (#375). Remove those lines from this commit.")+ for p, (parent, old) in enumerate(zip(parents or [EMPTY_TREE], ch.old_paths)):+ if not old or parent == EMPTY_TREE:+ continue+ for row in _signed(repo, parent, old, must_exist=len(parents) == 1):+ for hk in ch.hunks:+ if p >= len(hk.old):+ continue+ inserted = [t for cols, t in hk.lines if "+" in cols]+ if _touches(row, hk.old[p][0], hk.old[p][1], inserted):+ edited.setdefault((ch.path, row.label), sha)+ break+ continue+ # A person's commit: the sign-off's day, and re-signing (or unsigning) a row an agent edited.+ for cols, text in named:+ if "+" in cols:+ m = ON_VALUE.search(text)+ if m:+ try:+ signed_on = datetime.date.fromisoformat(m.group(1))+ except ValueError:+ problems.append(f"{sha[:10]}: {ch.path}: reviewed_on {m.group(1)!r} is not a day (YYYY-MM-DD)")+ continue+ if signed_on > day:+ problems.append(f"{sha[:10]}: {ch.path}: reviewed_on {m.group(1)} is after the commit's own day, {day}")+ if named and len(parents) <= 1:+ # Release only the rows whose own lines gain or lose a sign-off line in this commit: a person re-signing (or+ # unsigning) row b does not release row a, even in the same hunk. A merge never releases (fail closed).+ added, removed = set(), set()+ for hk in ch.hunks:+ old_no, new_no = hk.old[0][0] if hk.old else 0, hk.new[0]+ for cols, text in hk.lines:+ if "-" in cols:+ if _named(text):+ removed.add(old_no)+ old_no += 1+ elif "+" in cols:+ if _named(text):+ added.add(new_no)+ new_no += 1+ released = {row.label for row in _signed(repo, sha, ch.path, must_exist=False)+ if any(row.first <= n <= row.last for n in added)}+ old = ch.old_paths[0] if ch.old_paths else ""+ if old and parents:+ released |= {row.label for row in _signed(repo, parents[0], old, must_exist=True)+ if any(row.first <= n <= row.last for n in removed)}+ for label in released:+ edited.pop((ch.path, label), None)+ for (path, label), sha in edited.items():+ problems.append(f"{sha[:10]}: a commit with an AI co-author trailer edits {path} row {label!r}, which a person signed "+ f"off (owner, 15 October 2026: \"Block it in CI\"). A person must read it again and sign it again "+ f"(new reviewed_by / reviewed_on), or remove its sign-off, in a commit of their own.")+ return problems+++def main(argv: list[str] | None = None) -> int:+ ap = argparse.ArgumentParser(description=__doc__.splitlines()[0])+ ap.add_argument("--base", required=True)+ ap.add_argument("--head", default="HEAD")+ ap.add_argument("--repo", default=".")+ a = ap.parse_args(argv)+ try:+ problems = check(Path(a.repo), a.base, a.head)+ except GuardError as e:+ print(f"reviewed_by guard: {e}. Failing closed.")+ return 1+ for p in problems:+ print(p)+ if problems:+ return 1+ print("reviewed_by guard: no AI-co-authored commit touches a sign-off or a signed-off row.")+ return 0+++if __name__ == "__main__":+ sys.exit(main())diff --git a/scripts/oss/tests/test_github_config.py b/scripts/oss/tests/test_github_config.pyindex 7107c5f58..62e166401 100644--- a/scripts/oss/tests/test_github_config.py+++ b/scripts/oss/tests/test_github_config.py@@ -181,3 +181,14 @@ def test_player_golden_runs_only_the_repositorys_own_released_players():assert "curl" not in text and "wget" not in text and "download-artifact" not in textfor ref_line in re.findall(r"uses:\s*[\w.-]+/[\w./-]+@[0-9a-f]{40}.*", text):assert re.search(r"# v\d+\.\d+\.\d+$", ref_line), ref_line+++def test_the_reviewed_by_guard_runs_on_the_pr_head_with_full_history():+ """#375: the guard needs every commit of the pull request (fetch-depth 0) and diffs the PR head, not the merge ref."""+ job = next(j for j in ci()["jobs"].values() if j["name"] == "Changelog")+ checkout = next(s for s in job["steps"] if s.get("uses", "").startswith("actions/checkout@"))+ assert checkout["with"]["fetch-depth"] == 0+ step = next(s for s in job["steps"] if "reviewed_by_guard.py" in s.get("run", ""))+ assert '--base "$BASE_SHA"' in step["run"] and '--head "$HEAD_SHA"' in step["run"]+ assert step["env"]["HEAD_SHA"] == "${{ github.event.pull_request.head.sha }}"+ assert step["env"]["BASE_SHA"] == "${{ github.event.pull_request.base.sha }}"diff --git a/scripts/oss/tests/test_historian_review.py b/scripts/oss/tests/test_historian_review.pyindex 986f5b56d..fbfff3467 100644--- a/scripts/oss/tests/test_historian_review.py+++ b/scripts/oss/tests/test_historian_review.py@@ -18,14 +18,19 @@ def test_guide_is_current_process_not_a_fabricated_signoff():assert 'EveryHistoricalRecordIsSourcedAndFactChecked' in read('sim/Statecraft.Sim.Tests/RealContentTests.cs')assert '? ReleaseGate.ReviewedStatus : "fact-checked"' in read('sim/Statecraft.Sim.Tests/RealContentTests.cs')assert 'public const string ReviewedStatus = "sensitivity-reviewed"' in read('sim/Statecraft.Sim/ReleaseGate.cs')+ # Owner decision, 15 October 2026 (#375, "Yes, humans only"): the reversal of "no reviewed_by keys", dated, with its+ # guard. A status row now carries a person's sign-off.event = re.search(r'class GameEvent\b.*?\n }', read('sim/Statecraft.Sim/Content.cs'), re.S).group(0)- assert 'ReviewedBy' not in event and 'ReviewedOn' not in event+ assert 'ReviewedBy' in event and 'ReviewedOn' in event+ for text in ('Changed on 15 October 2026', '#375', 'Yes, humans only', 'reviewed_by_guard.py', 'fails closed',+ 'never an email', 'Block it in CI', 'signs it again'):+ assert text in guidedef test_review_example_adds_only_comments_and_links_resolve():guide = read('docs/HISTORIAN_REVIEW.md')sample = re.search(r'```yaml\n(.*?)```', guide, re.S).group(1)- assert all(not line.strip() or line.lstrip().startswith('#') for line in sample.splitlines())+ assert all(not line.strip() or line.lstrip().startswith('#') for line in sample.splitlines()) # no sign-off of its ownfor link in re.findall(r'\]\(([^)]+)\)', guide):if not link.startswith('https://'):assert (ROOT / 'docs' / link.split('#')[0]).resolve().is_file(), linkdiff --git a/scripts/oss/tests/test_policies.py b/scripts/oss/tests/test_policies.pyindex f8d73bcd5..3cd500993 100644--- a/scripts/oss/tests/test_policies.py+++ b/scripts/oss/tests/test_policies.py@@ -54,9 +54,9 @@ def test_check_script_runs_every_ci_command():ci = yaml.safe_load(read(".github/workflows/ci.yml"))script = read("scripts/check.sh")runs = [s["run"] for job in ci["jobs"].values() for s in job["steps"] if "run" in s]- assert len(runs) == 5, runs+ assert len(runs) == 6, runsfor cmd in runs:- # The changelog job passes the PR's SHAs; the script passes its own base ref.+ # The changelog job (and the reviewed_by guard in it) passes the PR's SHAs; the script passes its own base ref.cmd = cmd.split(" --base ")[0]assert cmd in script, cmdassert f'UV_PYTHON:-{ci["env"]["UV_PYTHON"]}' in scriptdiff --git a/scripts/oss/tests/test_reviewed_by_guard.py b/scripts/oss/tests/test_reviewed_by_guard.pynew file mode 100644index 000000000..af92cf625--- /dev/null+++ b/scripts/oss/tests/test_reviewed_by_guard.py@@ -0,0 +1,297 @@+"""scripts/oss/reviewed_by_guard.py (#375, "Yes, humans only"): no commit an AI agent co-wrote adds, changes or removes a+`reviewed_by` / `reviewed_on` line in content/, and a person's `reviewed_on` is not after their commit. It fails closed.+Runs on throwaway git repositories."""+import os+import subprocess++import pytest++import reviewed_by_guard as guard+from conftest import git+[email protected](autouse=True)+def an_explicit_git_identity(monkeypatch):+ """Every git call here (commits, merges, the guard itself) gets an explicit identity and default branch, so the tests+ do not lean on a guessed name and email: CI's runner refuses to guess one (#629, Repo policy run 38736960399)."""+ for k, v in {"GIT_AUTHOR_NAME": "t", "GIT_AUTHOR_EMAIL": "[email protected]",+ "GIT_COMMITTER_NAME": "t", "GIT_COMMITTER_EMAIL": "[email protected]"}.items():+ monkeypatch.setenv(k, v)+++AI = "\n\nCo-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>"+ROW = "people:\n - id: a\n name: A\n status: fact-checked\n"+SIGNED = ROW + " reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n"+++def commit(root, msg, date="2026-10-15T12:00:00+00:00"):+ git(root, "add", "-A")+ subprocess.run(["git", "-C", str(root), "-c", "user.name=t", "-c", "[email protected]", "commit", "-qm", msg],+ check=True, capture_output=True, env={**os.environ, "GIT_AUTHOR_DATE": date, "GIT_COMMITTER_DATE": date})+ return git(root, "rev-parse", "HEAD").strip()+++def repo(tmp_path, text=ROW):+ root = tmp_path / "r"+ (root / "content").mkdir(parents=True)+ git(root, "init", "-q", "-b", "main")+ (root / "content" / "people.yaml").write_text(text, encoding="utf-8")+ base = commit(root, "content: people" + AI)+ return root, base+++def edit(root, text, rel="content/people.yaml"):+ (root / rel).write_text(text, encoding="utf-8")+++def test_a_persons_sign_off_passes(tmp_path):+ root, base = repo(tmp_path)+ edit(root, SIGNED)+ commit(root, "content: sign off A")+ assert guard.check(root, base, "HEAD") == []+++def test_an_agent_commit_that_adds_a_sign_off_fails(tmp_path, capsys):+ root, base = repo(tmp_path)+ edit(root, SIGNED)+ sha = commit(root, "content: sign off A" + AI)+ problems = guard.check(root, base, "HEAD")+ assert len(problems) == 1 and sha[:10] in problems[0] and "content/people.yaml" in problems[0]+ assert guard.main(["--repo", str(root), "--base", base, "--head", "HEAD"]) == 1+ assert "AI co-author" in capsys.readouterr().out+++def test_an_agent_commit_that_changes_or_removes_a_sign_off_fails(tmp_path):+ root, base = repo(tmp_path, SIGNED)+ edit(root, SIGNED.replace("2026-10-15", "2026-10-14"))+ commit(root, "content: fix the day" + AI)+ assert any("changes a reviewed_by / reviewed_on line" in p for p in guard.check(root, base, "HEAD"))+ root2, base2 = repo(tmp_path / "two", SIGNED)+ edit(root2, ROW)+ commit(root2, "content: drop the sign-off" + AI)+ assert any("changes a reviewed_by / reviewed_on line" in p for p in guard.check(root2, base2, "HEAD"))+++def test_an_agent_commit_may_touch_other_lines_comments_and_renames(tmp_path):+ """Outside a signed row an agent may edit: a comment naming the keys above it, and a pure move of the file. (An edit+ inside a signed row is the owner's "Block it in CI" rule, tested below.)"""+ root, base = repo(tmp_path, SIGNED)+ edit(root, "# reviewed_by: only a person writes it (#375)\n" + SIGNED)+ commit(root, "content: a comment" + AI)+ git(root, "mv", "content/people.yaml", "content/people2.yaml")+ commit(root, "content: move the file" + AI)+ assert guard.check(root, base, "HEAD") == []+++def test_a_flow_style_sign_off_by_an_agent_fails(tmp_path):+ root, base = repo(tmp_path, "parties:\n - { id: a, name: A, status: fact-checked }\n")+ edit(root, "parties:\n - { id: a, name: A, status: fact-checked, reviewed_by: eyalgolan, reviewed_on: 2026-10-15 }\n")+ commit(root, "content: sign off" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1+++def test_a_sign_off_dated_after_its_commit_fails(tmp_path):+ root, base = repo(tmp_path)+ edit(root, SIGNED.replace("2026-10-15", "2026-10-16"))+ commit(root, "content: sign off A", date="2026-10-15T12:00:00+00:00")+ problems = guard.check(root, base, "HEAD")+ assert len(problems) == 1 and "after" in problems[0]+++def test_it_fails_closed_when_it_cannot_read_the_range(tmp_path, capsys):+ root, base = repo(tmp_path)+ assert guard.main(["--repo", str(root), "--base", "0" * 40, "--head", "HEAD"]) == 1+ assert guard.main(["--repo", str(root), "--base", "no-such-ref", "--head", "HEAD"]) == 1+ edit(root, SIGNED)+ commit(root, "content: sign off A")+ shallow = tmp_path / "shallow"+ subprocess.run(["git", "clone", "-q", "--depth", "1", root.as_uri(), str(shallow)], check=True, capture_output=True)+ assert guard.main(["--repo", str(shallow), "--base", "HEAD~1", "--head", "HEAD"]) == 1+ assert "cannot" in capsys.readouterr().out+++def test_a_commit_whose_message_cannot_be_read_fails_closed(tmp_path, monkeypatch):+ root, base = repo(tmp_path)+ edit(root, SIGNED)+ commit(root, "content: sign off A")+ real = guard._git++ def broken(args, cwd):+ if args[:2] == ["log", "-1"]:+ raise subprocess.CalledProcessError(128, ["git", *args])+ return real(args, cwd)++ monkeypatch.setattr(guard, "_git", broken)+ assert guard.main(["--repo", str(root), "--base", base, "--head", "HEAD"]) == 1+++# ---- second review of #629: the guard's diff reading must not fail open ------------------------------------------------++def test_a_quoted_key_is_still_a_sign_off(tmp_path):+ for i, text in enumerate([ROW + ' "reviewed_by": eyalgolan\n "reviewed_on": 2026-10-15\n',+ ROW + " 'reviewed_by': eyalgolan\n 'reviewed_on': 2026-10-15\n"]):+ root, base = repo(tmp_path / str(i))+ edit(root, text)+ commit(root, "content: sign off A" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1, text+++def test_paths_with_a_space_or_hebrew_are_read(tmp_path):+ for i, rel in enumerate(["content/my people.yaml", "content/אנשים.yaml", "content/sub dir/p.yml"]):+ root, base = repo(tmp_path / str(i))+ (root / rel).parent.mkdir(parents=True, exist_ok=True)+ edit(root, SIGNED, rel)+ commit(root, "content: sign off A" + AI)+ problems = guard.check(root, base, "HEAD")+ assert len(problems) == 1 and rel in problems[0], (rel, problems)+++def test_a_binary_attribute_does_not_hide_the_lines(tmp_path):+ root, base = repo(tmp_path)+ (root / ".gitattributes").write_text("content/*.yaml -diff\n", encoding="utf-8")+ edit(root, SIGNED)+ commit(root, "content: sign off A" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1+++def test_local_git_config_does_not_change_what_the_guard_reads(tmp_path):+ for i, (key, value) in enumerate([("color.ui", "always"), ("diff.noprefix", "true"), ("diff.mnemonicPrefix", "true"),+ ("core.quotePath", "true"), ("diff.relative", "true"), ("diff.external", "false")]):+ root, base = repo(tmp_path / str(i))+ git(root, "config", key, value)+ edit(root, SIGNED)+ commit(root, "content: sign off A" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1, key+++def branch_with_main_signed(tmp_path, main_text):+ """main: the row signed off (or changed) by a person; branch: an agent's own commit; then the agent merges main in."""+ root, base = repo(tmp_path, ROW + " - id: b\n name: B\n status: fact-checked\n")+ git(root, "checkout", "-q", "-b", "agent")+ (root / "content" / "other.yaml").write_text("rows: []\n", encoding="utf-8")+ commit(root, "content: other" + AI)+ git(root, "checkout", "-q", "main")+ edit(root, main_text)+ commit(root, "content: sign off A")+ main_tip = git(root, "rev-parse", "HEAD").strip()+ git(root, "checkout", "-q", "agent")+ subprocess.run(["git", "-C", str(root), "-c", "user.name=t", "-c", "[email protected]", "merge", "-q",+ "--no-ff", "-m", "Merge main" + AI, "main"], check=True, capture_output=True)+ return root, main_tip+++def test_merging_main_with_a_persons_sign_off_is_not_a_false_failure(tmp_path):+ signed = ROW + " reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n - id: b\n name: B\n status: fact-checked\n"+ root, main_tip = branch_with_main_signed(tmp_path, signed)+ assert guard.check(root, main_tip, "HEAD") == []+++def test_an_agent_merge_that_adds_a_sign_off_itself_fails(tmp_path):+ root, base = repo(tmp_path)+ git(root, "checkout", "-q", "-b", "agent")+ (root / "content" / "other.yaml").write_text("rows: []\n", encoding="utf-8")+ commit(root, "content: other" + AI)+ git(root, "checkout", "-q", "main")+ (root / "content" / "third.yaml").write_text("rows: []\n", encoding="utf-8")+ commit(root, "content: third")+ main_tip = git(root, "rev-parse", "HEAD").strip()+ git(root, "checkout", "-q", "agent")+ subprocess.run(["git", "-C", str(root), "merge", "-q", "--no-ff", "--no-commit", "main"], check=True, capture_output=True)+ edit(root, SIGNED) # an "evil merge": the sign-off comes from the merge commit itself, in no parent+ commit(root, "Merge main" + AI)+ assert len(guard.check(root, main_tip, "HEAD")) == 1+++# ---- owner ruling, 15 October 2026 ("Block it in CI"): an agent may not edit a row a person signed off ------------------++TWO = SIGNED + " - id: b\n name: B\n status: fact-checked\n"+++def test_an_agent_edit_to_a_signed_row_fails(tmp_path):+ for i, change in enumerate([("name: A", "name: A2"), ("id: a", "id: a2"), ("status: fact-checked\n reviewed", "status: draft\n reviewed")]):+ root, base = repo(tmp_path / str(i), TWO)+ edit(root, TWO.replace(*change, 1))+ commit(root, "content: edit A" + AI)+ problems = guard.check(root, base, "HEAD")+ assert len(problems) == 1 and "signed off" in problems[0] and "'a'" in problems[0], (change, problems)+++def test_an_agent_key_added_inside_a_signed_row_fails(tmp_path):+ root, base = repo(tmp_path, TWO)+ edit(root, TWO.replace(" name: A\n", " name: A\n party: x\n"))+ commit(root, "content: add a key to A" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1+++def test_an_agent_edit_to_an_unsigned_row_or_a_new_row_passes(tmp_path):+ root, base = repo(tmp_path, TWO)+ edit(root, TWO.replace("name: B", "name: B2") + " - id: c\n name: C\n status: draft\n")+ commit(root, "content: edit B, add C" + AI)+ assert guard.check(root, base, "HEAD") == []+++def test_a_person_re_signing_or_unsigning_after_the_agent_edit_passes(tmp_path):+ for i, after in enumerate([TWO.replace("name: A", "name: A2").replace("2026-10-15", "2026-10-16"),+ TWO.replace("name: A", "name: A2").replace(" reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n", "")]):+ root, base = repo(tmp_path / str(i), TWO)+ edit(root, TWO.replace("name: A", "name: A2"))+ commit(root, "content: edit A" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1+ edit(root, after)+ commit(root, "content: re-read A and sign again", date="2026-10-16T12:00:00+00:00")+ assert guard.check(root, base, "HEAD") == [], i+++def test_merging_main_where_a_person_edited_and_signed_a_row_is_not_a_false_failure(tmp_path):+ signed = TWO.replace("name: A", "name: A (corrected)")+ root, main_tip = branch_with_main_signed(tmp_path, signed)+ assert guard.check(root, main_tip, "HEAD") == []+++# ---- scoped re-review of #629: three ways round the signed-row rule ---------------------------------------------------++def test_a_key_inserted_after_a_comment_or_a_blank_line_is_still_inside_the_row(tmp_path):+ for i, lead in enumerate([" # note\n", "\n", " # one\n\n"]):+ root, base = repo(tmp_path / str(i), TWO)+ edit(root, TWO.replace(" reviewed_on: 2026-10-15\n", " reviewed_on: 2026-10-15\n" + lead + " born: 1900\n"))+ commit(root, "content: add born to A" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1, repr(lead)+ root, base = repo(tmp_path / "eof", SIGNED)+ edit(root, SIGNED + " # note\n born: 1900\n")+ commit(root, "content: add born to A at the end" + AI)+ assert len(guard.check(root, base, "HEAD")) == 1+++def test_a_comment_or_blank_line_alone_after_a_signed_row_passes(tmp_path):+ root, base = repo(tmp_path, TWO)+ edit(root, TWO.replace(" reviewed_on: 2026-10-15\n", " reviewed_on: 2026-10-15\n\n # a note between rows\n"))+ commit(root, "content: a note" + AI)+ assert guard.check(root, base, "HEAD") == []+++def test_a_person_re_signing_another_row_does_not_release_the_edited_one(tmp_path):+ both = SIGNED + " - id: b\n name: B\n status: fact-checked\n reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n"+ root, base = repo(tmp_path, both)+ edit(root, both.replace("name: A", "name: A2"))+ commit(root, "content: edit A" + AI)+ edit(root, both.replace("name: A", "name: A3").replace(" name: B\n status: fact-checked\n reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n",+ " name: B\n status: fact-checked\n reviewed_by: eyalgolan\n reviewed_on: 2026-10-16\n"))+ commit(root, "content: fix A's typo, re-sign B", date="2026-10-16T12:00:00+00:00")+ problems = guard.check(root, base, "HEAD")+ assert len(problems) == 1 and "'a'" in problems[0]+++def test_an_anchor_a_signed_row_uses_is_part_of_it(tmp_path):+ text = ("people:\n - id: x\n name: X\n sources: [&src { url: 'https://example.org/1', checked: 2026-10-14 }]\n"+ " status: draft\n"+ " - id: a\n name: A\n sources: [*src]\n status: fact-checked\n reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n")+ root, base = repo(tmp_path, text)+ edit(root, text.replace("https://example.org/1", "https://example.org/2"))+ commit(root, "content: change X's source" + AI)+ problems = guard.check(root, base, "HEAD")+ assert len(problems) == 1 and "'a'" in problems[0]+ merge = ("defaults: &d\n status: fact-checked\n note: n\n"+ "people:\n - id: a\n <<: *d\n name: A\n reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n")+ root2, base2 = repo(tmp_path / "merge", merge)+ edit(root2, merge.replace("note: n", "note: m"))+ commit(root2, "content: change the defaults" + AI)+ assert len(guard.check(root2, base2, "HEAD")) == 1diff --git a/sim/Statecraft.Sim.Tests/ReviewRecordTests.cs b/sim/Statecraft.Sim.Tests/ReviewRecordTests.csnew file mode 100644index 000000000..7c1c1e64e--- /dev/null+++ b/sim/Statecraft.Sim.Tests/ReviewRecordTests.cs@@ -0,0 +1,133 @@+using System;+using System.Collections.Generic;+using System.IO;+using System.Linq;+using Statecraft.Sim;+using YamlDotNet.RepresentationModel;++/// <summary>A person's sign-off beside a status (owner, 15 October 2026, #375: "Yes, humans only"): `reviewed_by` (a GitHub+/// handle) and `reviewed_on` (the day), both or neither. Only a person writes them; scripts/oss/reviewed_by_guard.py+/// refuses an AI-co-authored commit that touches them.</summary>+public class ReviewRecordTests+{+ const string Signed = "reviewed_by: eyalgolan\nreviewed_on: 2026-10-15\n";++ static string Indent(string lines, int n) => string.Concat(lines.Split('\n').Where(l => l != "").Select(l => new string(' ', n) + l + "\n"));++ static Dictionary<string, string> With(string file, string after, string lines) =>+ new Dictionary<string, string> { [file] = Fixture.Files[file].Replace(after, after + lines) };++ static Content Load(Dictionary<string, string> files, Dictionary<string, string>? events = null) =>+ ContentLoader.Load(Fixture.Write(files, events));++ [Fact]+ public void ASignOffLoadsOnEveryKindOfStatusRow()+ {+ var files = With("people.yaml", " name: Pm One\n", Indent(Signed, 4));+ files["legislatures.yaml"] = Fixture.Files["legislatures.yaml"].Replace(" body: Council\n", " body: Council\n" + Indent(Signed, 4));+ files["governments.yaml"] = Fixture.Files["governments.yaml"].Replace(" name: Government One\n", " name: Government One\n" + Indent(Signed, 4));+ files["aliyah.yaml"] = Fixture.Files["aliyah.yaml"].Replace(" to: 1948-12-31\n", " to: 1948-12-31\n" + Indent(Signed, 4));+ var c = Load(files, new Dictionary<string, string> { ["drought.yaml"] = ValidationTests.Event + Signed });+ const string day = "2026-10-15";+ Assert.Equal(("eyalgolan", day), (c.People.Single(p => p.Id == "pm_one").ReviewedBy, c.People.Single(p => p.Id == "pm_one").ReviewedOn));+ Assert.Equal("eyalgolan", c.Legislatures.Single(l => l.Id == "council").ReviewedBy);+ Assert.Equal(day, c.Governments.Single(g => g.Id == "gov1").ReviewedOn);+ Assert.Equal("eyalgolan", c.Aliyah[0].ReviewedBy);+ Assert.Equal(day, c.Events.Single().ReviewedOn);+ Assert.Equal(("", ""), (c.People.Single(p => p.Id != "pm_one").ReviewedBy, c.People.Single(p => p.Id != "pm_one").ReviewedOn));+ }++ [Theory]+ [InlineData(" reviewed_by: eyalgolan\n", "people[pm_one].reviewed_on")] // both or neither+ [InlineData(" reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: ''\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")] // blank is not a person+ [InlineData(" reviewed_by: ~\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: [email protected]\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")] // never an email+ [InlineData(" reviewed_by: '@eyalgolan'\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: eyal.golan\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: -eyal\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: eyal--golan\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: Eyal Golan\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: dependabot[bot]\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")]+ [InlineData(" reviewed_by: a123456789012345678901234567890123456789\n reviewed_on: 2026-10-15\n", "people[pm_one].reviewed_by")] // 40 > 39+ [InlineData(" reviewed_by: eyalgolan\n reviewed_on: ~\n", "people[pm_one].reviewed_on")]+ [InlineData(" reviewed_on: ~\n", "people[pm_one].reviewed_by")] // a blank key is still a key+ public void ABadSignOffNamesTheFileAndField(string lines, string field)+ {+ var ex = Assert.Throws<ContentException>(() => Load(With("people.yaml", " name: Pm One\n", lines)));+ Assert.Equal("people.yaml", ex.File);+ Assert.Equal(field, ex.Field);+ }++ [Theory]+ [InlineData(" reviewed_by: eyalgolan\n reviewed_on: yesterday\n")]+ [InlineData(" reviewed_by: eyalgolan\n reviewed_on: 2026-13-01\n")]+ [InlineData(" reviewed_by: [eyalgolan]\n reviewed_on: 2026-10-15\n")]+ public void ASignOffThatIsNotADateOrAHandleDoesNotLoad(string lines)+ {+ var ex = Assert.Throws<ContentException>(() => Load(With("people.yaml", " name: Pm One\n", lines)));+ Assert.Equal("people.yaml", ex.File);+ }++ [Fact]+ public void ABadSignOffOnAnEventOrAGovernmentNamesItsField()+ {+ var ev = Assert.Throws<ContentException>(() => Load(new Dictionary<string, string>(), new Dictionary<string, string>+ { ["drought.yaml"] = ValidationTests.Event + "reviewed_by: [email protected]\nreviewed_on: 2026-10-15\n" }));+ Assert.Equal("events/drought.yaml", ev.File);+ Assert.EndsWith("reviewed_by", ev.Field);+ var gov = Assert.Throws<ContentException>(() => Load(With("governments.yaml", " name: Government One\n", " reviewed_on: 2026-10-15\n")));+ Assert.Equal(("governments.yaml", "governments[gov1].reviewed_by"), (gov.File, gov.Field));+ }++ [Theory]+ [InlineData("eyalgolan", true)]+ [InlineData("a", true)]+ [InlineData("guy-shoham", true)]+ [InlineData("agamrafaeli-instinct", true)]+ [InlineData("Jeremy-Hoover1", true)]+ [InlineData("", false)]+ [InlineData("[email protected]", false)]+ [InlineData("eyal-", false)]+ [InlineData("eyal_golan", false)]+ [InlineData("dependabot[bot]", false)]+ public void TheHandleShapeIsGitHubs(string handle, bool ok) => Assert.Equal(ok, ReviewRecord.IsHandle(handle));++ // ---- the shared cases: every reader agrees on them (tools/tests/data/review_record_cases.json) --------------------++ public static IEnumerable<object?[]> SharedCases()+ {+ var path = Path.Combine(RealContentTests.ContentRoot(), "..", "tools", "tests", "data", "review_record_cases.json");+ using var doc = System.Text.Json.JsonDocument.Parse(File.ReadAllText(path));+ foreach (var c in doc.RootElement.GetProperty("cases").EnumerateArray())+ {+ string? S(string k) => c.GetProperty(k).ValueKind == System.Text.Json.JsonValueKind.Null ? null : c.GetProperty(k).GetString();+ yield return new object?[] { S("by"), S("on"), S("field"), c.TryGetProperty("nonscalar", out var n) && n.GetBoolean() };+ }+ }++ [Theory]+ [MemberData(nameof(SharedCases))]+ public void TheLoaderAgreesWithTheSharedCases(string? by, string? on, string? field, bool nonscalar)+ {+ var lines = (by == null ? "" : (" reviewed_by: " + by).TrimEnd() + "\n") + (on == null ? "" : (" reviewed_on: " + on).TrimEnd() + "\n");+ var files = With("people.yaml", " name: Pm One\n", lines);+ if (field == null) { Load(files); return; }+ var ex = Assert.Throws<ContentException>(() => Load(files));+ Assert.Equal("people.yaml", ex.File);+ if (!nonscalar) Assert.Equal("people[pm_one]." + field, ex.Field);+ }++ /// <summary>The real content: every sign-off is a handle and a day that has already come (the loader keeps no clock; the+ /// test does).</summary>+ [Fact]+ public void EveryRealSignOffIsAHandleAndAPastDay()+ {+ var c = ContentLoader.Load(RealContentTests.ContentRoot());+ var signed = c.People.Select(p => (p.ReviewedBy, p.ReviewedOn)).Concat(c.Legislatures.Select(l => (l.ReviewedBy, l.ReviewedOn)))+ .Concat(c.Governments.Select(g => (g.ReviewedBy, g.ReviewedOn))).Concat(c.Aliyah.Select(a => (a.ReviewedBy, a.ReviewedOn)))+ .Concat(c.PopulationAnchors.Select(a => (a.ReviewedBy, a.ReviewedOn))).Concat(c.Events.Select(e => (e.ReviewedBy, e.ReviewedOn)))+ .Concat(c.Sites.Select(s => (s.ReviewedBy, s.ReviewedOn))).Where(x => x.ReviewedBy != "").ToList();+ Assert.All(signed, x => { Assert.True(ReviewRecord.IsHandle(x.ReviewedBy)); Assert.True(ReviewRecord.IsDay(x.ReviewedOn)); Assert.True(DateTime.ParseExact(x.ReviewedOn, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture) <= DateTime.UtcNow.Date); });+ }+}diff --git a/sim/Statecraft.Sim/Content.cs b/sim/Statecraft.Sim/Content.csindex 3abbc70aa..6111b1035 100644--- a/sim/Statecraft.Sim/Content.cs+++ b/sim/Statecraft.Sim/Content.cs@@ -9,6 +9,36 @@ namespace Statecraft.Simpublic sealed class Source { public string Url { get; set; } = ""; public DateTime Checked { get; set; } }+ /// <summary>The shape of a sign-off's `reviewed_by`: a GitHub handle (letters and digits, single hyphens between them,+ /// at most 39 characters, and at least one letter, so a bare number such as 1234 reads the same in every reader), so never an email, an @-name, a display name or a bot account ("name[bot]"). Shared with+ /// the map's readers in Unity.</summary>+ public static class ReviewRecord+ {+ static readonly System.Text.RegularExpressions.Regex Handle =+ new System.Text.RegularExpressions.Regex(@"^(?=[A-Za-z0-9-]*[A-Za-z])[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}\z");++ public static bool IsHandle(string? s) => s != null && Handle.IsMatch(s);++ static readonly System.Text.RegularExpressions.Regex Day = new System.Text.RegularExpressions.Regex(@"^\d{4}-\d{2}-\d{2}\z");++ /// <summary>Exactly YYYY-MM-DD, and a real day (no 30 February).</summary>+ public static bool IsDay(string? s) => s != null && Day.IsMatch(s)+ && DateTime.TryParseExact(s, "yyyy-MM-dd", System.Globalization.CultureInfo.InvariantCulture, System.Globalization.DateTimeStyles.None, out _);++ /// <summary>What is wrong with a row's sign-off, as (field, message), or null when it is absent or whole: both keys or+ /// neither (a key that is present but blank counts as present), the handle's shape, and the day as YYYY-MM-DD.</summary>+ public static (string field, string message)? Problem(bool byGiven, string? by, bool onGiven, string? on)+ {+ if (!byGiven && !onGiven) return null;+ if (!onGiven) return ("reviewed_on", "required with reviewed_by: the day the person signed off (YYYY-MM-DD)");+ if (!byGiven) return ("reviewed_by", "required with reviewed_on: the reviewer's GitHub handle");+ if (!IsHandle(by)) return ("reviewed_by", "must be the reviewer's GitHub handle (letters, digits and single hyphens; no @, email or display name)");+ if (!IsDay(on))+ return ("reviewed_on", "must be the day of the sign-off, YYYY-MM-DD");+ return null;+ }+ }+/// <summary>The review flag of a Hebrew display name (`*_he_review`, CONTENT_POLICY section 2, rule 6). A name an AI agent/// checked against its sources, but no person has read yet, carries <see cref="AgentChecked"/>; the row's own `status`/// stays what it is for the English facts. A native speaker's review clears the flag (the key is removed).</summary>@@ -137,6 +167,19 @@ namespace Statecraft.Simpublic Portrait? Portrait { get; set; }public List<OfficeTerm> Offices { get; set; } = new List<OfficeTerm>();public string Status { get; set; } = "draft";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;}public sealed class Legislature@@ -161,6 +204,19 @@ namespace Statecraft.Simpublic List<string> OpenQuestions { get; set; } = new List<string>();public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "draft";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;}public sealed class Government@@ -184,6 +240,19 @@ namespace Statecraft.Simpublic List<CoalitionChange> CoalitionChanges { get; set; } = new List<CoalitionChange>();public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "draft";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;/// <summary>The coalition on <paramref name="date"/>: the opening list with every change dated on or before that/// day applied. The result keeps the opening order, with parties that joined added at the end.</summary>@@ -400,6 +469,19 @@ namespace Statecraft.Simpublic DateTime Founded { get; set; }public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;}/// <summary>A city's start values (cities.yaml, GDD "Cities and construction"). Counts are population units (D-A1).</summary>@@ -483,6 +565,19 @@ namespace Statecraft.Simpublic Dictionary<string, double> Origins { get; set; } = new Dictionary<string, double>();public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "draft";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;}public sealed class PopulationAnchor@@ -491,6 +586,19 @@ namespace Statecraft.Simpublic double Jews { get; set; }public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "draft";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;}public sealed class EventCondition { public string Indicator { get; set; } = ""; public double? Min { get; set; } public double? Max { get; set; } }@@ -528,6 +636,19 @@ namespace Statecraft.Simpublic List<EventOption> Options { get; set; } = new List<EventOption>();public List<Source> Sources { get; set; } = new List<Source>();public string Status { get; set; } = "draft";+ /// <summary>The person who signed this row off: a GitHub handle, written only by that person (owner, 15 October 2026,+ /// #375: "Yes, humans only"; scripts/oss/reviewed_by_guard.py). Empty when no one has; with <see cref="ReviewedOn"/>.</summary>+ public string ReviewedBy { get => reviewedBy ?? ""; set => reviewedBy = value ?? ""; }+ /// <summary>True when the file has the key at all, even blank: a blank sign-off is an error.</summary>+ [YamlIgnore] public bool ReviewedByGiven => reviewedBy != null;+ string? reviewedBy;+ /// <summary>The day of the sign-off, YYYY-MM-DD, as the file writes it (read as text, so the loader checks the same+ /// shape as tools/review_record.py and the map's readers; YamlDotNet's own date parsing would take "15 October 2026");+ /// set exactly when <see cref="ReviewedBy"/> is.</summary>+ public string ReviewedOn { get => reviewedOn ?? ""; set { reviewedOn = value ?? ""; ReviewedOnGiven = true; } }+ /// <summary>True when the file has the key at all, even blank.</summary>+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;/// <summary>Path relative to the content root, set by the loader (not read from YAML).</summary>[YamlIgnore] public string File { get; set; } = "";}diff --git a/sim/Statecraft.Sim/ContentLoader.cs b/sim/Statecraft.Sim/ContentLoader.csindex 743087423..f32dca08d 100644--- a/sim/Statecraft.Sim/ContentLoader.cs+++ b/sim/Statecraft.Sim/ContentLoader.cs@@ -380,6 +380,14 @@ namespace Statecraft.Simif (string.IsNullOrWhiteSpace(name)) throw new ContentException(file, field, "required (the name shown to the player)");}+ /// <summary>A row's sign-off (#375): reviewed_by and reviewed_on together, a GitHub handle, a day as YYYY-MM-DD (read as+ /// text, the same rule as tools/review_record.py and the map's readers). <paramref name="at"/> is the row's path, as in "people[ben_gurion]".</summary>+ internal static void Review(string file, string at, string by, bool byGiven, string on, bool onGiven)+ {+ var p = ReviewRecord.Problem(byGiven, by, onGiven, on);+ if (p != null) throw new ContentException(file, $"{at}.{p.Value.field}", p.Value.message);+ }+internal static void Status(string file, string field, string status){if (!Statuses.Contains(status))@@ -656,11 +664,11 @@ namespace Statecraft.Simforeach (var p in c.Policies)if (Array.IndexOf(PlayerText.MoneyIds, p.Id) >= 0) throw new ContentException("model.yaml", $"policies[{p.Id}].id", "same id as money (treasury, debt, fx_reserves)");- foreach (var p in c.People) Status("people.yaml", $"people[{p.Id}].status", p.Status);- foreach (var l in c.Legislatures) Status("legislatures.yaml", $"legislatures[{l.Id}].status", l.Status);- foreach (var g in c.Governments) Status("governments.yaml", $"governments[{g.Id}].status", g.Status);- for (int i = 0; i < c.Aliyah.Count; i++) Status("aliyah.yaml", FormattableString.Invariant($"series[{i}].status"), c.Aliyah[i].Status);- for (int i = 0; i < c.PopulationAnchors.Count; i++) Status("population.yaml", FormattableString.Invariant($"anchors[{i}].status"), c.PopulationAnchors[i].Status);+ foreach (var p in c.People) { Status("people.yaml", $"people[{p.Id}].status", p.Status); Review("people.yaml", $"people[{p.Id}]", p.ReviewedBy, p.ReviewedByGiven, p.ReviewedOn, p.ReviewedOnGiven); }+ foreach (var l in c.Legislatures) { Status("legislatures.yaml", $"legislatures[{l.Id}].status", l.Status); Review("legislatures.yaml", $"legislatures[{l.Id}]", l.ReviewedBy, l.ReviewedByGiven, l.ReviewedOn, l.ReviewedOnGiven); }+ foreach (var g in c.Governments) { Status("governments.yaml", $"governments[{g.Id}].status", g.Status); Review("governments.yaml", $"governments[{g.Id}]", g.ReviewedBy, g.ReviewedByGiven, g.ReviewedOn, g.ReviewedOnGiven); }+ for (int i = 0; i < c.Aliyah.Count; i++) { Status("aliyah.yaml", FormattableString.Invariant($"series[{i}].status"), c.Aliyah[i].Status); Review("aliyah.yaml", FormattableString.Invariant($"series[{i}]"), c.Aliyah[i].ReviewedBy, c.Aliyah[i].ReviewedByGiven, c.Aliyah[i].ReviewedOn, c.Aliyah[i].ReviewedOnGiven); }+ for (int i = 0; i < c.PopulationAnchors.Count; i++) { Status("population.yaml", FormattableString.Invariant($"anchors[{i}].status"), c.PopulationAnchors[i].Status); Review("population.yaml", FormattableString.Invariant($"anchors[{i}]"), c.PopulationAnchors[i].ReviewedBy, c.PopulationAnchors[i].ReviewedByGiven, c.PopulationAnchors[i].ReviewedOn, c.PopulationAnchors[i].ReviewedOnGiven); }foreach (var p in c.People){@@ -1008,6 +1016,7 @@ namespace Statecraft.Simif (x.Sources[i] == null || string.IsNullOrWhiteSpace(x.Sources[i].Url) || x.Sources[i].Checked == default)throw new ContentException(sf, FormattableString.Invariant($"{at}.sources[{i}]"), "needs a url and checked date");Status(sf, at + ".status", x.Status);+ Review(sf, at, x.ReviewedBy, x.ReviewedByGiven, x.ReviewedOn, x.ReviewedOnGiven);}}diff --git a/sim/Statecraft.Sim/EventRules.cs b/sim/Statecraft.Sim/EventRules.csindex d8be79589..94707eec8 100644--- a/sim/Statecraft.Sim/EventRules.cs+++ b/sim/Statecraft.Sim/EventRules.cs@@ -21,6 +21,7 @@ namespace Statecraft.Simif (!ids.Add(e.Id)) throw new ContentException(e.File, F("id"), "duplicate event id");if (e.Anchor != "hard" && e.Anchor != "soft") throw new ContentException(e.File, F("anchor"), $"unknown anchor '{e.Anchor}' (must be hard or soft)");ContentLoader.Status(e.File, F("status"), e.Status);+ ContentLoader.Review(e.File, $"events[{e.Id}]", e.ReviewedBy, e.ReviewedByGiven, e.ReviewedOn, e.ReviewedOnGiven);ContentLoader.Period(e.File, $"events[{e.Id}]", e.From, e.To);// Chapters design 9: an event may not span a boundary; it is split. An open window (no `to`) is allowed only in// the last era, since EventSystem keeps an open event eligible to the end of the game.diff --git a/tools/review_queue.py b/tools/review_queue.pyindex 81251708f..8ce32c668 100644--- a/tools/review_queue.py+++ b/tools/review_queue.py@@ -21,7 +21,10 @@ such status line, `git blame` on the working-tree file (the text this script reauncommitted edit does not shift the lines), with `-w -M`, gives the commit that last wrote it; a file git does not trackyet is read too, and every row in it counts as not committed. A commit counts when its message has an AI co-author trailer or the Claude Code line ("Co-Authored-By:Claude ...", "Co-Authored-By: ... Codex / Copilot / GPT ...", "Generated with [Claude Code]", "Generated with Codex").-Such a row is listed with the commit and its pull request number. A status line not committed yet is listed too, as+A row that carries a person's whole sign-off beside its status (`reviewed_by`, a GitHub handle, and `reviewed_on`, a day;+owner, 15 October 2026, #375: "Yes, humans only"; tools/review_record.py) leaves the queue and is counted as signed off,+whatever wrote its status line; a malformed sign-off does not count (fail closed). Any other such row is listed with+the commit and its pull request number. A status line not committed yet is listed too, as"not committed yet": no commit vouches for it, so the queue fails closed. Any other row is counted, not listed.Limits, said plainly, and on the page too:@@ -50,6 +53,9 @@ from pathlib import Pathimport yaml+sys.path.insert(0, str(Path(__file__).resolve().parent)) # under python -I the script's folder is not on sys.path+import review_record # noqa: E402+ROOT = Path(__file__).resolve().parents[1]PAGE = ROOT / "docs" / "review-queue.md"STATUSES = ("fact-checked", "historian-reviewed", "sensitivity-reviewed")@@ -98,6 +104,13 @@ def _scalar(node) -> str:return node.value if isinstance(node, yaml.ScalarNode) else ""+def _value(node):+ """A scalar's text (None for a YAML null), or the node itself when it is not a scalar (never a valid sign-off)."""+ if not isinstance(node, yaml.ScalarNode):+ return node+ return None if node.tag.endswith(":null") else node.value++def _urls(node) -> list[str]:"""Every https URL under a node, in order (a `sources` list of strings or of {url, checked} maps)."""out: list[str] = []@@ -126,6 +139,65 @@ def _rows(node, path: str = ""):yield from _rows(v, f"{path}[{i}]")+def _mappings(node, path: str = ""):+ """Every mapping node in the document with its label (as _rows)."""+ if isinstance(node, yaml.MappingNode):+ keys = {_scalar(k): v for k, v in node.value}+ yield (_scalar(keys["id"]) if "id" in keys else path or "(file)"), keys, node+ for k, v in node.value:+ yield from _mappings(v, f"{path}.{_scalar(k)}" if path else _scalar(k))+ elif isinstance(node, yaml.SequenceNode):+ for i, v in enumerate(node.value):+ yield from _mappings(v, f"{path}[{i}]")+++@dataclass+class SignedRow:+ label: str+ first: int # 1-based lines the row's mapping spans, inclusive+ last: int+ key_column: int # 0-based column of its keys (a line inserted at this indent or deeper, right after it, belongs to it)+ flow: bool # a one-line { ... } row: nothing inserted after it belongs to it+ # 1-based inclusive spans of nodes the row pulls in from elsewhere through an alias or a merge key (`*a`, `<<: *d`):+ # editing the anchor changes the row as surely as editing the row (people.yaml shares source anchors across rows).+ extra: list = field(default_factory=list)+++def signed_rows(text: str) -> list[SignedRow]:+ """The rows of a YAML text that carry a person's whole sign-off (#375), with their line spans. Raises yaml.YAMLError on+ text that is not YAML."""+ root = yaml.compose(text)+ if root is None:+ return []+ lines = text.splitlines()++ def last_line(n) -> int:+ end = n.end_mark+ before = lines[end.line][:end.column] if end.line < len(lines) else ""+ return (end.line - 1 if before.strip() == "" else end.line) + 1++ out = []+ for label, keys, node in _mappings(root):+ if "reviewed_by" not in keys or not review_record.signed({k: _value(keys[k]) for k in review_record.FIELDS if k in keys}):+ continue+ first, last = node.start_mark.line + 1, last_line(node)+ extra, seen, todo = [], set(), [node]+ while todo: # every node the row reaches; one whose text lies outside the row came in through an alias+ n = todo.pop()+ if id(n) in seen:+ continue+ seen.add(id(n))+ a, b = n.start_mark.line + 1, last_line(n)+ if a < first or a > last:+ extra.append((a, max(a, b)))+ if isinstance(n, yaml.MappingNode):+ todo.extend(v for kv in n.value for v in kv)+ elif isinstance(n, yaml.SequenceNode):+ todo.extend(n.value)+ out.append(SignedRow(label, first, last, node.start_mark.column, bool(node.flow_style), sorted(set(extra))))+ return out++def scan(text: str, rel: str) -> list[Entry]:"""The flags and the reviewed statuses in one YAML file, with their lines; no git."""root = yaml.compose(text)@@ -141,8 +213,10 @@ def scan(text: str, rel: str) -> list[Entry]:_urls(keys[name + "_sources"]) if name + "_sources" in keys else []))status = keys.get("status")if status is not None and _scalar(status) in STATUSES:- entries.append(Entry("status", rel, status.start_mark.line + 1, label, "status", _scalar(status),- _urls(keys["sources"]) if "sources" in keys else []))+ # A whole sign-off by a person (#375) takes the row out of the queue; a malformed one does not (fail closed).+ signoff = {k: _value(keys[k]) for k in review_record.FIELDS if k in keys}+ entries.append(Entry("signed" if review_record.signed(signoff) else "status", rel, status.start_mark.line + 1, label,+ "status", _scalar(status), _urls(keys["sources"]) if "sources" in keys else []))return entries@@ -194,11 +268,12 @@ def content_files(repo: Path) -> tuple[list[str], set[str]]:return sorted(set(tracked) | untracked), untracked-def queue(repo: Path) -> tuple[list[Entry], int]:- """The entries to review, and how many reviewed statuses were set by a commit with no agent marker (not listed)."""+def queue(repo: Path) -> tuple[list[Entry], int, int]:+ """The entries to review; how many reviewed statuses were last written by a commit with no agent marker (not listed);+ and how many rows a person signed off (reviewed_by and reviewed_on, #375; not listed)."""cache: dict[str, Commit] = {}entries: list[Entry] = []- human = 0+ human = signed = 0files, untracked = content_files(repo)for rel in files:found = scan((repo / rel).read_text(encoding="utf-8"), rel)@@ -206,6 +281,9 @@ def queue(repo: Path) -> tuple[list[Entry], int]:continuelines = {e.line: UNCOMMITTED for e in found} if rel in untracked else blame(repo, rel)for e in found:+ if e.kind == "signed":+ signed += 1+ continuec = commit(repo, lines[e.line], cache)if e.kind == "flag":e.checked_by = f"an AI agent (the `{FLAG}` flag)"@@ -218,14 +296,14 @@ def queue(repo: Path) -> tuple[list[Entry], int]:entries.append(e)else:human += 1- return entries, human+ return entries, human, signeddef _cell(text: str) -> str:return text.replace("|", "\\|").replace("\n", " ")-def page(entries: list[Entry], human: int, head: str) -> str:+def page(entries: list[Entry], human: int, head: str, signed: int = 0) -> str:flags = [e for e in entries if e.kind == "flag"]statuses = [e for e in entries if e.kind == "status"]out = [@@ -234,13 +312,14 @@ def page(entries: list[Entry], human: int, head: str) -> str:f"Generated by `uv run tools/review_queue.py --write` at commit `{head[:8]}`. Do not edit by hand: rerun the tool.","It changes no status. Clearing an entry is a content change in its own pull request: a native speaker deletes a","name's `*_review: agent-checked` line once they have read it against its source (#564); a person who has checked",- "every claim of a listed row records it as `docs/HISTORIAN_REVIEW.md` describes.",+ "every claim of a listed row signs it off beside its status with `reviewed_by` (their GitHub handle) and",+ "`reviewed_on` (the day), as `docs/HISTORIAN_REVIEW.md` describes; only a person writes those (#375).","","**This list is over-inclusive, and it is not a verdict on who checked anything.** The second table lists every","reviewed status whose line was last written by a commit with an AI co-author trailer. Some of those record a","person's decision that an agent only typed in, such as the owner's sensitivity sign-offs; they are listed",- "anyway, because the repository holds no reviewer record to tell them apart (`docs/HISTORIAN_REVIEW.md` keeps it",- "in the pull request). It also misses things: an agent whose commits carry no such trailer (another tool, or an",+ "anyway until a person signs them off with `reviewed_by` and `reviewed_on`, the only reviewer record the queue",+ "reads. It also misses things: an agent whose commits carry no such trailer (another tool, or an","outside contributor who does not mark AI use) is counted as a person, and a person who set a status without","checking is not caught. Blame ignores whitespace and follows moved lines, but a key reordering too small for git","to match, or a reflow between flow and block style, makes that commit the line's author. The heuristic in full:",@@ -251,6 +330,7 @@ def page(entries: list[Entry], human: int, head: str) -> str:f"- `fact-checked`, `historian-reviewed` or `sensitivity-reviewed` statuses last written by a commit with an AI "f"co-author trailer, or not committed yet: **{len(statuses)}**",f"- the same statuses last written by a commit without one (not listed): {human}",+ f"- signed off by a person (`reviewed_by` and `reviewed_on`; not listed): {signed}","",]for title, items, cols in (@@ -280,11 +360,11 @@ def run(repo: Path, write: bool) -> int:print("review_queue: a shallow clone blames every line on one commit; run it on a full clone", file=sys.stderr)return 2try:- entries, human = queue(repo)+ entries, human, signed = queue(repo)except QueueError as e:print(f"review_queue: {e}", file=sys.stderr)return 2- text = page(entries, human, _git(["rev-parse", "HEAD"], repo).strip())+ text = page(entries, human, _git(["rev-parse", "HEAD"], repo).strip(), signed)if write:target = repo / PAGE.relative_to(ROOT)target.write_text(text, encoding="utf-8", newline="\n")diff --git a/tools/review_record.py b/tools/review_record.pynew file mode 100644index 000000000..30d0a5804--- /dev/null+++ b/tools/review_record.py@@ -0,0 +1,54 @@+"""A person's sign-off beside a status (owner, 15 October 2026, #375: "Yes, humans only"): `reviewed_by`, the reviewer's+GitHub handle, and `reviewed_on`, the day, both or neither. The Python side of Statecraft.Sim.ReviewRecord (the same+rules): the tools that read status rows check it, and tools/review_queue.py leaves a signed-off row out of the queue.+Only a person writes these keys; scripts/oss/reviewed_by_guard.py refuses an AI-co-authored commit that touches them."""+from __future__ import annotations++import datetime+import re++FIELDS = ("reviewed_by", "reviewed_on")+# Letters and digits, single hyphens between them, at most 39 characters, at least one letter: never an email, an+# @-name, a display name, a bot account ("name[bot]") or a bare number (1234 is an int to some readers and text to others).+HANDLE = re.compile(r"(?=[A-Za-z0-9-]*[A-Za-z])[A-Za-z0-9](?:[A-Za-z0-9]|-(?=[A-Za-z0-9])){0,38}")+DAY = re.compile(r"\d{4}-\d{2}-\d{2}")+++def is_handle(value) -> bool:+ return isinstance(value, str) and HANDLE.fullmatch(value) is not None+++def is_day(value) -> bool:+ if isinstance(value, datetime.datetime):+ return False+ if isinstance(value, datetime.date):+ return True+ if not isinstance(value, str) or not DAY.fullmatch(value):+ return False+ try:+ datetime.date.fromisoformat(value)+ except ValueError:+ return False+ return True+++def problem(row: dict) -> tuple[str, str] | None:+ """(field, message) for what is wrong with a row's sign-off, or None when it has none or a whole one. A key that is+ present but blank counts as present."""+ by, on = "reviewed_by" in row, "reviewed_on" in row+ if not by and not on:+ return None+ if not on:+ return "reviewed_on", "required with reviewed_by: the day the person signed off (YYYY-MM-DD)"+ if not by:+ return "reviewed_by", "required with reviewed_on: the reviewer's GitHub handle"+ if not is_handle(row["reviewed_by"]):+ return "reviewed_by", "must be the reviewer's GitHub handle (letters, digits and single hyphens; no @, email or display name)"+ if not is_day(row["reviewed_on"]):+ return "reviewed_on", "must be the day of the sign-off, YYYY-MM-DD"+ return None+++def signed(row: dict) -> bool:+ """True when the row carries a whole sign-off."""+ return "reviewed_by" in row and problem(row) is Nonediff --git a/tools/routes_1948.py b/tools/routes_1948.pyindex 8649b2785..7a4a0a3ae 100644--- a/tools/routes_1948.py+++ b/tools/routes_1948.py@@ -41,6 +41,7 @@ import numpy as npfrom PIL import Imagesys.path.insert(0, str(Path(__file__).resolve().parent)) # under python -I the script's folder is not on sys.path+import review_record # noqa: E402import yaml12 # noqa: E402ROOT = Path(__file__).resolve().parents[1]@@ -453,6 +454,9 @@ def validate_routes(doc: dict, bounds: dict) -> None:raise ValueError(f"{rid}: kind (and trace, when given) must be one of {KINDS}")if r.get("status") not in STATUSES:raise ValueError(f"{rid}: status must be one of {STATUSES}")+ signoff = review_record.problem(r) # a person's sign-off beside the status (#375)+ if signoff:+ raise ValueError(f"{rid}: {signoff[0]} {signoff[1]}")if not r.get("name"):raise ValueError(f"{rid}: name required")if "opened" in r and (isinstance(r["opened"], bool) or not isinstance(r["opened"], int) or r["opened"] > 1948):diff --git a/tools/tests/data/review_record_cases.json b/tools/tests/data/review_record_cases.jsonnew file mode 100644index 000000000..d36900516--- /dev/null+++ b/tools/tests/data/review_record_cases.json@@ -0,0 +1,40 @@+{+ "about": "One list of sign-off cases (#375) that every reader must agree on: Statecraft.Sim.ReviewRecord through the sim's loader (ReviewRecordTests), tools/review_record.py and the review queue (test_review_record.py), and the Unity readers (ReviewRecordCasesTests). 'by' and 'on' are the raw YAML text after 'reviewed_by: ' and 'reviewed_on: ' (null: the key is absent). 'field' is the one each reader must name, null when the sign-off is whole; 'nonscalar' marks a value a typed reader refuses as YAML before the rule sees it.",+ "cases": [+ {"by": null, "on": null, "field": null},+ {"by": "eyalgolan", "on": "2026-10-15", "field": null},+ {"by": "'guy-shoham'", "on": "'2026-10-15'", "field": null},+ {"by": "Jeremy-Hoover1", "on": "2026-02-28", "field": null},+ {"by": "a1", "on": "2024-02-29", "field": null},+ {"by": "eyalgolan", "on": null, "field": "reviewed_on"},+ {"by": null, "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "''", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "~", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "[email protected]", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "'@eyalgolan'", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "eyal.golan", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "-eyal", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "eyal-", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "eyal--golan", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "eyal_golan", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "Eyal Golan", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "'dependabot[bot]'", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "1234", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "'1234'", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "a123456789012345678901234567890123456789", "on": "2026-10-15", "field": "reviewed_by"},+ {"by": "[eyalgolan]", "on": "2026-10-15", "field": "reviewed_by", "nonscalar": true},+ {"by": "eyalgolan", "on": "''", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "~", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "2026-1-5", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "2026-10-15 09:30", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "2026-10-15T09:30:00", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "15 October 2026", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "10/15/2026", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "2026-02-30", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "2023-02-29", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "20261015", "field": "reviewed_on"},+ {"by": "eyalgolan", "on": "[2026-10-15]", "field": "reviewed_on", "nonscalar": true}+ ]+}diff --git a/tools/tests/test_review_queue.py b/tools/tests/test_review_queue.pyindex 23f242a7d..b379903a1 100644--- a/tools/tests/test_review_queue.py+++ b/tools/tests/test_review_queue.py@@ -69,7 +69,7 @@ def test_scan_finds_flags_and_reviewed_statuses_with_their_lines():def test_queue_lists_agent_set_statuses_and_every_flag_and_counts_the_rest(tmp_path):repo = make_repo(tmp_path)- entries, human = rq.queue(repo)+ entries, human, _ = rq.queue(repo)assert [(e.kind, e.file, e.line, e.row) for e in entries] == [("flag", "content/governments.yaml", 5, "g1"),("status", "content/governments.yaml", 10, "g1"),@@ -91,7 +91,7 @@ def test_an_agent_marker_is_read_from_the_whole_message():def test_the_queue_changes_no_content(tmp_path):repo = make_repo(tmp_path)before = {p: hashlib.sha256(p.read_bytes()).hexdigest() for p in (repo / "content").rglob("*.yaml")}- entries, human = rq.queue(repo)+ entries, human, _ = rq.queue(repo)rq.page(entries, human, git(repo, "rev-parse", "HEAD").strip())assert {p: hashlib.sha256(p.read_bytes()).hexdigest() for p in (repo / "content").rglob("*.yaml")} == beforeassert git(repo, "status", "--porcelain") == ""@@ -99,7 +99,7 @@ def test_the_queue_changes_no_content(tmp_path):def test_the_page_groups_by_file_and_links_each_line(tmp_path):repo = make_repo(tmp_path)- entries, human = rq.queue(repo)+ entries, human, _ = rq.queue(repo)text = rq.page(entries, human, "0123456789abcdef")assert "at commit `01234567`" in textassert "- Hebrew names flagged `agent-checked`: **2**" in text@@ -117,7 +117,7 @@ def test_deleting_a_flag_then_regenerating_keeps_every_line_right(tmp_path):repo = make_repo(tmp_path)gov = repo / "content" / "governments.yaml"gov.write_text(gov.read_text(encoding="utf-8").replace(" name_he_review: agent-checked\n", ""), encoding="utf-8")- entries, human = rq.queue(repo)+ entries, human, _ = rq.queue(repo)assert [(e.kind, e.file, e.line, e.row) for e in entries] == [("status", "content/governments.yaml", 9, "g1"), ("flag", "content/offices.yaml", 2, "pm")]assert entries[0].checked_by.startswith("a commit with an AI co-author trailer (PR #10")@@ -132,7 +132,7 @@ def test_an_uncommitted_status_is_listed_as_not_committed_yet(tmp_path):ev = repo / "content" / "events" / "truce.yaml"ev.write_text("# a new comment line\n" + ev.read_text(encoding="utf-8").replace("status: sensitivity-reviewed", "status: historian-reviewed"),encoding="utf-8")- entries, human = rq.queue(repo)+ entries, human, _ = rq.queue(repo)truce = [e for e in entries if e.row == "truce"]assert [(e.kind, e.line, e.value, e.checked_by) for e in truce] == [("status", 6, "historian-reviewed", "not committed yet")]assert human == 0@@ -169,7 +169,7 @@ def test_an_untracked_content_file_is_scanned_and_listed_as_not_committed_yet(tm"""Independent re-review of #611 (A): git ls-files missed a new, untracked file, so its rows were never scanned."""repo = make_repo(tmp_path)(repo / "content" / "events" / "new_event.yaml").write_text(EVENT.replace("id: truce", "id: new_event"), encoding="utf-8")- entries, human = rq.queue(repo)+ entries, human, _ = rq.queue(repo)new = [e for e in entries if e.row == "new_event"]assert [(e.file, e.line, e.value, e.checked_by) for e in new] == [("content/events/new_event.yaml", 5, "sensitivity-reviewed", "not committed yet")]@@ -183,7 +183,7 @@ def test_a_whitespace_only_human_edit_does_not_hide_an_agent_set_status(tmp_pathgov = repo / "content" / "governments.yaml"gov.write_text(gov.read_text(encoding="utf-8").replace(" status: fact-checked\n", " status: fact-checked \n"), encoding="utf-8")git(repo, "commit", "-q", "-am", "content: tidy spacing (#12)")- entries, human = rq.queue(repo)+ entries, human, _ = rq.queue(repo)g1 = [e for e in entries if e.row == "g1" and e.kind == "status"]assert len(g1) == 1 and g1[0].checked_by.startswith("a commit with an AI co-author trailer (PR #10")assert human == 1@@ -196,3 +196,23 @@ def test_a_moved_tracked_file_is_a_clear_error(tmp_path, capsys):assert rq.run(repo, write=False) == 2err = capsys.readouterr().errassert "content/offices.yaml" in err and "missing from the working tree" in err+++def test_a_row_a_person_signed_off_leaves_the_queue_and_is_counted(tmp_path):+ """#375 ("Yes, humans only"): a whole reviewed_by / reviewed_on beside the status takes the row out of the queue, even+ when an agent-co-written commit last wrote the status line; a malformed sign-off does not (fail closed)."""+ repo = make_repo(tmp_path)+ gov = repo / "content" / "governments.yaml"+ gov.write_text(gov.read_text(encoding="utf-8").replace(" status: fact-checked\n",+ " status: fact-checked\n reviewed_by: eyalgolan\n reviewed_on: 2026-10-15\n"),+ encoding="utf-8")+ git(repo, "commit", "-q", "-am", "content: sign off g1 (#13)")+ entries, human, signed = rq.queue(repo)+ assert [e.row for e in entries if e.kind == "status"] == []+ assert (human, signed) == (1, 1)+ text = rq.page(entries, human, "0123456789abcdef", signed)+ assert "- signed off by a person (`reviewed_by` and `reviewed_on`; not listed): 1" in text++ gov.write_text(gov.read_text(encoding="utf-8").replace("reviewed_by: eyalgolan", "reviewed_by: [email protected]"), encoding="utf-8")+ entries, human, signed = rq.queue(repo)+ assert [e.row for e in entries if e.kind == "status"] == ["g1"] and signed == 0diff --git a/tools/tests/test_review_record.py b/tools/tests/test_review_record.pynew file mode 100644index 000000000..2a71bb6f4--- /dev/null+++ b/tools/tests/test_review_record.py@@ -0,0 +1,67 @@+"""tools/review_record.py: the shape of a person's sign-off (#375), the Python side of Statecraft.Sim.ReviewRecord."""+import datetime++import pytest++import review_record as rr++[email protected]("handle, ok", [+ ("eyalgolan", True), ("a", True), ("guy-shoham", True), ("Jeremy-Hoover1", True), ("a" * 39, True),+ ("", False), ("a" * 40, False), ("[email protected]", False), ("@eyalgolan", False), ("eyal-", False), ("-eyal", False),+ ("eyal--golan", False), ("eyal_golan", False), ("eyal.golan", False), ("Eyal Golan", False), ("dependabot[bot]", False),+ (None, False), (123, False),+])+def test_the_handle_shape_is_githubs(handle, ok):+ assert rr.is_handle(handle) is ok++[email protected]("row, field", [+ ({}, None),+ ({"reviewed_by": "eyalgolan", "reviewed_on": "2026-10-15"}, None),+ ({"reviewed_by": "eyalgolan", "reviewed_on": datetime.date(2026, 10, 15)}, None),+ ({"reviewed_by": "eyalgolan"}, "reviewed_on"),+ ({"reviewed_on": "2026-10-15"}, "reviewed_by"),+ ({"reviewed_by": None, "reviewed_on": "2026-10-15"}, "reviewed_by"),+ ({"reviewed_by": "eyalgolan", "reviewed_on": None}, "reviewed_on"),+ ({"reviewed_by": "eyalgolan", "reviewed_on": "2026-13-01"}, "reviewed_on"),+ ({"reviewed_by": "eyalgolan", "reviewed_on": "2026-10-15T10:00"}, "reviewed_on"),+])+def test_problem_names_the_field(row, field):+ got = rr.problem(row)+ assert (got[0] if got else None) == field+++# ---- the shared cases: every reader agrees on them (tools/tests/data/review_record_cases.json) ---------------------------++import json # noqa: E402+from pathlib import Path # noqa: E402++import review_queue # noqa: E402+import yaml12 # noqa: E402++CASES = json.loads((Path(__file__).parent / "data" / "review_record_cases.json").read_text(encoding="utf-8"))["cases"]+++def row_text(case, indent=" "):+ lines = [f"{indent}status: fact-checked"]+ for key in ("by", "on"):+ if case[key] is not None:+ lines.append(f"{indent}reviewed_{key}: {case[key]}".rstrip())+ return "\n".join(lines) + "\n"++[email protected]("case", CASES, ids=lambda c: f"{c['by']}|{c['on']}")+def test_the_rule_agrees_with_the_shared_cases(case):+ row = yaml12.load("rows:\n - id: a\n" + row_text(case))["rows"][0]+ got = rr.problem(row)+ assert (got[0] if got else None) == case["field"]++[email protected]("case", CASES, ids=lambda c: f"{c['by']}|{c['on']}")+def test_the_queue_agrees_with_the_shared_cases(case):+ """The queue reads raw YAML scalars, not the loader's types: it must still take a row out exactly when the rule says the+ sign-off is whole."""+ entries = review_queue.scan("rows:\n - id: a\n" + row_text(case), "content/x.yaml")+ whole = case["field"] is None and case["by"] is not None+ assert [e.kind for e in entries] == ["signed" if whole else "status"]diff --git a/tools/tests/test_routes_1948.py b/tools/tests/test_routes_1948.pyindex 39c8677d6..d0dc1529d 100644--- a/tools/tests/test_routes_1948.py+++ b/tools/tests/test_routes_1948.py@@ -236,3 +236,24 @@ def test_gaussian_smooth_flattens_a_wobble_and_keeps_a_bend():radii = np.hypot(out[5:-5, 0], out[5:-5, 1])assert radii.min() > 0.9 * r, radii.min() # the bend keeps its shapeassert rt.gaussian_smooth(arc, rt.RESAMPLE_M) == rt.gaussian_smooth(arc, rt.RESAMPLE_M) # deterministic++[email protected]("change, message", [+ ({"reviewed_by": "eyalgolan"}, "reviewed_on"),+ ({"reviewed_on": "2026-10-15"}, "reviewed_by"),+ ({"reviewed_by": "[email protected]", "reviewed_on": "2026-10-15"}, "reviewed_by"),+ ({"reviewed_by": None, "reviewed_on": "2026-10-15"}, "reviewed_by"),+ ({"reviewed_by": "eyalgolan", "reviewed_on": "15 October 2026"}, "reviewed_on"),+])+def test_validate_rejects_a_bad_sign_off(change, message):+ """A person's sign-off beside the status (#375): both or neither, a GitHub handle, a day."""+ doc = yaml12.load((ROOT / "content" / "map" / "routes_1948.yaml").read_text(encoding="utf-8"))+ doc["routes"][0].update(change)+ with pytest.raises(ValueError, match=message):+ rt.validate_routes(doc, BOUNDS)+++def test_validate_accepts_a_whole_sign_off():+ doc = yaml12.load((ROOT / "content" / "map" / "routes_1948.yaml").read_text(encoding="utf-8"))+ doc["routes"][0].update({"reviewed_by": "eyalgolan", "reviewed_on": "2026-10-15"})+ rt.validate_routes(doc, BOUNDS)diff --git a/unity/Assets/Scripts/Map/Kits/KitPopulation.cs b/unity/Assets/Scripts/Map/Kits/KitPopulation.csindex 6204dbe5b..e126e774f 100644--- a/unity/Assets/Scripts/Map/Kits/KitPopulation.cs+++ b/unity/Assets/Scripts/Map/Kits/KitPopulation.cs@@ -25,6 +25,14 @@ namespace Statecraft.Game.Map.Kitspublic string ListedAs { get; set; } = "";public string Note { get; set; } = "";public string Status { get; set; } = "";+ /// <summary>A person's sign-off beside the status (#375, "humans only"): both or neither, a GitHub handle and a day;+ /// Statecraft.Sim.ReviewRecord checks them. A key that is present but blank counts as present.</summary>+ public string? ReviewedBy { get => reviewedBy; set { reviewedBy = value; ReviewedByGiven = true; } }+ [YamlIgnore] public bool ReviewedByGiven { get; private set; }+ string? reviewedBy;+ public string? ReviewedOn { get => reviewedOn; set { reviewedOn = value; ReviewedOnGiven = true; } }+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;public List<SourceRef> Sources { get; set; } = new List<SourceRef>();}@@ -34,7 +42,7 @@ namespace Statecraft.Game.Map.Kits/// <summary>Parses the file. Every malformed input throws InvalidDataException naming <paramref name="file"/> (and the/// id): YAML errors, unknown keys, an empty or non-snake_case or duplicate id, a negative population, a status other- /// than owner-verify / fact-checked / verified, no sources, a source with an empty url or checked. A null population+ /// than owner-verify / fact-checked / verified, a bad sign-off (reviewed_by / reviewed_on), no sources, a source with an empty url or checked. A null population/// (a place the source does not list) is kept out of the table.</summary>public static Dictionary<string, int> Parse(string yaml, string file = FileName){@@ -51,6 +59,8 @@ namespace Statecraft.Game.Map.Kitsif (!seen.Add(r.Id)) throw new InvalidDataException($"{at} duplicate id");if (r.Population < 0) throw new InvalidDataException($"{at} population {r.Population} is negative");if (!Statuses.Contains(r.Status ?? "")) throw new InvalidDataException($"{at} status '{r.Status}' is not owner-verify, fact-checked or verified");+ var signOff = Statecraft.Sim.ReviewRecord.Problem(r.ReviewedByGiven, r.ReviewedBy, r.ReviewedOnGiven, r.ReviewedOn);+ if (signOff != null) throw new InvalidDataException($"{at} {signOff.Value.field}: {signOff.Value.message}");if (r.Sources == null || r.Sources.Count == 0) throw new InvalidDataException($"{at} sources is empty");for (int i = 0; i < r.Sources.Count; i++)if (string.IsNullOrWhiteSpace(r.Sources[i]?.Url) || string.IsNullOrWhiteSpace(r.Sources[i].Checked))diff --git a/unity/Assets/Scripts/Map/Kits/Localities.cs b/unity/Assets/Scripts/Map/Kits/Localities.csindex 2f540881f..f1cb4a01f 100644--- a/unity/Assets/Scripts/Map/Kits/Localities.cs+++ b/unity/Assets/Scripts/Map/Kits/Localities.cs@@ -165,6 +165,7 @@ namespace Statecraft.Game.Map.Kitspublic string Match { get; set; } = ""; public bool OwnerVerify { get; set; } public string Wikidata { get; set; } = "";public string? DraftId { get; set; } public string? Note { get; set; }public string Checked { get; set; } = ""; public string Status { get; set; } = "";+ public bool ReviewedByGiven, ReviewedOnGiven; public string ReviewedBy = "", ReviewedOn = "";public List<SourceRow> Sources { get; set; } = new List<SourceRow>();public int Line, SourceCount;}@@ -174,6 +175,7 @@ namespace Statecraft.Game.Map.Kitspublic string Subdistrict { get; set; } = ""; public int Population { get; set; } = -1;public List<string> ListedAs { get; set; } = new List<string>(); public string? Note { get; set; }public string Checked { get; set; } = ""; public string Status { get; set; } = "";+ public bool ReviewedByGiven, ReviewedOnGiven; public string ReviewedBy = "", ReviewedOn = "";public List<SourceRow> Sources { get; set; } = new List<SourceRow>();public int Line, SourceCount;}@@ -280,6 +282,8 @@ namespace Statecraft.Game.Map.Kitsthrow new InvalidDataException($"{at} lon/lat {p.Lon}, {p.Lat} missing or outside the map");if (p.Population < 1) throw new InvalidDataException($"{at} population {p.Population} is not a count of people");CheckSourced(at, p.Status, p.Checked, p.Sources, runtime ? p.SourceCount : p.Sources.Count);+ var signOffp = Statecraft.Sim.ReviewRecord.Problem(p.ReviewedByGiven, p.ReviewedBy, p.ReviewedOnGiven, p.ReviewedOn); // #375; the YAML only (the runtime form does not carry it)+ if (signOffp != null) throw new InvalidDataException($"{at} {signOffp.Value.field}: {signOffp.Value.message}");if (p.NameHeSources.Count > 0 && string.IsNullOrWhiteSpace(p.NameHe)) throw new InvalidDataException($"{at} name_he_sources without a name_he");// Absent (a person has reviewed the name) or exactly agent-checked: blank, null or a list is neither.if (p.NameHeReviewGiven && p.NameHeReview != "agent-checked")@@ -304,6 +308,8 @@ namespace Statecraft.Game.Map.Kitsif (!subs.Add(a.Subdistrict)) throw new InvalidDataException($"{at} duplicate subdistrict");if (a.Population < 1) throw new InvalidDataException($"{at} population {a.Population} is not a count of people");CheckSourced(at, a.Status, a.Checked, a.Sources, runtime ? a.SourceCount : a.Sources.Count);+ var signOffa = Statecraft.Sim.ReviewRecord.Problem(a.ReviewedByGiven, a.ReviewedBy, a.ReviewedOnGiven, a.ReviewedOn); // #375; the YAML only (the runtime form does not carry it)+ if (signOffa != null) throw new InvalidDataException($"{at} {signOffa.Value.field}: {signOffa.Value.message}");doc.Encampments.Add(new Area { Subdistrict = a.Subdistrict, Population = a.Population, Sources = runtime ? a.SourceCount : a.Sources.Count });}return doc;@@ -317,10 +323,10 @@ namespace Statecraft.Game.Map.Kitsstatic readonly HashSet<string> PlaceKeys = new HashSet<string>{"id", "name", "name_basis", "today", "name_he", "name_ar", "lon", "lat", "kind", "type", "landmark", "population",- "listed_as", "match", "owner_verify", "wikidata", "draft_id", "note", "checked", "status", "sources", "name_he_sources", "name_he_review",+ "listed_as", "match", "owner_verify", "wikidata", "draft_id", "note", "checked", "status", "sources", "name_he_sources", "name_he_review", "reviewed_by", "reviewed_on",};static readonly HashSet<string> NameSourceKeys = new HashSet<string> { "url", "checked" };- static readonly HashSet<string> AreaKeys = new HashSet<string> { "subdistrict", "population", "listed_as", "note", "checked", "status", "sources" };+ static readonly HashSet<string> AreaKeys = new HashSet<string> { "subdistrict", "population", "listed_as", "note", "checked", "status", "sources", "reviewed_by", "reviewed_on" };static readonly HashSet<string> TodayKeys = new HashSet<string> { "name", "name_he", "source" };static FileRow Read(string yaml, string file)@@ -345,6 +351,7 @@ namespace Statecraft.Game.Map.KitsLon = Num(m, "lon", at), Lat = Num(m, "lat", at), Population = (int)Num(m, "population", at, -1),Today = t == null ? null : new TodayRow { Name = Str(t, "name"), NameHe = Str(t, "name_he"), Source = Str(t, "source") },Checked = Str(m, "checked"), Status = Str(m, "status"), Sources = Sources(m, at), Line = m.Line,+ ReviewedByGiven = m.ContainsKey("reviewed_by"), ReviewedBy = Str(m, "reviewed_by"), ReviewedOnGiven = m.ContainsKey("reviewed_on"), ReviewedOn = Str(m, "reviewed_on"),});}foreach (var o in List(root, "encampments", file))@@ -356,6 +363,7 @@ namespace Statecraft.Game.Map.Kits{Subdistrict = Str(m, "subdistrict"), Population = (int)Num(m, "population", at, -1),Checked = Str(m, "checked"), Status = Str(m, "status"), Sources = Sources(m, at), Line = m.Line,+ ReviewedByGiven = m.ContainsKey("reviewed_by"), ReviewedBy = Str(m, "reviewed_by"), ReviewedOnGiven = m.ContainsKey("reviewed_on"), ReviewedOn = Str(m, "reviewed_on"),});}return f;diff --git a/unity/Assets/Scripts/Map/Units/UnitData.cs b/unity/Assets/Scripts/Map/Units/UnitData.csindex 02e06ffd7..038e4b902 100644--- a/unity/Assets/Scripts/Map/Units/UnitData.cs+++ b/unity/Assets/Scripts/Map/Units/UnitData.cs@@ -85,6 +85,14 @@ namespace Statecraft.Game.Map.Unitspublic string Sector { get; set; } = "";public bool WikipediaOnly { get; set; }public string Status { get; set; } = "";+ /// <summary>A person's sign-off beside the status (#375, "humans only"): both or neither, a GitHub handle and a day;+ /// Statecraft.Sim.ReviewRecord checks them. A key that is present but blank counts as present.</summary>+ public string? ReviewedBy { get => reviewedBy; set { reviewedBy = value; ReviewedByGiven = true; } }+ [YamlIgnore] public bool ReviewedByGiven { get; private set; }+ string? reviewedBy;+ public string? ReviewedOn { get => reviewedOn; set { reviewedOn = value; ReviewedOnGiven = true; } }+ [YamlIgnore] public bool ReviewedOnGiven { get; private set; }+ string? reviewedOn;/// <summary>Why the map does not draw the unit (the sources name it but do not place it), or null.</summary>public string? Hidden { get; set; }public List<string>? ToVerify { get; set; }@@ -180,6 +188,8 @@ namespace Statecraft.Game.Map.Unitsif (!ids.Add(u.Id)) throw new InvalidDataException($"{at} duplicate id");if (!Services.Contains(u.Service)) throw new InvalidDataException($"{at} has unknown service '{u.Service}' (army, air or navy)");if (string.IsNullOrWhiteSpace(u.Name) || string.IsNullOrWhiteSpace(u.Sector)) throw new InvalidDataException($"{at} needs a name and a sector");+ var signOff = Statecraft.Sim.ReviewRecord.Problem(u.ReviewedByGiven, u.ReviewedBy, u.ReviewedOnGiven, u.ReviewedOn);+ if (signOff != null) throw new InvalidDataException($"{at} {signOff.Value.field}: {signOff.Value.message}");if (u.Disbanded != null){try { Day(u.Disbanded.Date); }diff --git a/unity/Assets/Tests/EditMode/KitTests.cs b/unity/Assets/Tests/EditMode/KitTests.csindex 69e61ffbc..45d0ea78b 100644--- a/unity/Assets/Tests/EditMode/KitTests.cs+++ b/unity/Assets/Tests/EditMode/KitTests.cs@@ -491,6 +491,14 @@ public class KitTestsBad("places:\n" + Place("a").Replace("https://example.org/x", "example.org/x"), "URL");Bad("places:\n" + Place("a", " fate: x\n"), "fate");Bad("places:\n" + Place("a", " today:\n name: Y\n") , "today");+ // A person's sign-off (#375): both or neither, a GitHub handle (never an email), a day; on a place or a camp row.+ Assert.AreEqual(1, Localities.Parse("places:\n" + Place("a", " reviewed_by: eyalgolan\n reviewed_on: '2026-10-15'\n"), b, reserved, "loc.yaml").Places.Count);+ Bad("places:\n" + Place("a", " reviewed_by: eyalgolan\n"), "reviewed_on");+ Bad("places:\n" + Place("a", " reviewed_on: '2026-10-15'\n"), "reviewed_by");+ Bad("places:\n" + Place("a", " reviewed_by: [email protected]\n reviewed_on: '2026-10-15'\n"), "reviewed_by");+ Bad("places:\n" + Place("a", " reviewed_by: ''\n reviewed_on: '2026-10-15'\n"), "reviewed_by");+ Bad("places:\n" + Place("a", " reviewed_by: eyalgolan\n reviewed_on: 15 October\n"), "reviewed_on");+ Bad("places:\n" + Place("a") + "encampments:\n- subdistrict: gaza\n population: 500\n reviewed_by: eyalgolan\n" + src, "reviewed_on");// #558: name_he_sources need the name, and each source an https url and a checked date.Bad("places:\n" + Place("a", " name_he_sources:\n - {url: 'https://he.wikipedia.org/x', checked: '2026-10-14'}\n"), "name_he_sources without a name_he");Bad("places:\n" + Place("a", " name_he: \"\\u05D0\"\n name_he_sources:\n - {url: 'https://he.wikipedia.org/x'}\n"), "name_he_sources[0]");@@ -808,6 +816,10 @@ public class KitTestsBad("settlements:\n- id: a\n population: 1\n status: owner-verify\n" + src + "- id: a\n population: 2\n status: owner-verify\n" + src, "duplicate");Bad("settlements:\n- id: A\n population: 1\n status: owner-verify\n" + src, "snake_case");Bad("settlements:\n- id: a\n people: 1\n", "people");+ // A person's sign-off (#375): both or neither, a GitHub handle, a day.+ Bad("settlements:\n- id: a\n population: 1\n status: verified\n reviewed_by: eyalgolan\n" + src, "reviewed_on");+ Bad("settlements:\n- id: a\n population: 1\n status: verified\n reviewed_by: [email protected]\n reviewed_on: '2026-10-15'\n" + src, "reviewed_by");+ Assert.AreEqual(1, KitPopulation.Parse("settlements:\n- id: a\n population: 1\n status: verified\n reviewed_by: eyalgolan\n reviewed_on: '2026-10-15'\n" + src, "pop.yaml").Count);}[Test]diff --git a/unity/Assets/Tests/EditMode/ReviewRecordCasesTests.cs b/unity/Assets/Tests/EditMode/ReviewRecordCasesTests.csnew file mode 100644index 000000000..49bb8362d--- /dev/null+++ b/unity/Assets/Tests/EditMode/ReviewRecordCasesTests.cs@@ -0,0 +1,58 @@+#nullable enable+using System.Collections.Generic;+using System.IO;+using NUnit.Framework;+using Statecraft.Game;+using Statecraft.Game.Map.Kits;+using Statecraft.Game.Map.Units;+using YamlDotNet.Serialization;++/// <summary>A person's sign-off (#375) reads the same in every reader: the map's three readers here take the one shared+/// list of cases (tools/tests/data/review_record_cases.json) that the sim's loader (ReviewRecordTests) and the Python+/// tools (test_review_record.py) also take.</summary>+public class ReviewRecordCasesTests+{+ public sealed class Case+ {+ public string? By, On, Field; public bool NonScalar;+ public override string ToString() => $"{By ?? "(absent)"} | {On ?? "(absent)"}";+ }++ public static IEnumerable<Case> Cases()+ {+ var path = Path.Combine(Paths.RepoRoot, "tools", "tests", "data", "review_record_cases.json");+ // JSON is YAML: YamlDotNet keeps null (the key is absent) apart from "" (the key is there, blank).+ var doc = new DeserializerBuilder().Build().Deserialize<Dictionary<string, object>>(File.ReadAllText(path));+ foreach (Dictionary<object, object?> c in (List<object>)doc["cases"])+ yield return new Case+ {+ By = c["by"] as string, On = c["on"] as string, Field = c["field"] as string,+ NonScalar = c.TryGetValue("nonscalar", out var n) && n as string == "true",+ };+ }++ static string Lines(Case c, string indent) =>+ (c.By == null ? "" : (indent + "reviewed_by: " + c.By).TrimEnd() + "\n") + (c.On == null ? "" : (indent + "reviewed_on: " + c.On).TrimEnd() + "\n");++ static void Expect(Case c, TestDelegate parse)+ {+ if (c.Field == null) { Assert.DoesNotThrow(parse); return; }+ var ex = Assert.Throws<InvalidDataException>(parse);+ if (!c.NonScalar) StringAssert.Contains(c.Field, ex.Message);+ }++ [TestCaseSource(nameof(Cases))]+ public void LocalitiesAgree(Case c) => Expect(c, () => Localities.Parse(+ "places:\n- id: a\n name: X\n lon: 35.0\n lat: 32.0\n type: village\n landmark: mosque\n population: 1200\n" + Lines(c, " ")+ + " checked: '2026-10-11'\n status: draft\n sources:\n - https://example.org/x\n", (34.2, 35.9, 29.45, 33.35), new[] { "tel_aviv" }, "loc.yaml"));++ [TestCaseSource(nameof(Cases))]+ public void ThePopulationFileAgrees(Case c) => Expect(c, () => KitPopulation.Parse(+ "settlements:\n- id: a\n population: 1\n status: verified\n" + Lines(c, " ")+ + " sources:\n - url: https://example.org/x\n checked: '2026-10-11'\n", "pop.yaml"));++ [TestCaseSource(nameof(Cases))]+ public void TheUnitsFileAgrees(Case c) => Expect(c, () => UnitData.Parse(+ "units:\n- id: a\n name: A\n number: '1'\n service: army\n sector: s\n status: draft\n wikipedia_only: true\n" + Lines(c, " ")+ + " anchors:\n - {place: P, lon: 34.8, lat: 32.0, from: '1948-05-15', to: '1948-06-01', end_basis: source, end_note: n, sources: [{url: 'https://x.org', checked: '2026-10-11'}]}\n", "u.yaml"));+}diff --git a/unity/Assets/Tests/EditMode/ReviewRecordCasesTests.cs.meta b/unity/Assets/Tests/EditMode/ReviewRecordCasesTests.cs.metanew file mode 100644index 000000000..c4f370224--- /dev/null+++ b/unity/Assets/Tests/EditMode/ReviewRecordCasesTests.cs.meta@@ -0,0 +1,2 @@+fileFormatVersion: 2+guid: eee3b787b481e4ed98c5b06651f3bdd1\ No newline at end of filediff --git a/unity/Assets/Tests/EditMode/UnitsInPlayTests.cs b/unity/Assets/Tests/EditMode/UnitsInPlayTests.csindex 60b840be7..2e44499df 100644--- a/unity/Assets/Tests/EditMode/UnitsInPlayTests.cs+++ b/unity/Assets/Tests/EditMode/UnitsInPlayTests.cs@@ -124,6 +124,11 @@ public class UnitsInPlayTests[TestCase("units:\n- {id: a, name: A, number: '1', service: army, sector: s, status: draft, wikipedia_only: true, headgear: [wool_cap, wool_cap, wool_cap], anchors: [" + Anchor + "]}", "headgear has no source")][TestCase("units:\n- {id: a, name: A, number: '1', service: air, sector: s, status: draft, wikipedia_only: true, anchors: [" + Anchor + "]}", "without aircraft")][TestCase("units:\n- {id: a, name: A, number: '1', service: army, colour: red, sector: s, status: draft, wikipedia_only: true, anchors: []}", "colour")]+ // A person's sign-off (#375): both or neither, a GitHub handle (never an email), a day.+ [TestCase("units:\n- {id: a, name: A, number: '1', service: army, sector: s, status: draft, reviewed_by: eyalgolan, wikipedia_only: true, anchors: [" + Anchor + "]}", "reviewed_on")]+ [TestCase("units:\n- {id: a, name: A, number: '1', service: army, sector: s, status: draft, reviewed_by: [email protected], reviewed_on: '2026-10-15', wikipedia_only: true, anchors: [" + Anchor + "]}", "reviewed_by")]+ [TestCase("units:\n- {id: a, name: A, number: '1', service: army, sector: s, status: draft, reviewed_by: eyalgolan, reviewed_on: soon, wikipedia_only: true, anchors: [" + Anchor + "]}", "reviewed_on")]+ [TestCase("units:\n- {id: a, name: A, number: '1', service: army, sector: s, status: draft, reviewed_by: '', reviewed_on: '2026-10-15', wikipedia_only: true, anchors: [" + Anchor + "]}", "reviewed_by")]public void BadUnitFilesNameTheFileAndTheProblem(string yaml, string expected){var e = Assert.Throws<InvalidDataException>(() => UnitData.Parse(yaml, "u.yaml"));@@ -131,6 +136,13 @@ public class UnitsInPlayTestsStringAssert.Contains(expected, e.Message);}+ [Test]+ public void AUnitSignOffParses()+ {+ var u = UnitData.Parse("units:\n- {id: a, name: A, number: '1', service: army, sector: s, status: draft, reviewed_by: eyalgolan, reviewed_on: '2026-10-15', wikipedia_only: true, anchors: [" + Anchor + "]}", "u.yaml");+ Assert.AreEqual(("eyalgolan", "2026-10-15"), (u[0].ReviewedBy, u[0].ReviewedOn));+ }+[Test]public void AMissingOrBrokenFileDrawsNoUnitsAndWarns(){