Repository navigation
docs: split the as-built doc by subsystem and lint it - #50
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
docs/design/deslag.asbuilt.mddescribes the code as it is. At a2d8ea1 it is 16378 bytes of its 16384max_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 tocorpus.asbuilt.md. Thedeslag-design-docsskill 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.tomldid not select the doc. Selected at a2d8ea1, it failsmax_emphasis(20 bold spans, 1.24% of its prose) anddensity(8 paragraphs over 500 characters).This PR splits the doc the way
corpus.asbuilt.mdalready is: one as-built doc per subsystem, each with its own budget, and every one of them linted.deslag.asbuilt.mdis 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 anddeslag explain.document.asbuilt.md: theDocumentand frontmatter. It is named forsrc/document/, the module it holds.lints.asbuilt.md: checking, marks, one section per lint inLint::ALLorder, 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 holdssrc/module names, each in exactly one doc: the one with its detail.subsystems:deslag.asbuilt.mdcli,instructionsconfig.asbuilt.mdconfig,glob,explaindocument.asbuilt.mddocument,parselints.asbuilt.mdlint,outputcorpus.asbuilt.mdcorpus(unchanged)Where each old section went
deslag.asbuilt.md, as they weredeslag.asbuilt.mdkeeps the tree at directory level and the paragraph on what calls what; each subsystem doc takes its file-level linesdocument.asbuilt.md: Blocks; Tokens, sentences and locationslints.asbuilt.md: max_size_bytesconfig.asbuilt.md: The config, and Glob patterns for theglob::Patternparagraphdocument.asbuilt.md: Frontmatterconfig.asbuilt.md: Explaining a fileconfig.asbuilt.md: Walking the repolints.asbuilt.md: Checking, Marks, a section per lint, Reports, --formatdeslag.asbuilt.md, as they wereCommits
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 inAGENTS.md.README.mdsays the overview indexes the subsystem docs.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.docs: correct the as-built docs against the code: an ellipsis, U+2026, also ends a sentence (src/document/sentences.rs:113);make cleanalso runscargo clean(Makefile:98-99); the trees now nameparse/mod.rs,ACKNOWLEDGEMENTS.mdand.agents/skills/;explainis insubsystems:, where no doc named it (src/lib.rs:27).test: lint every as-built doc and its subsystems:.agents/deslag.tomlselects/docs/design/*.asbuilt.mdin place ofcorpus.asbuilt.mdalone. The glob does not selectdeslag.desired.md, which is written by hand and stays unlinted, and topic docs stay listed one by one.src/lint/max_size_bytes.rs:35-38). An override on the same glob withvalue = 4096closes that: a frontmatter budget wins over it, and a doc that declares none fails at 4 KB.tests/asbuilt.rsfails when a module undersrc/is named in no as-built doc'ssubsystems:, or in more than one, so a new module gets its doc on purpose. It finds the frontmatter withDocumentand reads it withserde-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:
The six, each on purpose:
The document,Where a file's budget comes fromandChecking and reporting, replaced by the sections in the table above.max_size_byteskey ..." 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.make cleanremoves both directories" now adds "and runscargo 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
explaincallsconfig,globandparsetoo. It is not wrong, so it was not rewritten.corpus.asbuilt.md,corpus.mdand their lines in.agents/deslag.tomlare untouched; the glob now selectscorpus.asbuilt.mdin place of its own line.Testing
make ci: exit 0deslag checkon the repo: exit 0 with all five as-built docs selected;deslag explain docs/design/deslag.desired.mdsays it is not selected.docs/design/nofm.asbuilt.mdwith no frontmatter fails at 4096 bytes;deslag explainshows the frontmatter budget winning over the override forlints.asbuilt.md. File removed after.tests/asbuilt.rsfails withparse: in no docwhenparseis dropped fromdocument.asbuilt.md, and withlint: in corpus.asbuilt.md, lints.asbuilt.mdwhenlintis added tocorpus.asbuilt.md, which also shows it reads a YAML block list. Both reverted.References