ADR 0014: Reference-backed correlation snapshots
- Status: Accepted for the default-disabled G-NAF locality/state/postcode candidate capability; broader address matching, real aliases, and distributed snapshots remain conditional
- Date: 2026-10-04
- Decision owners: architecture, data platform, detector, privacy, legal, security, SRE, and Australian data owners
- Extends: ADR 0006, ADR 0011, and ADR 0012
Context
Groundskeeper needs governed reference evidence for future Australian addresses,
locality/state/postcode consistency, aliases, trusted schema paths, and exact
suppressions. PostgreSQL, PostGIS, and pg_trgm are useful for loading, reviewing,
quality-checking, and publishing this content, but a database call in every
evaluation would violate the availability and latency boundary in ADR 0006.
Reference evidence is also easy to overstate. A similar locality string is not a person or address identity. A postcode is not an address. A place name, language, postcode, or location is never evidence that a person is Indigenous. A reference match does not validate an unrelated identifier and cannot choose a policy action.
This ADR defines the control-plane source and the bounded artifact consumed by the default-disabled component-consistency detector. It does not alter default policy, HPI-I, VSN, or any free-text address path.
Decision
Use PostgreSQL 16 with PostGIS and pg_trgm as the reviewed authoring and release
store. Compile one tenant-scoped, complete, immutable correlation snapshot from
approved rows. Verify its digest and atomically swap a local in-memory index.
Evaluation never synchronously queries PostgreSQL.
┌─────────────────────────────────────┐
│ PostgreSQL control/reference plane │ sources, licences, releases, aliases,
│ correlation + reference_au schemas │ trusted paths, suppressions, approvals
└──────────────────┬──────────────────┘
│ repeatable-read export of approved versions
▼
┌─────────────────────────────────────┐
│ Offline correlation compiler │ validate, normalize, sort, index, hash
└──────────────────┬──────────────────┘
│ complete digest-addressed artifact
▼
┌─────────────────────────────────────┐
│ Verified local snapshot store │ one atomic pointer; LKG retained
└──────────────────┬──────────────────┘
│ bounded exact/fuzzy candidate API
▼
┌─────────────────────────────────────┐
│ Future detector evidence │ policy remains the only decision owner
└─────────────────────────────────────┘Data model and migration boundary
Migration db/migrations/000001_reference_correlation_foundation.sql is
forward-only and must run transactionally. A migration runner remains to be
selected when the first deployed control plane chooses pgx/sqlc and Atlas or
goose. The migration creates two ownership boundaries:
correlation: source and licence records, immutable dataset release identity, transactional release channels, tenant registry, trusted schemas/paths, exact expiring suppressions, and snapshot input lineage;reference_au: release-keyed Australian locality, postcode association, alias, and optional GDA2020 representative-point records with GIN trigram, B-tree, and GiST indexes.
The reference schema is deliberately not a complete G-NAF model. Future G-NAF ingestion adds release-specific address-detail tables after a field mapping and licence review. It must not force address-level rows into the small locality tables or treat representative points as locality boundaries.
Every imported dataset has a stable dataset ID and immutable release UUID,
publisher version, SHA-256 content digest, retrieval/publication/effective dates,
row count, source, and approval/withdrawal state. dataset_channel is the single
transactional pointer to candidate, active, and previous releases and accepts
only approved releases. A release is built under staged; content writers lose
write access before approval. Promotion changes the pointer, never release rows.
Direct table ownership is not an application role.
Source records carry the minimum distributable provenance required by ADR 0011: publisher/title/document version/URI, retrieval date and content digest, authority and access class, SPDX expression when applicable, copyright/attribution, permitted and prohibited purposes, redistribution and commercial-use flags, reviewer, approval, review-due date, and withdrawal state. JSONB release metadata cannot replace these columns. Original source record IDs survive into snapshots.
Trusted paths and suppressions
A trusted schema is digest-pinned and registry-addressed. A trusted path is one exact RFC 6901 JSON Pointer, category, and detector-owned evidence tier. There are no wildcards, regexes, prefixes, request-supplied schema claims, or semantic promotion through aliases.
A suppression is tenant-owned, skip_action only, and has category, one or more
exact trusted selectors, reason, owner, risk approver, ticket, start, and expiry.
It cannot contain a matched value or a per-value/unkeyed identifier digest.
Compilation omits not-yet-active, expired, revoked, and unapproved suppressions.
The finding and coverage remain visible; only a future policy compiler may apply
the action skip under ADR 0012.
Compiler and artifact contract
internal/correlation.Reader is the future repository boundary. One call reads a
named tenant, explicit selection time, and exact active release IDs in a
repeatable-read, read-only transaction. The repository must set tenant context
before reading tenant rows and return only approved inputs.
Compile(Input) currently provides the no-database foundation. It:
- rejects missing, unapproved, withdrawn, undigested, duplicate, or dangling sources/releases/records;
- validates exact states, four-digit postcodes, normalized locality/alias text, schema digests, JSON Pointers, and bounded suppression selectors;
- selects suppressions at the explicit UTC selection time;
- sorts every semantic set by stable identity and never uses query row order;
- emits source/licence/provenance and source record IDs with the data; and
- hashes the versioned semantic payload as
sha256:<lowercase hex>before writing the envelope.
The initial artifact uses structs, sorted arrays, UTC RFC 3339 timestamps, no
maps, and no floating-point semantic values, making Go's encoding deterministic.
Before the format leaves v1alpha1 or is produced in another language, replace
this constrained profile with ADR 0011/0012's cross-language RFC 8785 vectors.
The digest excludes only its own envelope field; format and compiler IDs,
selection time, tenant, source rights, releases, records, and suppressions are
covered. Snapshot lineage records each input ID and digest in PostgreSQL.
Open rejects unknown fields, trailing content, incompatible format/compiler,
and digest mismatch, then constructs local immutable exact and trigram search
indexes. Store.Install verifies the complete next artifact before one atomic
pointer store. This package is not wired into internal/evaluation, so current
HPI-I/VSN behavior and timing are unchanged.
Incremental refresh and atomic swap
“Incremental” applies to control-plane work, not evaluator mutation:
- ingest a complete new source release into staging tables (bulk/COPY and release partitions may be added for G-NAF);
- validate manifest digest, schema, counts, duplicate keys, referential and locality/state/postcode constraints, licence gates, and index health;
- approve the immutable release and transactionally move the candidate/active/ previous channel pointers;
- compare active release and tenant-input digests with the last build; skip an unchanged build, otherwise stream only changed database partitions into a new complete artifact;
- run artifact conformance and quality gates, persist lineage, sign/publish when OCI distribution exists, and notify evaluators; and
- download to a temporary file, verify size/digest/signature/compatibility,
fsyncand rename the local cache, build indexes off to the side, then swap one pointer. Keep current and previous verified artifacts for restart/rollback.
No evaluator applies row deltas. Mixed source versions and partial snapshots are invalid. A refresh that races another build uses channel generation or input digests and discards stale output before publication.
Suppression expiry schedules a build before the earliest expiry. Runtime may also refuse to apply an expired suppression using the signed selection/expiry values; it must not extend one because refresh failed.
Tenancy and access control
- Australian public/licensed reference releases are shared data, not copied per tenant. Licence terms may still require deployment-local storage.
- Trusted schemas/paths can be global or tenant-owned. Suppressions are always tenant-owned. Snapshot scope contains exactly global approved inputs plus one tenant's approved inputs; there is no cross-tenant merge.
- PostgreSQL RLS filters tenant registries and suppressions using transaction-local
groundskeeper.tenant_id. Application roles must beNOINHERIT, non-owner, non-superuser, and withoutBYPASSRLS; pool checkout resets all session state. - Separate least-privilege roles own migration, ingestion, review/approval, compilation, and audit. Ingest can write only staged releases. Compiler is read-only. Publisher/approver/activator separation follows ADR 0012.
- Dataset licences and source withdrawals are authorization inputs. Database readability is not permission to compile, redistribute, or use a dataset.
- Audit contains actor/workload, tenant, input/result digests, approval/ticket, timing/counts, and outcome, but no prompt, matched value, full address, or secret. Schema paths can be confidential and use tenant-scoped retention.
The migration creates RLS policies but does not create production roles or grants; those depend on the chosen identity system and are a deployment deliverable.
Evidence semantics
The local API emits both a match kind and the constant authority
candidate_only:
| Match | Meaning | Permitted use |
|---|---|---|
| exact canonical locality + exact state + exact postcode | the tuple occurs in the pinned release | component-consistency evidence |
| exact reviewed alias + exact state + exact postcode | the alias maps to such a tuple in the pinned release | weaker, provenance-visible consistency evidence |
| trigram canonical/alias candidate constrained by exact state/postcode | a lexical candidate exceeded the configured retrieval threshold | candidate generation for further deterministic checks |
| no candidate | no evidence in this snapshot, not proof that the address is invalid | coverage/unknown only |
Exactness does not establish the identity of an address or person. Fuzzy score is never confidence and never raises evidence state by itself. Neither exact nor fuzzy evidence establishes identifier validity, Indigeneity, sensitivity, or a policy decision. Policy cannot trigger directly on a trigram score.
Normalization is a versioned retrieval transform (initially case folding and
whitespace collapse), while evidence retains original detector spans and source
text. Adding punctuation, abbreviation, transliteration, unaccent, or Unicode
compatibility transforms is a semantic change with collision tests and replay.
Is pg_trgm sufficient?
Yes for the initial bounded problem: Australian locality and reviewed-alias candidate generation after exact state/postcode filtering. It is transparent, available in the existing PostgreSQL/PostGIS images, indexable, cheap to operate, and reproducible as a small local trigram index. It does not solve token semantics, address parsing, geospatial validation, or identity.
pgvector remains prohibited until OD-020 is decided using all of this evidence:
- a versioned, licence-approved, representative Australian address query corpus with typographical, abbreviation, token-order, multilingual, OCR, hard-negative, regional, and no-match partitions;
- a documented user need that exact structured fields, alias dictionaries,
full-text search,
pg_trgm, and PostGIS fail to meet; - blind comparison showing a material predefined recall gain at the same precision and candidate cap, with bootstrap confidence intervals and per-slice regressions—not only a better average score;
- p95/p99 latency, memory, artifact size, build time, cold-start, and cost within the budgets below under target release size and concurrency;
- embedding model/version/digest, lawful input/data/model use, hosting and cross-border review, reproducible rebuilds, drift/poisoning analysis, and a withdrawal path;
- explainable candidate provenance and proof that vector score remains retrieval metadata only; and
- an approved compatible PostgreSQL/PostGIS/pgvector image, pinned by digest, with backup, upgrade, rollback, and vulnerability ownership.
A win on a synthetic demo or unconstrained top-k recall is insufficient.
Failure and degraded semantics
- PostgreSQL unavailable, read timeout, serialization failure, or compiler error: publish nothing; evaluator keeps last-known-good (LKG).
- Invalid digest/signature/schema/compatibility, oversized artifact, or index-build failure: reject before swap; LKG remains active.
- Process restart: load the newest locally persisted verified artifact; if none is available, the future reference-backed detector reports unavailable/unjudged.
- Snapshot stale beyond its dataset- and licence-specific maximum age: mark the detector degraded/unjudged; never silently claim no match. Exact maximum ages require data-owner/SRE approval before activation.
- Withdrawn or stop-use source: block new builds immediately, revoke publication, compile a replacement/removal snapshot, and activate it under the approved incident SLA. Whether legal stop-use requires fail-closed routes is a risk/legal decision, not a compiler default.
- Snapshot has no candidate: report “no reference evidence” with coverage/version, not “invalid address”. Candidate truncation or timeout is explicit incomplete coverage.
HPI-I and VSN do not consume this snapshot. Their existing policy snapshot and detector behavior are therefore unaffected by all these states.
Observability and initial budgets
Metrics contain no query/reference value:
- source release age/status, active release digest label via bounded short ID, rows and rejected rows by reason;
- compiler duration, input/output counts, artifact bytes, index bytes, digest, and success/failure reason;
- refresh attempts/success/failure, LKG age, rejected installs, rollback count, and active snapshot generation;
- candidate requests, exact/fuzzy/no-candidate/truncated counts, candidate-count histogram, and query duration; and
- tenant scope only where cardinality policy permits, otherwise audit correlation IDs in a protected sink.
Initial engineering budgets are admission limits, not production SLOs:
| Operation | Initial budget |
|---|---|
| local exact locality lookup | p99 ≤ 100 µs, zero allocations after caller result allocation target |
| local fuzzy lookup, exact state/postcode prefilter, top 8 | p99 ≤ 2 ms and ≤ 2,000 scored terms |
| snapshot open/index build | ≤ 30 s and peak RSS ≤ 2.5 × artifact bytes |
| snapshot artifact | ≤ 512 MiB until measured address-level partitioning is designed |
| control-plane compile excluding source ingest/index build | ≤ 5 min |
| evaluator PostgreSQL calls per evaluation | exactly 0 |
Benchmarks on representative hardware and data must replace these defaults before activation. Exceeding a bound rejects/degrades reference coverage; it does not fall back to synchronous PostgreSQL.
Testing and promotion gates
The foundation uses only synthetic reference data. Required coverage includes:
- migration in a transaction against the supported PostgreSQL/PostGIS line; catalog constraints, approval-only promotion, RLS under non-owner roles, and rollback/reapply on a disposable database;
- compiler unit/property/fuzz tests for row-order determinism, duplicate/dangling rejection, JSON Pointer and normalization collisions, explicit-time expiry, unknown fields, trailing bytes, and digest tampering;
- exact/fuzzy tests where misspellings differ from exact results and every result
remains
candidate_only; state/postcode mismatch and common-name hard negatives; - concurrency/race tests proving readers see only old or new complete snapshots; failed install, disk-full, cancellation, stale build, restart, rollback, source withdrawal, and database-outage tests;
- golden cross-language canonicalization vectors before format stabilization;
- benchmark gates for memory, build/open time, exact/fuzzy latency, candidate cap, and corpus precision/recall by slice; and
- unchanged HPI-I/VSN golden, race, and micro-slice suites.
Production data, G-NAF ingestion, deployment, runtime policy enforcement, and vector infrastructure are explicitly outside this foundation.
Recommended first detector
Implement Australian locality–state–postcode component consistency first, in observe-only mode and only after OD-017/legal approval for the selected source. It should consume already parsed structured components or exact trusted paths, not discover a full street address from free text. It returns:
consistent_exact,consistent_reviewed_alias,candidate_fuzzy,inconsistent, orunknown/unjudgedevidence;- source release/digest and non-sensitive record IDs; and
- explicit coverage and candidate truncation.
It must not call an address “valid”, infer residence/identity, classify a postcode alone as PII, or trigger a final action. This detector has the smallest semantic surface, directly tests the snapshot boundary, and produces useful evidence before the much larger G-NAF address parser/matcher is attempted.
Reconciliation with earlier decisions and local setup
- ADR 0006: PostgreSQL remains authoritative off-path; snapshots and LKG make
database failure independent of evaluation.
reference_auis separately versioned from tenant/control-plane state. - ADR 0011: stable source/object IDs, licences, provenance, compiler/version identity, complete flattened artifacts, and digest pinning are retained. A future deployment snapshot includes this correlation digest in its lock.
- ADR 0012: trusted paths are exact registry-backed pointers; suppressions are
bounded, expiring
skip_actionrecords with approvals. Tenant and caller input cannot select snapshots. Correlation evidence cannot redefine detector states or policy. - Podman/orb: the existing
postgis/postgis:16-3.5path already provides PostGIS andpg_trgm; the orb's Debian PostgreSQL/PostGIS setup is suitable for migration tests.unaccentremains optional and is not used implicitly. No pgvector image or second database container is introduced.
2026-10-05 owner decision and implementation record
The owner approved the G-NAF-only decision set for locality/state/postcode
candidate evidence. PAF remains excluded unless separately licensed. The pinned
input is the official August 2026 GDA2020 resource recorded in
data/reference-manifests/gnaf-aug-2026-gda2020.json.
The owner separately confirmed that Aug26 means August 2026 and was the latest
available release; the official catalogue independently reports “AUG 2026”, a
17 August 2026 resource update and GDA2020.
The exact 26 February 2016 EULA was retrieved and hashed before ingestion. It
grants worldwide royalty-free reproduction, sharing and production/sharing of
adapted material, including database extraction and reuse, without a
non-commercial restriction. Sharing requires attribution, licence/disclaimer and
modification notices, and no downstream restriction on licensed rights. G-NAF
must not generate addresses for mail unless each address is independently
verified as mail-capable using a secondary source. Non-compliance automatically
terminates rights, subject to its cure/reinstatement terms; publisher cessation
alone does not terminate the licence. Groundskeeper applies the stricter local
rule that a publisher withdrawal or emergency governance event invokes immediate
StopUse, prevents LKG use, and requires a newly verified replacement.
Real ingestion is limited to current canonical G-NAF locality rows and distinct current locality/postcode relationships derived from address detail. Address records, coordinates and geometry are not written to snapshots. Real G-NAF locality aliases are excluded because community/historical/Indigenous alias provenance and withdrawal authority are not yet approved; synthetic aliases test the bounded API. Culturally restricted or secret location material is prohibited.
Snapshots expire after 30 November 2026. Refresh failure retains LKG only until that date; after it, the detector reports degraded/unjudged. Distribution is deployment-local and must be signature-verified under an active policy. Signing identity and trust root remain unset, so distribution is not active and no raw or derived G-NAF data is committed to Git.
Remaining conditional decisions
Before the corresponding broader behavior is activated, owners must resolve:
- signing identity, trust root, registry admission, deployment-specific access, backup and retention controls for any snapshot distribution;
- whether any future requirement needs Australia Post PAF or another source; such data remains excluded until separately licensed and approved;
- whether locality aliases, historical names, and Indigenous place names may be used, who has authority to approve them, cultural/IP and withdrawal controls, and whether any community-controlled material must remain excluded;
- whether geometry or geocoding outputs are derivative data with additional licence, privacy, security, or sovereignty restrictions;
- source-specific update/withdrawal SLAs, allowed stale age, incident failure posture, and who can approve/activate a release;
- tenant-schema/path confidentiality, residency, retention, deletion, support access, and audit obligations; and
- licence compatibility for any artifact distributed through OCI, including required notices and whether reference rows may leave the licensed deployment.
Until each conditional item is recorded, its affected sub-capability remains disabled or unjudged; the accepted canonical locality/state/postcode scope is not authority to broaden it.