Skip to content

docs: split the as-built doc by subsystem and lint it - #50

Merged
webern merged 4 commits into
mainfrom
m/deslag-asbuilt
Sep 27, 2026
Merged

webern merged 4 commits into
mainfrom
m/deslag-asbuilt

Conversation

@webern

@webern webern commented Sep 27, 2026

Copy link
Copy Markdown
Owner

Summary

docs/design/deslag.asbuilt.md describes the code as it is. At a2d8ea1 it is 16378 bytes of its 16384 max_size_bytes, and it has been within 180 bytes of that budget since #23 (16352). Each of #44, #45 and #47 made room for its new paragraphs by cutting others, and #45 moved the corpus text out to corpus.asbuilt.md. The deslag-design-docs skill says a budget is not raised without the owner, so every change to the code has had to squeeze the doc.

The budget was also kept by hand: .agents/deslag.toml did not select the doc. Selected at a2d8ea1, it fails max_emphasis (20 bold spans, 1.24% of its prose) and density (8 paragraphs over 500 characters).

This PR splits the doc the way corpus.asbuilt.md already is: one as-built doc per subsystem, each with its own budget, and every one of them linted.

  • deslag.asbuilt.md is now the overview: what deslag is, a run, the modules at directory level and what calls what, an index of the subsystem docs, the command line and exit codes, other files, the tests and the build. Its budget drops from 16384 to 8192, so it cannot grow back into the place every detail goes.
  • config.asbuilt.md: the config, glob patterns, the walk and deslag explain.
  • document.asbuilt.md: the Document and frontmatter. It is named for src/document/, the module it holds.
  • lints.asbuilt.md: checking, marks, one section per lint in Lint::ALL order, reports and --format. A new lint is one new section.

Each subsystem doc opens with its entry points and callers, then its src/ tree, then one section per concern. subsystems: in each doc's frontmatter holds src/ module names, each in exactly one doc: the one with its detail.

Doc Bytes Budget subsystems:
deslag.asbuilt.md 6786 8192 (was 16384) cli, instructions
config.asbuilt.md 3889 5000 config, glob, explain
document.asbuilt.md 2194 3000 document, parse
lints.asbuilt.md 5884 7500 lint, output
corpus.asbuilt.md 5998 8192 corpus (unchanged)

Where each old section went

Section at a2d8ea1 Now
intro, A run deslag.asbuilt.md, as they were
Modules deslag.asbuilt.md keeps the tree at directory level and the paragraph on what calls what; each subsystem doc takes its file-level lines
The document document.asbuilt.md: Blocks; Tokens, sentences and locations
Where a file's budget comes from lints.asbuilt.md: max_size_bytes
The config config.asbuilt.md: The config, and Glob patterns for the glob::Pattern paragraph
Frontmatter document.asbuilt.md: Frontmatter
Explaining a file config.asbuilt.md: Explaining a file
Walking the repo config.asbuilt.md: Walking the repo
Checking and reporting lints.asbuilt.md: Checking, Marks, a section per lint, Reports, --format
The command line, Other files, Tests, Build deslag.asbuilt.md, as they were

