ADR-074: Administrative-Authority Family — A Jurisdiction-Declared Office Hierarchy Resolved from Ruleset Data

Status

Accepted (2026-09-12) — with U2 (#1787), the first consumer: craig-financial resolves the import class from the family. Drafted FIRST per the draft-first path as U0 of #1614 (epic &86); plan: Administrative Authority (#1614) (archived). Executes the ruling in ADR-072 § "Administrative authority: tier 1, single source". The design took the maintainer’s 9-finding plan-mode review (2026-09-12, folded into rev 2, approved) and the plan page’s round-1 folds; the as-built notes below record U2, U3 and U4. The program COMPLETED with U5 (#1790, 2026-09-12): all five units merged, epic &86 closed, the plan archived.

U2 as-built note (2026-09-12, #1787). Two refinements of the Decision text: (1) the shared parser takes the fleet office vocabulary as a PARAMETER (AuthorityDeclaration::parse(document, craig_auth::OFFICE_REALM_ROLES)) so the leaf contracts crate carries no craig-auth edge; (2) the eval-thread handle is craig_authz::EvalHandle::spawn(name, remedy, …) with the budget on the CALL (evaluate(decision, input, budget, diag)), and a full queue surfaces as the budget elapse (eval-timeout) rather than a distinct reason — the queue wait is inside the budget by construction. The subsidy_agreement_created payload gains authority_revision with U3, when the create sites resolve (an always-absent key would have been noise under the omit-when-absent doctrine).

U3 as-built note (2026-09-12, #1788). Every human approval act now resolves from the family; Office, required_level, the REGIONAL_* reason lists and the legacy proof path are DELETED (the rules-side golden keeps the transcription of the former matrix as the identity oracle). Two mechanism refinements of decisions 6–7: a site resolves AT THE POINT OF NEED rather than carrying an eager Resolution (the in-window schedule, an honest replay and a pre-linkage completion never touch the surface — the same outcome, no plumbing), and the sweep candidates do NOT carry the head: the executor pins ONE verified snapshot per run (review_sweep::Executor) and each per-row proof is resolved in-tx from the freshly read head BEFORE any lock (the handoff leg reads the head before the pay-exclusion lock, then locks and re-verifies), the store’s key-equality re-check catching a head that moved in between. ONE helper mints for every handler (api::subsidy_shared::resolved_proof); the subsidy_agreement_created payload carries authority_revision.

U4 as-built note (2026-09-12, #1789). craig-web renders the decision-11 map verbatim: the one BFF extractor behind every write form (routes::financial::rejection_detail) keeps its any-4xx rule and gains a typed 5xx allowlist of exactly SUBSIDY_AUTHORITY_NOT_READY (the flash names the surface around the closed reason token) and SUBSIDY_AUTHORITY_EVALUATION_FAILED; every other 5xx stays generic. The BFF’s county_director|admin gates on the guardianship routes are a GA stacking assumption over a floor the family declares — annotated, not changed (a jurisdiction declaring a LOWER floor retires that layer as its own work). require_georgia stays (#1797); its 400 now names the refused jurisdiction and that the family resolves floors without opening writes.

Context

ADR-054 D1 gave the subsidy programs a verified-office authority model: nothing approval-shaped is caller-supplied; the acting worker’s IdP-verified office role is turned into a proof-typed ApprovedAction by authorize(claims, action) and re-checked by covers inside the store transaction. The ORDERING of the offices and the FLOOR for each action, however, are Rust: Office (county < regional < state by derive(Ord) declaration order), required_level(action) and two reason lists in services/craig-financial/src/subsidy/approvals.rs:56-210 — 12 proof mints, 7 in-transaction re-checks, the vocabulary copied into APPROVAL_LEVELS and four DDL CHECKs. ADR-072 ruled this "tier-1 policy in a tier-3 costume" and froze it: the replacement is a jurisdiction-declared unit hierarchy + per-action floors, fail-closed when unconfigured, SINGLE SOURCE = ruleset data (StateBundles do NOT double-declare), and until that seam is operational no new hardcoded floor may land — which blocks backpay (#1115).

The #1614 census (123 surfaces) fixed the constraints:

  • covers is sync and pure and runs under SELECT … FOR UPDATE; check_transition_authority re-derives the head status and head reason from the LOCKED row. Whatever resolves the floor cannot be an await under that lock.

  • The scheduled review sweep has NO HTTP actor; its consented legs authorize as system. A per-act call to /v1/rules/evaluate (which needs an actor) cannot serve it.

  • zen-engine futures are !Send; craig-authz already evaluates in-process on a dedicated thread behind a bounded queue with a published budget (crates/craig-zen-eval/src/thread.rs since #2312).

  • Two mint sites are CONDITIONAL: in-window review scheduling needs no office at all, and honest replays return before any authority check.

  • The sweep’s handoff candidates carry neither head status nor head reason, yet the query admits active AND suspended heads; the sweep counts changed-world store errors as skipped_drift.

  • The promotion canary replays rule_evaluations; in-process evaluations never populate it, so this family’s canary would be thin forever.

  • craig-cases' intake-screening surface derives a SECOND role hierarchy (metadata.screening.actor_roles) for a different act; admin and state_office are unmapped there.

Decision

  1. One family per jurisdiction, {j}-administrative-authority.json, ONE first-hit table, trailing sentinel. Inputs operation, from_status, to_status, reason_code, head_reason (absent = the literal "none"; the resolver never omits a key); output office with a CLOSED enum = the declared tokens ∪ "unconfigured"; the last row ("" ×5 → unconfigured) is the ADR-072 fail-closed sentinel. The operation is a discriminating INPUT, so one table carries every action, one sentinel, one citation key space, one golden test. The name never contains -authz- (that substring selects file-level citation bucketing and craig-authz’s boot prefix).

  2. The hierarchy is DATA in metadata.authority.offices[] { token, realm_roles[], rank }; output tokens ARE realm- role names. token ∈ realm_roles ⊂ craig_auth::OFFICE_REALM_ROLES (the three ADR-054 office roles), AT MOST one owner per realm role (an unowned role holds no office in that jurisdiction), ranks unique integers ≥ 1. The held office is the max-rank entry whose realm_roles intersects the session’s realm roles (the screening derive_actor_role shape); no intersection is the existing no-office refusal. Office’s `derive(Ord) becomes the declared rank; ADR-054’s one vocabulary survives (persisted approval_level == realm role == token). A two-tier jurisdiction declares two entries (the Texas twin: regional_director 1, state_office 2, each owning only its own realm role — a county_director session holds no office there); a fourth tier is a fleet contract change (new realm role + IdP configs + DDL), filed as #1791, not presupposed. The DDL CHECKs stay because every declarable hierarchy is a subset of their set.

  3. No none FLOOR. Every ApprovalAction is an approval act by construction; none is the HELD side only (#1791 revisits when a jurisdiction has no office roles).

  4. The operation vocabulary is single-sourced in crates/craig-financial-contracts/src/subsidy_authority.rs (AuthorityOperation::ALL: eight subsidy_agreement.* operations + subsidy_backpay.stage / .supersede / .finalize), beside AuthorityDeclaration::parse — the ONE structural parser the rules check lint and the service verifier share, whose closed error tokens ARE the 503 reasons.

  5. Resolution = a service-local VERIFIED surface + a BOUNDED evaluator; resolved BEFORE the row lock, never under it; re-checked by KEY EQUALITY in-transaction. craig-financial reads the family by name with its SERVICE bearer inside one 4 s overall timeout (the cases ScreeningSurfaceClient shape), runs the shared parser, compiles the JDM and swaps an immutable snapshot { rule_set_id, revision, hierarchy, decision } behind an atomic gate; a Critical verifier worker re-verifies every 60 s (the #1727 ladder after a failure) and publishes a gauge. Evaluation runs on craig-authz’s eval-thread machinery through a NEW pub EvalHandle (thread name and deadman label parameterized; authz’s own authz-eval unchanged) under a 250 ms PER-KEY budget covering queue wait + eval; timeout, a full queue or a dead thread is a typed 503 — never a defaulted floor. Sites whose key is known from the request resolve before the transaction; the two transition sites that read the head in-transaction by design (after the assignment / session check, so no row attribute leaks to an unauthorized caller) resolve inside the closure, after that check and before the store takes FOR UPDATE — a connection held for at most the budget, never a row lock. A verified snapshot stays usable until the verifier OBSERVES failure (≤ 64 s after an outage or a promotion). Per-act /v1/rules/evaluate is REJECTED (no actor for the sweep, a network hop before every mint, useless under the lock).

  6. Lazy consumption at conditional sites. Every mint site resolves eagerly into a Resolution = Result<ResolvedFloor, AuthorityError> and consumes it only where a fresh approval is required; in-window scheduling and honest replays never inspect it, so a resolution error rejects exactly the requests that needed an office.

  7. The proof carries provenance; covers compares KEYS. ApprovedAction.provenance = Resolved { entries: [{ key, floor, floor_rank }], held, held_rank, rule_set_id, revision } | SystemLeg. covers stays sync and pure: the binding admits the action (unchanged); SystemLeg passes on binding admission alone (today’s leg arm); for Resolved the store builds the key from the LOCKED row, and an entry with an EQUAL key and held_rank >= floor_rank must exist. A missing entry is the NEW ProofContextStale — DISTINCT from an insufficient office end to end (a drift class in the sweep, HTTP 409 SUBSIDY_APPROVAL_CONTEXT_STALE for humans; InsufficientApproval stays a real failure). Every DB fact that can change the floor is IN the key, so key equality under one pinned revision implies floor equality — not weaker than today, stricter on replay. ActivateGuardianship proofs carry two entries (own key + the implied pending→active transition the binding admits). Sweep candidates carry head_status + head_reason; the manual executor resolves every per-row proof from ONE snapshot per run.

  8. Durable provenance. authority_rule_set_id + authority_revision on FOUR tables: subsidy_agreements (written from the proof that CONSENTED the creation — create-active, create-pending, import finalize; the import class has no other row of its own) and the three stamped tables subsidy_agreement_terms, subsidy_agreement_status_intervals, subsidy_agreement_reviews (NULL for historical import stamps and system); subsidy_agreement_created / _imported gain authority_revision. Pre-1.0 Changed.

  9. Historical stamps validate against the FLEET vocabulary (OFFICE_REALM_ROLES + system where the column admits it), never against the current declaration — a two-tier jurisdiction never rejects authentic county-approved history.

  10. system stays the fourth token OUTSIDE the hierarchy. Consented enforcement legs never touch the surface or the evaluator and keep running while it is unverified.

  11. Fail-closed map: 503 SUBSIDY_AUTHORITY_NOT_READY (closed reason detail), 403 SUBSIDY_AUTHORITY_UNCONFIGURED (operation, ruleset, revision), 500 SUBSIDY_AUTHORITY_EVALUATION_FAILED, 400 approval_error (held below floor — unchanged text), 409 SUBSIDY_APPROVAL_CONTEXT_STALE. craig-web renders each verbatim.

  12. GA content is behaviour identity with the former required_level matrix (18 rows in the plan’s mapping table, arm order preserved, the two asymmetric fail-closed defaults explicit rows; the matrix itself was deleted by U3 — the rules-side golden keeps its transcription as the oracle); the backpay floors ship as ⁂ best readings on #1073 (county / county / state). The TX twin is a curated two-tier fixture behind require_georgia.

  13. Maintained offline evidence replaces the promotion canary for this family: rulesets/<j>/evidence/administrative-authority.toml (every key → office, plus a declared-token × key allow / refuse matrix) consumed by the rules-side golden, the financial-side verify_document test and cargo xtask authority-evidence (in validate; run against a candidate before rules-promote, its digest named in the thin-corpus acknowledgement). Server-side corpora for the preview itself: #1796.

  14. Production bootstrap is cargo xtask rules-bootstrap (create-if-absent via POST /v1/rules/sets), then rules-promote for later versions; per environment the content precedes the consuming image.

  15. Scope: the WHOLE matrix migrates in this program (U2 the import class + the backpay variants — the #1115 unblock — then U3 the remaining eleven sites and the deletion of Office / required_level). require_georgia stays (#1797). The screening actor-role hierarchy COEXISTS as a second hierarchy for a different act (#1793 reconciles it or records why not); leg_admits (#1794), the twin-parity lint (#1795) and persona coverage (#1792) are out.

Consequences

  • Backpay (#1115) unblocks on a mechanical criterion (the plan states it): U1’s content bootstrapped + U2 merged.

  • A jurisdiction changes its hierarchy or a floor by PROMOTING a ruleset revision — never by a source change. The approval row names the revision that authorized it.

  • A financial image deployed before its content answers 503 on every human approval act and writes nothing; consented automation continues. Operators run the bootstrap first (deployment guide).

  • Two new Critical workers in craig-financial (authority-surface-verifier, the eval thread); /readyz fails when either dies.

  • Pre-1.0 breaking: the provenance columns, the event field, the 409 stale-context class, the deleted Office surface. No N−1 rollback requirement and no old-shape sweep JSON preserved (maintainer ruling, 2026-09-12).

Open questions

  • Whether a none floor is ever admissible, and for which operations (#1791).

  • Whether the screening actor-role hierarchy and this family become one declaration with per-act role maps (#1793).

  • Production evidence for promotion previews of in-process families (#1796) — until then the offline evidence digest is the acknowledgement.

Alternatives considered

  • StateBundle-declared hierarchy + floors. Rejected by ADR-072 at ruling time: two sources of truth; bundles are compiled, not promotable or citable.

  • Per-act POST /v1/rules/evaluate from every mint site. Rejected: needs an actor the scheduled sweep lacks, a 4 s hop before twelve mint sites, and nothing to re-check under the row lock.

  • An {j}-authz-subsidy_ row per floor inside the existing authz families.* Rejected: authz answers "may call the operation", not "which office floor"; the reason-conditioned arms (head reason, termination reason) are row facts the authz probe never carries; the -authz- name selects file-level citations.

  • Floor-equality re-check in covers (carry only the resolved floor). Rejected: the floor can change between mint and lock when the head moves; carrying the KEY makes the store’s re-derivation an equality test and the stale case a distinct, retryable class.

  • Keeping Office as a parallel legacy path after migration. Rejected: two matrices drift; the program deletes the enum in U3.

Amendment — #2999 (2026-11-08): the configuration layers left CRAIG’s source

ADR-087 U4 (#2955) moved the configuration layers out of CRAIG’s source. A rulesets/<j>/<file> path above now names <file> in layer <j>: the federal, Georgia and Texas layers are the craig-config-{federal,georgia,texas} repositories, pinned in config-sources.lock and fetched to target/config/layers/<j>/ by cargo xtask config fetch, and the synthetic testonia layer is fixtures/config/testonia/. The decision above is unchanged.

Edit this page · latest