Files
CatoandClaude Opus 5 f29463cabe feat(ci): catch a doc that restates the entity list instead of pointing at it (#108)
An entity is anything that can hold a wallet and is better for holding one.
The list of types has one producer, `orangecat/src/config/entity-registry.ts`.
Measured 2026-09-17: THREE copies of that list lived in orangecat's own
agent-read docs and all three disagreed. One named `organization`, which has
never been an entity type. Another omitted six that are. These are the files a
coding agent reads before it touches anything, so each copy was quietly
teaching a wrong list, and nothing broke loudly enough for anyone to notice.

The copies are gone (bitbaum/orangecat#1071). This is the gate that stops the
fourth one.

## Why it is structural and not a word count

The obvious detector — "a doc naming 4+ type names is restating the list" — was
written, run against all 48 repos, and REJECTED. Its only finding was a false
positive on the sentence that FIXES the problem:

    ... it named `organization`, which has never been an entity type, and
    omitted six that are — `document`, `group`, `investment`, `research`,
    `wallet`, `wishlist`.

A detector whose first finding is its own remedy trains people to ignore it.
The second false positive was a legitimate code example.

So a restatement is the list PRESENTED AS THE LIST — a shape, not a vocabulary.
A fenced block with 4+ lines each naming one type (the `type EntityType = |
'product'` shape), or 4+ consecutive list/table rows each naming one. Prose is
never counted, however many names it holds, because prose that names types is
explaining them rather than defining them.

## Proven in both directions, and by mutation

`test_entity_drift.py` runs on the REAL historical text rather than invented
fixtures — proving a detector against fixtures its author invented proves only
that the author can invent suitable fixtures. All three copies must fire; both
real false positives must not; three list lines must stay under the threshold.
Seven cases, no network, no checkout. Wired into ci.yml beside the other
"still detects, still stays quiet" self-tests.

The audit itself is proven by MUTATION, which is the part a green gate cannot
tell you. `REF_OVERRIDE` pins a repo to a ref, so the sweep can be re-run
against the commit BEFORE the copies were removed:

    orangecat pinned at 55e431ee^
    NEW orangecat/.claude/CLAUDE.md:28    LIST, 10 type lines
    NEW orangecat/.claude/CLAUDE.md:109   LIST, 14 type lines
    NEW orangecat/.claude/rules/domain-specific.md:138  FENCE, 9 type lines
    exit 1

Against today's main: 97 docs across 48 repos, zero findings, exit 0. A gate
that has never fired is indistinguishable from a clean fleet, and this one
would otherwise have gone green forever on its first day.

## Two deliberate details

The baseline ships EMPTY and says why in the file. Three copies existed, all
three were replaced, and a full sweep found no others — so the first line added
there is a regression, not a backlog item.

It reports SKIPPED loudly when it cannot list repos. A vacuous pass reads
exactly like coverage, which is the failure mode already documented for
hosted-supabase-audit.

`audit-health.yml` picks this up with no change: it audits every workflow not
on its own exclusion list.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-17 07:22:56 -07:00

46 lines
1.8 KiB
YAML

# A doc that RESTATES the entity list instead of pointing at its producer.
#
# An entity is anything that can hold a wallet and is better for holding one.
# The list of types has one producer, orangecat/src/config/entity-registry.ts.
# On 2026-09-17 THREE copies of it lived in orangecat's own agent-read docs and
# all three disagreed: one named `organization`, which has never been a type,
# another omitted six that are. Nothing broke loudly — a wrong list in a doc
# just teaches every coding agent that reads it, quietly, for months.
#
# The rules are proven BEFORE the run that judges the fleet. The first version
# of this detector counted type names, and its only finding across the whole
# org was the SENTENCE THAT FIXES THE PROBLEM — so the self-test pins the real
# historical text of all three copies and both of those false positives.
# A detector whose first finding is its own remedy trains people to ignore it.
#
# On the schedule: GitHub does not honour `schedule:` reliably here, so the
# cron below is a free second chance rather than the clock. Dispatch it by hand
# when the answer matters.
name: Entity drift
on:
workflow_dispatch: {}
schedule:
- cron: '41 6 * * *'
permissions:
contents: read
jobs:
audit:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v7
- name: Prove the rules, both directions
run: python3 scripts/ci/test_entity_drift.py
- name: Sweep every default branch
env:
# Reading PRIVATE repos needs the org PAT; GITHUB_TOKEN sees only this
# one. A sweep that silently skipped the private repos would report a
# smaller fleet as a clean one.
GH_TOKEN: ${{ secrets.FLEET_PAT || secrets.GITHUB_TOKEN }}
run: python3 scripts/ci/entity-drift-audit.py --check | tee -a "$GITHUB_STEP_SUMMARY"