Maintenance, validation and recovery

Documentation spine · Getting started · Personas and journeys · Illustrated manual · Agent guide · Evaluation

The release lifecycle is fail-closed:

draft → candidate → validated → rc → published

An RC is built once and promoted by identical digest. Historical source evidence, research packages and audits are immutable. New checks create a new attempt and replacement lineage.

The reproduction and promotion contract keeps the literal asset name okf-uk-legislation-v0.5.0.tar.zst on both v0.5.0-rc.2 and v0.5.0. The published v0.4.0 archive and its original promotion evidence remain immutable history. Promotion reuses the sealed bytes and SHA-256; rebuilding or renaming the asset is prohibited.

Release policy v2 separates embedded pre-freeze evidence from a write-once external evidence plane. The deterministic assurance projection publishes the policy, external finalization contract, referenced receipt schemas, finalizer hash, frozen GitHub release-observation-controller hash and embedded GATE-12 release-report.json. The report must bind relationship composition by predicate, authority, confidence and freshness; coverage and snapshot currency; unresolved gaps; licence/access escalations; executed evaluation; model cost in USD and GBP with its assurance boundary; and the declared YAML-LD MIME exception.

Post-freeze evidence never goes back into the frozen checkout. Store every receipt, deployed attempt, GitHub release observation and downloaded release asset as a regular, non-symbolic-link file outside the repository. The offline pre- and post-RC receipt controllers derive the wrapper receipts and locked probe manifest from verified sources; do not hand-author those JSON documents. The offline finalizer enforces this sequence:

  1. authorize-rc writes the pre-RC authorization from clean-room reproduction, Explorer release, security, accessibility and performance evidence;
  2. verify-rc reconstructs that receipt before the RC is published;
  3. after RC publication and public-route validation, authorize-final-promotion closes GATE-09, binds the downloaded RC asset and authorizes uploading those already sealed bytes under the final tag;
  4. after the final asset and its release observation are available, create the terminal GATE-14 traceability receipt; finalize verifies those final materials, rehashes the sealed, RC and final copies, reconstructs GATE-14 and writes the external finalization receipt; and
  5. verify-final reconstructs the terminal receipt without writing.

The frozen ledger is never rewritten to claim post-freeze work. Only the nine release obligations explicitly named by traceability.externally_closable_ids may move from a frozen started or blocked status to passed in the external receipt, and only with non-empty hash-verified evidence. Every other passage still requires frozen verified status.

The authorizing commands are atomic and write-once: an identical rerun is idempotent, while different bytes at an existing output path fail closed. Neither the finalizer nor a verification command publishes a GitHub release or performs network access. See the complete command workflow.

Source-of-truth map

Surface Source of truth Generated or maintained output
work catalogue and facets official Atom feeds and legislation builders bundle/
provision normalisation Explorer CLML loader live browser CLML tree
official effect snapshot immutable request/response envelopes and effects config bundle/data/effects/
governed Codex-assisted discovery hash-bound prompts, rules, per-work outcomes and independent review bundle/enrichment/codex-assisted-v3/ and the active bundle/data/enrichment-v3/ projection
historical Codex v2 discovery preserved rules, calibration and independent audit bundle/enrichment/codex-assisted-v2.json
rich directed relationship semantics the governed work, effects, accepted v3, historical v2 and rejected v1 source planes bundle/data/semantic/ direct/reified JSON-LD, Reader runtime arrays, hash-bucket route locator and registries
optional direct API discovery profile enrichment/model-assisted-paid-v2/ observed evidence optional bundle/enrichment/model-assisted-paid-v2.json; not a release prerequisite
Whole-Law contracts and ontology whole-law/ bundle/whole-law/
answer benchmarks evaluation builders root and Whole-Law evaluation routes
documentation docs/, whole-law/ and preserved compatibility docs Pages documentation routes

Deterministic rebuild

Run uv sync --locked to establish the governed CPython 3.12.11 environment. The reproduction profile defines the current Core 0.3 build sequence:

