Documentation

Complete developer reference

The developer guide on one page

What you will learn

  • Find, on one page, where each kind of change belongs and what it must touch.
  • Look up an exit code, a test helper or a release rule without rereading the page that explains it.
  • Use the combined review checklist for a change.

Prerequisites: the appendix overview.

The layers and their rules

Layer Contains May use May not use
Entry start-up, option parsing, the guard everything below –
Commands one module or tree per command engines, core and output another command
Engines model, control-stream interpreter, solvers, covariate methods, differentiation, file readers, data core a command; the assistant
Core and output errors, logging, hashing, random streams, statistics, settings documents, output set nothing above it an engine; a command

The three structural rules: one command per module; one shared core; no command calls another. Page D.1.

Where a change belongs

If the change is… It goes in… Read
a new option on a command the command's options, its settings module, its summary, its template, the assistant's catalogue, the documentation D.6
a new data check the check catalogue (id, category, question, level, action) and its documentation entry D.7
a new command a command module, a settings extension, the catalogue, the assistant lists, the documentation D.8
a new failure the one failure type, with a code from the table, a message and a hint D.3
anything that writes files the output set, with the checksum list written last D.5
anything that draws random numbers a named stream derived from the seed and a label D.5, D.12

Exit codes

Code Name Code Name
0 success 7 data validation failure
2 invalid usage 8 posterior reconstruction failure
3 file discovery or I/O failure 9 numerical or learner failure
4 invalid configuration 10 no evaluable relationships
5 unsupported model feature 11 resume/checkpoint incompatibility
6 inconsistent NONMEM artifacts 12 internal invariant violation (a caught bug)

A new failure takes a code from this table. A new code is a change to the contract with every script, and so at least a minor release (D.13).

The three promises of every run

Promise Meaning Tested by
Logging every run writes a transcript; a warning is not an error end-to-end tests of the transcript
Output set outputs are written through one writer; the checksum list is written last, so a missing checksum means an incomplete run integrity tests
Random streams a stream is derived from the seed and a label; results do not depend on the number of threads; changing the derivation makes old checkpoints refuse to resume the one-thread-against-three test (D.12)

The settings system

Item Rule
One extension per command sixteen settings extensions, each with its own reader
Unknown keys an error (exit code 4)
Template generated with --print-config; it is itself a valid settings file
Precedence command line, then file, then default
Relative paths resolved against the settings file's folder
Echo the resolved settings are written to the output folder, so a run can be repeated

Test helpers

Helper Use
ok(args) run; fail unless exit code 0
fails_with(args, code) run; fail unless exactly that code; return the error text
example(), example_of(kind) shared example projects, generated once per run
scratch(name) a clean folder for one test
read_csv, col, json_f64, png_info read results

The four layers of testing (D.10): unit tests beside the code; end-to-end tests that run the real program; the independent QC folder, whose calculators share no code with the program; the validation package, which is a record and not the test suite.

The release rules

Rule Statement
Every change is a release there is no unreleased state; one request is one version
The upgrade test what happens to someone who upgrades without reading the notes? settings or outputs broken: major; something added or a default changed: minor; a fix or documentation only: patch
One place the version is stored once; the banner's release date must equal the newest change-log date
Change-log entry ## [X.Y.Z] - date, then one bullet per change with a bold short name; never rewrite a past entry
Gates formatting; lint with warnings as errors; the full test run; the variant built without the assistant's language-model component; a visual look at the HTML and PNG outputs
Archive named with the program and the release number; excludes build products, version-control metadata and the manuscript; never overwrites an earlier archive
Commit the subject starts with the release number
Report what changed, the number and its reason, the gates, what was not done, where things are

Combined review checklist for a change

Design

  • Does the change keep the layer rules and the three structural rules?
  • Does every new failure have a code from the table, a one-sentence message naming the thing at fault, and a hint?

Settings and outputs

  • Is there a template entry, a reader entry, an echo and a precedence test?
  • Does a misspelled key fail with exit code 4?
  • Does every output go through the output set, and is the checksum list last?
  • Does every random consumer use a named stream, and does a test compare one thread against several?

Tests

  • A happy-path test, an error test with the exit code, and a determinism or resume test where relevant?
  • Are tolerances stated with their reason?

Documentation

  • Help and template read as a user; the data-check reference, the manual's version line, the assistant's catalogue, this book searched for the old wording?

Release

  • Number chosen by the upgrade test; entry written; date true; five gates green; archive new; commit subject starts with the number; report says what was not done.

What this appendix does not cover

It does not teach the programming language, does not list build or packaging commands, and does not describe the hosted applications of Chapter 43 (those are separate products built around the program). It describes the structure and the rules; the authority on any particular behaviour is the program itself and its tests.

See the appendix overview, the first page and Appendix A.