Skip to content

Adds a test keeping new tracker ids out of lib/ - #174

Merged
johnnyt merged 1 commit into
mainfrom
se-l9xx-lib-prose-tracker-ids
Sep 30, 2026
Merged

johnnyt merged 1 commit into
mainfrom
se-l9xx-lib-prose-tracker-ids

Conversation

@johnnyt

@johnnyt johnnyt commented Sep 30, 2026

Copy link
Copy Markdown
Member

What

A new test, StatifierExamples.TrackerIdTest, refuses a new tracker id in any file under lib/. A tracker id is a family tracker prefix, a dash and three or four base36 characters; in a moduledoc or a comment it points a reader at an issue instead of saying what the code does.

lib/ already carries such ids, so the test works the way StatifierExamples.PrivateIdTest does: a committed baseline, test/fixtures/tracker_id_baseline.txt, counts the ids each lib/ file carries at this commit. A count above the baseline fails, naming the file and the id; a count below it fails too, naming the baseline line to lower or delete, so an id that leaves a file cannot come back unseen. CSS class names of the same shape are excluded by name (sr-only); longer class prefixes such as sb-editor never match the shape. The test globs lib/ at run time, so a file added later is covered the moment it exists.

Provenance

  • The bead read lib/ as already free of tracker ids. It is not: the ids are in moduledocs and comments across lib/statifier_examples/ and lib/statifier_examples_web/ (the baseline lists every one). A test that forbids every id outright would be red at the tip, so this PR takes the baseline shape of private_id_test.exs instead, chosen in this PR as a test-shape choice. Rewriting the existing ids into their substance is left as a follow-up; each rewrite lowers a baseline line, and the second assertion makes that lowering required.
  • No lib/ file changes in this PR.

Checks

  • Sabotage, each run and reverted from a copy: an invented id planted in charts/fixture.ex's moduledoc, a second copy of an id documents.ex already carries, and the id removed from charts/fan_out.ex's moduledoc each turned "no lib/ file gains a tracker id" red on its assertion; dropping only from the excluded class words and shortening the id shape to three characters each turned the pattern test red on its assertion. The one-line notes sit above each test.
  • Full mix quality green on the committed tree: format, compile, credo, dialyzer, deps, and the full suite with coverage.

In-turn review

I re-read the diff against the bead: its acceptance asks for a test that fails when a tracker-id shape appears in a lib/ moduledoc or comment, CSS classes allowed, sabotaged with an injected id and green at the tip. The planted-id sabotage above is the injected id; the sr-only and sb-editor negatives in the pattern test are the CSS allowance; the suite is green at the tip. I checked the prefix list against every family tracker's prefix, and checked every non-id match of the shape in lib/ today (there is one, sr-only in core_components.ex). The moduledoc's "What it does not catch" list names the known gaps: a prefix not yet listed, an id spelling an excluded class word, and a baseline line added beside a new id.

lib/ moduledocs and comments carry tracker ids that point a reader at
an issue instead of saying what the code does. The new test refuses a
new one: a committed baseline counts the ids each lib/ file carries
today, a count above it fails naming the file and the id, and a count
below it fails naming the baseline line to lower, so an id that
leaves a file cannot come back unseen. CSS class names of the same
shape (sr-only) are excluded by name.

Refs: se-l9xx
@johnnyt
johnnyt merged commit d09c7c2 into main Sep 30, 2026
3 checks passed
@johnnyt
johnnyt deleted the se-l9xx-lib-prose-tracker-ids branch September 30, 2026 10:59
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.

1 participant