docs toc --apply and docs verify disagree on a ~100-line type-spec; second --apply removes the region and the blank line before it #235

Open
opened 2026-10-17 10:46:22 +00:00 by torben · 0 comments
Owner

Summary

For types/source.md (instance-owned type-spec, shipped as types/source.md.template) at about 100 lines, wikitool docs toc --apply inserts a table-of-contents region, wikitool docs verify then still reports that region as stale, and a second --apply removes it again. The removal also deletes the blank line that stood before the region, so the end state differs from the start state by that one line.

Environment

Claude Code (CLI), zsh, Linux 6.18.36-1-lts. Instance on stack 10.1.0 (distribution exported 2026-10-16, from commit c1ddefdc7f), content version 10.0.0. WIKITOOL_SESSION_ID=upgrade-10.1.0. The upgrade to 10.1.0 itself completed with doctor, docs verify, instructions verify and lint green before the steps below.

Steps

First occurrence (exit codes of steps 2-5 not captured, output was piped):

  1. Edited types/source.md by hand: added one table row. The file went from 100 lines (as committed, no table-of-contents region) to 101 lines.
  2. tools/wikitool docs toc --apply printed types/source.md and OK Refreshed the table of contents on 2 file(s). The region was inserted into types/source.md.
  3. tools/wikitool docs verify printed ERROR Documentation issues found: / - types/source.md needs a table-of-contents region refreshed - run wikitool docs toc --apply. Same result on an immediate second run.
  4. tools/wikitool docs toc --apply printed OK Refreshed the table of contents on 1 file(s). The region was removed again, together with the blank line before ## Frontmatter; the file had 100 lines afterwards.
  5. tools/wikitool docs verify printed OK Docs verified: ....

Deliberate reproduction in the same checkout, exit codes captured:

  1. Re-inserted the blank line before ## Frontmatter by hand (101 lines, no region).
  2. docs verify exited 1: - types/source.md needs a table-of-contents region refreshed.
  3. docs toc --apply exited 0: OK Refreshed the table of contents on 1 file(s). File: 108 lines (region inserted).
  4. docs verify exited 1, same ERROR line as in step 7.
  5. docs toc --apply exited 0: OK Refreshed the table of contents on 1 file(s). File: 100 lines (region removed, and the blank line before ## Frontmatter with it).
  6. docs verify exited 0.
  7. cmp against a copy taken before step 6: identical.

Expected

  • docs toc --apply brings a file into the state docs verify accepts in one run. The help says: "If docs verify still reports a stale region after --apply, the file's ## headings changed in between; run it again".
  • Removing a region restores the text around it as it was before insertion.

Observed

  • For a type-spec of 101 lines, --apply inserts a region, docs verify then still reports it stale, and the second --apply removes it. Nothing changed the ## headings between the runs.
  • The removal also deletes the blank line that preceded the region, so ## Frontmatter follows a paragraph line directly.

Not known

Whether the effect depends on the file being a type-spec or occurs on any in-scope file near the 100-line threshold. Only types/source.md was observed.

Notes

A pseudonymised bug-report bundle exists locally (bugreport-20261016T194027Z) and can be supplied on request.

## Summary For `types/source.md` (instance-owned type-spec, shipped as `types/source.md.template`) at about 100 lines, `wikitool docs toc --apply` inserts a table-of-contents region, `wikitool docs verify` then still reports that region as stale, and a second `--apply` removes it again. The removal also deletes the blank line that stood before the region, so the end state differs from the start state by that one line. ## Environment Claude Code (CLI), zsh, Linux 6.18.36-1-lts. Instance on stack 10.1.0 (distribution exported 2026-10-16, from commit c1ddefdc7f15), content version 10.0.0. `WIKITOOL_SESSION_ID=upgrade-10.1.0`. The upgrade to 10.1.0 itself completed with doctor, docs verify, instructions verify and lint green before the steps below. ## Steps First occurrence (exit codes of steps 2-5 not captured, output was piped): 1. Edited `types/source.md` by hand: added one table row. The file went from 100 lines (as committed, no table-of-contents region) to 101 lines. 2. `tools/wikitool docs toc --apply` printed `types/source.md` and `OK Refreshed the table of contents on 2 file(s).` The region was inserted into `types/source.md`. 3. `tools/wikitool docs verify` printed `ERROR Documentation issues found:` / `- types/source.md needs a table-of-contents region refreshed - run wikitool docs toc --apply`. Same result on an immediate second run. 4. `tools/wikitool docs toc --apply` printed `OK Refreshed the table of contents on 1 file(s).` The region was removed again, together with the blank line before `## Frontmatter`; the file had 100 lines afterwards. 5. `tools/wikitool docs verify` printed `OK Docs verified: ...`. Deliberate reproduction in the same checkout, exit codes captured: 6. Re-inserted the blank line before `## Frontmatter` by hand (101 lines, no region). 7. `docs verify` exited 1: `- types/source.md needs a table-of-contents region refreshed`. 8. `docs toc --apply` exited 0: `OK Refreshed the table of contents on 1 file(s).` File: 108 lines (region inserted). 9. `docs verify` exited 1, same ERROR line as in step 7. 10. `docs toc --apply` exited 0: `OK Refreshed the table of contents on 1 file(s).` File: 100 lines (region removed, and the blank line before `## Frontmatter` with it). 11. `docs verify` exited 0. 12. `cmp` against a copy taken before step 6: identical. ## Expected - `docs toc --apply` brings a file into the state `docs verify` accepts in one run. The help says: "If `docs verify` still reports a stale region after `--apply`, the file's `##` headings changed in between; run it again". - Removing a region restores the text around it as it was before insertion. ## Observed - For a type-spec of 101 lines, `--apply` inserts a region, `docs verify` then still reports it stale, and the second `--apply` removes it. Nothing changed the `##` headings between the runs. - The removal also deletes the blank line that preceded the region, so `## Frontmatter` follows a paragraph line directly. ## Not known Whether the effect depends on the file being a type-spec or occurs on any in-scope file near the 100-line threshold. Only `types/source.md` was observed. ## Notes A pseudonymised bug-report bundle exists locally (`bugreport-20261016T194027Z`) and can be supplied on request.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: torben/chemenu#235