uv run --locked python scripts/core03_snapshot.py
uv run --locked python scripts/build_release_metadata.py
uv run --locked python scripts/rebuild_legislation_discovery.py
uv run --locked python scripts/build_relationship_semantics.py
uv run --locked python scripts/build_bounded_relationship_navigation.py
uv run --locked python scripts/build_legislation_evaluation.py
uv run --locked python scripts/build_whole_law_evaluation.py
uv run --locked python scripts/run_yaml_ld_conformance.py
uv run --locked python scripts/run_ontology_competency_questions.py
uv run --locked python scripts/build_publication_docs.py
uv run --locked python scripts/build_whole_law_okf.py
uv run --locked python scripts/run_release_evaluation.py --check
uv run --locked python scripts/run_semantic_conformance.py
uv run --locked python scripts/build_whole_law_okf.py
uv run --locked python scripts/audit_graph_enrichment_gate.py build
uv run --locked python scripts/build_whole_law_okf.py
uv run --locked python scripts/build_checksums.py
uv run --locked python scripts/build_release_assurance.py
uv run --locked python scripts/build_bundle_guides.py
uv run --locked python scripts/build_checksums.py

The recipe verifies all 2,603 frozen source inputs and regenerates only their publication projections. It retains the accepted July work, effects and enrichment bytes, dates and independent audits. Do not run the historical build_legislation_okf.py --from-existing sequence against this frozen publication: the base builder refuses to replace its default bundle/. A new acquisition requires a separately identified output and review.

The first checksum pass bootstraps the integrity input consumed by the release-assurance projection; the final pass then binds that projection itself. Omitting either pass is not an equivalent release build. The historical enrichment and effects builders are checked for preservation rather than rerun. Their validation gates remain mandatory; no API key or direct API call is required by this release.

The separately assembled Pages transport deterministically gzip-encodes only the two Whole-Law migration answers.json objects, from executions eval-76d593e3295063f2cbe5 and eval-1edbcf9ff765b952ee03, using their exact source bytes. These objects were introduced during this migration; previously published historical executions retain their existing paths. The v1 encoding receipt binds original and encoded identities, the frozen source commit, plain raw-source routes and the release archive fallback. The report HTML and AI/discovery metadata point to the compressed payload and receipt. Canonical bundle/whole-law/ answers and integrity files remain unchanged; the default Whole-Law validator still requires every original file. The typed-site integrity check accepts these two encodings only after bounded single-member decompression reproduces each canonical byte count and SHA-256. The encoding policy also verifies that its current execution remains the declared latest one and both approved runs remain indexed. A new evaluation needs a reviewed policy and size assessment; the builder refuses to silently encode an older run. This large assurance payload is separate from the phone question journey, which must use small plain evidence files and source-linked graph selections. Measure and report the remaining Pages headroom before promotion. The builder separately bounds file bytes and the GNU-format Pages TAR, including member headers, file padding and end blocks, to 1,000,000,000 bytes each. Exact CI packaging and deployment remain separate checks.

Network refreshes are separate and create immutable acquisition attempts. They must not overwrite the evidence used by an existing release candidate.

rebuild_legislation_discovery.py is the narrow offline recovery path when the complete work and relationship shards already exist. It reads those published shards and the declared effects/enrichment datapacks, then replaces only bundle/data/search/ and bundle/data/records/ and synchronizes the facets, overview, presentation, performance, exact relationship-composition, manifest and Explorer descriptor control files. It performs no network acquisition and fails if research, evidence, effects or enrichment inputs change during the run. Run enrichment/effects first so its exact composition reflects their current immutable chunks.

Validation

The optional live API catalogue builder uses the shared bounded public HTTPS transport for Ordnance Survey discovery. Each document and redirect must stay within the approved publisher's host. Discovery limits unique routes and total response bytes, and records incomplete responses as acquisition failures. Fixture-backed catalogue generation stays offline.

Before starting a full release reproduction, run the exact-candidate Security evidence preflight. It invokes the same Security evidence consumer used during promotion. Use a completed, sealed scan from the installed producer and the exact registered clean checkout. A missing capability, unresolved review or unbound producer report must stop qualification before the full build. Frozen reproduction checks the source snapshot and runs the unit suite with the production offline guard before regenerating the corpus. The guard allows the Security verifier's exact local Git origin lookup. Git network operations remain blocked. The production preflight also checks that the configured compressed archive limit fits the release observer before reproduction starts. Published RC1 remains a historical attempt.

