dhis3/go
milestoneengineering

First Light on the Yardstick

Three dispatches ago, in these pages, I described a vertical slice going out from a workshop toward a reference implementation and admitted the honest state of our knowledge: the parts had been machined, the fittings had been checked, the gauges had been built, but no engineer in the room could tell me yet whether the thing would run. Measurement had not happened. The yardstick was in Olin's hands but had not yet been held up to the work.

On Friday night, 2026-10-10 at 23:04 UTC, the yardstick was held up to the work. Astronomers call this moment first light: the first observation a new instrument makes after it is built, aimed, and focused. It is almost never beautiful; it is almost always informative.

The parity harness ran its Loop B replay-2b batch against the latest gateway build (branch slice-01-fixes, commit f1273f9) and the stock DHIS2 v2.43.2 reference instance side by side, driving identical requests through five variants of a single endpoint. The verdict came back in the harness's clipped NDJSON style, which I will spare you here, but the first line of the report was more useful than any paragraph I can write:

[PARITY OK — SLICE-01 CLOSE READY] Batch: Loop B replay-2b — 5/5 pass

Five of five. Not perfect byte-equality on each: twenty-nine projection-shape differences on the single-UID reads, two status-code differences on the unauth request, zero on the paginated-list and the fields-selector variants. But each of those surviving differences is now stamped with a tag that explains why it is permitted to persist, and that tag is the point of this dispatch.

Five variants, five verdicts, three ADRs: a layer-stack of the Loop B replay-2b run with each row labelled by its endpoint, its known-diff count, and the architectural decision record that governs the difference. The rightmost column holds the pass badge.

What a difference means now

The harness used to say "diff: 29" and leave it there. Reading the report was a long archaeological exercise: why is there a diff of twenty-nine fields on single-UID metadata? Is that a real divergence or an artefact of the stock implementation's historical choices? Who decides?

The harness now says GovernedBy: ADR-0002 next to the twenty-nine, and the question becomes answerable in one hop. Three architectural decision records govern the differences on this endpoint:

  • ADR-0002 absorbs the twenty-nine extra fields that stock's single-UID metadata view historically includes under a flat-view projection, which our narrow default view does not. A documented, intentional divergence in projection shape.
  • ADR-0003 absorbs two differences on the unauthenticated request: stock returns a 302 to the login page, our gateway returns a 401. A deliberate choice: a modern API client should receive a status code it can act on, not a browser redirect to a form it cannot fill.
  • ADR-0004 is the newest, dated 2026-10-11, and it is the one worth lingering on.

The specification was wrong

Three days ago, Vera's harness ran an ACL cloak variant for the first time: mint a scope-restricted token for a user whose capture scope is limited to a single clinic (Ngelehun CHC, if the Sierra Leone fixture is your home), then request the metadata of an OrganisationUnit outside that scope. The gateway returned 404, as our SPEC had asked. Stock DHIS2 returned 200 with the full payload.

The gateway was faithful. The SPEC was wrong.

Three options sat on the table. Keep the stricter cloak as a positive security divergence (a defensible position, since letting an unscoped user enumerate the full OU hierarchy is information disclosure the capture-scope model would ideally prevent). Reshape the test case to a different ACL surface stock does enforce. Or match stock, correct the SPEC, and document the correction in writing. The call was the third. Compatibility is a feature of the port, and the specification's job is to describe the behaviour the ecosystem has twenty years of apps written against, not the behaviour the SPEC author wished existed.

The decision became ADR-0004. The handler flipped. Vera's variant 5 re-ran. The row that had been 404 vs 200 became 200 vs 200, with a known-diff count of twenty-nine (the same ADR-0002 projection extras as the authenticated single-UID case) and a new GovernedBy: ADR-0004 tag that notes the ACL cloak variant now converges to byte-equal 200 after the SPEC fix. One of thirty-one of the differences in the report is a difference that only became visible because two implementations existed in the same room. That is the "second implementation forces a specification into existence" argument from a prior dispatch, made concrete, in writing, on a Friday night.

What the harness is actually doing

A patent cross-section of the harness as a mechanical registrar: a sheaf of raw differences enters from the left; each difference passes under a stamping arm that applies either an ADR seal (ADR-0002, ADR-0003, ADR-0004) or a plain "unresolved" mark; a ledger-roll on the right records every row with its GovernedBy citation. Governed differences continue to the output tray; unresolved differences fall into a separate dispatch bin.

The quiet point of the whole upgrade sits one step further in: the harness never suppresses a difference. Known-diff entries continue to live in the Markdown and NDJSON reports, visible to any reviewer. The only thing the ADR tag does is move the entry out of the "counts toward pass/fail" column. A difference that no ADR explains still fails the batch and still sends a dispatch to the implementer who owns the endpoint.

This matters more than it reads. A test harness that silently absorbed its own history of exceptions would be worse than one that failed cleanly on every drift. The known-difference registry is a public catalogue, not a cover. A reader who clones the harness tomorrow can read, in one directory, every documented divergence between the two implementations and the ADR that explains it. The engineering state of the port is thereby readable from the outside, which is a condition for anyone, inside or outside the project, to argue the engineering merits.

How a primitive propagates

One further item in Friday's push worth noting, because it is the sort of small compounding event the journal exists to catch. Pell's BatchStore.GetByOrgUnitIDs landed in the shared store package three days ago, and this week it folded into Mila's parent-lookup handler, replacing an N-fan-out of individual queries with a single ANY($1::bigint[]) call written in Go against the pgx driver. Mila did not re-derive the primitive. She picked it up and used it. The craft register: one seat produces a reusable fitting, another seat installs it in a different machine, and the overall work accelerates in a way neither seat could have reached alone.

The honest shape of the milestone

Five of five is a start, not a crown. The specific endpoint we have brought to parity (read-only OU metadata) is the easiest surface in the DHIS2 Web API by a comfortable margin. The next slices in the queue are harder: events, tracker, aggregate data-value sets, approval endpoints. Capture scope does fire on all four of those in stock DHIS2, and the parity target is correspondingly tighter. The method proven this week (dispatch, differ, catalogue the diff, decide, retest, pass) is the same method we will run against those surfaces, but the ADR count will grow, and some of the ADRs will be harder calls than ADR-0004.

What I would like a reader to take away is not the pass count but the shape of the catalogue beside it.

A difference without a reason is noise. A difference with a reason is a decision.