Auditing the generators and datasets
The corpus specs (template-corpus.spec.ts, activity-coherence.spec.ts) render every template
with the MOCK_* fixtures — complete entities by construction — and the first pool row only, and
they are skipped in CI, where the corpus is absent. They prove the templates; they say nothing of
what a real population makes of them. The generator audit fills that gap: it renders every
event type of every technology the way the tick renders it, on the real entities of the nine
seeded populations, and reports what breaks, what leaves a field empty and what names someone it
should not.
pnpm audit:generators [--mode=cartesian|crossed] [--layer=0,1,2]
[--generator=slug,…] [--population=slug,…]
[--workers=N] [--out=folder] [--calibrate]
It reads the database that DATABASE_URL points to, read-only, after a pnpm db:seed. The
report lands in --out (audit-report/ by default): report.md, report.json, and
registry-draft.json.
Three layers
| Layer | What it renders | What it answers |
|---|---|---|
| 0 — datasets | nothing: it reads the rows | Does each dataset pass parseDataset? Are identities missing, fake or shared? Does every user's city have a site, every server a role? Which pools does nothing read? |
| 1 — the matrix | every event type × entity × gesture × candidate pool row | What can break, whatever the message generated |
| 2 — the simulated day | each population played as a community, a weekday and a Saturday, then each seeded scenario launched on it | What the tick actually drops or sends with holes, and how many |
The matrix renders production, not an imitation of it
- The render is
renderProjection(packages/engine/src/render-projection.ts), the very function of the production renderer, moved out ofEventRenderServiceword for word — a characterisation test and a full trial day hashed before and after prove the move. - The gesture is produced by the engine: a one-node workflow through
buildSessionTimeline, with the real fact catalogues. ItsactivityId, facts, peer and device are those a real day would have given it. - The pool row is chosen without any test hook: the audit searches for the seed scope that
makes production draw the row it wants (
seedScopesForRows). - The tier of each cell comes from the projector itself: flux (sent every day), launch (sent only as an alert fallback during a scenario launch) or latent (never retained for that gesture). A finding is ranked by its tier.
The cartesian mode renders every entity × action × on/off site × device × two draws × pool
row — about 184 million cells, a little over an hour on seven workers. It uses a cached renderer
(createCachedRenderer, held byte for byte equal to renderTemplate by a spec, and re-checked on
one cell in 200 during the run). --calibrate prints an estimate before the run, and an
interrupted run resumes from checkpoint.json. The crossed mode renders each representative
entity, action and candidate row at least once per event type — some 18,000 renders, seconds.
What a cell is checked for
| Check | Meaning |
|---|---|
render-error, unrendered-delimiter, invalid-output | The exact reasons the tick drops a message |
empty-slot | A JSON "key": , — the message is invalid, the key is named |
blank-field | An empty field, attributed: to the entity (it disappears once the entity's missing expected keys are filled), to the template (it stays empty with a complete fixture entity) or to the gesture's data |
literal-leak, placeholder-leak | undefined, NaN, [object Object], None; {GUID}, <HOSTNAME> |
mock-leak, population-leak | A MOCK_* identity, or an identity that belongs to another population |
date-drift | A date more than two days away from the gesture (a warning) |
Template blanks are only counted: BLANK_FIELDS already judges them against the real samples.
The CI guard
packages/engine/src/audit/generator-audit.spec.ts runs the crossed matrix, the dataset checks,
the cached-render equivalence on every seeded template and the smallest population's day with every
scenario launched on it — on the database CI seeds, in about twenty seconds. It is skipped without a
seeded database.
Its findings are held equal to a registry (packages/engine/src/audit/registry.ts), in both
directions: a finding that is not declared fails (a regression), and a declaration that nothing
justifies any more fails too (a debt paid off that nobody crossed out). Each entry carries its
reason. Fields that only the cartesian run meets are declared apart (cartesianFields): CI does not
require them, the cartesian CLI does.
undeclared lists event type · check · field; stale lists declarations nothing confirms. Fix
the cause rather than the registry — and when the cause cannot be fixed faithfully ("we probe, we do
not guess"), declare it with its reason.
What the first audit found
The production flow came out clean: 1.4 million messages over the nine populations, a weekday, a Saturday and the nineteen scenarios, and not one dropped. The defects were elsewhere, and five classes were fixed:
- the third channel of the machine fallback — derivations of a template's preamble did not
receive the
user.<field> | default(server.<field>)fallback, so CrowdStrike'sDetectIdleft asldt:undefined:…whenever a scenario targeted a server; timedelta— the rule translating this Jinja2 idiom existed for the Sekoia agent only, and vCenter'suser-logoutfailed on every render;- Apache's authenticated user — with no derivation, the probe had bound
%uto the pool's referer, so a refused request read… - @self:/portal/dashboard [...]; it now follows IIS's rule (a visitor never has a user), and the referer tokens@self:/@searchare resolved; - Office 365
TimeOfClick— frozen in April 2026 by its pool, it now reads the gesture's instant; - fake identities — 18 servers of
demo-metacortexand one user ofdemo-reynholmcarried a placeholder agent id (a repeated pattern, the SHA-256 of an empty string), now derived; two users ofdemo-springfield-nuclearshared a workstation SID.
What remains is declared, and none of it removes a message from the normal flow: latent server-side
variants, product values (None for Zscaler), borrowings already declared elsewhere, dates that
belong to the data, and fields empty by design.