Skip to content

CI: comments that point at docs/ fail when the heading is gone; ARCHITECTURE.md says where each number lives - #75

Open
dinooo13 wants to merge 2 commits into
mainfrom
ci/doc-pointers
Open

dinooo13 wants to merge 2 commits into
mainfrom
ci/doc-pointers

Conversation

@dinooo13

Copy link
Copy Markdown
Owner

Part of #73, point 6.

What and why

The comment pass (#71) moved timings, limits and rules out of the code into docs/ARCHITECTURE.md, with one-line // See docs/ARCHITECTURE.md, "<section>". pointers. Since then the docs are the source of truth for numbers the code no longer comments, and nothing kept a pointer and its heading, or a number and its constant, in step.

  • scripts/check-doc-pointers.sh (bash 3.2 and POSIX awk, no Swift). It reads the level 1 to 3 headings of every docs/*.md, outside code fences and with backticks removed, then every .swift under Sources/ and Tests/. A run of consecutive // lines is read as one comment, so a pointer split over two lines is checked too (FillerRemover, PasteboardOutput, AXPasteObserver, OutputMuteController, UtteranceSlot, ClipboardKeeper, StreamingTranscriptionEngine, CustomWordCorrector). Both forms are matched: docs/X.md, "Section" and "Section" in docs/X.md (BenchProcess). A bare docs/X.md is allowed if the file exists (TimingLine). A failure prints file:line: no heading "<section>" in docs/X.md or file:line: no file docs/X.md and exits 1; on success it prints the count.
  • .github/workflows/docs.yml runs only that script on ubuntu-latest, for pushes to main and pull requests touching docs/**, Sources/**, Tests/**, the script or the workflow. ci.yml is unchanged.
  • docs/ARCHITECTURE.md, "Where the numbers live": a table from each number the docs and CLAUDE.md quote to its constant and file. A change to a constant updates its row and the prose that quotes it. The measured figures (the 110 ms cold pass, the 0 to 25 ms read after Cmd+V, Universal Clipboard's 15 ms) are listed as measurements, not constants. The doc's intro now says pointers are checked, so a section is renamed together with its pointers.
  • PermissionMonitor.pollInterval: the two-second poll was an unnamed literal; it is a private static let now so the table can name it. No behaviour change.

Verified

  • ./scripts/check-doc-pointers.sh on the tree: 29 pointers to docs/ headings checked in 168 Swift files. grep -rn 'docs/' Sources Tests gives 30 lines: the 29 pointers plus TimingLine's bare file name.
  • Run with macOS's /bin/bash 3.2.57 and /usr/bin/awk (BSD). The ubuntu run is this PR's Docs check.
  • In a scratch copy (not committed): renaming ## Paste and clipboard failed both pointers to it, ClipboardKeeper.swift:6 and the split one in PasteboardOutput.swift:10; changing the second line of FillerRemover's split pointer to "Processor" failed at FillerRemover.swift:3; a wrong section in BenchProcess's "…" in docs/BENCHMARKS.md form failed; a misspelt docs/BENCHMARK.md in TimingLine failed with no file. Each run exited 1. A second scratch tree checked that a ## line inside a code fence is not taken as a heading, that a backticked heading matches without its backticks, and that a pointer naming a missing file is reported once.
  • Every row of the table checked against the code.
  • swift build and swift test green. Nothing touches the release-to-paste path, so no benchmark.

🤖 Generated with Claude Code

dinooo13 and others added 2 commits October 16, 2026 15:29
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…TECTURE.md says where each number lives

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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