Before qualifying a release-tooling successor, run the bounded offline preflight with a retained real Explorer v0.9.2 release-bound runtime receipt and its exact Pages archive. Set FROZEN_BASELINE_COMMIT to the verified Legislation revision whose publication bytes the change must preserve.

uv run --locked python scripts/preflight_release_toolchain.py \
  --baseline "$FROZEN_BASELINE_COMMIT" \
  --pages-zip /absolute/path/to/retained-pages.zip \
  --runtime /absolute/path/to/explorer-runtime-acceptance.json \
  --explorer-root /absolute/path/to/clean-pinned-okf-explorer \
  --output /absolute/external/path/to/new-preflight-receipt.json

This diagnostic compiles receipt schemas, checks the real Pages inventory and runtime fixture, invokes the actual pinned Explorer canonical-inventory helper on the current production file inventory, proves its digest equals the Python producer's digest, reconstructs the retained native receipt against the current finaliser, runs controller and finaliser regression tests and rehashes every protected publication file against the baseline. Only the explicit assurance and maintenance-guide projection paths may differ. It does not refresh evidence, authorise publication or replace exact-successor reproduction, runtime, headless Security and public-release gates. The prior archive remains an immutable comparison baseline; the corrected assurance schema and its checksums require a new archive, promoted unchanged from RC to final. No legislation data or semantic graph is regenerated for this fix.

The canonical inventory orders complete relative POSIX path strings by code point. Do not use Python Path component ordering: enrichment-v3/ and enrichment/ are a concrete counterexample. JSON object key order is a separate contract. Cross-language digest equivalence must pass before a candidate is frozen; schema validity alone cannot establish it. The diagnostic fixture is never release-bound browser evidence.

GitHub Actions executes the complete validation contract through four mandatory, read-only jobs: core, legislation, semantics and federation. The stable validate gate fails unless every phase succeeds, and Pages deployment cannot start before that gate passes. This is a runtime-bound split of one full-suite contract, not impact-based test selection. Run sh scripts/validate_publication.sh without OKF_VALIDATION_PHASE for the same complete contract in serial local mode.

The Whole-Law builder excludes Finder .DS_Store files and AppleDouble ._* sidecars from authored and generated publication inventories. These are operating-system metadata, not OKF content. If a clean runner reports a stale Whole-Law integrity manifest, remove neither governed source data nor checks: regenerate the projection with the builder and confirm that the manifest does not contain those metadata paths.

python3 -m unittest discover -s tests -v
python3 scripts/check_legislation_okf.py
python3 scripts/build_model_enrichment_input_evidence.py --check
python3 scripts/build_codex_semantic_enrichment.py --check
python3 scripts/build_legislation_effects.py --check
python3 scripts/build_codex_semantic_enrichment_v3.py check
python3 scripts/audit_codex_semantic_enrichment_v3.py check
python3 scripts/rebuild_legislation_discovery.py --check
python3 scripts/build_relationship_semantics.py --check
python3 scripts/build_whole_law_evaluation.py --check
python3 scripts/run_release_evaluation.py --check
python3 scripts/build_publication_docs.py --check
python3 scripts/build_whole_law_okf.py --check
.venv/bin/python scripts/run_semantic_conformance.py --check
.venv/bin/python scripts/check_whole_law_okf.py
python3 scripts/audit_graph_enrichment_gate.py check
python3 scripts/build_release_assurance.py --check
python3 scripts/check_internal_links.py
python3 scripts/build_checksums.py --check

The direct-API/paid-model profile remains preserved historical evidence. It is excluded from the active build and validation sequences, requires a new explicit decision, and must not request an API key or block this Codex-only release.

Validation includes OKF 0.2 Markdown, YAML-LD/JSON-LD RDF equivalence, Reader runtime row/manifest reconciliation, bounded route-locator integrity, complete descriptor-graph SHACL, exhaustive JSON Schema checks over all core/provider source rows, CSVW, federation and source contracts, source/effect/model coverage reconciliation, links and checksums. It also recomputes all bounded relationship semantic shards and reconciles one direct triple with one rich reified assertion for every active or explicitly historical source row. The startup descriptor remains bounded; the sharded semantic plane is separately and accurately reported as RDF materialisation.

