Skip to content

Tighten the docs, and stop testing them editorially - #17

Merged
jbloom merged 1 commit into
mainfrom
docs-accuracy-pass
Aug 31, 2026
Merged

jbloom merged 1 commit into
mainfrom
docs-accuracy-pass

Conversation

@jbloom

@jbloom jbloom commented Aug 31, 2026

Copy link
Copy Markdown
Member

Follows the hand-editing of docs/ to cut implementation detail. Checking the shortened prose against the code turned up several places where it had changed a claim into a false one.

Accuracy fixes

  • The CSV's representation column is additive. It had been rewritten as "how residue is drawn", but annotation_rows sets extra_rep alongside base_rep, and docs/spec.md still said "added on top" — the two pages contradicted each other. That additivity is what produces the cartoon-plus-sticks figure.
  • Unlisted heteroatoms do not take default_color. The het_layer components deliberately get no color node, so an unlisted ligand, ion or glycan keeps Mol*'s element coloring or its SNFG symbol.
  • Two wrong counts in docs/examples.md. d-3-1-to-d-3-1-1.csv was called "12 sites"; it is 12 rows over 4 sites, one row per protomer. Same error in the row below it. Verified by counting unique residues.
  • docs/index.md said residues are styled from a YAML file. They are styled from the CSV; the YAML is the spec that names it. README.md already said CSV.
  • The Labels checkbox appears when a label was actually drawn, not whenever the CSV asks for one — a row naming a residue the view excludes draws nothing and is reported as a warning.
  • assembly was marked au "(default)" although it is a required top-level key, and the orientation section no longer said which of its four keys are required (position/target are; up/radius are not).

Plus a broken bold marker (**…*) in the H1 example intro, the typos (HTmL, esidue, hiddien, "are shown are hidden", "lastest"), and a rewrap to the ~90 columns the rest of docs/ uses. Reset view gets back the one clause saying why it exists.

Anchor validation moves to mkdocs

validation.links.anchors: warn in mkdocs.yml replaces test_cross_page_anchors_resolve and the _heading_anchors helper. MkDocs resolves anchors from the rendered HTML, so it also covers the mkdocstrings headings on python-api.md that the hand-rolled slugify could not see. Verified it fails the build rather than passing silently:

WARNING - Doc file 'viewer.md' contains a link 'internals.md#no-such-heading',
          but the doc 'internals.md' does not contain an anchor '#no-such-heading'.
Aborted with 1 warnings in strict mode!

The check moves from the pytest job to the docs job; docs.yml already builds on pull_request, so CI coverage is unchanged.

That also removes a "negative control" asserting docs/spec.md contained a specific internals.md#… link. It pinned an editorial choice — cutting one sentence failed a test with nothing actually wrong — and it did not even exercise the regex it claimed to guard, matching a different pattern from the sweep's. The same content-pinning assertion (>= 10 repo links in examples.md) is dropped from the repo-link control.

tests/test_docs.py: 8 tests → 5. The three that catch genuinely silent breakage nothing else enforces (Mol\* escaping, blob/main/ links, OPTION_DOCS → docs/spec.md) all stay. CLAUDE.md gains the rule this follows.

Verification

scripts/check.sh — 215 passed. scripts/build_docs.sh — mkdocs build --strict clean with anchor validation on.

No changes to config.yml or data/; no renderer or template changes, so nothing about what gets rendered changes.

🤖 Generated with Claude Code

The docs were shortened by hand to cut implementation detail. Checking the
result against the code turned up several places where the shortening had
changed a claim into a false one:

- The CSV's `representation` column was described as how a residue is drawn.
  It is additive: `annotation_rows` sets `extra_rep` alongside `base_rep`, and
  `docs/spec.md` still said "added on top", so the two pages contradicted each
  other. That additivity is what produces cartoon-plus-sticks.
- `docs/csv-schema.md` said every residue without a row takes `default_color`.
  The `het_layer` components deliberately get no color node, so an unlisted
  ligand, ion or glycan keeps element coloring or its SNFG symbol.
- `docs/examples.md` called `d-3-1-to-d-3-1-1.csv` "12 sites". It is 12 rows
  over 4 sites, one per protomer; same error in the row below it.
- `docs/index.md` said residues are styled from a YAML file. They are styled
  from the CSV; the YAML is the spec that names it.
- The Labels checkbox appears when a label was actually *drawn*, not whenever
  the CSV asks for one -- a row naming a residue the view excludes draws
  nothing and is reported as a warning.
- `assembly` was marked "(default) au" although it is a required top-level key,
  and the orientation section no longer said which of its four keys are
  required.

Also restores the one-clause reason **Reset view** exists (a representation
added from Mol*'s Components panel arrives uncolored), fixes a broken bold
marker and several typos, and rewraps to the ~90 columns the rest of docs/ uses.

Anchor validation moves from a hand-rolled test to mkdocs' own
`validation.links.anchors`, which resolves anchors from the rendered HTML and
so also covers the mkdocstrings headings on python-api.md that the test's
slugify approximation could not see. That removes `_heading_anchors`, its
sweep, and a "negative control" that asserted docs/spec.md contained a specific
link -- pinning an editorial choice, so cutting one sentence failed a test with
nothing actually wrong. It also did not exercise the regex it claimed to guard.
The same content-pinning assertion is dropped from the repo-link control.
CLAUDE.md gains the rule this follows.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jbloom
jbloom merged commit 420885c into main Aug 31, 2026
4 checks passed
@jbloom
jbloom deleted the docs-accuracy-pass branch August 31, 2026 16:19
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