Skip to content

Gate: the newest period's reach rows must be what rule_reach.csv says now - #25

Merged
mmcky merged 2 commits into
mainfrom
fix/reach-history-stale
Sep 1, 2026
Merged

mmcky merged 2 commits into
mainfrom
fix/reach-history-stale

Conversation

@mmcky

@mmcky mmcky commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Closes #21 — the reach half; the score half landed in #23.

rule_reach_history.csv is written by qestyle_scan.py --append-history, an optional flag, and the file is committed. So a scan run without it does not leave the file absent — it leaves the previous run's rows present under the current period's label. rule_reach.csv moves, the history does not, and everything that reads the history (the trend chart, check_narrative, the front page's trend sentence) is happy with the stale row.

What changes

New check_reach_history in the gate. Both files are written from the same counts, so the newest period's history rows must equal rule_reach.csv per rule — lectures_affected and total_occurrences, rule sets equal in both directions — its corpus_size must be snapshot.json's n_lectures, and share_pct must be reach / corpus_size. Green on main today (35 of 35 rules agree). Runbook and pass-measure now say the gate enforces --append-history instead of asking people to remember it.

Verified

mutation result
unmodified tree pass
one occurrence count changed in the history FAIL, names the rule and both values
a rule missing from the history FAIL — "--append-history was not run"
a rule missing from rule_reach.csv FAIL — "the history is from another run"
corpus_sizen_lectures FAIL
rule_reach.csv absent FAIL, no traceback
the real #21 shape: scan re-run, history not FAIL

Not in this PR

Making --period / --append-history mandatory in the scan (the prevention half) touches qestyle_scan.py, which moves the checker digest and forces a re-measure of both periods. It is bundled with the other two scan-side changes in #24, to be taken with the next detector change. Checker digest unchanged here (aef064f3b260).

🤖 Generated with Claude Code

… now

rule_reach_history.csv is written by --append-history, an optional flag, and
the file is committed — so a scan run without it leaves the previous run's
rows present under the current period's label. rule_reach.csv moves, the
history does not, and every reader of the history (the trend chart, the
narrative claims) is happy with the stale row (#21). Both files are written
from the same counts, so check_reach_history holds the newest period's rows to
rule_reach.csv per rule (both columns, both directions), its corpus_size to
snapshot.json's n_lectures, and share_pct to reach / corpus_size. Six
mutations tested, all caught, including the real shape: scan re-run,
--append-history not.

Runbook and pass-measure now say the gate enforces the flag rather than
asking people to remember it. The prevention half — making the flags
mandatory in the scan — moves the checker digest and is bundled for the next
detector change in #24.

Closes #21

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Copilot AI lite review requested due to automatic review settings September 1, 2026 04:18

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a new consistency-gate check to prevent publishing a stale rule_reach_history.csv “latest period” row when a scan is run without --append-history, and updates the runbook/skill docs to reflect that the gate now enforces this invariant (reach half of #21).

Changes:

  • Add check_reach_history to tools/qestyle_check.py to hold the newest period’s history rows to rule_reach.csv and snapshot.json.
  • Update UPDATE.md and pass-measure skill text to document that --append-history is effectively mandatory because the gate now fails on stale reach history rows.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
tools/qestyle_check.py Introduces the new reach-history gate check and wires it into main().
UPDATE.md Updates the runbook narrative + adds a new “Reach history” row to the consistency checks table.
.claude/skills/pass-measure/SKILL.md Aligns the measurement skill instructions with the new enforced reach-history invariant.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread UPDATE.md Outdated
Comment thread tools/qestyle_check.py Outdated
… and the message

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@mmcky
mmcky merged commit 28d8f44 into main Sep 1, 2026
2 checks passed
@mmcky
mmcky deleted the fix/reach-history-stale branch September 1, 2026 04:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The gate cannot tell a stale history row from a current one

2 participants