Skip to content

Commit b81006c

Browse files
authored
feat(kernel): complete P02b-4 transactional job runtime (#32)
* feat(kernel): persist outbox events in the admitted transaction Make successful enqueue an immediate atomic write with trusted execution metadata and explicit identifier-only routing. Refuse stale, foreign or unowned frames before persistence and retain production receipts across absorbed failures without changing event-free execution. ADR: 0057 * docs(events): reconcile the delivered outbox entry baseline Distinguish the phase-entry inventory from current producer delivery and record the first independent review round without rewriting entry evidence. ADR: 0057 * test(kernel): prove enqueue and completion never publish A persisted event with no subscriber cannot reveal accidental delivery. Observe the resolved transport with a positive control and close both independent outbox review rounds against the passing database proof. ADR: 0057 * feat(kernel): complete saved domain facts before commit Collect facts only after their source save succeeds and retain their invocation origin until physical-owner completion. Translate completed tenant provisioning into one pending outbox row on the same commit as both business roots and MUST audit, with no subscriber delivery yet. ADR: 0057, 0040, 0042, 0044 * docs(events): close domain completion review rounds Record two fresh independent reviews and their focused passing repeats before starting the producer enforcement step. ADR: 0057 * test(events): enforce producer contracts across production code Keep producer guarantees measurable across complete assembly censuses and transitive helper paths, with deliberate dirty and clean controls. Align the catalogue and authoring guidance with delivered producer capabilities while retaining dispatcher and consumer ownership in their named packets. ADR: 0057 Module: Tenancy, Customization, Audit * test(events): cover abstract and virtual helper dispatch Expand the producer and domain-handler walks to derived implementations so normal class dispatch cannot bypass their capability checks. Plant dirty and clean class paths and verify the interface-only regression fails. Reconcile the lease migration's existing-row premise. ADR: 0057 * docs(roadmap): close P02b-1 implementation and review rounds Record complete producer delivery with exact local evidence, verified review fixes and preserved decision history. Keep PR approval separate and name the remaining dispatcher and consumer decision passes. ADR: 0057 * test(web): expose bounded browser admission failure phases Keep private browser diagnostics contained while distinguishing launch, hydration and document-fallback failures in the existing CI proof. The first PR run failed without identifying the browser operation; preserve all assertions and deadlines while making the next result actionable. ADR: 0055 * docs(events): reconcile producer and pending delivery guarantees Align current-state references with delivered producer completion and keep durable ordering, dispatch and inbox obligations with their owning packets. Process-local serialization is not a durable ordering proof. ADR: 0057 * docs(architecture): distinguish local event invocation ordering Remove the remaining durable-order equivalence claim found during the independent CI follow-up review. Partition serialization is process-local; P02b-2 G3 still owns ordering across commits and retries. ADR: 0057 * docs(events): align transport comments with ordering ownership Keep XML guidance consistent with the corrected architecture and glossary. Process-local invocation serialization does not decide durable ordering across concurrent commits or retry, which remains P02b-2 G3. ADR: 0057 * test(web): preserve the first admission proof failure Always run browser cleanup without allowing its failure to replace the original diagnostic phase. A cleanup-only failure remains classified as shutdown, and neither path exposes private exception text. ADR: 0055 * docs(roadmap): record P02b-1 CI follow-up verification Retain the first failed browser receipt and distinguish the subsequent passing integration evidence from an established cause. Record bounded diagnostics, verified review corrections and their independent reviews; the PR checks own final-head CI approval. ADR: 0057 * test(kernel): strengthen producer and audit proof controls Exercise actual outbox receipts and require positive intent and owner write observations so missing production work cannot pass these tests. ADR: 0057 * docs(roadmap): record external producer proof review Keep the review follow-up traceable to verified regressions, controlled mutations and independent reviews without claiming new runtime behavior. ADR: 0057 * fix(kernel): distinguish frame refusal from indeterminate commit A live transaction means frame completion refused before COMMIT. Route that failure through guarded rollback so durable audit records the known failure and cleanup cannot replace its original exception. Prove actual business/outbox rollback and raw event-save admission in both hosts. ADR: 0033, 0040, 0057 * fix(kernel): bound shared execution proofs and reconcile review records Keep shared transaction state inside the sequential-execution census, with exact exceptions for independent singleton flights. Distinguish private browser proof failures without exposing their source. Reconcile uncached settings ownership and correct the historical clause locators without changing accepted decisions. ADR: 0033, 0040, 0041, 0057 * fix(web): authenticate sanitized browser proof failures A closed phase token alone cannot prove that an error was sanitized. Use the same private brand at the outer proof boundary, retaining sanitized first-error identity while refusing forged raw messages. ADR: 0055 * docs(roadmap): record verified PR29 remediation and reviews Record the independently verified pre-commit audit correction, bounded proof changes and both completed review rounds against actual local regression counters. Preserve historical evidence and keep exact-head CI ownership separate from local results. ADR: 0033, 0040, 0041, 0057 * fix(kernel): poison the unit after a failed outbox insert An absorbed SQL failure must not leave the producer unit eligible for completion. Mark it rollback-only at the insert boundary while retaining successful-production receipts only for completed inserts. Exercise both rethrow and absorption against PostgreSQL and align the audit ownership and delivered producer documentation with the shared coordinators. ADR: 0040, 0057 * docs(roadmap): record outbox failure and ownership verification Record the reproduced INSERT failure, both independent review rounds and full backend regression without changing accepted decisions or claiming dispatcher or consumer delivery is implemented. ADR: 0057 * docs(decisions): propose P02b-2 delivery and recovery Define the producer dispatcher and coupled subscriber recovery contract before enabling durable delivery. Preserve unready provisioning events and require fenced terminal transitions with atomic MUST audit. Record four implementation steps and two completed proposal review rounds. Keep ADR-0046 Proposed until maintainer approval; runtime and Accepted ADR bodies are unchanged. ADR: 0003, 0006, 0010, 0033, 0038, 0044, 0046, 0057 * docs(decisions): tighten P02b-2 recovery and audit contracts Bind terminal audit identity to the actual fenced transition and name negative controls for the bypass-role write boundary. Clarify Pending holds, publication eligibility, inbox completion and retry ownership. Record verified external-review dispositions and exact acceptance carrier replacements without changing Accepted ADRs or runtime code. Keep the revised decision package Proposed pending maintainer approval. ADR: 0046, 0044, 0057 * docs(decisions): accept P02b-2 durable delivery contracts Record maintainer approval before runtime implementation, preserving prior accepted decisions and dated producer delivery evidence. Register the recovery and row-bound audit obligations without claiming delivery. ADR: 0046, 0003, 0006, 0010, 0033, 0038, 0044 Module: Tenancy, Audit * feat(kernel): add confined outbox dispatch foundation Establish the accepted lease state and explicit event readiness before activating dispatch. Constrain the worker credential at configuration and physical-connection boundaries while preserving legacy event facts. ADR: 0046, 0003, 0033, 0044 Module: Tenancy, Audit * fix(docs): reconcile remaining shared inbox guidance Keep mandatory reviewer instructions aligned with the accepted transport ownership while preserving the earlier dated architecture note. ADR: 0046 * fix(kernel): refuse open generic active outbox handlers Fail invalid delivery composition before a stored event can be claimed. Exercise the existing discovery gap and a closed generic accepting control, with a mutation check proving the refusal is load-bearing. ADR: 0046 * docs(roadmap): close P02b-2 foundation review rounds Record independent verification of the composition fix and synchronize current delivery status before starting fenced transitions. ADR: 0046 * feat(kernel): add fenced outbox transitions and terminal audit Keep committed dispatch claims recoverable with database-time ownership, closed retries and terminal requests. Bind the fifth audit writer to the actual fenced UPDATE so state and MUST audit commit together. Prove expiry and identity refusal on real roles, including a lost COMMIT response and mutation controls for each critical safeguard. ADR: 0046, 0044, 0033 Module: Tenancy * fix(kernel): validate persisted outbox routing fields Refuse missing or altered get-only routing members before reconstructing an event, so canonical getters cannot hide invalid stored envelopes. Cover the refusal with payload mutations and real terminal audit proof. ADR: 0046 * docs(roadmap): close P02b-2 transition review rounds Record independently verified routing remediation and both clean second reviews before activating hosted dispatch in the next approved step. ADR: 0046 * feat(kernel): host bounded outbox dispatch and observation Make dispatcher startup mandatory while preserving Pending production facts and retaining callback-owned resources through timeout and shutdown. Real host/database proofs cover live claims, poison progress and safe cleanup; API launchers confine the dispatcher credential to its owning process. ADR: 0046, 0057 Module: Audit, Tenancy * fix(dev): confine dispatcher credentials to the API host Keep local demo database validation inside the launcher instead of passing bypass credentials to a Seeder validation process. Share an explicit application-only child environment across manifest, demo seed and standalone seed paths, including ambient alias controls. ADR: 0046 * fix(kernel): clarify dispatcher boot refusal and close step 3 Keep startup diagnostics useful without disclosing supplied credentials. Record both independent reviews and their verified corrections before starting the final enforcement step. ADR: 0046 * test(kernel): enforce confined outbox dispatch boundaries Keep dispatcher credentials, publication and status SQL confined to nonempty production subjects with dirty and clean controls. Reconcile delivery documentation without claiming pending consumer work or CI. ADR: 0046, 0057 Module: Tenancy, Audit * fix(kernel): close dispatcher census mutation gaps Make closure provenance, literal SQL targets and worker registration controls reject the verified alternate paths instead of overstating coverage. Preserve production behavior and record the first review. ADR: 0046, 0057 * fix(kernel): pin dispatcher authority and observation bindings Bind privileged method grants to literal signatures and observation to its actual system clock and singleton health state so added overloads or same-type detached factories cannot pass the enforcement census. ADR: 0046 * docs(roadmap): close P02b-2 implementation and review rounds Record verified producer delivery and correction evidence while keeping subscriber work with P02b-3 and CI/merge state with the closeout record. Preserve acceptance history and earlier step receipts. ADR: 0046 * docs(roadmap): link P02b-2 PR and live verification ownership Keep dated local receipts intact and use PR 30 as the current-head CI, review and merge surface instead of repeating an evergreen pending status throughout the corpus. ADR: 0046 * fix(dev): reject paired missing demo role passwords Require each selected role password explicitly so an omitted connection password and environment value cannot validate by comparing undefined. Prove the refusal for all four roles and retain valid password grammar. ADR: 0046 * docs(roadmap): record demo password correction reviews Record both independent correction reviews and bounded local evidence while leaving current-head CI to the PR's live verification record. ADR: 0046 * fix(kernel): align recovery selection and preserve commit faults Keep Pending backlog outside ordered recovery scans and preserve both uncertain COMMIT and reconciliation failures. Expose the fixed local configuration diagnostic, tighten lifecycle proofs and reconcile the reviewed documentation with the shipped producer boundary. ADR: 0046 * docs(kernel): reconcile integration contract delivery remarks Keep source guidance aligned with ADR-0046 so future consumers use the transport-owned shared inbox and do not infer durable order from a key. Record the first correction review and its verified adjacent finding. ADR: 0046 * docs(roadmap): record external correction reviews and verification Keep review and test evidence tied to the corrected source instead of reusing the earlier PR head. Record both independent rounds, the complete local suites and the remaining exact-head CI verification boundary. ADR: 0046 * fix(kernel): close dispatcher membership and credential census gaps Detect reverse role grants at new dispatcher connections and close the compiled configuration-indexer and assembly-instantiation census gaps. Add targeted ownership controls and reconcile current documentation; retain accepted wire semantics and record unconfirmed suggestions. ADR: 0003, 0046 * docs(roadmap): record dispatcher guard follow-up verification Keep the latest review dispositions and both independent correction rounds tied to the tested source. Record complete local validation and the remaining exact-head CI boundary without reusing earlier evidence. ADR: 0003, 0046 * fix(kernel): respect the outbox snapshot refresh interval Avoid a full backlog scan after every successful claim. Prove continued dispatch with a retained snapshot before the configured interval and a refresh at its exact monotonic-clock boundary. ADR: 0046 * docs(roadmap): record snapshot cadence correction reviews Record both independent approvals and the isolated predecessor failure alongside the passing local regression evidence. ADR: 0046 * docs(roadmap): close P02b-2 after PR 30 merge Record the verified source/squash tree and final PR evidence. Mark producer dispatch complete, link current status surfaces to its closeout, and identify P02b-3 plus the remaining phase obligations. ADR: 0046 * docs(roadmap): prepare the P02b-3 decision package Reverify inherited delivery contracts against the merged producer runtime before activating consumers. Record concrete storage, completion, retry, default and Seeder policies with six implementation steps, two independent package reviews and passing documentation controls. Approval remains pending and no runtime changes are included. ADR: 0046, 0057 * docs(decisions): accept the P02b-3 implementation package Record the maintainer's explicit approval before runtime changes, register six delivery/default proof obligations and preserve existing accepted history. Correct the inbox minting locator through an additive erratum and record the capture exclusions already authorized by ADR-0046. ADR: 0046, 0057, 0044, 0023 * feat(kernel): add shared delivery and inbox storage Install the subscription-scoped ledger and immutable inbox under exact application and scheduler grants. Keep payload access behind tenant and organization RLS, and preserve independent retention and completion facts. Prove applied DDL parity, real-role capabilities, all-table isolation, index selection order and disposable migration reversal before runtime acceptance or production subscription activation. ADR: 0003, 0023, 0044, 0046, 0057 * style(kernel): remove blank SQL lines with trailing whitespace * test(kernel): prove ledger organization scope boundaries Exercise real app-role reads, acceptance and fenced completion with and without the tenant read hatch. Isolated weakened-policy controls show that each required organization protection is observable. Correct the Step 1 proof scope and record the independently verified review finding and 125 passing ledger/organization integration cases. ADR: 0003, 0046 * docs(roadmap): close both P02b-3 storage review rounds * feat(kernel): accept integration events durably per subscription Persist validated immutable envelope copies atomically without constructing business handlers. Claim shared inbox identities only on the announced application transaction, before the later delivery owner executes work. Prove duplicate waits, conflicting subsets, tenant scope and uncertain acceptance COMMIT using PostgreSQL. Preserve producer worker cancellation and cleanup proofs with a disclosed acceptance wrapper and direct control. ADR: 0046, 0057, 0040, 0003 * docs(standards): align the durable acceptance proof reference * docs(roadmap): close both durable acceptance review rounds * feat(kernel): own subscriber business completion and commit admission Keep retained-envelope execution on one prepared application transaction, so inbox, business state, produced events, audit and delivery completion commit together. Fence ownership after saved work and arbitrate cancellation against physical commit without losing acknowledged durability to cleanup. ADR: 0046, 0040, 0057, 0044 * docs(roadmap): record subscriber owner review and regression evidence Record the independent first-round reviews and completed broader regression, and attribute the two new owner-census proofs to their delivery step. ADR: 0046 * docs(roadmap): close both subscriber business owner reviews Record fresh second-round runtime and evidence verification before advancing to independent subscriber scheduling under the accepted package. ADR: 0046 * feat(kernel): schedule independent subscriber delivery and replay Keep subscriber retries, terminal audit and targeted replay independent from producer and sibling outcomes. Retain cancellation callbacks and scope cleanup through actual completion, and observe bounded progress without adding payload access to the confined scheduler. ADR: 0040, 0044, 0046 * fix(kernel): isolate acceptance from subscriber execution lanes A retained handler or cleanup must not consume the producer's timeout and capacity through a shared partition queue. Keep consumer ordering local while allowing durable acceptance to finish independently; prove both held-handler and acknowledged-cleanup scenarios with a killed mutant. ADR: 0046 * docs(roadmap): close subscriber scheduler review rounds Record the verified acceptance-lane correction and independent second round reruns before advancing to useful consumers and Seeder handoff. ADR: 0046 * feat(customization): initialize preserved defaults and hand off seed Make both durable tenant-created subscriptions useful without replacing any touched customization concept. Share transaction-owned semantic locks with ordinary registration, and let Seeder retain verified warm built-in identities while authored identities remain exact. ADR: 0046, 0057 Module: Customization, Tenancy, Audit * docs(architecture): align current default delivery guidance Keep mutable audit ownership and review guidance consistent with the Active production subscriptions, while preserving dated prior receipts. Record the first independent Step 5 review and verified corrections. ADR: 0046, 0057 * docs(roadmap): close default delivery and seed review rounds Record both completed independent Step 5 reviews and distinguish the Pending policy fixtures from the Active production bindings they protect. ADR: 0046, 0057 * test(kernel): enforce production subscription delivery boundaries Keep both real default subscribers inside the shared inbox and common completion owner, and require concrete handler audit coverage in the actual roots. Exercise missing and bypassed typed capabilities with planted controls and prove persisted tracing from HTTP and delivery. Reconcile current guidance while preserving accepted decision history. ADR: 0046, 0057, 0044, 0038 Module: Customization, Tenancy * fix(kernel): close typed delivery enforcement escapes Bind provisioning to its exact type, follow inherited implementations and generic DI forwarding, and enumerate EF transaction completion so future typed bypasses cannot appear covered by the common-owner guards. Keep independent dirty and clean controls and align current guidance. ADR: 0046, 0042, 0057 Module: Customization, Tenancy * docs(roadmap): close all subscriber delivery review rounds Record fresh second-round evidence and the verified current-carrier corrections so the completed six-step implementation has one truthful handoff. Preserve historical receipts and leave PR-head CI and merge with their actual owners; background jobs remain the next packet. ADR: 0046, 0057 * docs(roadmap): link subscriber delivery PR handoff Give the completed packet one live PR and exact-head CI owner while preserving scoped local receipts and the next background-job decision gate. Maintainer review and merge remain pending. ADR: 0046, 0057 * fix(kernel): close subscriber delivery review gaps Keep failed queue observations recoverable and distinguish uncertain completion from lease expiry. Pin actual tenant-announcement callers, status parsing and production index candidates without relaxing the accepted overrun or causal-metadata contracts. Reconcile live delivery status and record verified review dispositions and scoped validation. ADR: 0040, 0046, 0044 * docs: align delivery review guidance with accepted ownership Preserve the classified direct one-root consumer path while banning module writes to inbox and delivery machinery. Remove a stale setter count and record independent first-round verification and corrections. ADR: 0040, 0044, 0046, 0057 * docs(standards): wrap tenant announcement guidance * fix(standards): count both implemented isolation rules Normalize qualified implementation statuses so two shipped integration rules participate in catalogue checks. Pin qualified discovery in the existing parser control and record independent second-round verification. ADR: 0003, 0046 * fix(kernel): preserve delivery progress and compatible acceptance Rotate acquisition classes so terminal audit outages cannot starve unrelated deliveries. Compare retained type identities through the explicit registry family while preserving every immutable envelope. Close constructor/project census gaps and align diagnostics and receipts. ADR: 0046, 0057 * docs(roadmap): record delivery remediation review round one Record three independent reviews and their executed checks without substituting earlier CI evidence for the correction head. ADR: 0046, 0057 * fix(kernel): preserve producer progress during terminal audit faults The subscriber review exposed the same priority starvation in producer dispatch. Rotate claim classes while retaining one claim, lease fencing, terminal audit atomicity and the existing publication ownership boundary. Prove real durable acceptance and recovery under sustained audit denial. ADR: 0046 * docs(roadmap): close verified delivery and producer review fixes Record both independent review rounds for the adjacent producer fix and keep final-head CI ownership explicit without reusing old receipts. ADR: 0046, 0057 * docs(roadmap): close P02b-3 after PR 31 merge Record the verified squash merge, exact source CI artifacts and completed subscriber delivery/review scope. Align live status pointers and name P02b-4's decision pass while preserving prior receipts and all ADR files. ADR: 0046, 0057 * docs(decisions): propose P02b-4 transactional job runtime Resolve the job runtime, authority and durability choices before any scheduler code is written. Record the verified source premises, bounded supersessions, six-step plan and two independent decision review rounds. The ADR and package remain Proposed pending maintainer approval. ADR: 0047 * docs(decisions): expand Hangfire runtime alternatives Compare stock wakeup transport and transaction-aware storage integration against the proposed bounded runner. Record isolated native transaction, dependency and invocation evidence with its limits instead of treating stock-provider constraints as proof that customization is impossible. Runtime selection and implementation remain pending maintainer approval. ADR: 0047 * docs(decisions): clarify job workloads before runtime selection Verify the external review against current source and phase contracts. Separate short transactional work from media operations, tenantless fan-out and logical schedule replacement; keep route and scope open. Clarify final fencing, retry parity, mixed-version admission and the SystemActor ceiling without changing runtime or Accepted ADR bodies. ADR: 0047 * docs(decisions): correct job carrier locator and record reviews Point ADR-0017 navigation at the exact defense-in-depth table and record both independent correction reviews and focused validation. Keep runtime selection, workload scope and ADR acceptance pending. ADR: 0047 * docs(decisions): propose expanded H1 background job contract Apply the selected stock Hangfire and authoritative LearnStack route. Specify staged external work, quiescence-bound tenant capacity and trusted recurrence fan-out alongside transactional completion/audit. Keep final acceptance pending and preserve all Accepted ADR bodies. ADR: 0047 * docs(decisions): refine H1 proposal after first review Distinguish business job envelopes from vendor control messages in the standard handoff, pin guarded provider connection and SQL paths, and clarify delayed wakeup and recurrence target admission. Record the three independent proposal reviews without claiming runtime acceptance. ADR: 0047 * docs(decisions): reconcile concurrent H1 overrun bounds Treat four retained executions as the atomic stop-start threshold while retaining all work already admitted. Bound the remaining work by the configured workers plus four and require simultaneous-overrun proof. Both fresh second-round reviewers verified the corrected proposal. ADR: 0047 * docs(roadmap): record final H1 proposal review readiness Record both fresh second-round reviews, the verified concurrency-bound correction and final document checks. Keep final maintainer acceptance separate from direction selection and from runtime implementation. ADR: 0047 * docs(decisions): accept expanded H1 background job runtime Record maintainer approval of ADR-0047 and the nine-step P02b-4 plan before runtime changes. Disclose the bounded supersessions and additive seams through insert-only amendments while preserving prior decisions and delivery receipts. Acceptance makes no implementation claim. ADR: 0047, 0003, 0036, 0040, 0044, 0046, 0057 * feat(kernel): add typed job contracts and ordinary authority guards Keep background work inside an immutable positive request ceiling before activating the H1 runtime. Freeze module-owned definitions and bounded identifier payloads, and guard every privileged connection acquisition so mutable ambient context cannot grant a job platform authority. Register later runtime obligations without claiming their delivery. ADR: 0047, 0036, 0040, 0052 * fix(kernel): close job ancestry and identifier lifetime gaps Revoke retained request descendants when any ancestor closes, including direct owner entry. Require automatic identifier accessors so validated job payloads cannot change their resource identity through getter code. Keep awaited nesting and ordinary immutable record forms working. ADR: 0047 * docs(roadmap): record completed job contract review rounds Record both independent Step 1 rounds, reproduced corrections and exact validation scope before advancing to storage. Keep recurrence precision as an explicit constraint for the database representation step. ADR: 0047 * docs(decisions): propose bounded stock counter maintenance Record the exact pinned counter I/O limitation before dependent runtime work, with a narrow exception, single ownership, pacing and minimum pool capacity proposal. Preserve the accepted H1 business contract and keep maintenance implementation pending maintainer approval. ADR: 0047, 0058 * docs(decisions): qualify selective Hangfire maintenance Replace the proposed unlimited-I/O exception after verifying stock expiration cleanup. Preserve reproducible component and timeout probes while configuration and ownership changes await maintainer acceptance. ADR: 0047, 0058 * docs(roadmap): close revised maintenance proposal reviews Record two fresh independent reviews and reproducible qualification receipts without treating them as runtime delivery or maintainer acceptance. Keep the isolated probes formatted and protect owned cleanup. ADR: 0047, 0058 * docs(decisions): accept bounded stock maintenance policy Record maintainer acceptance of selective counter/history suppression and retained expiration ownership without weakening command I/O bounds. Keep source/reset qualification and worker enforcement explicitly pending. ADR: 0047, 0058 * feat(kernel): add guarded job and Hangfire storage Add authoritative job state, scoped grants and guarded stock storage.\nKeep execution activation with later steps and preserve exact vendor\nsource, binary and licence material in build and publish outputs.\n\nADR: 0047, 0058 * fix(kernel): close storage bootstrap review gaps Validate the complete pinned stock shape and retained metadata before provider construction. Prove bounded idle eligibility scans and include the embedded Cronos source and notice in the distribution kit. ADR: 0047, 0058 * fix(kernel): preserve known and unknown job outcomes Prevent external success or selected finalization from reopening normal execution. Keep unknown effects from releasing capacity or becoming a retry or terminal result, while retaining known-failure retry controls. ADR: 0047, 0058 * docs(roadmap): close reviewed job storage step Record both independent review rounds, verified outcome corrections, final 4,089-case regression and exact source/distribution qualification. Keep maintenance activation and enforcement with their owning steps. ADR: 0047, 0058 * feat(kernel): add transactional job submission and admission Keep job intent on its typed producer's announced transaction and separate opaque routing from app-role validation and counted start. Only acknowledged commit mints an activation receipt; unknown outcomes and cleanup faults cannot silently authorize or lose that boundary. Add physical isolation, callback, concurrency, commit-loss and cleanup proofs, with live construction and caller censuses. Business execution and vendor workers remain the approved later implementation steps. ADR: 0047, 0040, 0057 Module: Kernel * fix(kernel): bound job submission and admission SQL waits Keep the accepted five-second SQL ceiling independent of app connection defaults, including uncertain admission COMMIT waits. Prove poisoning and receipt refusal with real blocked and response-withholding PostgreSQL paths. ADR: 0047 * docs(roadmap): close reviewed job submission and admission step Record both fresh review rounds and the exact CI-split backend proof so later worker activation starts from a verified submission boundary. ADR: 0047 * docs(decisions): propose owned Hangfire server generations Expose the pinned restart ownership failure before worker activation and make the changed policy reviewable with isolated reproducible controls. Keep dependent runtime pending maintainer acceptance. ADR: 0059 * docs(decisions): qualify shared maintenance and process exit Separate shared provider components from replaceable pool generations and distinguish finite host waiting from final Core exit callbacks. Add repeatable direct-callback and closed-relay child controls, retaining actual child ownership on interruption without claiming graceful cleanup. Record the first proposal reviews and focused verification; the new runtime policy remains Proposed pending maintainer approval. ADR: 0047, 0058, 0059 * docs(roadmap): expose pending server lifecycle decision Point the primary current-state carriers to Step 4's Proposed ADR-0059 and its approval boundary. Steps 1-3 remain delivered; no dependent worker activation or remaining packet completion is implied. ADR: 0047, 0058, 0059 * docs(roadmap): record reviewed server lifecycle proposal Record two fresh second-round approvals after verified lifecycle and process-exit corrections, plus independent seven-mode probe and owned child-cleanup results. Keep ADR-0059 Proposed and distinguish these isolated checks from the real Step 4 production qualification still due. ADR: 0047, 0058, 0059 * docs(decisions): close server lifecycle review gaps Name the complete public storage seam and stop fences for Core's outer repeat loop, separate local drain from host cancellation, and make the single-generation availability cost and alternatives explicit. Pin the options, metadata, parity and capability proof gates without inventing a previously accepted automatic-restart policy. Add twelve isolated lifecycle controls and retain the proposal's approval boundary. ADR: 0047, 0058, 0059 * docs(roadmap): record lifecycle revision reviews and correction Record fresh first-round proposal reviews and their independent probe and dirty-control results. Correct the historical Accepted-ADR count with the canonical parser and explicit compared revisions, preserving the earlier as-of receipt and the still-Proposed approval boundary. ADR: 0047, 0058, 0059 * docs(decisions): name bounded pool availability supersession Distinguish additive server composition from the actual narrowing of affected-tenant progress during whole-generation drain. Quote the two ADR-0047 clauses and name the bounded exception below four overruns, while preserving healthy-pool independence and prior Accepted bytes. Record the final cross-check finding without changing the probe sources or claiming the earlier review verdict covered this correction. ADR: 0047, 0058, 0059 * docs(decisions): preserve retention beyond the stop threshold State precisely that four retained overruns stop new starts, while actual retention and cleanup continue. Keep the bounded generation-drain availability exception and all prior authority/resource limits intact. ADR: 0047, 0058, 0059 * docs(roadmap): record revised lifecycle proposal closeout Record independent focused verification of the explicit availability supersession and retention wording, preserving prior findings and the maintainer approval boundary before dependent Step 4 runtime. ADR: 0047, 0058, 0059 * docs(decisions): accept owned Hangfire server generations Record maintainer approval before dependent Step 4 work and disclose the precise affected-pool availability qualification while preserving prior Accepted decisions and all production qualification gates. ADR: 0047, 0058, 0059 * docs(decisions): propose fatal required-startup boundary Expose the stock Core pre-capture construction qualification gap and request an explicit narrow process-failure policy without weakening the Accepted lifecycle promise or authorizing dependent runtime implicitly. ADR: 0047, 0058, 0059, 0060 * docs(decisions): record required-startup proposal reviews Remove an unsupported frequency qualifier and preserve the independent review evidence and pending approval boundary for the narrow startup policy. No fatal runtime or production qualification is implied. ADR: 0059, 0060 * docs(decisions): record required-startup second reviews Keep the new fatal-process proposal distinct from approved lifecycle work and preserve the independent review limits before acceptance. ADR: 0059, 0060 * feat(kernel): add confined Hangfire bridge and storage boundary Keep vendor wakeups repairable without spending business attempts and preserve the pinned public provider surface before server activation. Qualify opaque invocation, retained handoff calls and delayed queue metadata independently of the pending required-startup decision. ADR: 0047, 0058, 0059 * fix(kernel): preserve retry precedence and bridge credential bounds Apply stock filter normalization and reject reordered global retries so opaque wrappers retain zero vendor retries. Pin the bridge's exact guarded source and consumer captures to prevent an approved acquisition from forwarding the dispatcher capability. ADR: 0047, 0058, 0059 * docs(decisions): revise fatal startup policy after external review Keep quarantine as a viable alternative and disclose conservative constructor and before/after-capture unwind boundaries. Name the prospective availability amendments, operational owners and pending proof gates before seeking approval. Record independent reviews and the separately authorized foundation corrections. ADR: 0060 * docs(decisions): accept ADR-0060 before lifecycle implementation Record maintainer approval of the reviewed fatal startup and unsafe-unwind policy, its bounded availability amendments and required proof owners before any dependent runtime changes. Acceptance does not claim worker activation. ADR: 0060 * feat(kernel): own Hangfire generation and fatal lifecycle boundaries Retain actual stock generation and shared-component work through cleanup, and qualify the closed process fatal sink in isolated Linux children. Keep this Step 4 foundation uncomposed until its remaining lifecycle and physical-acquisition gates are proven before API worker activation. ADR: 0047, 0058, 0059, 0060 * fix(kernel): preserve fetched-heartbeat storage failure health Stock renewal can swallow a SQL failure and return normally. Separate actual invocation cleanup from storage health, retaining known failure until a clean pass confirms real renewal. Prove refusal and recovery on PostgreSQL and preserve the foundation's restricted evidence claims. ADR: 0047, 0058, 0059, 0060 * feat(kernel): own pool replacement and private job cleanup Keep actual generations and framework resources alive across wrapper return so stock joins and caller cancellation cannot authorize premature replacement. Retain failed cleanup identities, close actual issuance gates, and record focused PostgreSQL and architecture proof boundaries. ADR: 0047, 0059, 0060 * feat(kernel): compose owned job runtime and source lifetime Keep the shared privileged source alive through actual job and messaging cleanup, including caller deadlines and unresolved physical disposal. Qualify the composed runtime, supported capacity and pinned Core phase boundaries before the complete Step 4 review rounds. ADR: 0047, 0058, 0059, 0060 * fix(kernel): bound framework waits and report lifecycle health Retain actual routing, private callbacks and cleanup after native waiting expires, and expose confirmed heartbeat and maintenance faults through the registered health result. Qualify the shipped cancellation relay at process exit and preserve fresh scoped architecture scans. ADR: 0047, 0058, 0059, 0060 * test(kernel): qualify heartbeat outage and close Step 4 Prove stored-success cutoff reset and common-outage recovery through the shipped lifecycle before closing its two full review rounds. Keep retained cleanup authoritative after storage recovery and record the exact bounds of the combined regression receipt. ADR: 0047, 0058, 0059, 0060 * feat(kernel): execute transactional background jobs Run acknowledged job starts through the existing transaction owner so business state, child jobs, outbox, audit and completion commit together. Keep renewal, recovery and terminal work independently owned and bind terminal audit to the actual fenced row. Retain both source lifetimes through real task and callback cleanup. Qualify locked COMMIT probes, safe count-validation locking, role bounds, source capacity and native backlog progress with real PostgreSQL. Record complete and focused correction receipts without claiming review closure. ADR: 0047, 0040, 0033, 0057, 0059 Module: Tenancy, Audit * fix(kernel): join actual auxiliary cleanup before job release Observe the original loader before deciding cleanup failure so a late positive result can release its native invocation. Qualify lost business COMMIT responses and final lock waits through actual Hangfire workers. ADR: 0047, 0059 * fix(kernel): retain job decisions and bounded cleanup signals Preserve each rolled-back MUST reconciliation failure signal, serialize renewal closure before timer disposal, and retain known decisions across cleaned control faults. ADR: 0047 Module: Kernel * docs(roadmap): close job owner reviews and start capacity work * docs(decisions): propose known external job failure policy * docs(decisions): refine external failure policy proposal Make failure selection, cancellation taxonomy and row-bound terminal audit explicit before external activation. Keep reapproval pending and reconcile the inherited job retry summary with the already accepted contract. ADR: 0047, 0061 * docs(decisions): accept known external job failure policy Close the maintainer's acceptance conditions before external execution: make cancellation and checkpoint authority explicit, replace ambiguous factories, and assign each policy obligation to its implementation step. Keep runtime and migration proof pending and accepted history intact. ADR: 0047, 0061 * feat(kernel): enforce tenant-wide job capacity reservations Bind release to positive actual cleanup and separate recovery so expired leases or uncertain acknowledgements cannot free occupied work. Count all organizations after the shared mutex wait while preserving the existing transaction owner, source limits and narrow grants. ADR: 0047, 0040, 0036 * fix(kernel): settle capacity cleanup after peer recovery Revisit committed cleanup after an unavailable recovery acquisition so peer routing cannot strand an already-clean native invocation. Qualify both stop windows and recovery acknowledgement loss with actual workers, PostgreSQL and discriminating restored-source controls. ADR: 0047, 0040, 0036 * fix(kernel): reconcile original capacity admission history Use locked original admission history after a peer changes routing, so positive rollback or release can settle the original clean invocation without confusing occupied original history with a later peer attempt. Keep native fixture setup deterministic and retain both failed full qualification receipts alongside the final passing run. ADR: 0047, 0040 * feat(kernel): execute and recover staged external jobs Run external work outside the business transaction with acknowledged stage authority and capacity retained until positive cleanup. Persist explicit outcome policy and bound finalization separately from effects. Add exact locked-history probes, quiescent retirement and invalid-job cleanup, atomic terminal audit, and closed owner/caller guards. Record source-specific regression evidence without claiming packet-wide CI. ADR: 0040, 0047, 0059, 0061 Module: Tenancy * fix(kernel): defer external jobs when tenant capacity is full Apply the existing bounded capacity disposition to external normal admission so a refusal clears its exact route instead of waiting for lease expiry. Prove actual control completion, provider-owned release, subsequent admission and stale-token refusal against PostgreSQL. ADR: 0047, 0061 * fix(kernel): bound terminal cleanup candidate scans Seek only due terminal jobs and keep the occupied-reservation probe correlated to each candidate. Exercise the exact query against real guarded future and occupied histories, including a volatile-cutoff control, while preserving fresh locked ownership checks. ADR: 0047, 0061 * test(kernel): verify external cancellation across restart Qualify actual provider cancellation and an independent permanent failure across stopped-owner cleanup and fresh native reconciliation. A genuine Reconcile-only adapter lie must fail the same semantic assertion while the independent provider journal remains unchanged. ADR: 0047, 0061 * test(jobs): qualify recovered external failure policies Verify genuine Reconcile policies against independent provider facts so retry and failure finalization cannot pass with relabeled old outcomes. Record the discriminating controls and close both full Step 7 reviews. ADR: 0047, 0061 * feat(kernel): add durable recurrence and bounded recipient pages Persist immutable recurrence revisions and coalesced UTC occurrences, then atomically page raw lifecycle keys into deduplicated recipients. Tenancy supplies closed status metadata and only eight SELECT column grants. Qualify mixed revisions, rollback, bounded seek plans and grant parity, including an omitted canonical grant that must fail the same assertion. This is the first Step 8 foundation slice; restricted child admission and runtime integration remain pending before its two full review rounds. ADR: 0047 Module: Tenancy * feat(kernel): add acknowledged recipient routing claims Bind one due stored route to its compatible frozen manifest and publish single-use authority only after claim ACK, cleanup and a live lease. Unknown or incompatible deployments retain work with bounded deferral. Match the pending index and qualify a 3,000-row tied backlog with the obsolete-order dirty control. Preserve accepted declaration metadata through the actual PostgreSQL registration-to-claim path. This Step 8 slice creates no child or business execution. App submission and owned runtime integration remain pending before both full reviews. ADR: 0047 * feat(kernel): submit recipient jobs on the existing owner Keep recurrence routing tied to its acknowledged recipient acquisition while the ordinary request coordinator commits the child and reciprocal receipt atomically. Preserve tenant scope, successful-production receipts and actual cleanup ownership without constructing feature work. ADR: 0047, 0040, 0057 * feat(kernel): reconcile recipient receipts after actual cleanup Resolve uncertain child submission from the locked reciprocal receipt without inventing its original acknowledgement or another identity. Keep lifecycle skip and bounded deferral confined to the original live acquisition after positively completed application cleanup. ADR: 0047 * test(kernel): qualify recipient admission fault boundaries Observe actual PostgreSQL effects independently of rollback so context, lease and stop races cannot pass through a masked late refusal. Keep the healthy counterpart and exact guard-removal proof alongside the restored source qualification. ADR: 0047 * fix(kernel): fence native recurring writes against supersession Keep old deployments from replacing current invocation hints after a manifest changes, including writes delayed before the live guard runs. Verify volatility alongside the existing bootstrap contract and prove upgrade, snapshot and lock behavior with actual stock transactions. ADR: 0047 * feat(kernel): own recurrence runtime and quarantine observation Keep durable fan-out independent of stock timer delivery, native calls and locally retained recipient work. Preserve original cleanup and receipt ownership, observe all stored control quarantines, and budget the concrete application and privileged connection owners. ADR: 0047, 0059 Module: Kernel, Tenancy * test(kernel): prove retained recurrence native ownership Exercise actual stock registration while durable fan-out progresses and all sibling owners join. Separate guard-removal controls demonstrate single-flight and parent-source retention without cooldown masking. ADR: 0047, 0059 * test(kernel): prove retained recipient progress and source pins Exercise four actual application owners through natural lease expiry, independent child progress and late cleanup. Separate semantic controls pin the ceiling, retained-ID exclusion and cancellation ownership. Reconcile the published architecture method count with the existing Step 8 companion methods. ADR: 0047, 0059 * test(kernel): close recurrence core capability identities Pin concrete construction and callback ownership to exact targets, callers and opcodes. Trusted framework cleanup signatures and planted foreign targets prevent name-only cleanup checks from passing blindly. ADR: 0047, 0059 * test(kernel): close recurrence ownership and hint boundaries Constrain the concrete retained owners, native recurrence entry points, memory-only tick closure and recipient exclusion/publication seams. Plant foreign identities, escaped resources, reordered acknowledgements and unauthorized work against the same nonempty production detector. Record source-specific qualification and its limits before the two full Step 8 review rounds. The nineteen packet obligations stay Registered. ADR: 0047, 0059 * fix(kernel): contain invalid recurrence facts and late setup Keep schema-legal dates outside the CLR range from poisoning control quanta, and let an already stopped recurrence child decline late setup without inventing cleanup failure. Preserve duplicate setup refusals, actual locked-row quarantine, owned joins and source disposal. Cover all changed readers and the real parent-start race with PostgreSQL regressions, and reconcile the completed Step 7 catalogue pointer. ADR: 0047, 0059 * fix(kernel): close recurrence drain and parent stop qualification Keep a stopped first parent start neutral while preserving duplicate refusal. Prove durable recurrence progress while the actual control generation stays held, including late native duplicate ticks. Record both full Step 8 reviews, verified corrections and source-bound qualification, then reconcile primary status carriers for Step 9. ADR: 0047, 0059 * test(kernel): tighten recurrence guards and scope metadata scans Keep accepted independent recurrence owners visible to existing guards while reducing repeated metadata work without losing mutation controls. Record full-suite failures and focused recovery; the CI budget and complete packet qualification remain open. ADR: 0040, 0046, 0047, 0059 * test(kernel): defer orchestration identity formatting Resolve exact callback and field-owner identities only after candidate selection, retaining the complete production inventory and every mutation phase. Compare the old and new lookup policies independently and record focused timing without claiming whole-workflow budget compliance. ADR: 0047 * test(kernel): bound parallel census mutation collections Keep independent mutation graphs in bounded collections without splitting clean, dirty and restored evaluations. Preserve all 249 declarations and 405 discovered cases; full packet and CI budget qualification remain open. ADR: 0047 * feat(kernel): observe durable job obligations across restarts Classify complete status populations against frozen local metadata so future and unsupported work cannot disappear behind an empty registry. Publish immutable aggregates only after actual read rollback and cleanup, using the existing serialized control owner and confined grants. Qualify cold runtime health, independent SQL/.NET hashes, stored history, real routing eligibility, reservation counts and failed refresh ownership. Keep Step 9 metrics, enforcement and complete packet qualification open. ADR: 0047 * feat(kernel): project confirmed native job observation facts Expose existing running work and generation cleanup witnesses through immutable snapshots. Preserve confirmed monotonic zero separately from missing metadata heartbeat, without adding execution or release authority. Qualify the real PostgreSQL callback and facade collection immutability; record focused review and source-specific qualification boundaries. ADR: 0047, 0059 * feat(kernel): expose bounded memory-only job metrics Bind the required observer to the concrete initialized runtime and project durable samples, native progress and finite component states without opening sources or granting execution authority in collection. Qualify the actual Meter callbacks and singleton wiring with listener, PostgreSQL and mutation controls; record corrected test premises and keep remaining stage instrumentation and packet review gates explicit. ADR: 0047, 0059 * feat(kernel): record actual job stage outcomes after owned cleanup Keep stage measurements tied to actual executor settlement and durable acknowledgements so cleanup faults and unissued provider calls cannot invent a failed commit or uncertain external effect. Contain metric listener faults without changing completed work, and pin the memory-only observation boundary with actual-call and hidden-initializer controls. ADR: 0047, 0059, 0061 * feat(kernel): preserve owned job tracing across observer faults Keep named job spans on their existing actual owners before Start can invoke observers, and separate declared causal parents from fresh roots. Preserve W3C correlation without an exporter and attempt tenant restoration independently of Activity callback faults. Bind source and cleanup calls to their real receivers so tracing cannot hide an unowned Activity. ADR: 0032, 0047, 0059, 0061 * fix(kernel): count confirmed job control transitions Preserve physical acknowledgements through cleanup refusal and count only the original retry's locked confirmation. Keep renewal history separate from physical ACKs without reopening execution or ownership. Qualify actual retry owners and fixed-memory counter boundaries while recording the remaining Step 9 proof work explicitly. ADR: 0047, 0061 * test(kernel): qualify job control transition observations Exercise actual owner tasks and PostgreSQL commit uncertainty so retries, renewals and terminal audit observations cannot imply cleanup or renewed execution authority. Keep native handoff and grouped history limits explicit. ADR: 0047, 0059, 0061 * feat(kernel): observe acknowledged recurrence progress Distinguish original committed fanout progress from a returned value or a later durable history, while preserving acknowledged work after cleanup refusal. Keep observation in fixed memory cells without expanding authority. ADR: 0047 * fix(kernel): count fenced bridge repairs and deferrals Keep prior-handoff repair observations distinct from unmarked work and refuse to report a durable deferral when its current fence did not change. Qualify actual native/status cleanup without inferring hidden commit ACKs. ADR: 0047 * feat(kernel): observe first acknowledged job lease loss Keep the first actual lease-loss cause after its execution leaves memory without mistaking stop, settled work or cleanup for expired authority. Guard the recorder as synchronous memory-only work and qualify real renewal and recovery ownership. ADR: 0047, 0059 * feat(kernel): observe actual late job settlement Retain elapsed-stage provenance until actual invocation cleanup so returned wrapper waits cannot masquerade as settled work. Keep fixed memory-only process counters and pin their task and cleanup evidence with runtime controls and the existing architecture censuses. ADR: 0047, 0059 * docs: add the shared background job workflow Guide feature authors through the delivered typed scheduler, explicit composition, external evidence and recurrence boundaries so later features preserve the accepted ownership and failure contracts. ADR: 0047, 0058, 0059, 0060, 0061 * test(kernel): close job manifest and route census gaps Compare disk-wide declarations and actual Program registries and served endpoints so missing composition, hidden modules and conditional routes cannot pass the infrastructure-only contract. Exercise dashboard and inherited-action controls and complete the sixth-attempt SQL policy pair. ADR: 0047, 0061 * test(kernel): verify context before actual job construction Observe real parameter, request and handler constructors under trusted job context and independent causal tracing. Keep the genuine business task held after cancellation and distinguish caller isolation from positive owned cleanup, with separate wrong-context and trace controls. ADR: 0047 * ci: qualify the published Hangfire distribution Gate the existing backend job on its actual API publish and both offline material/replacement controls so passing test binaries cannot hide a missing distribution kit. Retain JSON receipts and the existing job identity, filters and deadline. ADR: 0047 * test(kernel): align job obligation owners with the catalogue Name existing substantive proofs after their canonical obligations without duplicating graphs or changing their bodies, data or traits. Keep full companion qualification and catalogue promotion separate from compiled discovery of the nineteen actual owners. ADR: 0047 * test(kernel): qualify combined privileged connection ownership Prove native business progress while three actual shared-source owners retain physical connections, and reconcile the conservative supported acquisition ledger. ADR: 0047, 0058, 0059 * test(kernel): correct final regression fixture boundaries Keep real planner, blocker and migration-boundary evidence while eliminating stale fixture assumptions and repeated observation-body selection. Reconcile source inventory and live observation summaries with the qualified implementation. ADR: 0047, 0058, 0059, 0060, 0061 * docs(standards): record enforced background job obligations Replace reserved status with qualified canonical owners while preserving the separate pending packet review, demo and exact-head CI budget gates. ADR: 0047, 0058, 0059, 0060, 0061 * test(kernel): qualify P02b-4 completion and closeout Keep every owner-boundary mutation and exact field identity while avoiding repeated whole-corpus budget scans. Record completed reviews, source-qualified regression and demo evidence without presenting local runs as exact PR-head CI or merge success. ADR: 0047, 0058, 0059, 0060, 0061 * docs(roadmap): link P02b-4 PR and live CI ownership Keep the fixed local receipts separate from live exact-head checks so later readers can review the open packet without mistaking an initial or superseded run for final CI success. ADR: 0047 * docs(decisions): propose isolated native CI prerequisites Make the missing hosted-kernel prerequisite and its bounded provisioning choice reviewable before authorizing any VM-wide change. Preserve the failed CI evidence and every existing native proof requirement. ADR: 0060, 0062 * docs(decisions): reserve native CI finalization margin * fix(dev): reuse one fresh migration and demo build Keep the shared demo lifecycle inside its existing budget by compiling the startup graph once, while retaining standalone restore and explicit failures before every migration chain. Exercise real Make orchestration and refusal paths rather than accepting stale output or removing proof work. ADR: 0056 * test(kernel): avoid repeated CI census and database setup Retain every production subject and mutation while indexing actual instruction populations within each detector evaluation. Plain database fixture setup owns a physical nonpooled connection instead of repeating Docker and psql startup; real role, rollback and cleanup controls pin the same authority. Record completed local proof without implying hosted fit. ADR: 0003, 0047, 0060 * test(ci): observe native prerequisites and completed cases Measure the unchanged proof workload before selecting collector authority or scheduling bounds. Report only finite read-only environment facts and enable the stock console logger alongside final TRX results. Preserve all filters, required names and deadlines; the native preflight still refuses unsupported collectors. Keep the decision index tied to local closeout. ADR: 0060 * fix(web): classify read-only CI diagnostic sources Keep the repository source census fail-closed while recording the two\nCI-only Python observer files with the existing non-runtime tooling. * docs(decisions): revise native CI authority and qualification Separate the proposed native VM and fixed collector lifecycle from measured CI outcomes, preserve complete required coverage, and record reviewed alternatives without accepting or implementing the decision. ADR: 0060 * test(kernel): defer capacity and recipient owner formatting Keep the complete production and mutation census while avoiding eager identity formatting for unrelated calls and field writes. Preserve independent raw traversal parity and per-evaluation cache lifetimes. ADR: 0047 * test(kernel): index concrete task owner writes Keep the same concrete task-owner proof while selecting field writes from the current detector index, so unrelated method identities are not rebuilt on every mutation. Record full and focused qualification without treating local timings as hosted CI success. ADR: 0047 * docs(decisions): accept bounded native CI provisioning Record the maintainer's approval before dependent CI implementation. Preserve ADR-0060's accepted body through a dated bounded disclosure and keep implementation, enforcement and hosted qualification pending. ADR: 0060, 0062 * ci: isolate and qualify complete native crash proofs * fix(ci): preserve exact interrupted test evidence * fix(ci): align native proof context and compiler census Accept the hosted runner's documented absent-services representation and parse native ownership with the actual Release build symbols so normal jobs launch and conditional native calls cannot escape their partition. Record both independent review rounds and real native protocol evidence. ADR: 0062 * fix(ci): publish synthetic cgroup snapshots atomically Keep the strict production event parser while preventing a forked test fixture from exposing an empty intermediate file on faster Linux hosts. Record the real hosted failure separately from local repair evidence. ADR: 0062 * fix(ci): retain closed crash inventory refusal details Keep every crash candidate fatal to qualification while retaining enough finite metadata to distinguish its scan scope and filename category. Never export candidate paths, contents or provider text from the VM. ADR: 0062 * docs(decisions): propose complete bounded CI test shards Reopen the execution topology after measured hosted budget failures while preserving every case, existing required names and twenty-minute ceilings. Record reviewed finite VM costs and defer dependent code to acceptance. ADR: 0062, 0063 * fix(ci): classify crash candidates without disclosing contents Keep unknown inventory candidates fatal while observing a finite format label through one fixed read-only probe within the existing scan budget. Diagnostic faults never replace the original qualification refusal. ADR: 0062 * fix(ci): distinguish bounded Docker inventory observations Keep scan decisions strict while distinguishing fixed storage regions, common file formats and a refused probe without exporting private data. Record actual prelaunch observations separately from qualification. ADR: 0062 * fix(ci): retain closed image and workload failure facts * fix(ci): qualify image layer scope in crash inventory * fix(ci): classify unexpected workload faults without provider text * fix(ci): retain result evidence across diagnostic rotation * docs(roadmap): record native proof and rotation review * docs(decisions): revise bounded CI shard qualification Separate retained wall evidence from incomplete duration estimates and make manual tuning, independent layouts, runner authority and aggregate ownership concrete before seeking acceptance. Preserve the outstanding ordinary owner fault and all hosted qualification gates. ADR: 0062, 0063 * docs(roadmap): record revised shard proposal reviews Keep independent proposal reviews and document checks distinct from maintainer acceptance and final hosted qualification. ADR: 0063 * docs(decisions): accept complete bounded CI shard plan Record maintainer approval before dependent implementation, disclose ADR-0062's bounded replacement and additive authority, and register the general CI obligation without claiming implementation or hosted fit. ADR: 0062, 0063 * feat(ci): add complete selector assignment and bounded shard plan Keep every fresh discovered test in one deterministic owner and prove both accepted layouts against exact per-project selector discovery. Retain timing provenance without letting estimates define membership. Fix a nonserializable theory and bind TRX Unicode equivalence to the actual discover…
1 parent ed60157 commit b81006c

714 files changed

Lines changed: 129298 additions & 1282 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.claude/skills/README.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ index plus the relevant [Architecture](../../docs/architecture/) doc.
7474
| [add-tenant-owned-entity](add-tenant-owned-entity/SKILL.md) | Adding a `[TenantOwned]` / `[OrganizationScoped]` aggregate with EF filter + RLS migration + isolation tests. |
7575
| [add-mediatr-handler](add-mediatr-handler/SKILL.md) | Adding a command or query handler that participates in the MediatR pipeline (Result, FluentValidation, audit). |
7676
| [add-integration-event](add-integration-event/SKILL.md) | Publishing or consuming an integration event (outbox + inbox guard + Dapr topic). |
77+
| [add-background-job](add-background-job/SKILL.md) | Adding module-owned transactional/external jobs, delayed submissions, capacity declarations or durable recurrence through the typed H1 runtime. |
7778
| [add-ef-migration](add-ef-migration/SKILL.md) | Producing an EF Core migration with RLS-aware patterns and the project naming convention. |
7879
| [add-permission](add-permission/SKILL.md) | Registering a permission key with the closed action set and scope (Platform / Tenant / Organization). |
7980
| [add-feature-key](add-feature-key/SKILL.md) | Adding a `FeatureKey` / `LimitKey` to the typed registry and wiring entitlement-projection reads. |
Lines changed: 179 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,179 @@
1+
---
2+
name: add-background-job
3+
description: >
4+
Add a module-owned transactional or external background-job definition, delayed
5+
submission, or durable recurrence using LearnStack's typed scheduler and H1
6+
runtime. USE FOR: job parameters/roots, prepare-execute-finalize adapters,
7+
capacity declarations, recurrence manifests and their proofs. DO NOT USE FOR:
8+
direct Hangfire calls, operator replay, privileged maintenance, or changing
9+
runtime ownership/storage policy without its decision pass.
10+
---
11+
12+
# Adding a background job
13+
14+
## Purpose
15+
16+
Deliver a feature's job through the existing trusted submission, ordinary
17+
transaction owner and retained-work boundaries. The architecture is decided in
18+
[ADR-0047](../../../docs/decisions/0047-transactional-background-job-runtime.md),
19+
with lifecycle refinements in ADR-0058/0059/0060 and known external failure policy
20+
in [ADR-0061](../../../docs/decisions/0061-known-external-job-failure-policy.md).
21+
Use [implement-task](../implement-task/SKILL.md) as the substantive entry point.
22+
23+
## When to use
24+
25+
- Add a feature-owned transactional or external definition and its request metadata.
26+
- Schedule an ordinary job or declare a code-owned recurring manifest.
27+
- Bind a feature's external operation port, dedicated capacity group or worker queue.
28+
29+
## When not to use
30+
31+
- Publish cross-module facts: use [add-integration-event](../add-integration-event/SKILL.md).
32+
- Change the scheduler, credential grants, transaction owner, quiescence policy or
33+
native invocation contract: run the owning decision pass first.
34+
- Add operator replay, privileged maintenance or a cancellation/rescheduling API:
35+
verify the named feature phase's accepted contract before implementation.
36+
37+
## Inputs
38+
39+
| Input | Required | Description |
40+
|-------|----------|-------------|
41+
| Owning feature phase/module | Yes | Confirm this is the phase that delivers the business definition. |
42+
| Profile and scope | Yes | Transactional/external; TenantWide/Organization. |
43+
| Typed parameter and request contracts | Yes | Exact module Contracts/Application types and all allowed nested requests. |
44+
| Queue/capacity declaration | Yes | Compatible pool; external work requires its declared capacity group. |
45+
| External evidence contract | External | Stable logical operation, Execute/Reconcile, known outcome and positive quiescence. |
46+
| Recurrence manifest | Recurring | Monotonic revision, UTC schedule, target and closed lifecycle recipient policy. |
47+
48+
## Workflow
49+
50+
### 1. Check the delivered boundary
51+
52+
Read the feature roadmap and current
53+
[P02b-4 record](../../../docs/roadmap/phase-02b-events-auth.md#p02b-4-decision-package-2026-10-15).
54+
P02b-4 intentionally carries no production business definitions or recurrence
55+
manifests. The first feature must explicitly reconcile that infrastructure-only
56+
census when its own accepted phase delivers real definitions.
57+
58+
Read the relevant [glossary](../../../docs/glossary.md),
59+
[Events and Outbox architecture](../../../docs/architecture/15-event-and-outbox.md),
60+
[Database Standards](../../../docs/standards/05-database.md#background-jobs), and
61+
[Observability Standards](../../../docs/standards/10-observability.md#required-metrics).
62+
Verify new capabilities have an owning decision rather than inventing a new entry
63+
path, general tenant selector or platform authority.
64+
65+
### 2. Declare inert types and exact request metadata
66+
67+
Use the actual contracts in
68+
[`SharedKernel/Jobs`](../../../backend/src/LearnStack.SharedKernel/Jobs).
69+
Put a sealed, init-only identifier parameter record implementing
70+
`IBackgroundJobParameters` in the owning `Application.Contracts`. Follow the
71+
payload guards for identifier types and size; custom getters, plaintext business
72+
content and mutable object graphs are refused.
73+
74+
Declare the module's code-owned definition in `Application`, with its exact
75+
`BackgroundJobKey<TParameters>`, scope, readiness and profile. List every allowed
76+
root/nested request with positive `Ordinary` scope metadata. Roots belong to the
77+
owning Application assembly; nested cross-module work uses the existing Contracts
78+
mechanism. Use [add-mediatr-handler](../add-mediatr-handler/SKILL.md) and
79+
[add-audit-coverage](../add-audit-coverage/SKILL.md) for each actual handler.
80+
81+
Wire declarations through the existing module/definition/infrastructure registries
82+
and API composition; inspect their current constructors and validation instead of
83+
copying a stale registration example. Verify root parameter constructors, queue
84+
profile, module ownership and scope before constructing any handler. Add an
85+
explicit retired tombstone for an intentionally retired identity; unknown and
86+
Pending definitions preserve work for a compatible deployment.
87+
Composition is explicit: preserve `BackgroundJobFrameworkRequests.All` and the
88+
catalog aliases when supplying feature registries. Verify the resolved API
89+
registry and every submitting composition root, including Seeder when applicable.
90+
91+
### 3. Submit on the owning transaction
92+
93+
Inject only `IBackgroundJobScheduler` into feature code. Its real methods are
94+
`EnqueueAsync(key, parameters, ct)` and `ScheduleAsync(key, parameters, dueAt, ct)`.
95+
Submit inside the existing enrolled writable module transaction. Tenant,
96+
organization, producer and causal metadata come from trusted enrollment; a key or
97+
payload cannot supply them. The returned identity does not commit the owner.
98+
99+
Keep schedule/business changes and the job INSERT atomic. Prove commit and
100+
rollback, including an absorbed refusal after produced work. An org-bound context
101+
cannot submit a TenantWide definition by relabeling the input. Never write job
102+
rows, call a Hangfire client or mint routing/start/recipient receipts in a module.
103+
104+
### 4. Implement the selected execution profile
105+
106+
**Transactional:** use the ordinary MediatR root and its existing owner. Do not
107+
open another transaction, change tenant context or acknowledge the job directly.
108+
Completion, outbox and MUST audit remain one owned transaction.
109+
110+
**External:** define identifier-only `IBackgroundJobPlan` and
111+
`IBackgroundJobOutcome` records in Contracts. Its module Contracts port inherits
112+
one closed `IBackgroundJobExternalOperation<TPlan,TOutcome>`; the concrete adapter
113+
lives in the same module's Infrastructure. Prepare/finalize are ordinary typed
114+
requests; Execute/Reconcile hold no business transaction or sender/service locator.
115+
116+
Qualify stable logical-operation deduplication and positive provider/supervisor
117+
quiescence. A timeout, cancellation, missing process or NotFound after ExecuteIntent
118+
is not proof that effects stopped. Use the explicit Succeeded/Failed/Cancelled
119+
factories and the actual three-state failure policy. Cancelled cannot be Permanent;
120+
nonrepeatable outcomes are not silently retried. Preserve selected durable facts
121+
across restart and conflicting later reports. Finalization must not repeat Execute.
122+
123+
Declare the module's tenant-wide `BackgroundJobCapacityGroupRegistration` through
124+
the infrastructure registry. Use [add-feature-key](../add-feature-key/SKILL.md) for
125+
any optional registered Hard `LimitKey`. An unknown external effect keeps its
126+
reservation; expiry, host exit or replacement never frees capacity.
127+
128+
### 5. Declare recurrence through the existing manifest path
129+
130+
Use `BackgroundJobRecurrenceRegistration` and its actual registry validation.
131+
The target belongs to the same module, accepts `BackgroundJobOccurrenceParameters`
132+
and matches the selected recipient scope. That input deliberately does not
133+
implement `IBackgroundJobParameters`; recurrence does not call the ordinary
134+
submission port directly.
135+
136+
Preserve revision/hash compatibility, UTC CoalesceLatest and bounded lifecycle
137+
paging. Native ticks are opaque hints; the durable occurrence/recipient records
138+
own progress. Do not add a module tenant-list reader or a per-route scheduler loop.
139+
Prove duplicate/late ticks, mixed revisions, tenant/org eligibility, bounded raw
140+
paging and one reciprocal accepted child receipt. No recurring tick grants
141+
business execution authority.
142+
143+
### 6. Validate and reconcile carriers
144+
145+
Run [run-tests-locally](../run-tests-locally/SKILL.md) for affected Unit,
146+
Architecture and real PostgreSQL suites, using the nonempty/zero-skip runner.
147+
Use [add-integration-test](../add-integration-test/SKILL.md) for tenant/org pairs
148+
as `learnstack_app`; independently verify the dispatcher's narrow status grants.
149+
150+
Exercise actual registrations and dirty controls. Include rollback, hidden/cross-org
151+
input, Pending/unknown identities, current/stale ownership, duplicate wakeups and
152+
confirmed failure versus unknown COMMIT. External definitions additionally need
153+
accepted-before-ACK, restart reconciliation, retained cleanup, no-effect restart
154+
proof and reservation retention/release. Recurrence needs actual held-control
155+
progress and late native duplicates, not only a mocked tick.
156+
157+
Update the owning roadmap, module audit/permission matrices and applicable feature
158+
handoffs. Standards 05 owns schema/grants, Standards 10 instruments and Standards 21
159+
the canonical obligations. Preserve Accepted ADR bodies; new decisions follow
160+
[write-adr](../write-adr/SKILL.md). Commit with
161+
[commit-and-pr](../commit-and-pr/SKILL.md) and perform the requested review rounds.
162+
163+
## Validation
164+
165+
- Production registration is nonempty for the feature and matches its owner/scope.
166+
- Submission is atomic; execution uses the existing ordinary transaction owner.
167+
- Failure, uncertainty, cancellation and quiescence remain distinct in actual tests.
168+
- Finite registered metric dimensions contain no tenant/org/job/occurrence identities.
169+
- All touched rules and handoffs describe delivered behavior and actual evidence.
170+
171+
## Common pitfalls
172+
173+
- Treating a definition key, tick, lease expiry or cleanup timeout as authority.
174+
- Calling Hangfire or selecting all tenants from feature code.
175+
- Moving long external I/O into a database transaction.
176+
- Releasing capacity without verified positive completion/no-start/quiescence evidence,
177+
or retrying a nonrepeatable effect.
178+
- Losing prior selected outcome facts while retrying finalization.
179+
- Inventing cancel, replace, dedup or replay semantics absent from the owning contract.

‎.claude/skills/add-ef-migration/SKILL.md‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ and survive forward-only deploy rules
2626
- Adding monthly partition for an append-only table (`audit_log`, future event
2727
tables).
2828
- Backfilling data alongside a schema change (use an idempotent SQL block or a
29-
Hangfire job).
29+
deployment-owned backfill).
3030

3131
## When not to use
3232

@@ -44,7 +44,7 @@ and survive forward-only deploy rules
4444
| Module | Yes | The module's `Infrastructure` project hosts the migration. |
4545
| Touches RLS? | Yes | New table → yes. Column add on existing tenant-owned table → no. |
4646
| Destructive? | Yes | Drop, rename, type-change — requires two-step plan. |
47-
| Backfill? | No | If data must be populated, prefer an idempotent Hangfire job. |
47+
| Backfill? | No | Use an idempotent deployment-owned backfill when inline SQL is too large. |
4848

4949
## Workflow
5050

@@ -260,9 +260,12 @@ migrationBuilder.DropColumn(name: "source_legacy", table: "enrollments");
260260

261261
### Step 7: Data migration
262262

263-
Small data migrations live inline as SQL. Larger migrations live as **idempotent
264-
Hangfire jobs** triggered by the migration. The job sets `app.tenant_id` per tenant
265-
before mutating data, on the **migration** connection:
263+
Small data migrations live inline as SQL. Larger backfills remain idempotent,
264+
deployment-owned migration work under
265+
[ADR-0047](../../../docs/decisions/0047-transactional-background-job-runtime.md#bounded-supersessions-and-additive-seams).
266+
The ordinary API job runtime cannot receive migration credentials or execute this
267+
backfill. The migration-owned loop sets `app.tenant_id` per tenant on its own
268+
**migration** connection:
266269

267270
> This loop is a migration-time backfill, not a ninth entry in ADR-0040's closed
268271
> eight-setter set. Application code never opens its own connection to set the

‎.claude/skills/add-integration-test/SKILL.md‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ architecture test) plus any other invariant the change touches. See
6969
> for a role-level or provisioning question. `SchemaFixture` builds on it and is
7070
> what almost every test wants: **every** migration chain applied — through
7171
> `MigrationChains.ApplyAllAsync`, never a list a fixture keeps itself — and every
72-
> table seeded for two tenants, with a second organization under tenant A. There
73-
> are five chains and 23 data tables (28 including migration histories). Discover
72+
> table populated under its role and table class, with two tenants and a second
73+
> organization under tenant A for tenant-owned data. There
74+
> are five chains and 42 data tables (47 including migration histories). Every
75+
> discovered public table must match an exact class in
76+
> [SchemaTableClasses](../../../backend/tests/LearnStack.Tests.Integration/Database/SchemaTableClasses.cs).
77+
> Vendor/control SELECTs as `learnstack_app` must raise `42501`; a zero count or
78+
> an excluded table does not prove the required denial. Discover
7479
> current chains and history names through
7580
> [MigrationChains](../../../backend/tests/LearnStack.Tests.Integration/Database/MigrationChains.cs);
7681
> do not copy that inventory into a fixture. Share the schema with
@@ -90,9 +95,12 @@ What the fixtures do today:
9095
which owns every table — and expose a connection as **`learnstack_app`** for the
9196
tests themselves. A test that connects as the owner or as a `BYPASSRLS` role
9297
passes even when every policy is inert, so it proves nothing.
93-
- Seed **every table for both tenants**, deliberately: a count assertion against a
94-
table the fixture never populated passes whatever the policy says. That shipped
95-
once, in Packet 6, and is why `SchemaFixture` fills all of them.
98+
- Seed **every table**, deliberately: tenant tables carry both tenants and org-scoped
99+
tables also carry both organizations under A. Control/vendor tables carry nonempty
100+
subjects through their confined dispatcher grants; the FORCE-RLS control tables
101+
have no owner/app policy and cannot be seeded by assuming ownership bypasses RLS.
102+
Tenant isolation assertions always authenticate as `learnstack_app`. A count
103+
against an empty table passes whatever the policy says; that shipped in Packet 6.
96104
- Expose the seeded ids as `SchemaFixture.TenantA` / `TenantB` / `OrgA1` / `OrgA2`,
97105
and the session-variable helpers as `SchemaQueries.SetTenantAsync` /
98106
`SetSettingAsync` — `set_config(name, value, true)`, not `SET LOCAL`, because

‎.claude/skills/code-review/SKILL.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ Walk every change against the project's
8181
| **Tenant + organization isolation** | New tenant-owned entity has `[TenantOwned]` + EF filter + RLS policy + canonical `app.tenant_id` session var. `[OrganizationScoped]` covered the same way. Any `IgnoreQueryFilters` outside platform-admin paths is a zero-tolerance blocker per [17-code-review.md § Zero Tolerance](../../../docs/standards/17-code-review.md). |
8282
| **4-step auth order** | Every write use case checks in order: (1) Authn → (2) Tenant membership → (3) Role / permission → (4) Resource scope. Failure at each step returns the right Problem Details code (`unauthorized` / `tenant_mismatch` / `forbidden` / `resource_scope_violation`). Source: [11-security.md § Authorization](../../../docs/standards/11-security.md), [19-permissions.md § Enforcement Points](../../../docs/standards/19-permissions.md). |
8383
| **Authn / authz** | Every new endpoint has `[Authorize(Policy=…)]` or `[AllowAnonymous]` with a comment. Policy keys exist in the permission registry. Resource-scope handlers (`instructor` edits own course only) present where needed. |
84-
| **Tenant id from the resolved context only** | Resolved per [ADR-0036](../../../docs/decisions/0036-tenant-resolution-trusted-inputs.md): from the host lookup of the effective host, or on a platform host from validated claims confirmed by live membership; off HTTP, from the job parameters or the integration-event envelope. Never from a request body, query string, cookie or tenant header — `X-Tenant-Id` and `X-Organization-Id` are assertions that can only reject, on every hop. Check command and DTO surfaces. |
84+
| **Tenant id from the resolved context only** | Resolved per [ADR-0036](../../../docs/decisions/0036-tenant-resolution-trusted-inputs.md): from the host lookup of the effective host, or on a platform host from validated claims confirmed by live membership; off HTTP, from the validated authoritative job row or the integration-event envelope. Never from a request body, query string, cookie or tenant header — `X-Tenant-Id` and `X-Organization-Id` are assertions that can only reject, on every hop. Check command and DTO surfaces. |
8585
| **SQL injection** | EF Core LINQ or `FromSqlInterpolated`; never raw string concatenation. Raw SQL has parameters. |
8686
| **XSS** | No `dangerouslySetInnerHTML` outside a sanitisation wrapper; CSP nonces in place; markdown via allowlist. Nothing sets a CSP today: the [standards index](../../../docs/standards/README.md#honest-status-today) row for Security Standards carves § HTTP Headers out to [Phase 11](../../../docs/roadmap/phase-11-production-hardening.md#security), so a missing nonce is not a Blocker until that phase sets one. Accepted P02d-6 G42 requires atomic four-color validation and a fixed style element, with whole-palette fallback; output must be safe without CSP. [The accepted package](../../../docs/roadmap/phase-02d-walking-skeleton.md#p02d-6-accepted-answers) owns its proof obligations; acceptance alone is not delivery. |
8787
| **CSRF** | Server Actions / Auth.js session check; non-Action mutating fetches carry CSRF tokens. |

0 commit comments

Comments
 (0)