Documentation

D.9 Keeping the program, the assistant, the guides and the book in step

Four things that must tell the same story

What you will learn

  • Identify the four descriptions of a command (code, assistant, guide, book) and what ties each pair together.
  • Separate what is generated (cannot drift) from what is tested (drifts loudly) from what is reviewed (drifts quietly).
  • Apply the release coupling: a change to options, settings or outputs updates the documentation in the same release.

Prerequisites: D.6 and D.8.

A command is described four times: by the program (the real behaviour and the help text), by the assistant's manual (the guides it reads and the catalog it is given), by the guides in docs/, and by the book. Any two can disagree. The maintainer's task is to arrange that disagreements are impossible where possible, loud where not, and reviewed otherwise.

Three grades of protection

Grade Meaning Examples
Generated there is one source and the others are made from it, so they cannot differ the assistant's catalog of commands and options is built from the command-line definitions; the qc-data settings template is built from the catalogue; the book's option tables, settings-key tables and output-file tables are generated from the program's help, templates and writers
Tested the copies are hand-written, and a test compares them, so a difference fails the build every check ID must appear in its guide; the settings template parses to the defaults; the echo round-trips; the date of the banner equals the date of the newest changelog entry; the extensions are distinct
Reviewed the copies are hand-written and nothing compares them the prose of a guide, a worked example, an interpretation paragraph, the explanation in a book chapter

The aim of a good change is to move things up this table. If you find yourself updating the same fact in three places by hand, ask whether one can be generated.

The assistant's view

The assistant is given three kinds of knowledge, each with a different protection.

  • The catalog (the commands, the options of one command with their help). Generated from the command-line definitions. A new option with its help text and heading is therefore visible to it with no further work (page D.6, item 2).
  • The templates. It writes settings files from the real template (--print-config output), and the program, not the model, fills in the values; it refuses a key or a section the template does not have and checks that the result is valid. So the assistant cannot invent a key, and cannot break a file.
  • The manual. Parts of the guides and the project's documents are searched for each request and given to the model, within a size limit. The guides are therefore the assistant's knowledge: a wrong sentence in a guide becomes a wrong answer in a conversation. The guide of the assistant itself carries a note that its section on the guardrails must match the policy module and the defaults, which a reviewer checks.

The guides

The guides in docs/ have one convention that matters: a version line at the top, updated with every release, and a statement, where it applies, of what the guide must match. Examples of the rule as the guides state it: the options table of the forest guide "must match the Forest help heading"; the settings table of the generate guide "must match the template in the program"; the check lists of the QC guides "must match the catalogue".

Every claim in the guides is checked by running it. Example commands are run before they are written down, and the numbers in a worked example are taken from real output.

The book

The book is a fourth description, and its structure follows the protection grades.

Part of the book Grade How
The command-line reference, the settings reference and the output reference (Chapters 36, 37, 38) generated produced by a script from the program's help, the templates and the output writers; reviewed, but not edited by hand
Executable examples (the frozen evidence bundles of Chapter 41) tested every example command was run on a companion project, and the numbers in the text are those of the stored output; a re-run that differs means the text or the program changed
Concepts, derivations, interpretation reviewed by a pharmacometrician and a statistician (the review roles of the production plan)
Terminology reviewed the glossary (Appendix B) is the single source; the book uses its terms exactly

The release coupling

The one rule that keeps the four in step: a change to a command's options, settings or outputs updates its guide and the book's generated reference in the same release. A change that is "just" a default is not exempt: it changes what a user gets from the same command line, and the changelog names it.

In practice, at the end of a change, ask five questions:

  1. Does nlmx COMMAND --help show the change?
  2. Does the assistant know it (catalog, templates, lists)?
  3. Does the guide's options table, outputs section and worked example match?
  4. Do the generated reference chapters need regenerating?
  5. Does the changelog describe the change for users?

What drift looks like

Symptom Likely cause
A user reports an option that "is in the book but not in the program" the reference was regenerated from a newer or older build than the one shipped
The assistant proposes a key the template does not have the model guessed; the program refused it; no defect (page 41.37)
A guide's example output no longer matches a real run the default or the format changed and the example was not re-run
A count (for example the number of checks) differs between the listing and the text a catalogue entry was added without updating the stated count

Review checklist

  • For each fact you changed, can you say whether it is generated, tested or reviewed?
  • Did you move any hand-maintained fact up a grade?
  • Did you answer the five questions above?

See the previous page, the next page and the developer reference.