Commits

  1. docs: split the as-built doc by subsystem: the text moves as it was. New text is limited to each subsystem doc's opening sentences, the overview's index, the section headings, and short descriptions for the directories in the overview's tree, worded after the layout in AGENTS.md. README.md says the overview indexes the subsystem docs.
  2. docs: fix the lint findings in the as-built docs: 8 paragraphs split at a sentence end, and 13 of 20 bold spans un-bolded. Each doc keeps its first two; the sentence that defines each of the others stays. No sentence is reworded.
  3. docs: correct the as-built docs against the code: an ellipsis, U+2026, also ends a sentence (src/document/sentences.rs:113); make clean also runs cargo clean (Makefile:98-99); the trees now name parse/mod.rs, ACKNOWLEDGEMENTS.md and .agents/skills/; explain is in subsystems:, where no doc named it (src/lib.rs:27).
  4. test: lint every as-built doc and its subsystems:
    • .agents/deslag.toml selects /docs/design/*.asbuilt.md in place of corpus.asbuilt.md alone. The glob does not select deslag.desired.md, which is written by hand and stays unlinted, and topic docs stay listed one by one.
    • A selected file with no budget is counted but never size-checked (src/lint/max_size_bytes.rs:35-38). An override on the same glob with value = 4096 closes that: a frontmatter budget wins over it, and a doc that declares none fails at 4 KB.
    • tests/asbuilt.rs fails when a module under src/ is named in no as-built doc's subsystems:, or in more than one, so a new module gets its doc on purpose. It finds the frontmatter with Document and reads it with serde-saphyr; no new dependency.

Nothing lost in the move

A script outside the repo cuts the a2d8ea1 doc into 177 units (each sentence, code line and heading) and 166 backticked names, and looks for each in the four new docs, with whitespace and bold markers ignored. After each commit:

After commit Units missing Names missing
1 4 0
2 4 0
3 6 0
4 6 0

The six, each on purpose:

  • Three headings, The document, Where a file's budget comes from and Checking and reporting, replaced by the sections in the table above.
  • "Most specific first: the max_size_bytes key ..." now opens "A file's budget comes from, most specific first: ...". Its heading used to say what it was about; the section is now named for the lint.
  • The sentence rule now names the ellipsis (commit 3).
  • "make clean removes both directories" now adds "and runs cargo clean" (commit 3).

The script proves each unit is somewhere, not that it is in the right place, so the trees were read by eye.

Left as it was

  • The overview's paragraph on what calls what does not say that explain calls config, glob and parse too. It is not wrong, so it was not rewritten.
  • The tests stay in the overview; no doc owns them yet.
  • corpus.asbuilt.md, corpus.md and their lines in .agents/deslag.toml are untouched; the glob now selects corpus.asbuilt.md in place of its own line.

Testing

  • make ci: exit 0
  • deslag check on the repo: exit 0 with all five as-built docs selected; deslag explain docs/design/deslag.desired.md says it is not selected.
  • A 5149-byte docs/design/nofm.asbuilt.md with no frontmatter fails at 4096 bytes; deslag explain shows the frontmatter budget winning over the override for lints.asbuilt.md. File removed after.
  • tests/asbuilt.rs fails with parse: in no doc when parse is dropped from document.asbuilt.md, and with lint: in corpus.asbuilt.md, lints.asbuilt.md when lint is added to corpus.asbuilt.md, which also shows it reads a YAML block list. Both reverted.
  • The residue script after each commit, as above.

References

deslag.asbuilt.md is 16378 bytes of its 16384 budget, so every change
to the code has had to cut a paragraph to add one. Split it the way
corpus.asbuilt.md already is: one as-built doc per subsystem, each with
its own budget.

- deslag.asbuilt.md keeps the overview: what deslag is, a run, the
  modules at directory level and what calls what, the command line,
  other files, the tests and the build. It gains an index of the
  subsystem docs, and its budget drops to 8192.
- config.asbuilt.md: the config, glob patterns, the walk and explain.
  Budget 5000.
- document.asbuilt.md: the Document and frontmatter. Budget 3000.
- lints.asbuilt.md: checking, marks, one section per lint in the
  order they run, reports and --format. Budget 7500.

Each subsystem doc opens with its entry points and callers and its
src/ tree. The text moves as it was, except the budget section: it is
now the max_size_bytes section, so its first sentence names the
budget. README.md says the overview indexes the subsystem docs.
Selected, the four docs would fail two of the repo's lints: density,
on eight paragraphs over 500 characters, and max_emphasis, on the
subsystem docs whose bold terms now weigh more against less prose.

Split each dense paragraph at a sentence end, and keep the first two
bold terms of each doc, with the sentence that defines each of the
others. No sentence is reworded.
- An ellipsis, U+2026, ends a sentence too (src/document/sentences.rs).
- make clean also runs cargo clean.
- The trees name parse/mod.rs, ACKNOWLEDGEMENTS.md and the skills.
- config.asbuilt.md names explain among its subsystems; no doc did.
The repo config selected corpus.asbuilt.md alone, so the budget of
deslag.asbuilt.md was kept by hand. Select /docs/design/*.asbuilt.md
instead: every as-built doc is now checked at its frontmatter budget
and by every lint the repo holds its own Markdown to. The glob skips
the desired doc, which is the owner's.

A selected file with no budget is counted but never size-checked, so
add an override on the same glob with a value of 4096. A frontmatter
budget wins over it; a doc that declares none fails at 4 KB.

tests/asbuilt.rs reads the subsystems: of each as-built doc, and fails
when a module under src/ is named in no doc or in more than one. A new
module then gets its doc on purpose. The test finds the frontmatter
with Document and reads it with serde-saphyr, so it adds no dependency.
@webern webern added docs Documentation including agent instructions, readmes, code comments, etc. ai Primarily authored by AI (whether PR, Issue, Whatever) labels Sep 27, 2026
@webern
webern merged commit 9dc1dcd into main Sep 27, 2026
2 checks passed
@webern
webern deleted the m/deslag-asbuilt branch September 27, 2026 06:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai Primarily authored by AI (whether PR, Issue, Whatever) docs Documentation including agent instructions, readmes, code comments, etc.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant