feat(placement): license-expiry machine + the <j>-placement-eligibility ruleset (ruled #1639)
What
Build the license-expiry half of the #1639 (closed) ruling (2026-09-02, option (a): both machines, GATING). Today foster_homes.license_expires is display-only (nothing derives license_status='expired'), the #1635 (closed) activation gate reads the stored license_status, and implementation-guide.adoc:1601/1622 claim an unbuilt foster_home.license_expiring event.
Design (per the ruling's ADR-072 tier split)
- Tier 3 machinery: ONE store-side derivation
effective_license_status(home, today)—expiredwhenlicense_expires < todayon the jurisdiction BusinessClock (ADR-053), else the stored status — consumed by the #1635 (closed) activation gate, matching candidate lists, and craig-web's new-placement home filter. No write-time denormalization (no drift to reconcile). - Tier 1 policy: a NEW placement domain ruleset
rulesets/<j>/<j>-placement-eligibility.json(JDM; thegeorgia-subsidy-eligibilitypattern) with decisionlicense_gate: inputs{ license_status_effective, days_past_expiry }, outputs{ admits_matching: bool, admits_activation: bool, refusal_reason }. GA arms:expired→ refuses BOTH (grace 0 — recorded best reading ⁂ #1073);pending|suspended|revoked→ today's #1635 (closed) behaviour (planning admitted, activation refused). Each arm_description-cited;citations.tomlrows ride this unit. craig-placement consults under actor-relay attribution (financial U2's client pattern) at matching + activation, inside a const-asserted budget partition; ruleset-absent = 500 invariant (fail-closed). - Producers:
foster_home.license_expiring(lead windowCRAIG_PLACEMENT__LICENSE_EXPIRY__LEAD_DAYS, default 30 — an operational knob) andfoster_home.license_expired, emitted by a scheduled sweep (scheduler-off devstack; admin-triggered run endpoint like the subsidy sweeps), idempotent per(foster_home_id, license_expires)— contracts incraig-placement-contracts, event catalog + mq-topology lint updated.
Acceptance criteria
-
effective_license_statusderivation exists once in the store and is consumed by the #1635 (closed) gate, matching, and the craig-web new-placement filter (an expired-by-date home with storedactiveis refused/hidden everywhere) -
<j>-placement-eligibility.jsonregistered/versioned/promotable;license_gatearms cited;cargo xtask policy auditclean for georgia at the row level - Activation of an expired-license home refuses with a typed 409 (
FOSTER_HOME_LICENSE_EXPIRED, RFC 9457) naming the expiry date; matching excludes it; no-mutation probes on every refusal - Sweep emits
license_expiringonce per (home, expiry) inside the lead window andlicense_expiredonce at/after expiry; replay-safe across runs; both events documented - Docs:
implementation-guide.adoc:1601/1622flipped from "unbuilt" to as-built;data-model-placement.adoc,state-machines.adoc,services.adocpointer, CHANGELOGAdded - Corpus: oracle
license_expires_drives_statusre-classed to its real enforcement; the license half ofcore.placement.training-expiry-inertunblocked; ledger re-blessed - Tests: derivation boundary (day-of-expiry on the jurisdiction clock, leap day), gate refusals, sweep idempotency + exactly-once events, e2e new-placement form excludes an expired home
References
#1639 (closed) (ruling), #1635 (closed) (activation license gate), ADR-072 (tier doctrine), ADR-053 (BusinessClock), ADR-071 (corpus).