Immutable refresh attempts

Fresh Whole-Law source, legislation-effects and catalogue-feed acquisitions use a shared bounded HTTPS transport. Every request and redirect must resolve to a public address and connect to the pinned address. Official effects pagination stays on the legislation.gov.uk host. Body and decoded-gzip ceilings are enforced before XML parsing or evidence retention. Unsafe or oversized responses are recorded as failed attempts, never substituted for the sealed July 2026 snapshot. The catalogue producer rejects non-official work links, and the Pages search renderer independently declines unsafe click targets.

These controls change future acquisition and the Pages runtime, not the existing legislation records, source envelopes or semantic graph. For a release successor, first compare the protected data and graph trees with the previous candidate. Run focused boundary tests and the required exact-head checks; do not refresh official feeds, rerun model enrichment or regenerate source evidence merely because acquisition code changed. The native release archive still needs a fresh byte identity when the Pages runtime changes.

.github/workflows/drift.yml runs every Monday and can be dispatched manually. Its observation stage validates the checked-in checksums and latest immutable access evidence, probes the declared Pages/raw entrypoints, and compares the 20 most recently published legislation.gov.uk feed entries with the route locator. The probe uses no credentials, follows only bounded HTTPS redirects between declared hosts, reads at most 1 MiB per response, and never writes to the checkout.

The workflow then seals the observation using the refresh-attempt policy, the manifest schema and the datapack schema. Each attempt has a content-derived identifier binding the exact observation and source commit. Its five uncompressed, bounded files are published as a uniquely tagged prerelease:

The release is the persistent record. Its tag is refresh-attempt-<attempt-id> and must never be edited, overwritten or deleted. A 90-day workflow artifact is retained only as a secondary convenience copy. If a tag already exists, the workflow compares all five downloaded assets byte-for-byte and never edits the release. Drift and failed access are still sealed before the job fails closed, so failed observations remain visible rather than disappearing with the job.

Run the same observation manually without changing the publication:

python3 scripts/check_release_drift.py --output /tmp/okf-drift-report.json

Seal it to a staging directory outside the checkout:

python3 scripts/seal_refresh_attempt.py seal \
  --observation /tmp/okf-drift-report.json \
  --output-root /tmp/okf-refresh-attempts \
  --source-commit "$(git rev-parse HEAD)"
python3 scripts/seal_refresh_attempt.py verify \
  /tmp/okf-refresh-attempts/<attempt-id>

Sealing is offline, rejects output below the repository, rejects symbolic links, limits the raw observation to 4 MiB, validates both JSON Schemas and refuses to mutate an existing package. Values from public responses remain untrusted JSON data and are never interpolated into Markdown, HTML or an executable asset. Each later refresh creates another attempt; it never replaces historical evidence or rewrites a release-candidate snapshot.

Namespace continuity

The current Whole-Law v1 namespace remains canonical until a permanent government domain and operating model are approved. The namespace-migration ADR defines the prerequisites, reviewed mapping, dual-publication, redirect, rollback and backwards-compatibility contract. A new domain must not cause an in-place identifier or evidence rewrite.

Documentation and access review

After changes:

  1. verify the legislation and Whole-Law descriptors;
  2. verify /docs/, /evaluation/, /whole-law/docs/ and /whole-law/evaluation/;
  3. verify that the repository, canonical descriptor, declared raw_subpath and release/archive fallback appear on each publication landing page;
  4. review all five role guides and run python3 scripts/check_internal_links.py;
  5. run the Claude adversarial access suite;
  6. verify compatibility redirects and the preserved CKAN/authoring links;
  7. confirm the official legislation.gov.uk and data.gov.uk documentation routes remain directly discoverable;
  8. confirm source constraints and failed access attempts remain visible;
  9. update the release report and changelog.

GitHub Pages’ .yamlld application/octet-stream response is a declared hosting constraint. Explorer may safely content-sniff YAML-LD; JSON-LD remains the strict transport fallback until a permanent host returns application/ld+yaml.