# FireMUD Scripting & Automation: Normative Contract Tables This document centralizes the **normative tables** for scripting and automation contracts so other design docs do not drift. For conflicts among secondary architecture documents over the exact identity fields, audit stage/outcome fields, or metric label sets owned by these tables, this document is the tie-breaker. It does not supersede accepted ADR decisions or the separate canonical owners named below; any projection here must remain aligned with those decisions and owners. The detailed DSL read-manifest contract is owned by the [DSL reference](./system-architecture-scripting-dsl-reference-and-lifecycle.md#read-consistency-contract); clock, recovery, due-point, and resume behavior is owned by the [scheduler and timers contract](./system-architecture-scripting-scheduler-and-timers.md#target-state-design). Exact pin/epoch, no-degraded-admission, rollback, dead-letter, rollout-history, schedule-continuity, DSL-lifecycle, and per-instance plugin-fencing decisions are recorded in [ADR 0103](./decisions/adr-0103-single-authority-script-pins-with-exact-version-execution.md), [ADR 0106](./decisions/adr-0106-epoch-fenced-script-rollback-without-routine-gameplay-pause.md), [ADR 0107](./decisions/adr-0107-stage-aware-script-dead-letter-recovery.md), [ADR 0108](./decisions/adr-0108-no-degraded-script-admission-without-authoritative-pin.md), [ADR 0109](./decisions/adr-0109-game-session-owned-script-rollout-history.md), [ADR 0110](./decisions/adr-0110-explicit-opt-in-schedule-continuity-across-script-transitions.md), [ADR 0111](./decisions/adr-0111-unified-dsl-with-distinct-embedded-script-and-plugin-lifecycles.md), and [ADR 0119](./decisions/adr-0119-epoch-fenced-per-instance-plugin-activation.md). Owner-read recovery and targeted durable-notification admission are defined by [ADR 0120](./decisions/adr-0120-owner-read-first-control-plane-notifications.md). This document retains only exact identity projections and the local audit consequences needed to make those owner contracts queryable. ## Implementation Status These tables define the canonical target-state scripting contracts. Current implementation and proof remain partial; see the [Automation and Scheduler Runtime tracker](../project-management/implementation-tracking/automation-and-scheduler-runtime.md#capability-status). In particular, plugin lifecycle epoch/revision propagation and final-fence proof remain incomplete; this document does not claim those target fields are live. Any explicitly labeled current live fallback in this document is implementation evidence and does not narrow or replace the target tables. - The ADR 0114 isolated `DRY_RUN_RESULT` preview remains unimplemented and unproved; the current legacy materialized dry-run path records `finalStage=DSL_EVAL`, `finalOutcome=dry_run_completed`, and `finalReason=dry_run_no_handoff` instead. ## Document Precedence (Normative) For the table-owned surfaces above, resolve conflicts among current canonical architecture documents in this order: 1. `system-architecture-scripting-normative-contract-tables.md` (this document) 2. `system-architecture-scripting-observability-contract.md` (metric/audit behavior not fully enumerated in tables) 3. `system-architecture-scripting-contracts.md` (cross-service invariants) 4. `system-architecture-scripting-control-plane-api.md`, `system-architecture-scripting-control-plane-events.md`, and `system-architecture-scripting-control-plane-operations.md` (operator API shapes, event families, and workflow sequencing) 5. DSL/service/hub docs (`system-architecture-scripting-dsl-reference-and-lifecycle.md`, service READMEs, and overview hubs) This ordering does not supersede accepted ADR decisions. Accepted ADRs remain binding; if a table projection diverges from one, the projection must be reconciled to the ADR before this tie-breaker is applied. ## Table of Contents - [Implementation Status](#implementation-status) - [Table 1: Trigger Identity (Required Fields)](#table-1-trigger-identity-required-fields) - [Table 1A: Event Ingress `scriptEventId` Ownership Matrix](#table-1a-event-ingress-scripteventid-ownership-matrix) - [Table 2: `script_event_audit` Stages and Outcomes](#table-2-script_event_audit-stages-and-outcomes) - [Table 3: Timer Semantics Matrix](#table-3-timer-semantics-matrix) - [Table 4: Metrics Label Matrix](#table-4-metrics-label-matrix) --- ## Table 1: Trigger Identity (Required Fields) Trigger Identity is the composite idempotency identity for logical handler work and handler-scoped evaluated-descriptor materialization of this resolved handler for this trigger at most once, and the natural primary key for handler-scoped `script_event_audit` records. It does not govern downstream gameplay effect materialization: authoritative effect idempotency belongs to the persisted mutation `EffectId` (the root `EffectId` for a root mutation or the generated child's persisted `EffectId` for a child mutation), typed operation, exact target aggregate, and immutable request digest. Any enclosing `rootEffectId` is lineage and reconciliation context only. This logical at-most-once boundary does not prohibit a frozen-input DSL re-evaluation attempt for eligible gameplay/runtime work before `EVALUATED_COMMITTED`; after that boundary, recovery never re-enters the DSL. `scriptEventId` is the stable, producer-namespaced parent-event token within the applicable event scope; it is not a globally unique standalone execution identity or a substitute for all other applicable identity fields. Incoming requests use the separate event-scope identity defined below until handler resolution completes. The handler-scoped input manifest defined by the [DSL lifecycle owner](./system-architecture-scripting-dsl-reference-and-lifecycle.md#read-consistency-contract) is durable evaluation input, not an additional Trigger Identity field; its owner versions and causal floor must be retained with the handler record. For gameplay/runtime work, `scriptPatchVersion` and the Game Session-owned `scriptPinEpoch` are an inseparable exact execution tuple; matching patch text under a different epoch is a fence mismatch. For plugin work, the captured `(pluginActivationEpoch, lifecycleRevision)` pair is required execution-fence evidence and is deliberately excluded from handler Trigger Identity. For applicable gameplay/runtime identities, `playableStateNamespaceId` is the durable playable-state uniqueness/allocation dimension. The server-derived `playableStateScope` is immutable within one playable-state lifecycle and is policy/routing/authorization/migration-fence evidence that must be persisted and exact-validated; a missing, stale, or mismatched scope fails closed. `playableStateScope` is not a Trigger Identity, event-scope, handoff, schedule, resume-window, or other uniqueness/deduplication dimension. A presented scope mismatch therefore requires authoritative reconciliation before admission: only stale or incorrect evidence with unchanged authoritative scope may reuse the namespace-keyed identity; an authoritative scope-policy transition starts a new playable-state lifecycle and selects or allocates a new `playableStateNamespaceId` before fresh durable identity is admitted. Downstream gameplay effects emitted by a handler use the ordinary Game Session effect-admission boundary, not Trigger Identity. Full Trigger Identity governs resolved handler work, including handler-scoped audit and deduplication, only. The complete applicable Command-Handoff Identity governs emitted-command handoff admission and deduplication; `scriptEventId`, the rest of Trigger Identity, and handler lineage remain separate correlation identities. The accepted effect contract requires downstream mutations to preserve the persisted mutation `EffectId`, typed operation, exact target aggregate, and immutable request digest through retries and participant guards. Deterministic command-plan ordering, `planOrdinal`, and root-allocation behavior remain proposal-only in [ADR 0183](./decisions/adr-0183-deterministic-effect-id-allocation-and-replay-binding.md). Ordinary producer event-ingress RPCs into Automation & Scripting (for example `TriggerScriptEvent`) use two-stage deduplication: - Before handler resolution, ordinary incoming-request dedupe uses the event-scope identity. `scriptId` and `bindingId` are unavailable on that path and must not be invented or used as synthetic identity fields. Tenant-readiness `onLoad` and scheduler/timer due candidates use the explicit owner-known exceptions below. - After binding resolution, each resolved handler dedupes independently by its full applicable Trigger Identity. The event-scope `scriptEventId` is propagated unchanged into every resolved handler identity; retries of that handler must reuse the same full identity fields and that same ID. Required Trigger Identity fields for all triggers: | Field | Required | Notes | | --- | --- | --- | | `tenantId` | Yes | Tenant/project identity. | | `gameInstanceId` | Yes | Required to avoid collisions when a tenant has multiple instances. Must be carried through audit and downstream idempotency. | | `playableStateNamespaceId` | Yes (gameplay/runtime) | Durable playable-state namespace used in Trigger Identity uniqueness/allocation. Shared, isolated, and playtest state namespaces must not collide even when other runtime identity fields match. | | `playableStateScope` | Yes (gameplay/runtime) | Server-derived playable-state policy/routing/authorization/migration-fence evidence, immutable for the namespace during one playable-state lifecycle. Persist and exact-validate it with the handler record; a missing or mismatched value fails closed. It is required evidence but is excluded from Trigger Identity uniqueness/deduplication. An authority-proven scope transition requires a new playable-state lifecycle/namespace rather than reuse. | | `regionId` | Yes (gameplay/runtime) | Region context for every gameplay/runtime trigger. Non-region tenant/control-plane events use an existing non-gameplay branch rather than a gameplay/runtime Trigger Identity. | | `regionEpoch` | Yes (gameplay/runtime) | Required for any trigger emitted from, aligned to, or fenced by the tick timeline. This includes standard gameplay lifecycle events emitted after tick commit (for example `onEnterRegion`, `onSpawn`, `onCommand`) and all scheduler/timer events. | | `entityId` | Yes (entity-scoped) | Required for entity-scoped triggers. | | `scriptId` | Yes | The script definition identity that will run. If bindings fan out, each `` is a distinct Trigger Identity. | | `eventType` | Yes | Logical event key (for example `onEnterRegion`, `onInterval`). | | `eventSchemaVersion` | Yes | Version of the event and payload contract. Different schema versions must not share Trigger Identity. | | `scriptPatchVersion` | Yes | Pinned patch version for the game instance at the time the trigger is emitted. | | `scriptPinEpoch` | Yes (gameplay/runtime) | Exact Game Session selection epoch paired with `scriptPatchVersion`; advances on every pin change, including rollback or repin to the same version. Absent for tenant-readiness `onLoad`. | | `scriptEventId` | Yes | One event-scope idempotency token propagated into each full applicable handler Trigger Identity. Live ingress uses caller-supplied IDs that must be stable across retries; scheduler/timer ingress derives one deterministic ID from the due-candidate identity. Dry-run/test ingress may use server-generated IDs by default. Must not be used as a Prometheus label. | | `isDryRun` | Yes | Required identity dimension for dedupe/audit namespace separation. Dry-run/test and live traffic must never share the same idempotency namespace. | Paired owner evidence (required where applicable but excluded from Trigger Identity): `scriptPinControlPlaneRequestId` is the exact nonblank Game Session control-plane request ID captured with `scriptPatchVersion` and a positive `scriptPinEpoch` for gameplay/runtime and scheduler triggers. It is retained immutably as owner evidence/correlation but excluded from logical identity and the trigger/candidate claim uniqueness and conflict keys governed here; it must match authoritative owner evidence through ingress, persistence, quota admission, replay, recovery, and finalization. It is absent for tenant-readiness `onLoad`. Epoch-zero retained or migration records are fail-closed evidence and are not gameplay/runtime or scheduler triggers. Additional required fields for plugin triggers: | Field | Required | Notes | | --- | --- | --- | | `pluginId` | Yes (plugin triggers) | Required to distinguish plugin-triggered runs from core scripts when the same `scriptId` model is reused. | | `pluginVersionId` | Yes (plugin triggers) | Required for rollback safety, audit correlation, and version-fence drops. | | `bindingId` | Yes (resolved plugin handlers and schedule-owned timer identity) | Stable signed-bundle binding identity. Required after ordinary handler resolution; a scheduler/timer also includes it before resolution when the durable schedule already owns that binding. Multiple handlers contributed by one plugin version cannot alias in dedupe, audit, quota, timer firing, or handoff state. | For plugin-backed runtime fence evidence, the captured `(pluginActivationEpoch, lifecycleRevision)` pair is retained through durable work, schedules, claims, handoff, retry, replay, remote follow-ups, staged commands, recovery, and final execution. Neither value is part of handler Trigger Identity, Command-Handoff Identity, stable schedule-row identity, or stable continuity identity. The distinct handler execution child identity for durable child work and lineage is `{parentEventId, pluginId, pluginVersionId, bindingId, pluginActivationEpoch}`; `parentEventId` references the full parent event identity, including its tenant/runtime or dry-run scope, so `scriptEventId` alone is not a standalone child key. Handler Trigger Identity and its audit-row dedupe use the full applicable event identity plus exact plugin provenance without the epoch, while the audit/work record retains the captured child execution identity and fence pair. Child work, audit lineage, retry, and recovery reuse that captured execution identity and never recompute it from current plugin state. Game Session compares the exact `(pluginId, pluginVersionId, bindingId)` provenance plus the captured lifecycle pair with its local projection before gameplay mutation; missing, stale, displaced, disabled, revoked, unavailable, or unverifiable state fails closed. Lifecycle transitions require a durable Game Session fence acknowledgement before new admission or containment completion. A breaker trip or reset independently changes execution admission state and requires no lifecycle fence installation or acknowledgement. The notification catalogue may wake a reread but cannot replace this command-and-acknowledgement barrier. Game Session may compare `(pluginActivationEpoch, lifecycleRevision)` lexicographically only for projection-write ordering. Admission and recovery first require exact `pluginActivationEpoch` equality with authoritative current state, then apply the state-specific `lifecycleRevision` rule: `ENABLED` requires the exact current revision, while same-version/same-epoch `DRAINING` may accept only work whose winning admission/fence CAS durably committed the immediately preceding `ENABLED` revision before the Automation-owned durable `DRAINING` admission barrier was created. Mere capture or observation of that revision, or a winning CAS after barrier creation, is insufficient. Arbitrary lower revisions, non-executable states, and epoch-advanced transitions fail closed. Additional required fields for scheduler/timer triggers: Plugin-owned schedule rows, due candidates, firing claims, candidate audits, and timer-derived work retain the captured `lifecycleRevision` alongside `pluginActivationEpoch`. The revision is fence evidence only: before a new firing claim or handler admission, the scheduler must observe the exact current lifecycle tuple and require the current revision in `ENABLED`; it may not use the `DRAINING` predecessor exception for a new firing. A same-epoch lifecycle revision change fences the old candidate under its existing identity and does not mint a fresh candidate identity merely because the revision changed. Already-admitted work may use the narrowly retained immediately preceding `ENABLED` revision only with ADR 0119's durable pre-`DRAINING` admission/fence evidence and same-version/same-epoch rule. Before handler resolution, a scheduler/timer firing claim is keyed by the complete durable logical schedule/event identity: the stable logical schedule continuity fields together with exact `scriptPatchVersion` and `scriptPinEpoch`, `isDryRun`, applicable runtime scope, target selector, trigger mode, and tagged due point; when `triggerMode=CATCH_UP`, `resumeWindowId` is additionally required and participates in claim uniqueness and `scriptEventId` derivation, and it is absent otherwise. The physical `scheduleInstanceId` is retained only as immutable row-generation metadata for durable lookup and reconciliation; it is explicitly excluded from `scheduleCandidateId`, firing-claim uniqueness, and `scriptEventId` derivation. The logical identity therefore includes schedule-owned `scriptId` and any schedule-owned `pluginId`, `pluginVersionId`, and `bindingId`; for plugin-owned candidates, the captured `pluginActivationEpoch` is an additional tagged field in the local `scheduleCandidateId`/firing-claim uniqueness key, while core-script candidates omit it. Same-epoch retries reuse that candidate identity only while the complete captured fence evidence remains current; for plugin-owned schedules, a same-version disable/re-enable derives a fresh candidate identity from the newer `pluginActivationEpoch`. `pluginActivationEpoch` is not a separate handler Trigger Identity field: it is included in the candidate, firing-claim, and candidate-audit identities and is an input to the scheduler-derived `scriptEventId`, so a fresh activation epoch yields a fresh event ID transitively in every resolved handler identity. Core schedule transition identity changes only through the accepted exact `scriptPatchVersion`/`scriptPinEpoch` contract; no separate core epoch is implied. It must not fabricate fields absent from the durable schedule. Candidate audits use that same complete due-candidate identity, including the exact patch and epoch, `isDryRun`, captured plugin activation epoch when applicable, and `resumeWindowId` only for `CATCH_UP`. This owner-known firing identity is distinct from the ordinary producer event-ingress key below and derives the one event-scope `scriptEventId` propagated to resolved handlers. After resolution, each plugin child uses the captured handler execution identity above; only scheduler candidate/firing-claim/audit identities include activation epoch directly, while the scheduler-derived `scriptEventId` makes it differ transitively in the handler Trigger Identity. `lifecycleRevision` is retained and revalidated alongside it as non-identity fence evidence and is not added to those identities. Neither lifecycle value is part of Command-Handoff Identity, stable schedule-row identity, or the stable continuity key. Durable schedule rows, due candidates, firing claims, candidate audits, and list/read projections persist and expose the exact plugin activation epoch and captured lifecycle revision as fence evidence; `scriptPinEpoch` remains execution/fence metadata and is excluded from the stable continuity key. For scheduler/timer identities, the applicable `playableStateNamespaceId` is the durable playable-state identity component carried in the schedule instance, due candidate, firing claim, candidate audit, and derived `scriptEventId`. The server-derived `playableStateScope` is retained alongside those records as separately persisted exact-validated policy/routing/authorization/migration-fence evidence; it is not added to schedule, candidate, firing-claim, event-scope, or handler uniqueness. Missing or mismatched scope evidence fails closed and fences admission until authoritative reconciliation. Only a stale or incorrect presented scope with unchanged authoritative scope may resume the existing namespace-keyed identity; an authority-proven scope transition starts a new playable-state lifecycle and namespace before fresh schedule state is admitted. | Field | Required | Notes | | --- | --- | --- | | `scheduleDefinitionId` | Yes | Identifies the pinned schedule definition whose due firing produced the trigger and prevents distinct schedules with otherwise identical trigger fields from colliding. | | Exactly one of `dueTickId` or `dueAt` | Yes | A tagged due point is required so scheduler `scriptEventId` can be deterministic and catch-up behavior can be audited. The alternate field must be absent/`NULL`; both populated or both absent are invalid for scheduler triggers. | | `triggerMode` | Yes | `NORMAL` vs `CATCH_UP` to make bounded catch-up observable. | ### Scheduler Candidate Identity Preimage (Normative) The canonical scheduler preimage fields are serialized in this fixed order: ``. The target implementation in `ScriptScheduleInstanceServiceImpl.TimerFiringCandidate.identity()` must serialize these fields in this order; the current live implementation remains narrower and does not yet implement this target preimage. Fields marked `when ...` are omitted, not replaced by empty or sentinel values, when their branch does not apply; `targetScopeType` makes the target selector explicit and `stableOwnerKind` makes the core/plugin owner branch explicit. The server-derived `playableStateScope` remains immutable policy/routing/authorization/fence evidence and is not a preimage or uniqueness input. `scriptEventId` itself is excluded from the preimage, and `resumeWindowId` is absent for non-catch-up triggers. `duePoint` is exactly one tagged value: `dueTickId:` for tick-aligned schedules or `dueAt:` for wall-clock timers. Any additional scheduler schema version or trigger mode must become an explicit deterministic-ID input before it is admitted. This permits delimiters and arbitrary UTF-8 text without creating tuple collisions. Serialize the preimage as fixed-order, length-prefixed UTF-8 fields. Encode each field as its UTF-8 byte length rendered as unsigned base-10 ASCII decimal with no leading zeroes, followed by a colon and its unescaped UTF-8 value; concatenate fields without separators. Numeric identity values use canonical base-10 ASCII spelling (for example, `0`, `7`, and `-1`), and the prefix length counts UTF-8 bytes rather than Unicode code points. Semantic validation controls which numeric values are admissible; deterministic decimal serialization does not make an otherwise invalid value valid. Booleans serialize as lowercase `true` or `false`. Enum values use the contract-declared enum symbol/name, never an ordinal, localized spelling, or implementation-specific representation. Hash the serialized bytes with SHA-256, encode the digest as lowercase hexadecimal, retain the first 60 hexadecimal characters, and prefix the result with `timer-`. Before this identity is considered proven, cross-producer golden vectors must cover empty values, non-ASCII values, delimiters, negative and zero numeric values, both boolean values, representative enum branches, and both tagged due-point branches. Proof also covers optional-branch omission and exact retry reuse without collisions or duplicate logical triggers. Additional required fields and exceptions for tenant-readiness lifecycle triggers: | Field | Required | Notes | | --- | --- | --- | | `tenantId` | Yes | Tenant whose patch is being validated. | | `scriptId` | Yes | Script definition running readiness initialization. | | `eventType` | Yes | Must be `onLoad`. | | `eventSchemaVersion` | Yes | Must identify the admitted `onLoad` event contract version. | | `scriptPatchVersion` | Yes | Pending patch being validated for tenant readiness. | | `scriptEventId` | Yes | Deterministically generated by Automation & Scripting from all non-generated applicable onLoad identity fields, including ``. | | `isDryRun` | Yes | Must be `false` for readiness `onLoad`; dry-run/test `onLoad` probes use the dry-run/test ingress contract instead. | | `gameInstanceId`, `playableStateNamespaceId`, `playableStateScope`, `regionId`, `regionEpoch`, `entityId` | No | `onLoad` is tenant-readiness work and is not tied to a running instance, playable-state namespace, playable-state policy, region, tick epoch, or entity. These fields must be absent rather than populated with sentinel values. | Ordinary producer event-scope ingress identity before handler resolution: | Field | Required | Notes | | --- | --- | --- | | `tenantId` | Yes | Tenant/project identity. | | `gameInstanceId` | Yes (runtime ingress) | Required for runtime ingress fences such as reload, rollback pause, and pin visibility. | | `playableStateNamespaceId` | Yes (gameplay/runtime ingress) | Durable playable-state namespace identity carried before handler fan-out and included in the event-scope uniqueness key. | | `playableStateScope` | Yes (gameplay/runtime ingress) | Server-derived policy/routing/authorization/migration-fence evidence carried before handler fan-out, immutable for the namespace during one playable-state lifecycle, persisted with the ingress claim/audit, and exact-validated. It is excluded from the event-scope uniqueness key; a mismatch fails closed. Only unchanged authoritative scope permits reuse; an authority-proven transition requires a new lifecycle/namespace. | | `regionId`, `regionEpoch`, `entityId` | Yes when the incoming event is gameplay/runtime-scoped | These fields describe the source event before handler fan-out. | | `eventType` | Yes | Logical event key being admitted for handler resolution. | | `eventSchemaVersion` | Yes | Version of the event and payload contract being admitted. | | `scriptPatchVersion` | Yes | Patch version supplied by the producer for pin/version checks. | | `scriptPinEpoch` | Yes (gameplay/runtime ingress) | Exact Game Session pin epoch supplied with the patch; absent for tenant-readiness `onLoad`. | | `scriptPinControlPlaneRequestId` | Yes (paired owner evidence, gameplay/runtime ingress) | Nonblank owner request evidence paired with the exact patch and epoch; retained immutably but excluded from logical identity and the durable ingress uniqueness/conflict key. Absent for tenant-readiness `onLoad` and explicitly unpinned epoch-zero records. | | `scriptEventId` | Yes | Caller-supplied live ingress idempotency token, or service-generated dry-run/test token. | | `isDryRun` | Yes | Separates live and dry-run/test ingress namespaces. | | `sourceService` | Yes for custom/service-specific events | Canonical producing service identity derived from the authenticated producer/workload identity and authorized by the event registry. It is not an untrusted caller field. Include the same value in the event-scope key and persist it unchanged in ingress and handler audit records; omit it for built-in events that originate entirely within Automation & Scripting. | ### Remote Follow-Up Tuple Binding (Normative) For remote playable-state handoff, the source `playableStateNamespaceId` is the source durable identity dimension, while the server-derived source `playableStateScope` is separately persisted exact-validated policy/routing/authorization/migration-fence evidence. The target `targetPlayableStateNamespaceId` is the target durable identity dimension; `targetPlayableStateScope` is separately persisted exact-validated target evidence and is excluded from target uniqueness/deduplication. A missing, stale, or mismatched source or target scope fails closed and requires authoritative reconciliation; only stale or incorrect presented evidence with unchanged authoritative scope may reuse the existing handoff identity. An authority-proven scope-policy transition starts a new playable-state lifecycle and selects or allocates the corresponding target namespace before fresh handoff identity is admitted. A remote follow-up whose source and target game instances differ carries two exact pin roles. The originating `sourceScriptPatchVersion`/`sourceScriptPinEpoch` pair is captured when the source event/follow-up is admitted and remains immutable source provenance and the source rollback fence. Before target-side Automation admission, Game Session revalidates that source pair against the authoritative source instance, reads and freezes the target instance's current exact `scriptPatchVersion`/`scriptPinEpoch` pair, and durably binds both pairs to the target delivery/claim and its immutable request/dedupe evidence. The target pair, not the source pair, populates the target event-scope and resolved-handler Trigger Identity and all target-side script admission and execution fences; the source pair remains separately named provenance/fence and is never substituted into that target identity. Retries reuse both frozen pairs. Source or target displacement, a conflicting retry, or a changed tuple fails closed; unavailable authority is retryable and creates no target admission, while semantic target `UNPINNED` creates no target script work. When source and target are the same game instance, one authoritative exact pair serves both roles and no distinct second tuple is fabricated. For semantic target `UNPINNED`, Game Session's existing `remote_followup_result` transaction is the sole result owner: it persists exactly one terminal row under `resultId=remote-result:` with `outcome=ABANDONED`, `resultErrorCode=REMOTE_TARGET_UNPINNED`, canonical empty `resultPayloadJson={}`, and no `resultCommandId`; the same transaction updates the existing follow-up and coordinator identities and creates no Automation event, work item, or command. An exact retry returns that row without work. A retry whose existing scope, source/target tuple or identity, outcome, or normalized result-authority fingerprint differs conflicts and cannot overwrite it; this reuses the existing persisted fields and adds no digest column or outcome family. `authority_unavailable` persists no terminal result and does not terminalize delivery: it remains non-admitted/retryable under the same follow-up identity after authority recovers. This is distinct from the finalized no-script result. ### Event-Scope Claim and Retry Semantics (Normative) The ordinary producer event-scope claim/conflict key is the ordered composite of every applicable field in the event-scope ingress identity table: ``. The paired `scriptPinControlPlaneRequestId` is retained immutably as owner evidence/correlation but is excluded from this durable storage key and the logical execution identity; the exact execution pin tuple remains `(scriptPatchVersion, scriptPinEpoch)` and the request ID must match authoritative owner evidence. `playableStateNamespaceId` is the applicable composite identity dimension; `playableStateScope` remains separately persisted, exact-validated scope evidence and is excluded from the key. An optional field is included exactly when its ingress scope requires it; absent optional fields remain absent and must not be replaced with sentinel values. `scriptId`, `pluginId`, `pluginVersionId`, and `bindingId` are not part of this ordinary producer key because they are unavailable before handler resolution. The scheduler/timer and tenant-readiness owner-known exceptions above use their separately defined pre-resolution identities; they do not authorize a producer to supply synthetic handler fields. For custom or service-specific events, Automation derives `sourceService` from the authenticated producer/workload identity and the event-registry authorization result. The derived value, rather than a caller-supplied value, participates in the event-scope dedupe key and is persisted identically in `script_event_ingress_audit` and every resolved-handler `script_event_audit` record. A changed or unauthorized producer identity is an admission identity conflict, not a retry. The durable event-scope claim has an `IN_PROGRESS` phase, a retry-eligible transient-denial phase, and a terminal finalized phase. The first claimant must atomically insert-or-claim this key and its single `script_event_ingress_audit` record before performing admission side effects. Only that claimant, or a fenced recovery owner for the same claim, may run handler resolution and fan-out. A claim that passes pre-handler admission remains `IN_PROGRESS` until resolution has completed and every matched handler's idempotent materialization attempt has completed; only then are the final response fields (`admitted`, `admissionOutcome`, `admissionReason`, `retryAfterMs` when present, and `resolvedHandlerCount`) atomically finalized on the claim and audit record. A pre-handler transient backpressure denial may enter the retry-eligible phase only when the owning policy explicitly permits retry: persist the denial/audit and a bounded retry eligibility window exposed by a bounded `retryAfterMs` hint, perform no handler resolution or fan-out, and keep the same event-scope key. After the indicated retry time, a same-key request may atomically reclaim that existing claim and transition it back to `IN_PROGRESS` for a new admission attempt; a lease/fence or compare-and-set must ensure that only one attempt owns the claim. If the bounded eligibility window expires without reclaim, the denial becomes terminal and is replayed exactly like any other permanent denial. - A concurrent retry or duplicate delivery that finds `IN_PROGRESS` waits for the same claim to finalize, or returns a retryable transport/application signal without an admission result; it must not start resolution, return a partial handler count, or create another ingress-audit row. Recovery resumes the same claim under fencing rather than creating a competing outcome. The same fencing applies while a retry-eligible denial is being reclaimed: losing attempts return the stored denial/hint or wait for the owner, and cannot fan out. - A retry or duplicate delivery with the same terminal finalized event-scope key returns the exact stored admission result, without re-evaluating admission or materializing duplicate handler work. Permanent denials and successful results are terminal finalized results; a retry-eligible transient denial is the explicit exception and may be reclaimed only through the bounded lifecycle above. - `resolvedHandlerCount` is the count of enabled bindings that matched and were resolved for the admitted event scope, including dry-run/test claims. It is not a count of persisted work items, emitted commands, successful handlers, or handler audit rows, and it is immutable in the finalized claim result. A resolved handler may have no work item when its handler-scoped admission decision denies it. - An admitted live claim with zero resolved handlers returns the normal admitted result with `resolvedHandlerCount=0`; `admitted_no_handlers` is emitted only as the Table 4 metric-only outcome. A dry-run/test claim with zero resolved handlers emits no live trigger metric. The finalized value is returned in the ingress response and stored on the claim and `script_event_ingress_audit`; it is not stored in handler-scoped `script_event_audit` rows. - A request that reuses `scriptEventId` must perform a producer-scoped collision lookup against the complete ordered event-scope key above, including every applicable runtime, namespace, region/epoch, event, pin, dry-run, and producer field. If it changes any other applicable key field, or presents required scope evidence that does not exactly match the authoritative bound evidence, it is an identity/evidence conflict, not a retry. Reject or fence it deterministically, preserve the original claim and outcome, and do not write a competing audit or materialize handlers until authoritative reconciliation completes. - A rejected claim has no handler materialization and remains represented only by its one event-scope ingress-audit row. Event-scope ingress outcomes are recorded in the existing `script_event_ingress_audit` surface using its event-scope identity, `scriptEventId` correlation, `createdAt` retention anchor, mutable `claimStartedAt` lease, and `admissionOutcome`/`admissionReason` fields, not in handler-scoped `script_event_audit`. Stale `IN_PROGRESS` recovery compares the claim's current row-version fence and lease timestamp before advancing the fence, so an abandoned owner's finalization is rejected as a stale write and operators can identify the reclaim through its bounded durable reason. Transport authentication/authorization and request/schema validation occur before the event-scope claim and use canonical non-OK gRPC status; they do not create a claim, finalized ingress-audit result, or ingress-drop metric. After the claim exists, genuine event-scope/domain decisions such as stale pin state, reload backpressure, rollback pause, or version unavailability may use typed admission fields and the matching ingress audit/drop metric. Once the event is accepted for handler resolution, each resolved handler produces its own full applicable Trigger Identity and `script_event_audit` row. Pre-resolution event-scope decisions must not invent a synthetic `scriptId`, `bindingId`, or command identity. Scheduler due-candidate skips use the candidate-audit rule in Table 3 instead of event-scope ingress audit. An oversized request `payloadJson` envelope is request/schema validation before the event-scope claim: return canonical non-OK gRPC `INVALID_ARGUMENT` and create no event-scope claim, admission result, `script_event_ingress_audit` row, handler-scoped `script_event_audit` row, or ingress-drop metric. This envelope check is distinct from handler-time output limits and must not use `TRIGGER_ADMISSION_OUTCOME_OUTPUT_BUDGET_EXCEEDED`. The request envelope bound is distinct from handler-time output enforcement. Current command-count and per-entity fan-out ceilings are applied during handler evaluation and produce the applicable bounded handler outcome; target serialized generated-output byte/data-dependent metering is applied during DSL evaluation before descriptor commit and remains target-only, not current implementation proof. A serialization or persistence failure after evaluation remains a `WORK_ITEM_PERSIST` failure, not a request-envelope validation result. Signer-policy unavailability before handler resolution is an event-scope denial: return `admissionOutcome=TRIGGER_ADMISSION_OUTCOME_SIGNER_POLICY_UNAVAILABLE` with bounded `admissionReason=signer_policy_unavailable`, record the same pair in `script_event_ingress_audit`, and do not create a handler-scoped `finalOutcome` or `script_event_audit` row. If signer policy is evaluated after binding resolution for a concrete handler, the handler-scoped outcome remains `finalOutcome=signer_policy_unavailable` under Table 2. Dry-run/test budget exhaustion before handler resolution is an event-scope denial: return `admissionOutcome=TRIGGER_ADMISSION_OUTCOME_QUOTA_DENIED` with bounded `admissionReason=dry_run_budget_exceeded`, record the same pair in `script_event_ingress_audit`, and do not create a handler-scoped `finalOutcome` or `script_event_audit` row. ### Durable Work-Item Lifecycle (Normative) For each resolved handler admitted to durable execution after handler-scoped gates, one durable parent work item owns the full applicable Trigger Identity, frozen event payload, and handler input manifest. In the target lifecycle, the parent transitions `PENDING_EVALUATION` -> `EXECUTING` -> `EVALUATED_COMMITTED`; executor acceptance, the execution-start marker, and the fenced capacity lease commit before DSL evaluation, and recovery after `EVALUATED_COMMITTED` replays committed descriptors without re-entering the DSL. The current live legacy path persists only `PENDING_EVALUATION` -> `EVALUATING`; it does not persist `EVALUATED_COMMITTED` or evaluated descriptor/child rows. Its pre-DSL queue pointers remain inspection-only while `EVALUATING`, and unresolved work remains fenced rather than being reclaimed as target execution. A handler denied before work-item materialization keeps its handler audit outcome but creates no parent work item. The target atomic transition to `EVALUATED_COMMITTED` persists the immutable evaluated command descriptors and child-dispatch rows, their parent correlation, the terminal evaluation outcome, and the audit update. Descriptor/child rows then progress independently through `PENDING`, `INDEXED`, `HANDOFF_IN_FLIGHT`, `HANDED_OFF`, `CANCELED`, or `DEAD_LETTERED`; those child statuses are not a second parent work-item lifecycle. A valid zero-command evaluation creates no dispatch or synthetic child descriptor. `automation:queue:*` is a derived projection: current implementation pointers identify pre-DSL parent work items in `PENDING_EVALUATION` or `EVALUATING`, while target pointers index committed descriptor/child work. Queue rebuild is pointer recovery only and never creates a new parent, re-enters the DSL, or substitutes for durable work truth. Before `EVALUATED_COMMITTED`, an eligible evaluation retry uses the same parent identity and frozen inputs; after `EVALUATED_COMMITTED`, recovery uses only the committed descriptor/child ledger and never re-enters the DSL. The separate parent recovery aggregate required for dead-letter generation and recovery attempts is status evidence for this parent, not another work item or a competing lifecycle. Notes: - If an implementation wants to treat some gameplay lifecycle events as “not tick-aligned”, it must define that exception explicitly in this table (not only in prose docs) and document why it is safe across scoped coordination resets. The default contract is that gameplay lifecycle triggers are fenced by `regionEpoch`. - Dry-run/test ingress must use a namespace separate from live ingress (`isDryRun=true`) regardless of whether `scriptEventId` is caller-generated or server-generated. - Full Trigger Identity governs resolved-handler work only; it does not govern emitted-command child admission or deduplication. The complete applicable Command-Handoff Identity governs that child admission and deduplication. After it is admitted/deduplicated and exact-maps to one durable target `commandId`, downstream authoritative service calls must use the mutation's persisted root-or-child `EffectId`, typed operation, exact target aggregate, and immutable request digest under `design/architecture/system-architecture-transactions.md`; a generated child uses its own persisted child identity while retaining the enclosing root only as lineage/reconciliation context. `scriptEventId`, `automationDispatchId`, and tick context remain correlation or admission metadata and cannot substitute for that mutation guard. ## Table 1A: Event Ingress `scriptEventId` Ownership Matrix The ingress endpoint determines who owns `scriptEventId` generation and retry behavior. Implementations must reject requests that violate these ownership rules. In the scheduler/timer ingress row, `runtime scope` means the durable runtime identity, including `playableStateNamespaceId` where applicable; the server-derived `playableStateScope` travels as separately persisted exact-validated policy/routing/authorization/migration-fence evidence and is excluded from the event-scope due-candidate identity. Missing or mismatched scope evidence fails closed before candidate or `scriptEventId` derivation. Only stale or incorrect presented evidence with unchanged authoritative scope may reuse an existing candidate; an authority-proven scope-policy transition starts a new playable-state lifecycle and namespace before fresh candidate identity is derived. | Ingress surface | `scriptEventId` owner | Required behavior | | --- | --- | --- | | Live external ingress (`TriggerScriptEvent`) | Caller | Caller must supply `scriptEventId` and must reuse it across retries for the same trigger identity. Missing ID is a deterministic validation error. | | Scheduler/timer internal ingress (`onInterval`, `onTimerExpire`) | Automation scheduler | Scheduler must generate one deterministic event-scope `scriptEventId` from the complete event-scope due-candidate execution identity, including runtime scope, event/schema, the exact `(scriptPatchVersion, scriptPinEpoch)` tuple, `isDryRun`, schedule identity, exactly one tagged due point (`dueTickId` or `dueAt`), `triggerMode`, and, for plugin-owned schedules, the captured `pluginActivationEpoch` (plus `resumeWindowId` for catch-up). The paired nonblank `scriptPinControlPlaneRequestId` is required owner evidence, retained immutably for validation/correlation, and excluded from the durable candidate/firing-claim key, `scriptEventId`, and logical execution identity. The captured `lifecycleRevision` must travel alongside as required non-identity fence evidence and is not included in candidate, firing-claim, or `scriptEventId` identity. Missing applicable owner or lifecycle evidence fails closed before candidate, firing-claim, or `scriptEventId` derivation. Same-epoch retries reuse that identity; for plugin-owned schedules, a same-version disable/re-enable derives a fresh candidate and `scriptEventId` from the newer `pluginActivationEpoch`. Core-script schedules use only the accepted exact patch/pin epoch transition contract and do not imply a separate core activation epoch. It propagates that ID unchanged into every resolved handler's full Trigger Identity and must not require or fabricate handler-only fields before resolution. The activation epoch participates only in owner-known scheduler candidate/firing identity and the derived event-scope `scriptEventId`; it remains excluded from handler Trigger Identity and Command-Handoff Identity. | | Tenant-readiness lifecycle ingress (`onLoad`) | Automation readiness worker | Worker must generate deterministic IDs from all non-generated applicable fields, including ``. The DSL evaluation is at-most-once; bounded retries are permitted only for independently idempotent external infrastructure steps and reuse the same persisted ID. Superseded patches must not mint replacement IDs for the same readiness tuple. | | Dry-run/test ingress (`RunScriptDryRun` or equivalent) | Service/test harness by default | Service generates `scriptEventId` by default. If caller-supplied IDs are accepted, service must validate dry-run namespace and reject collisions deterministically. | ## Table 2: `script_event_audit` Stages and Outcomes `script_event_audit` is limited to a concrete resolved-handler lifecycle: handler-scoped admission and materialized-work decisions, DSL evaluation, persistence, handoff, and current legacy materialized dry-run/test results. It must be stage-aware so operators can distinguish handler-scoped “rejected before evaluation” from “evaluated but not handed off” and from “accepted into tick queues”. Target ADR 0114 command-plan previews use an isolated preview result/audit surface and do not create or update `script_event_audit`; they may use the `DRY_RUN_RESULT`/`dry_run_success` stage and outcome terminology there, but that terminology does not make the preview a handler-audit row. Pre-handler event-scope decisions for event ingress, including dry-run rejection, signer-policy unavailability, and rollback backpressure, are represented by `script_event_ingress_audit` and its `admissionOutcome`/`admissionReason` fields instead. Scheduler due-candidate skips use the candidate-audit rule in Table 3. The generic live-event zero-handler rule is metric-only and applies only to non-readiness events: it must not override the tenant-readiness lifecycle. For tenant-readiness `onLoad`, an immutable manifest that proves zero handlers must produce terminal `READY` with the pinned manifest reference and digest and explicit declared-handler and terminal-handler counts of zero; an identifiable zero-handler notification without that proof instead produces the readiness lifecycle's durable `FAILED` status/audit outcome with bounded reason `zero_handler_manifest_unverifiable`. These readiness outcomes take precedence over `admitted_no_handlers`; neither path creates a handler-scoped `script_event_audit` row. ### Required Stage Set | `finalStage` | Meaning | Successful terminal outcome allowed? | | --- | --- | --- | | `ADMISSION` | Handler-scoped post-resolution pre-evaluation decisions: quotas, reload backpressure, disabled scripts, invalid version, policy enforcement. No DSL run occurs. For event ingress, pre-handler rollback pause is ingress-only; timer candidates use the Table 3 candidate-audit surface. | No | | `DSL_EVAL` | DSL graph evaluation and sandbox enforcement (validation, loop safety, runtime budgets). | A resolved handler uses `completed_no_commands` when it validly emits no commands, or its applicable handler failure outcome. `readiness_success` is reserved for the tenant-readiness patch-level owner/projection and is never a resolved-handler `finalOutcome`; tenant readiness uses a separate readiness-owner record with readiness-level status/outcome fields. `dry_run_completed` is a legacy-only outcome, permitted only when `executionSurface=LEGACY_TRIGGER_DRY_RUN` | | `WORK_ITEM_PERSIST` | Durable persistence of the resulting work item (outbox). | No | | `TICK_HANDOFF` | Durable handoff of every required dispatch to Game Session. | Only `handoff_accepted` | Target ADR 0114 non-committing previews may use `DRY_RUN_RESULT` and `dry_run_success` only on their isolated preview result/audit surface. Those values are not `script_event_audit` stages or outcomes; preview commands are returned directly to the authorized caller or retained on that isolated surface and are never persisted as live work or handed off. ### Required Audit Write Semantics (Normative) `script_event_audit` writes must be deterministic under retries and concurrent updates: - There must be at most one row per full handler Trigger Identity (Table 1 plus `pluginId`, `pluginVersionId`, and `bindingId` where applicable); the captured `(pluginActivationEpoch, lifecycleRevision)` pair is execution-fence evidence, not a handler-row uniqueness field. The separate durable handler execution child identity includes `pluginActivationEpoch` as defined above, and its child work/lineage records must retain and reuse it without changing the audit-row key. - Implementations must enforce uniqueness at storage level (composite unique key over Trigger Identity). - Retries and duplicate deliveries must update the existing row instead of inserting a new one. - Stage progression must be monotonic for live runs (`ADMISSION` <= `DSL_EVAL` <= `WORK_ITEM_PERSIST` <= `TICK_HANDOFF`); writers must not regress `finalStage`. Current legacy materialized dry-run/test handler rows use the terminal `ADMISSION` <= `DSL_EVAL` branch with `finalStage=DSL_EVAL`, `finalOutcome=dry_run_completed`, and `finalReason=dry_run_no_handoff`, and must never progress to `WORK_ITEM_PERSIST` or `TICK_HANDOFF`; target ADR 0114 previews use `DRY_RUN_RESULT`/`dry_run_success` only on their isolated preview result/audit surface or direct authorized result path. - On conflicting updates, the higher stage wins; if stages are equal, preserve the first terminal non-success outcome unless a later write provides a strictly higher-fidelity reason for the same stage. ### Required Outcome Rules (Normative) | Stage | Required rule | | --- | --- | | `ADMISSION` | Must record explicit post-resolution handler backpressure outcomes during `reloadState=RELOADING` (`finalOutcome=skipped_reloading`) and `PAUSED_FOR_ROLLBACK` (`finalOutcome=rollback_paused`) rather than silent drops. For event ingress, a pre-handler rollback pause remains only in `script_event_ingress_audit`; timer candidates use the Table 3 candidate-audit surface. | | `DSL_EVAL` | Sandbox failures use `finalOutcome=sandbox_error`. A valid live handler that intentionally emits no commands uses `finalOutcome=completed_no_commands`; it does not claim handoff. | | `WORK_ITEM_PERSIST` | If durable persistence fails, the audit record must not show success. It must record a persistence failure outcome and must not claim that effects were enqueued. | | `TICK_HANDOFF` | `finalOutcome=handoff_accepted` is permitted only when Game Session has durably accepted every required child dispatch. Evaluation or partial handoff is not handoff acceptance. | | *(isolated preview only)* | `finalOutcome=dry_run_success` is permitted only for the target ADR 0114 authorized `isDryRun=true` preview after DSL evaluation completes and the non-committing result has been returned directly to the authorized caller or stored on the isolated preview result/audit surface; it never creates a handler `script_event_audit` row and must not imply durable work-item persistence or tick handoff. The current legacy materialized dry-run/test handler instead records `finalStage=DSL_EVAL`, `finalOutcome=dry_run_completed`, and `finalReason=dry_run_no_handoff`. | Additional non-committing terminal outcome rules: - The tenant-readiness owner records patch-level readiness in a separate readiness record with status `READY` and readiness-level outcome `readiness_success` after its resolved `onLoad` handlers complete; individual resolved-handler audits use `finalOutcome=completed_no_commands` when valid and non-emitting, or their actual failure outcome. When its immutable manifest proves zero handlers, the readiness record instead reaches terminal `READY` with the pinned manifest reference and digest and explicit declared-handler and terminal-handler counts of zero, with no synthetic handler success. An identifiable zero-handler readiness notification without immutable manifest proof records terminal `FAILED` with bounded `statusReason=zero_handler_manifest_unverifiable`; these readiness outcomes take precedence over the generic `admitted_no_handlers` metric-only outcome. None of these outcomes claims `handoff_accepted` or populates a handler `finalOutcome`. - Control-plane or rollback fencing that intentionally prevents an already admitted execution from persisting or handing off must use `finalOutcome=canceled` with a bounded `finalReason` such as `rollback_epoch_advanced`, `superseded_by_newer_patch`, `operator_canceled`, or `operator_purged`. - **Target-state cancellation mapping:** a cancelable `PENDING_EVALUATION` trigger transitions durably to terminal `CANCELED` without entering the DSL and records `finalStage=ADMISSION`, `finalOutcome=canceled`, and the applicable bounded cancellation reason. An `EXECUTING` trigger must be fenced and its descriptor-commit marker inspected before transition. If the descriptor commit is present, the durable trigger remains `EVALUATED_COMMITTED` and cancellation never resumes or re-dispatches a committed child. The handler audit remains nonterminal while any child is `PENDING`, `INDEXED`, or `HANDOFF_IN_FLIGHT`, or while a downstream outcome is ambiguous: evaluated `PENDING` and `INDEXED` children compare-and-set to `CANCELED` with durable `cancelReason`, `finalStage=WORK_ITEM_PERSIST`, and `finalOutcome=canceled`; `HANDOFF_IN_FLIGHT` fences further retry and reconciles the durable downstream outcome; and `HANDED_OFF`, `CANCELED`, or `DEAD_LETTERED` children retain their outcome and no-op. A previously valid `handoff_accepted` result is immutable and never rewritten. Only after every child is durably terminal and no child can newly apply may an unfinished handler audit become `finalOutcome=canceled`, with `finalStage=WORK_ITEM_PERSIST` when handoff was never attempted or `finalStage=TICK_HANDOFF` when cancellation settled during handoff. Child dispositions remain authoritative; idempotent retries use compare-and-set and cannot produce conflicting parent or audit transitions. Explicit cancellation of an `EXECUTING` trigger whose descriptor commit has not occurred (a started-but-uncommitted evaluation) transitions to terminal `CANCELED` with `finalStage=DSL_EVAL`, `finalOutcome=canceled`, and the applicable bounded cancellation reason, and is never replay-eligible. Only the distinct expired-stale recovery-owner path for an `EXECUTING` trigger whose descriptor commit has not occurred transitions to terminal `DEAD_LETTERED` with `finalStage=DSL_EVAL`, `finalOutcome=canceled`, and `finalReason=stale_execution_fenced`; that path reuses the existing full Trigger Identity and propagated `scriptEventId` and creates no new `scriptEventId`, step identity, or command-child identity. A new `scriptEventId`/Trigger Identity is reserved for a new business attempt, not stale recovery; the cancellation API itself does not dead-letter stale displaced rows. Every transition is stage-aware and no path re-enters the DSL. ### Command-Handoff Identity (Target-State) The command collection uses one complete command-handoff identity for each evaluated child dispatch: ``. The source runtime identity fields are required for gameplay/runtime commands; the server-derived source `playableStateScope` is separately persisted exact-validated policy/routing/authorization/migration-fence evidence and is excluded from Command-Handoff Identity uniqueness/deduplication. The target runtime identity fields are included exactly when the emitted command is routed to a distinct target runtime scope, and `targetPlayableStateNamespaceId` is included whenever that distinct target has its own playable-state namespace. `targetPlayableStateScope` is separately persisted exact-validated target policy/routing/authorization/migration-fence evidence and is excluded from target uniqueness/deduplication. Missing, stale, or mismatched source or target scope evidence fails closed and requires authoritative reconciliation; only stale or incorrect presented scope evidence with unchanged authoritative scope may reuse the existing child identity. An authority-proven scope-policy transition starts a new playable-state lifecycle and selects or allocates the corresponding target namespace before fresh child identity is admitted. Absent optional identity fields remain absent. For command-capable gameplay/runtime evaluations, before DSL evaluation the pre-DSL/evaluation claim allocates no `automationDispatchId` or command-child identity. If evaluation emits commands, the first atomic durable evaluated-descriptor/outbox commit allocates and persists one opaque `automationDispatchId`; a valid zero-command evaluation creates no dispatch identity. Pre-commit evaluation retries preserve the original Trigger Identity, work-item identity, and frozen inputs and allocate none; retries after a winning commit reuse its dispatch ID and canonical ordinals. Tenant-readiness `onLoad` is non-emitting and does not allocate or expose a command dispatch identity. Before an evaluated descriptor exists, the pre-DSL trigger has no child identity or `commandOrdinal` and must not expose an `automationDispatchId` as a synthetic child/handoff reference. Once descriptors are emitted, `commandOrdinal` is deterministic from canonical emitted-command order: the first emitted command under a dispatch is `0`, followed by `1`, and so on. The first durable descriptor/outbox commit enforces uniqueness on the complete Command-Handoff Identity above. The complete source/target runtime identity, separately validated scope evidence, dispatch ID, and ordinal together prevent unrelated evaluations from converging; `automationDispatchId` is not assumed to be globally unique. `outboxWorkItemId`, the parent Trigger Identity, and `scriptEventId` are correlation-only and excluded from command-child uniqueness. The complete identity above is the canonical identity for evaluated command-child handoff deduplication, execution-fence reporting, replay selection, and child correlation; it is not the downstream authoritative effect identity. Downstream effect idempotency instead uses the persisted mutation `EffectId` (the root `EffectId` for a root mutation or the generated child's persisted `EffectId` for a child mutation), typed operation, and exact target aggregate, with the immutable request digest stored and compared; any enclosing `rootEffectId` is lineage and reconciliation context only, and a conflicting operation, target, or digest fails closed. The `(automationDispatchId, commandOrdinal)` pair is only a suffix and is insufficient without the complete source/target runtime identity; `script_event_audit` remains a separate one-row-per-handler surface. A command-handoff reference exists only for an emitted evaluated descriptor. Pre-DSL trigger records have no child Command-Handoff Identity or `commandOrdinal` and must not be represented by an `automationDispatchId`, parent `outboxWorkItemId`, parent Trigger Identity, or `scriptEventId` as a synthetic child/handoff reference. Read-only inspection may expose an emitted descriptor reference with the complete identity above, including `commandOrdinal`; mutation APIs currently accept bounded explicit `workItemIds[]` only. Descriptor references and filter selectors are listing/preview inputs, and descriptor-level replay or purge remains deferred until preview plus stable per-row proof. The downstream command-plan root design, including semantic order, `planOrdinal`, and allocation binding, remains pending in [ADR 0183](./decisions/adr-0183-deterministic-effect-id-allocation-and-replay-binding.md). Automation handoff identity and Trigger Identity retain their separate admission and handler/correlation roles under this document's existing contracts; those roles do not establish the pending root-allocation design. Supplementary post-handoff correlation rule: - **Target-state command-ordinal contract:** execution-time version/plugin fence drops that happen after tick handoff must not be left as metrics-only signals. They must be exposed on the affected per-command handoff disposition keyed by the complete Command-Handoff Identity, including `targetPlayableStateNamespaceId` when a distinct target playable-state namespace applies; retain source and target `playableStateScope`/`targetPlayableStateScope` as separately persisted exact-validated policy/routing/authorization/fence evidence, excluded from uniqueness, with the parent Trigger Identity and its exact `scriptPatchVersion`/`scriptPinEpoch` pair retained for correlation. Missing or mismatched scope evidence fails closed. Use `plugin_binding_mismatch` only for a proven plugin/lifecycle binding mismatch; use `plugin_activation_epoch_mismatch` for a captured activation-epoch mismatch, `plugin_disabled` for a lifecycle disablement or revocation that invalidates admitted work, `plugin_version_not_published` for publication failure, `plugin_component_policy_blocked` for a proven component-policy block, `signer_revoked` for signer revocation, and `authority_unavailable`, `component_policy_unavailable`, or `signer_policy_unavailable` when the applicable evidence is unavailable or unverifiable. `script_patch_mismatch` remains the script-version reason. - **Current live fallback:** the Game Session handoff currently carries `automationDispatchId`, command id/text, selected provenance fields, and parent work-item correlation, but not `commandOrdinal` or the complete Trigger Identity. Current diagnostics use those fields and must be labeled as the narrower fallback rather than as proof of the handoff target-state contract. The proposed plan-root allocation is not a live or accepted requirement. Per-command handoff correlation rule: - `script_event_audit` remains one handler record per Trigger Identity, even when that handler emits multiple gameplay commands. It must not contain a single command dispatch field or a single post-handoff outcome for the whole Trigger Identity. - **Target-state:** handoff and later execution dispositions are represented as a child/collection surface with one record per emitted command. One stable `automationDispatchId` identifies the persisted dispatch group, and `commandOrdinal` distinguishes each emitted command under that dispatch within the complete Command-Handoff Identity. Each record retains the parent `outboxWorkItemId` and complete Trigger Identity for correlation. `ListScriptHandoffEvents` is the canonical query surface for these records. - A handler may therefore have zero, one, or many command-handoff records; a later version-fence drop on one command must not overwrite or summarize the handler audit row or the dispositions of sibling commands. ### Canonical `finalOutcome` Values (Normative) Use a single canonical outcome taxonomy across docs, protos, metrics, and dashboards. Aliases are not allowed in new writes. Taxonomy governance rule: - Keep `finalOutcome` intentionally small and stable; add a new canonical value only when operator behavior, routing, or alert semantics materially change. Use `finalReason` for finer-grained diagnosis. - Event-scope admission failures that occur after the event-scope claim but before handler resolution are recorded in the ingress response and `script_event_ingress_audit`, not in this handler-scoped taxonomy. In particular, pre-resolution unavailable pin state uses `TRIGGER_ADMISSION_OUTCOME_PIN_STATE_UNAVAILABLE` / `pin_state_unavailable`, a requested-versus-observed pin mismatch uses `TRIGGER_ADMISSION_OUTCOME_VERSION_UNAVAILABLE` / `pin_state_mismatch_requested_vs_observed`, a failed runtime reload uses `TRIGGER_ADMISSION_OUTCOME_VERSION_UNAVAILABLE` / `reload_failed` without `retryAfterMs`, signer-policy unavailability uses `TRIGGER_ADMISSION_OUTCOME_SIGNER_POLICY_UNAVAILABLE` / `signer_policy_unavailable`, and an active promotion or rollback pin convergence timeout uses `TRIGGER_ADMISSION_OUTCOME_VERSION_UNAVAILABLE` / `pin_convergence_timeout` with no `retryAfterMs`. This timeout is terminal only for the current workflow `convergenceAttemptGeneration`, not generic retryable backpressure; only explicit same-workflow recovery with the same `controlPlaneRequestId` allocates a new `convergenceAttemptGeneration`. Transport authentication/authorization and request/schema validation are earlier non-OK gRPC failures and do not create these admission records. After handler resolution, unavailable pin state and signer-policy unavailability remain handler-scoped with `finalStage=ADMISSION` and their corresponding `finalOutcome` values. For plugin final fencing, unavailable or unverifiable activation-epoch evidence uses the existing bounded `authority_unavailable` disposition (or `signer_policy_unavailable` when that policy source is unavailable), while a present-but-different epoch uses `plugin_activation_epoch_mismatch`; neither invents a new outcome family. | Canonical value | Stage | Notes | | --- | --- | --- | | `handoff_accepted` | `TICK_HANDOFF` | Every required child dispatch was durably accepted by Game Session; this is not gameplay application. | | `completed_no_commands` | `DSL_EVAL` | A valid live handler evaluated and intentionally emitted no commands. | | `dry_run_success` | `DRY_RUN_RESULT` *(isolated preview only; not a `script_event_audit` stage)* | Target ADR 0114 non-committing preview completed and returned would-be commands directly or retained them on its isolated result/audit surface for inspection; it is not a handler `script_event_audit` outcome. | | `skipped_reloading` | `ADMISSION` | Explicit reload backpressure. For a low-rate event denied before handler resolution, apply the [event-scope claim retry lifecycle](#event-scope-claim-and-retry-semantics-normative): only an explicitly retryable denial may be reclaimed after its bounded retry hint/window, using the same event-scope identity and `scriptEventId`; it must not fan out while denied. After handler resolution, a handler retry reuses that handler's full Trigger Identity and the same propagated `scriptEventId`. A timer/cadence candidate skip remains the Table 3 candidate-audit outcome and creates no event-scope firing claim or `scriptEventId`. | | `rollback_paused` | `ADMISSION` | Post-resolution handler rollback backpressure while control-plane rollback pause is active; a handler retry reuses its full Trigger Identity and the same propagated `scriptEventId`, if policy allows. For low-rate event ingress denied before handler resolution, apply the [event-scope claim retry lifecycle](#event-scope-claim-and-retry-semantics-normative) to the ingress pair `TRIGGER_ADMISSION_OUTCOME_BACKPRESSURE_ROLLBACK` / `rollback_pause`: reclaim the same claim/identity only within its bounded retry eligibility, with no fan-out while denied. Timer candidates use the Table 3 candidate-audit outcome, not this handler or ingress audit path. | | `quota_denied` | `ADMISSION` | Script quota or concurrency/capacity denial before DSL evaluation. | | `tenant_budget_exceeded` | `ADMISSION` | Tenant budget exhausted. | | `version_unavailable` | `ADMISSION` | Unknown/failed/not-ready patch or plugin version. | | `pin_state_unavailable` | `ADMISSION` | Handler-scoped admission fails closed after handler resolution when fresh instance pin state cannot be obtained. Pre-resolution pin-state failures remain event-scope ingress records. | | `signer_policy_unavailable` | `ADMISSION` | Plugin admission fails closed because signer policy cannot be refreshed/verified from authoritative policy sources. | | `plugin_component_blocked` | `ADMISSION` | Plugin rejected by component policy. | | `plugin_disabled` | `ADMISSION` | Plugin disabled or draining state. | | `script_disabled` | `ADMISSION` | Script disabled or draining due to operator action. | | `sandbox_error` | `DSL_EVAL` | Runtime or guard failure; reason required. | | `validation_error` | `DSL_EVAL` | Static/semantic validation failure before effect persistence. | | `canceled` | `ADMISSION`, `DSL_EVAL`, `WORK_ITEM_PERSIST`, or `TICK_HANDOFF` | A scheduler candidate or `PENDING_EVALUATION` trigger fenced before admission, a started `EXECUTING` `onLoad`/evaluation fenced before readiness or descriptor commit, or an already admitted execution intentionally fenced before producing live work or before handoff completed. Use bounded `finalReason` values such as `runtime_scope_changed`, `playable_state_scope_changed`, `rollback_epoch_advanced`, `stale_execution_fenced`, `superseded_by_newer_patch`, `operator_canceled`, or `operator_purged`. | | `infrastructure_error` | Any non-success stage | Transport/storage/runtime infrastructure failure. | | `disabled_due_to_errors` | `ADMISSION` | Script or plugin handler denied by failure-rate policy. Use bounded `finalReason=failure_rate_breaker`; for plugins, retain `breakerState=DISABLED_DUE_TO_ERRORS` and the exact immutable version/runtime scope as audit evidence without changing lifecycle `pluginState`. | Deprecated aliases: - `skipped_version_unavailable` is deprecated. Use `finalOutcome=version_unavailable` with `finalReason` for specificity. ### Required Cleanup Rule for Version Fencing If Game Session rejects a queued command because its embedded `(scriptPatchVersion, scriptPinEpoch)` does not match the currently pinned exact tuple, because work referencing a revocable component lacks matching fresh component-revocation security-policy evidence, or because a plugin-produced command's execution evidence `(pluginId, pluginVersionId, bindingId)` plus captured `(pluginActivationEpoch, lifecycleRevision)` does not match fresh current activation-epoch, binding, and lifecycle evidence together with authoritative publication, signer-policy, component-policy, and capability-grant evidence for its scoped instance, or because any required component-revocation, activation-epoch, binding, lifecycle, publication, signer-policy, component-policy, or capability-grant evidence is unavailable, stale, contradictory, or unverifiable, it must fail closed and: - Record the drop on the affected command-handoff record keyed by the complete Command-Handoff Identity: required source runtime identity (`tenantId`, `gameInstanceId`, `playableStateNamespaceId`, `regionId`, `regionEpoch`), the dispatch-group suffix (`automationDispatchId`, `commandOrdinal`), and the optional distinct target runtime identity (`targetGameInstanceId`, `targetPlayableStateNamespaceId`, `targetRegionId`, `targetRegionEpoch`) when applicable. Retain the server-derived source `playableStateScope` and, when applicable, `targetPlayableStateScope` as separately persisted exact-validated policy/routing/authorization/fence evidence, excluded from uniqueness; missing or mismatched scope evidence fails closed and requires authoritative reconciliation. `automationDispatchId` is retained as dispatch-group correlation and is not a standalone child key; parent `outboxWorkItemId`, the parent Trigger Identity, and `scriptEventId` remain correlation-only. Retain `scriptId` and the exact `(scriptPatchVersion, scriptPinEpoch)` tuple for diagnosis; retain `entityId` only for entity-scoped commands and keep it absent otherwise, plus the applicable component-revocation fence evidence and, for a plugin handler, `pluginId`, `pluginVersionId`, `bindingId`, and captured `(pluginActivationEpoch, lifecycleRevision)` as execution evidence, not Command-Handoff Identity. Use bounded `reason=plugin_binding_mismatch` only for a proven plugin/lifecycle binding mismatch; use `plugin_activation_epoch_mismatch`, `plugin_disabled`, `plugin_version_not_published`, `plugin_component_policy_blocked`, or `signer_revoked` for the applicable proven epoch, disabled/revoked, publication, component-policy, or signer failure, and `authority_unavailable`, `component_policy_unavailable`, or `signer_policy_unavailable` when the applicable evidence is unavailable or unverifiable. - For a proven tuple, binding, lifecycle, publication, policy, or component-revocation mismatch, remove the rejected queue entry or move it to a bounded dead-letter store so terminal failures cannot accumulate unboundedly after a rollback. When required component-revocation or other authority evidence is temporarily unavailable or unverifiable without proving a permanent mismatch, retain the entry retryable under its original complete Command-Handoff Identity, record the applicable established bounded disposition such as `component_policy_unavailable`, `authority_unavailable`, or `signer_policy_unavailable`, and create no recovery claim/attempt or replacement identity. Retry timing and reconciliation use the owning queue/handoff policy and its existing lease/fence checks; the bounded dead-letter `maxAge`/`maxRows`, cleanup cadence, and alert thresholds are defined in [Scripting Quotas & Operations](./system-architecture-scripting-quotas-and-operations.md#auditability--metrics). Once evidence proves a component is blocked/revoked or another permanent mismatch, terminalize it under the applicable bounded disposition. These dispositions are distinct and do not create a new outcome or validator family. - Apply the corresponding Table 4 version-fence metric consequence for script-patch, plugin-version/binding, or plugin-activation-epoch mismatches; Table 4 owns the exact family, labels, and increment unit. - Dead-letter retention for rejected queue entries must be bounded and explicit: - `maxAge` and `maxRows` must be documented per environment. - Cleanup cadence must be documented and alert-backed. - Breaching thresholds must emit operator-visible alerts. ### Terminal Descriptor Evidence Purge (Target-State) Purge may delete only retention-eligible evaluated descriptor/outbox/evaluated-output evidence whose parent trigger is `EVALUATED_COMMITTED`, after every child under that parent is terminal `HANDED_OFF`, `CANCELED`, or `DEAD_LETTERED` and every eligible evidence item is purged atomically. If any sibling is `PENDING`, `INDEXED`, `HANDOFF_IN_FLIGHT`, otherwise nonterminal, or not retention-eligible, the entire parent purge is rejected and no `descriptorEvidencePurgedAt` marker is written. The same successful purge transaction must persist an explicit durable `descriptorEvidencePurgedAt` marker on the retained parent. A marked parent is non-recoverable and non-replayable; consumers reject it deterministically rather than treating missing children as recoverable. It must preserve the `EVALUATED_COMMITTED` trigger marker, the corresponding `script_event_audit` record, and replay-causation claims or records; deleting terminal child evidence must never delete or reset the marker as a side effect. Purge rejects `PENDING_EVALUATION` and `EXECUTING` triggers, any nonterminal trigger, and descriptor statuses `PENDING`, `INDEXED`, or `HANDOFF_IN_FLIGHT`, including when those rows are associated with an `EVALUATED_COMMITTED` parent; these rejections write no parent marker. Purge is evidence cleanup only: it must not cancel, reclaim, dead-letter, replay, or re-enter the DSL. Separately, a terminal pre-DSL `DEAD_LETTERED` row with no committed descriptor may have only retention-eligible trigger/failure payload material purged after its recovery eligibility window has expired. No new schema marker is introduced for this path. The retained purge audit/idempotency outcome is the durable evidence of the purge and makes the row permanently non-recoverable; any later replay attempt is rejected deterministically with `rejectionReason=stage_evidence_unavailable`. Its immutable identity/digest, failure-stage, corresponding `script_event_audit`, recovery-causation evidence, and audit/idempotency outcomes remain retained under their owning retention contracts. ## Table 3: Timer Semantics Matrix Recurring and advisory timer-driven handlers (`onInterval`, or advisory uses of `onTimerExpire`) are best-effort and produce at most one event-scope durable firing/claim and one deterministic event-scope `scriptEventId` per due candidate. That firing fans out to zero or more durable parent work items, each with its own full Trigger Identity containing that same propagated `scriptEventId`; handler uniqueness comes from the other applicable full-identity fields. Clock unit, recovery class, due-point calculation, resume-window fencing, and downtime policy are owned by the [scheduler and timers contract](./system-architecture-scripting-scheduler-and-timers.md#script-timers-vs-tick-timers); this table retains the exact Trigger Identity and candidate-audit consequences. Before `EVALUATED_COMMITTED`, a failed physical evaluation attempt for a handler's durable parent work item may retry under that handler's full Trigger Identity only for a retryable infrastructure or fencing failure and must converge on the same parent and admitted child work; deterministic logical, validation, and sandbox outcomes are final. After the boundary, recovery replays that parent's durable descriptors without re-entering the DSL. Correctness-bearing one-shot timers are not best-effort: durable intent must be recorded outside Redis before acknowledgement and must converge under the same logical identity to one execution or an explicit terminal outcome. The matrix below defines what the scheduler does when a firing becomes due under different conditions: | Condition | Behavior | Audit requirements | | --- | --- | --- | | Correctness-bearing one-shot | Persist intent outside Redis before acknowledgement; recover under the same logical identity to one execution or an explicit terminal outcome, never silently dropping or duplicating the effect. | Durable intent, execution, and terminal outcome must remain operator-visible; retries reuse the same identity. | | Recurring/advisory normal operation | Apply cadence/reload/version/event-policy gates before binding; after those event gates pass, create at most one event-scope durable firing claim and one event-scope `scriptEventId` for the due candidate, resolve handlers, and let all pre-materialization handler-scoped gates apply independently. Fan out zero or more handlers admitted by those gates (including quota) into durable parent work items, each with its own full Trigger Identity containing that same propagated `scriptEventId`; handler uniqueness comes from the other applicable full-identity fields. The later execution scheduler considers that queued work in canonical order for the artifact-estimate prefix reservation. Before `EVALUATED_COMMITTED`, a failed physical evaluation attempt may retry under the affected parent work item's full Trigger Identity only for a retryable infrastructure or fencing failure and must converge on the same parent and child identities; deterministic logical, validation, and sandbox outcomes are final. After the boundary, recovery replays that parent's durable descriptors without re-entering the DSL. | An admitted firing receives one `script_event_audit` row per resolved handler-scoped Trigger Identity with stage-aware outcomes; any handler denied by a pre-materialization handler-scoped gate, including quota, retains its audit row but creates no work item, queue projection, lease, or execution marker. A tenant-budget denial after durable work-item claim but before the executor-acceptance boundary follows the dedicated handler budget path below. | | Recurring/advisory permanent/declared-skip cadence/reload/version/policy gate denied before binding | Skip the candidate; do not create a firing claim, handler Trigger Identity, or replay it later. | Record an event-scope candidate audit keyed by deterministic `scheduleCandidateId`, with `finalStage=ADMISSION` and the applicable bounded outcome/reason. | | Recurring/advisory transient retryable reload/reconciliation/authority fence before binding | Retain a durable due-candidate state/claim keyed by deterministic `scheduleCandidateId` and the canonical due point under its original exact tuple. For plugin-owned candidates, the captured `(pluginActivationEpoch, lifecycleRevision)` pair remains frozen. While fenced, create no firing claim, handler Trigger Identity, or `scriptEventId`; retry the same candidate only after the exact pin tuple, runtime scope, owner evidence, and captured lifecycle pair reconcile unchanged, then compare-and-set once into the one firing path or one immutable terminal candidate audit. A lifecycle revision that authoritative state proves displaced cannot use the same-epoch `DRAINING` predecessor exception: terminalize the candidate under its original `scheduleCandidateId` with `finalStage=ADMISSION`, `finalOutcome=canceled`, and bounded `finalReason=plugin_binding_mismatch`, creating no firing claim, handler Trigger Identity, or `scriptEventId`. Retain the candidate nonterminal only while lifecycle/authority evidence is unavailable or ambiguous; reconciliation never refreshes or rebinds captured evidence, and a fresh candidate is created only after target schedule reconciliation. Never rebind a displaced scope or epoch. | While fenced, the transient state has no `finalStage`, `finalOutcome`, or terminal candidate audit. Proven displacement settles as the one immutable terminal candidate audit described in the behavior column; otherwise settlement produces at most one immutable terminal candidate audit or the firing-path audit. This plugin-lifecycle-fenced terminal-candidate disposition is audit-only: it increments no Table 4 metric and emits no additional metric family or counter. It is distinct from runtime-scope/epoch timer-fence metrics and from execution-time plugin command-drop metrics, which apply only to their own later dispositions. | | Recurring/advisory live handler quota/capacity gate denied before work-item materialization | Keep the one event-scope firing claim for the due candidate; deny only the affected resolved live handler before durable work-item creation. Do not create that handler's work item, capacity lease, or execution marker, and do not replay the denied handler automatically. | Record the handler-scoped full Trigger Identity in `script_event_audit` with `finalStage=ADMISSION`, `finalOutcome=quota_denied`, and the applicable bounded reason. | | Recurring/advisory live-only `ScriptTenantBudgetService` denied after executor claim (durable work-item claim; before executor acceptance) | The durable live handler work item exists and may have a durable evaluation claim, but the executor-acceptance boundary has not committed. Terminally cancel that work item before DSL evaluation; acquire no fenced execution-capacity lease, persist no `executionStarted`/`EXECUTING` marker, record no execution-start charge, create no child work, and do not replay the denied handler automatically. | Record the handler-scoped full Trigger Identity in `script_event_audit` with `finalStage=ADMISSION`, `finalOutcome=tenant_budget_exceeded`, and `finalReason=tenant_budget_exceeded`. Per Table 4, increment `automation_script_triggers_total` once for the handler and `automation_script_tenant_budget_denied_total` once; never increment `automation_script_skips_total`. This row is live-only (`isDryRun=false`). | | Recurring/advisory materialized dry-run/test capacity denied | Skip both live quota services, and reserve isolated handler capacity through `ScriptDryRunCapacityService` after the handler has been materialized. A denial ends that dry-run/test attempt before DSL evaluation without invoking `ScriptTenantBudgetService`; it is not the event-level catch-up candidate ceiling route. | Record the handler-scoped outcome with `finalStage=ADMISSION`, `finalOutcome=quota_denied`, and `finalReason=dry_run_capacity_exhausted`. Increment `automation_script_test_runs_total` once with the bounded `result=quota_denied` and `automation_script_test_capacity_denied_total` once with its bounded tenant/cluster scope; emit no live budget, trigger, skip, or catch-up candidate metric. | | Recurring/advisory `reloadState=RELOADING` | Do not admit new timer firings or backfill while `RELOADING`; use the transient due-candidate lifecycle above and retry only after the exact pin tuple, runtime scope, and owner evidence reconcile. | Keep the due-candidate state/claim fenced and nonterminal: no `finalStage`, `finalOutcome`, terminal candidate audit, firing claim, handler Trigger Identity, or `scriptEventId` while fenced; settle once under the original exact tuple as above. | | Recurring/advisory `reloadState=FAILED` | Fail closed until durable recovery reconciles the current pin, schedule, scope/epoch, and due evidence and returns the scope to `IDLE`; do not backfill from the prior patch. | Record the non-admitted due candidate under deterministic `scheduleCandidateId` with `finalStage=ADMISSION`, `finalOutcome=version_unavailable`, and `finalReason=reload_failed`; do not create a firing claim, handler Trigger Identity, or `scriptEventId`. | | Recurring/advisory `PAUSED_FOR_ROLLBACK` | Do not admit new timer firings until the exact pin/artifact, schedule rows, due candidates, displaced/firing projections, and current list/read projections reconcile; only terminal old-execution evidence cleanup remains asynchronous/diagnostic and does not gate resumption. This Automation admission barrier does not pause ordinary gameplay ticks. While the original exact tuple remains current, retain the due candidate and its canonical due point as nonterminal state; if rollback displaces that tuple, keep the old candidate fenced under its original identity and derive any fresh candidate only from reconciled target schedule/due state. Follow the owner-defined [scheduler and timers transition rules](./system-architecture-scripting-scheduler-and-timers.md#explicit-continuity-across-script-transitions) for due-point advancement and replacement. | While the original tuple remains current, retain the deterministic `scheduleCandidateId` with no `finalStage`, `finalOutcome`, terminal candidate audit, firing claim, handler Trigger Identity, or `scriptEventId`; retry the same candidate only after exact evidence reconciles. When rollback displaces it, terminalize the old candidate under its original identity as `finalStage=ADMISSION`, `finalOutcome=canceled`, `finalReason=rollback_epoch_advanced` when required, and create any target candidate with a fresh deterministic identity only after reconciliation. | | Recurring/durable-recurring leader failover or short downtime | Apply each complete stable schedule-instance identity's declared `SKIP_MISSED` or `COALESCE_ONE` policy. A coalescing schedule instance may admit at most one synthetic firing in the one Automation-owned durable timer-recovery resume window identified by ``; the server-derived `playableStateScope` is retained as immutable exact-validated policy/routing/authorization/migration-fence evidence for that window and is excluded from its identity, with missing or mismatched evidence fencing admission. At creation, that durable window freezes the effective numeric `SCRIPT_TIMER_CATCH_UP_MAX_FIRINGS_PER_RESUME` cap and the selection-policy revision defining grouping, ordering, round-robin passes, and tie breaks. Those frozen values govern every scan, retry, takeover, selection, and cap-excluded outcome until the window reaches `COMPLETE`; a later configuration or policy change applies only to a later window. The deterministic fair tenant-local cap applies across independent schedule instances within that one-tenant, one-mode `resumeWindowId`, grouped by the stable schedule-instance identity defined in the scheduler lifecycle (including target `playableStateNamespaceId` identity and dry-run mode; target scope remains evidence), not by `scheduleDefinitionId` alone. `pluginVersionId` and `bindingId` remain due-candidate provenance, fencing, and deduplication dimensions and do not split stable fairness groups. Durable compare-and-set creates or reuses one `OPEN` window per namespace/runtime identity, epoch, and `isDryRun` mode; same-window retries and takeovers revalidate and reuse that namespace identity, exact scope evidence, and frozen policy inputs. Excluded candidates are dropped and never deferred as backlog. A candidate selected within that cap still enters ADR 0166 tenant-first shared scheduler/cluster admission. Tenant or cluster capacity denial terminally skips that candidate under the same due-candidate and mode-specific `resumeWindowId` identity, consumes its deterministic selection slot, creates no firing claim, handler Trigger Identity, or `scriptEventId`, and is not retried, deferred, backfilled, or reminted as catch-up. Atomically persist that terminal candidate audit, advance the recurring schedule's canonical due state to its next ordinary future occurrence, and record the resume-window denial outcome; a resumable idempotent reconciliation keyed by `(scheduleCandidateId, resumeWindowId)` is required when one transaction is unavailable, and an incomplete settlement remains fenced. | Catch-up firings use `triggerMode=CATCH_UP` and deterministic identity from the coalesced due point and mode-specific `resumeWindowId`. The firing-claim uniqueness/comparison, candidate audit, and tenant-local-cap accounting all include `playableStateNamespaceId`, `isDryRun`, and `resumeWindowId`; same-window retries and takeovers reuse them while revalidating the separately persisted exact scope evidence. An epoch transition moves each prior epoch's `OPEN` window out of `OPEN` independently for each mode before creating the corresponding new-epoch window. The window completes only after selected candidates' firing or shared-admission-denial outcomes and all cap-excluded outcomes are durable, and only a later recovery episode allocates the next `resumeGeneration`. For `isDryRun=false`, a tenant-ceiling denial records candidate-audit `finalStage=ADMISSION`, `finalOutcome=tenant_budget_exceeded`, and `finalReason=tenant_budget_exceeded`, then increments `automation_script_skips_total` once with `scope="tenant"` and `reason="tenant_budget_exceeded"`; this candidate-level route does not invoke `ScriptTenantBudgetService` or increment `automation_script_tenant_budget_denied_total`. A cluster-ceiling denial records candidate-audit `finalStage=ADMISSION`, `finalOutcome=quota_denied`, and `finalReason=cluster_limit_reached`, then increments `automation_script_skips_total` once with `scope="cluster"` and `reason="cluster_limit_reached"`. Both live metrics use the remaining bounded Table 4 labels. For `isDryRun=true`, neither live-only family is emitted: no dedicated test-only candidate-ceiling metric is currently defined, so the settled candidate audit and mode-specific resume-window outcome are the complete observability surface; the handler-scoped test families are not used because the denial occurs before handler materialization. Neither denial increments `automation_script_timer_catchup_truncated_total`; cap-excluded candidates use that truncation family instead. | | Recurring/advisory runtime scope / epoch change before due-point admission | Do not remint stale due points under the newer `(tenantId, gameInstanceId, playableStateNamespaceId, regionId, regionEpoch)` identity timeline. The server-derived `playableStateScope` is separately persisted exact-validated policy/routing/authorization/migration-fence evidence and is immutable for a namespace during one playable-state lifecycle. A presented `playableStateScope` mismatch remains a schedule/runtime migration fence even when the identity fields are unchanged: fence admission and require authoritative reconciliation of the scope evidence. Only when authority proves the scope itself is unchanged and the presented evidence was stale or incorrect may the existing namespace-keyed schedule advance to its next valid due point; if authority proves a scope-policy transition, it must start a new playable-state lifecycle and select or allocate a new namespace under the existing retire/create ordering, never reuse the old identity. | For stale or incorrect presented scope evidence, or unavailable or ambiguous authority, keep the candidate fenced and nonterminal with no final audit (`finalStage`, `finalOutcome`, or `finalReason`) and no runtime-fence metric; retry only after authoritative reconciliation. When authority confirms the scope is unchanged, reuse the namespace-keyed identity and advance the due point without recording a scope-change cancellation or metric. Only an authority-proven runtime epoch change, scope-policy transition, or other displacement records the dropped candidate at event scope under deterministic `scheduleCandidateId` with `finalStage=ADMISSION`, `finalOutcome=canceled`, and `finalReason=runtime_scope_changed` (or `playable_state_scope_changed` for that specific fence), and emits the runtime-fence metric. Because actual displacement did not admit the candidate, do not create a firing claim, handler Trigger Identity, or `scriptEventId`. | | Correctness-bearing one-shot runtime scope / epoch change | Keep the durable intent and any effect under the original identity and fence it from ordinary execution on the new timeline. Reconcile it under authority-fenced owner evidence; a presented `playableStateScope` mismatch remains separately validated fence evidence and does not by itself mint a new identity, while an authority-proven scope-policy transition starts a new playable-state lifecycle/namespace and is never silently rebound into the old intent. Only after the original intent/effect and source claim conclusively permit `ABANDONED` may an authorized recovery create a fresh current-namespace identity with revalidation and durable lineage under [ADR 0067](./decisions/adr-0067-abandon-old-epoch-work-and-reschedule-with-new-lineage.md). | Retain the original identity, old namespace/scope/epoch, reconciliation evidence, terminal outcome when proven, and any fresh lineage link. Inconclusive old work remains nonterminal and blocks affected-scope reopen rather than being reported as skipped or silently replaced. | | Recurring/advisory timer preserved across reload/rollback | Apply the owner-defined resume rule only when its runtime-region, playable-state namespace, exact scope evidence, and epoch preconditions match; otherwise fence the old due point and derive a new due point after the replacement schedule entry is durable. A presented scope mismatch requires reconciliation and fences stale work; only unchanged authoritative scope permits reuse of the namespace-keyed Trigger Identity. An authority-proven scope-policy transition starts a new playable-state lifecycle/namespace and follows the existing replacement ordering. Do not reuse a stale due point or Trigger Identity. | Preserve the dropped old due-point evidence and the exact identity; see [Timer Resume Rule](./system-architecture-scripting-scheduler-and-timers.md#timer-resume-rule-normative). | | Recurring/advisory long downtime or sustained overload | No guarantee of eventual execution for every firing; the system converges by running future firings once capacity returns. | Missed firings must be visible as skips/drops in metrics and audit. | | Infrastructure error after admission | Before `EVALUATED_COMMITTED`, an admitted evaluation may retry only under the same full Trigger Identity and must converge on the same parent work item, full Trigger Identity, and frozen inputs; no dispatch or child identity exists before the winning evaluated-descriptor/outbox commit. After `EVALUATED_COMMITTED`, recovery replays the durable descriptors and never re-enters the DSL. Correctness-bearing one-shot recovery must converge under its durable intent identity to one execution or an explicit terminal outcome. Downstream retries remain idempotent. | Preserve the `finalStage` reached by the failed or committed operation; do not record `handoff_accepted` without full durable acceptance of every required child. | ### Preserved-Timer Resume Rule The exact resume formula, modulo-zero boundary behavior, and runtime scope/epoch preconditions are owned by [Scripting Scheduler and Timer Lifecycle](./system-architecture-scripting-scheduler-and-timers.md#timer-resume-rule-normative). This table records the resulting candidate-audit and identity requirements only: a preserved timer uses the original `playableStateNamespaceId`/runtime identity when those preconditions and unchanged authoritative scope evidence hold; a presented stale or incorrect scope fences admission until reconciliation, while an authority-proven scope-policy transition starts a new playable-state lifecycle/namespace, fences the old due point, and never reuses its Trigger Identity. ### Version-Owned Durable Schedule Migration (Normative) - `scheduleDefinitionId` participates in the stable logical continuity key but is not the durable row or trigger-claim identity. For a playable-state-scoped schedule, the continuity key is `{stableOwnerKind, stableOwnerId, scheduleDefinitionId, playableStateNamespaceId, targetScopeType, targetScopeId}`; `playableStateScope` is separately persisted exact-validated policy/routing/authorization/migration-fence evidence and is not a continuity-key component. `pluginId` is the stable plugin owner while `pluginVersionId`, `scriptPatchVersion`, and `scriptPinEpoch` remain provenance and exact execution-fence metadata. - By default, a version transition tombstones the displaced interval and creates a target interval with fresh due state when a validated target definition exists. When authoritative reconciliation proves the target definition is absent, reconciliation follows the [scheduler owner rule](./system-architecture-scripting-scheduler-and-timers.md#explicit-continuity-across-script-transitions): it fences admission and atomically tombstones the displaced interval, terminalizes any proven-displaced candidates under their original identities as applicable, creates no replacement row, due state, firing claim, or `scriptEventId`, and never rebinds existing candidates or claims. If target-definition or other required authority is unavailable, contradictory, or ambiguous, reconciliation must not tombstone or create replacement state; it retains the displaced row, candidates, and claims fenced and nonterminal until authority reconciles. Only a later validated target reconciliation may create fresh state and identities. Carrying due state requires explicit compatible continuity declarations on both sides, `source.isDryRun == target.isDryRun`, typed interval/cadence/target/playable-scope checks, and the exact pin/epoch transition identity. A same-version repin is still a new epoch transition: the transition must atomically or resumably reconcile the stable row and retire or rewrite all displaced mutable schedule state, due candidates, and current list/read projections before admission resumes. Old-epoch firing claims retain their original exact `(scriptPatchVersion, scriptPinEpoch)` and `resumeWindowId`, and only pending claims may be fenced or terminal-marked; claims already in handoff reconcile the downstream outcome under their original exact fence. Neither pending-claim fencing/terminalization nor in-handoff reconciliation creates a new firing claim, handler identity, or `scriptEventId`. Immutable candidate-audit identity, outcome, exact tuple, and `resumeWindowId` are never rewritten. A transient due-candidate state/claim keyed by `scheduleCandidateId` may remain fenced while reconciliation is pending. It may settle into the one firing path only while its original exact `(scriptPatchVersion, scriptPinEpoch)` tuple and every applicable authoritative binding, runtime-scope, owner, and plugin lifecycle fence (including the captured `(pluginActivationEpoch, lifecycleRevision)` pair when applicable) remain current, or into one immutable terminal candidate audit. If authoritative evidence proves any applicable fence displaced, terminalize the candidate under its original identity with the applicable bounded terminal outcome/reason and create no firing claim or `scriptEventId`; if authority is unavailable, contradictory, or ambiguous, retain the fenced candidate as nonterminal until reconciled. It is never rebound to a new scope or epoch. `scheduleSemanticsHash` is diagnostic evidence only; equality cannot grant continuity. Replacement creation and retirement are one atomic durable result or a resumable, idempotent operation keyed by `controlPlaneRequestId`. - The preceding playable-scope checks validate separately persisted server-derived policy/routing/authorization/fence evidence; they do not add `playableStateScope` to continuity, candidate, or Trigger Identity. A presented scope mismatch remains fenced until authoritative reconciliation; only unchanged authoritative scope permits the existing namespace-keyed identity, while an authority-proven scope-policy transition starts a new playable-state lifecycle and namespace. - A new version/namespace-owned entry, or a target entry created after a namespace transition, must derive a new scheduler trigger claim and `scriptEventId`; a matching `scheduleDefinitionId`, due point, handler, or old `playableStateNamespaceId` must never be used to reuse a Trigger Identity across the migration. A presented `playableStateScope` mismatch remains an admission/migration fence requiring authoritative reconciliation and exact evidence validation; an authority-proven transition must allocate the new namespace before fresh identity, and no path may silently reuse the old identity while fenced. For plugin-owned migration evidence, displaced rows, due candidates, firing claims, and candidate audits retain and revalidate the captured `(pluginActivationEpoch, lifecycleRevision)` pair alongside the exact script pin. `pluginActivationEpoch` participates in due-candidate, firing-claim, and derived `scriptEventId` identity as specified above; `lifecycleRevision` is execution-fence evidence only and is not added to the stable schedule, continuity, Trigger, or Command-Handoff identity. ## Table 4: Metrics Label Matrix This table is the sole exact owner of the scripting metric-family catalog, label sets, and increment units. The observability contract links here for behavior and local consequences; it must not redefine metric schemas. General rules: - `scriptEventId` is forbidden as a metric label. - Raw `tenantId`, `gameInstanceId`, `regionId`, `scriptId`, `pluginId`, `pluginVersionId`, `bindingId`, `automationDispatchId`, and other exact runtime identities are forbidden ordinary Prometheus labels. - Creator-, plugin-, or producer-defined strings are not bounded merely because they have a descriptive label name. Metrics use only enforced finite platform enums; unknown or retired values collapse to `other` or `unknown`. Bounded semantic labels use the existing scripting vocabulary and are validated before a sample is emitted: - `service` is required on every application metric family and is the bounded runtime identity of the service that emits that family, derived from its `spring.application.name`, never from request, tenant, plugin, or producer input. Automation-owned families use `automation-scripting-service`; the Game Session-owned `automation_pin_convergence_timeout_total` family uses `game-session-service`. - `scope` is the controlled operational traffic enum `region`, `game_instance`, `tenant`, or `cluster`; a metric family may restrict which of these values it accepts. Capacity metrics use only their documented subset, such as `tenant` or `cluster`. - `script_kind` is exactly one of the platform-owned values `SCRIPT`, `PLUGIN`, or `unknown`. The [scripting DSL lifecycle owner](./system-architecture-scripting-dsl-reference-and-lifecycle.md#event-fan-out-and-handler-ordering) maps a resolved core handler to `SCRIPT` and a resolved linked-plugin handler to `PLUGIN`; pre-handler and unavailable handler resolution use `unknown`. No script type, package name, or authored handler string may become a metric value. - `priority`/`tier` use the exact bounded runtime vocabulary `high`, `normal`, `background`, or `unknown`. For a rejected pre-handler increment, `priority` must come from a bounded request/event-scope value; when absent, invalid, or untrusted, use `unknown` rather than infer priority from a handler that was never materialized. `unknown` is the only permitted fallback and must not be replaced by a creator- or producer-defined value. - `event_class` is exactly one of the platform-owned values `command`, `spawn`, `enter_region`, `leave_region`, `interval`, `timer_expire`, `load`, `service`, `other`, or `unknown`. The [canonical event registry](./system-architecture-scripting-event-registry.md#registry-entry-contract) owns the mapping: `onCommand`, `onSpawn`, `onEnterRegion`, `onLeaveRegion`, `onInterval`, `onTimerExpire`, and `onLoad` map respectively to `command`, `spawn`, `enter_region`, `leave_region`, `interval`, `timer_expire`, and `load`; an accepted custom/service-specific registry entry maps to `service`; an accepted entry without a current class mapping maps to `other`; and a missing, malformed, unauthorized, unrecognized, deprecated, or unavailable entry maps to `unknown`. This metric projection never replaces Trigger Identity or audit `eventType`, and raw event content remains only in audit, log, and trace records. Event-scope `outcome`/`reason` values use bounded `admissionOutcome`/`admissionReason` codes; handler-scoped values use bounded `finalOutcome`/`finalReason` codes; `stage`/`finalStage` use the Table 2 stage set. An event-scope metric must not copy handler outcome or reason values. - `result` uses the bounded dry-run/test result taxonomy derived from Table 2 outcomes, including `dry_run_success` and the applicable classified non-success outcomes; it is never a free-form test result or raw exception. For the current legacy materialized dry-run handler only, `finalOutcome=dry_run_completed` with `executionSurface=LEGACY_TRIGGER_DRY_RUN` maps to metric `result=dry_run_success`; target ADR 0114 previews may use the same metric `result` label but use `finalOutcome=dry_run_success` on `DRY_RUN_RESULT`, so the metric cannot be used to infer the audit outcome or execution surface. For every classified non-success Table 2 outcome, metric `result` uses that same canonical outcome value (`quota_denied`, `sandbox_error`, `validation_error`, `infrastructure_error`, `canceled`, or another listed bounded outcome); `finalReason` remains diagnostic and never becomes a result value. - `reason` is the bounded admission, final-outcome, or command-handoff reason taxonomy owned by the relevant contract. `operation` uses the bounded operation vocabulary of its owning control-plane workflow. `component_class` uses the finite component-policy registry. None of these labels may carry a free-form request reason or raw identifier. - `source_class` is exactly one of the closed platform-owned producer classes `gameplay`, `scheduler`, `readiness`, `service`, `other`, or `unknown`; `service` means a registry-approved custom/service-specific event family and never a service name. Normalize the known event-registry producer categories deterministically: `onCommand`, `onSpawn`, `onEnterRegion`, and `onLeaveRegion` map to `gameplay`; `onInterval` and `onTimerExpire` map to `scheduler`; tenant-readiness `onLoad` maps to `readiness`; an authorized custom/service-specific producer category maps to `service`; an accepted registry event with no current class mapping maps to `other`; and an absent, malformed, unauthorized, or unrecognized category maps to `unknown`. For `automation_script_work_item_outcomes_total`, derive the class from the sealed event-registry category in the immutable trigger/work manifest. Retries, catch-up, remote follow-ups, and handler execution `sourceKind` preserve that class and must not create or override a class. The full canonical producer identity, including a custom-event `sourceService`, is preserved separately in event-scope and handler audit, log, and trace records; it is never widened into a metric label. - `plugin_origin` is exactly one of the platform-owned provenance classes `embedded`, `signed_external`, `platform_attested_external`, `other`, or `unknown`. The [plugin trust/provenance owner](./decisions/adr-0111-unified-dsl-with-distinct-embedded-script-and-plugin-lifecycles.md) maps game-owned embedded handlers to `embedded`, an accepted bundle with the required allowlisted signature evidence to `signed_external`, and an accepted unsigned bundle only after ADR 0111's exact-digest, scoped-approval, and platform-attestation path to `platform_attested_external`; any accepted provenance channel not in this set maps to `other`, while missing, unavailable, retired, or contradictory evidence maps to `unknown`. This classification is not a trust grant or raw marketplace/publisher/plugin identity; exact provenance remains in the command disposition, audit, log, or protected trace record. - `admitted_no_handlers` is a bounded metric-only outcome owned by `automation_script_triggers_total`. It is emitted only when an admitted live non-readiness event resolves zero handlers, with `script_kind="unknown"` and `plugin_origin="unknown"`; tenant-readiness `onLoad` is explicitly excluded and follows its manifest-proven `READY` or `zero_handler_manifest_unverifiable` readiness outcome instead. The target rule excludes this value from ingress responses and all Automation audit fields, including `script_event_ingress_audit` and `script_event_audit` admission and final outcome/reason fields. Current ingress still persists `admissionReason=admitted_no_handlers` in `script_event_ingress_audit`; that is documented implementation drift, not target semantics. - Every required label must be present and belong to its closed vocabulary. Normalize an invalid, missing, custom, or retired value to the documented bounded `unknown` or `other` value where that label permits it; otherwise suppress the metric sample rather than emitting an unbounded value. Retain the full source value only in the applicable audit/log/operational record. Metric hygiene does not create a new business admission outcome or validator family. - `isDryRun` is an execution-mode predicate, not a metric label. Live trigger, quota, work-item, sandbox, error, runtime, and tick-handoff families are emitted only for `isDryRun=false`. Dry-run/test handler executions use `automation_script_test_runs_total`, `automation_script_test_sandbox_failures_total`, and `automation_script_test_runtime_seconds` as applicable; `automation_script_test_capacity_denied_total` records isolated dry-run capacity denials. Pre-handler dry-run ingress and catch-up candidate denials use their applicable ingress/candidate audit surface; no live metric family is emitted, and no test-only metric is emitted unless the denial reaches the handler-scoped materialized capacity boundary defined below. Tenant-readiness `onLoad` is a separate readiness-owner lifecycle and is not the generic live trigger metric path. The readiness record uses status `READY` with readiness-level outcome `readiness_success` after successful non-empty evaluation, or manifest-proven zero-handler `READY` with a pinned manifest reference/digest and zero declared and terminal handler counts; a zero-handler notification without that proof is terminal `FAILED` with bounded `statusReason=zero_handler_manifest_unverifiable`. `readiness_success` is not a handler `finalOutcome`, and readiness outcomes never become `admitted_no_handlers`. The current fallback remains projection status `READY`, `ONLOAD_RUNNING`, or `FAILED` (with `ROLLED_BACK`/`SUPERSEDED` as applicable) plus `statusReason`; current notifications do not emit readiness-success/proof fields, an empty `affectedScripts` creates no readiness, and the integer no-scripts path may report `READY`/`no_scripts_in_patch` without proof. See the [scripting observability contract](./system-architecture-scripting-observability-contract.md#implementation-status) for the current boundary. | Metric family | Required labels | Forbidden labels | Notes | | --- | --- | --- | --- | | `automation_script_triggers_total` | `service`, `scope`, `script_kind`, `event_class`, `outcome`, `plugin_origin`, `priority` | exact or authored identifiers | Requires `isDryRun=false`. After resolution, increment exactly once for each resolved live handler using its applicable `finalOutcome`, with no additional admitted-event increment. A `ScriptTenantBudgetService` denial after durable work-item claim but before executor acceptance terminally cancels that work item before DSL evaluation; it is handler-level, so increment this family once for the affected handler with `finalOutcome=tenant_budget_exceeded` and also increment `automation_script_tenant_budget_denied_total` once with its bounded `scope`/`tier`; it records no execution-start marker or charge and never increments `automation_script_skips_total`. If an admitted live event resolves zero handlers, increment once at event scope with the metric-only `outcome="admitted_no_handlers"`; do not return or persist that value in ingress or audit fields. The current ingress validator may still persist `admissionReason=admitted_no_handlers` in `script_event_ingress_audit`; treat that as current drift and not as the target metric or audit contract. | | `automation_script_triggers_dropped_total` | `service`, `scope`, `script_kind`, `reason`, `plugin_origin`, `priority` | exact or authored identifiers | Requires `isDryRun=false`. Increment exactly once for each incoming trigger request that has passed transport authentication/authorization and request/schema validation, acquired or resumed its event-scope claim, and is then rejected by a typed event-scope/domain admission decision before handler resolution, alongside its event-scope `script_event_ingress_audit` record, using only bounded pre-handler admission reasons and dimensions. Transport/pre-domain failures that cannot produce an admission decision do not increment this family. This family remains defined for genuine ingress rejection; a live catch-up candidate denied by a cluster ceiling after candidate audit, due-state advance, and resume-window settlement increments `automation_script_skips_total{scope="cluster",reason="cluster_limit_reached"}` instead and never this family. | | `automation_script_skips_total` | `service`, `scope`, `script_kind`, `reason`, `plugin_origin`, `priority` | exact or authored identifiers | Requires `isDryRun=false`. “Skip” is limited to pre-handler and catch-up candidate-level decisions. A catch-up candidate selected within its resume-window cap but terminally denied by the shared tenant ceiling increments this family exactly once with `scope="tenant"` and `reason="tenant_budget_exceeded"`; a candidate denied by the cluster ceiling increments it once with `scope="cluster"` and `reason="cluster_limit_reached"`. Both increments occur only after candidate audit, canonical due-state advance, and resume-window outcome are durably settled. These candidate-level ceiling skips do not invoke `ScriptTenantBudgetService` or increment `automation_script_tenant_budget_denied_total`; handler-level denials after durable work-item claim use `automation_script_triggers_total` plus that tenant-budget decision family and never this skip family. | | `automation_script_work_item_outcomes_total` | `service`, `stage`, `outcome`, `priority`, `source_class` | exact or authored identifiers | Requires `isDryRun=false`. Increments exactly once for each terminal durable live work-item execution outcome using the `script_event_audit` stage/outcome vocabulary. Dry-run/test executions never increment this family; use `automation_script_test_runs_total` instead. | | `automation_script_work_item_canceled_total` | `service`, `scope`, `operation`, `finalStage`, `reason` | exact or authored identifiers | Increment once per durable work item or evaluated descriptor transitioned to `CANCELED` by an ordinary or control-plane cancellation, including rollback cancellation before execution. It does not count a purge that leaves status unchanged or an execution fence counted by `automation_rollback_drain_canceled_total`. | | `automation_script_work_item_purged_total` | `service`, `scope`, `operation`, `reason` | exact or authored identifiers | Increment once per terminal evaluated descriptor/outbox evidence item actually deleted by a successful purge. Retention/nonterminal rejection and ordinary cancellation do not increment this family; raw references remain in audit/log/trace records. | | `automation_retention_blocked_rows` | `service` | exact or authored identifiers | Current gauge of terminal work-item rows blocked by retention evidence across `HANDED_OFF`, `CANCELED`, and `DEAD_LETTERED` cleanup classes; measured in rows and never as a cumulative deletion count. | | `automation_retention_dead_letter_blocked_rows` | `service` | exact or authored identifiers | Current gauge of `DEAD_LETTERED` rows whose recovery-aware evidence blocks retention cleanup; measured in rows and never as a cumulative deletion count. | | `script_quota_allowed_total` | `service`, `scope`, `script_kind` | exact or authored identifiers | Quota decisions are pre-evaluation. | | `script_quota_denied_total` | `service`, `scope`, `script_kind`, `reason` | exact or authored identifiers | Counts per-script quota decisions only; handler-scoped dry-run capacity denials do not increment this family. | | `automation_script_tenant_budget_allowed_total` | `service`, `scope`, `tier` | exact or authored identifiers | Counts allowed live execution budget reservation decisions by bounded runtime budget tier. | | `automation_script_tenant_budget_denied_total` | `service`, `scope`, `tier` | exact or authored identifiers | Counts denied live `ScriptTenantBudgetService` execution-budget reservation decisions by bounded runtime budget tier. Each handler denial after durable work-item claim but before executor acceptance increments this family exactly once alongside its one `automation_script_triggers_total` handler outcome. Catch-up candidate-level tenant-ceiling skips are settled before handler claim/reservation and do not increment this family. | | `automation_tick_events_enqueued_total` | `service`, `scope` | exact or authored identifiers | Counts successful tick handoffs, not DSL evaluations. | | `automation_tick_version_fence_dropped_total` | `service`, `scope`, `script_kind`, `reason` | exact or authored identifiers | Counts commands dropped at execution time because the embedded `(scriptPatchVersion, scriptPinEpoch)` does not match Game Session's exact current tuple. | | `automation_tick_plugin_version_fence_dropped_total` | `service`, `scope`, `plugin_origin`, `reason` | exact or authored identifiers | Counts only commands terminally removed or dead-lettered at execution time due to plugin version, binding, lifecycle/policy, or captured activation-epoch fence failures, including `reason=plugin_activation_epoch_mismatch` when current epoch evidence is present and differs. A retryable `reason=authority_unavailable` disposition is retained in the command disposition/audit/log record and diagnostics but does not increment this terminal-drop family; if later evidence proves a permanent mismatch and the command is terminally removed or dead-lettered, increment once with the applicable terminal reason. Raw plugin and version identity remains in the command disposition/audit/log record and never becomes a metric label. | | `automation_script_queue_delay_seconds` | `service`, `scope`, `script_kind`, `priority` | exact or authored identifiers | Observes queue delay for sampled queued or processed live automation work by the bounded priority class, including work still waiting long enough to expose sustained deferral. This is the canonical priority-starvation signal; raw queue, tenant, and script identifiers are not labels. | | `automation_queue_orphaned_entries_total` | `service`, `scope` | exact or authored identifiers | Counts queue entries detected beyond the bounded age window without corresponding durable-executor progress or tick-effect-ledger entries. | | `automation_queue_oldest_entry_age_seconds` | `service`, `scope` | exact or authored identifiers | Records the age of the oldest sampled queue entry per bounded scope; tenant/script diagnosis remains in operational records. | | `automation_script_leadership_changes_total` | `service` | exact or authored identifiers | Counts automation scheduler leadership changes. | | `automation_script_runtime_seconds` | `service`, `scope`, `script_kind`, `event_class`, `plugin_origin` | exact or authored identifiers | Requires `isDryRun=false`. Runtime is live sandbox evaluation time (not tick execution time); dry-run/test runtime uses `automation_script_test_runtime_seconds`. | | `automation_script_sandbox_failures_total` | `service`, `scope`, `script_kind`, `reason`, `plugin_origin` | exact or authored identifiers | Requires `isDryRun=false`. Counts live sandbox failures; dry-run/test sandbox failures use `automation_script_test_sandbox_failures_total`. | | `automation_script_errors_total` | `service`, `scope`, `script_kind`, `reason`, `plugin_origin` | exact or authored identifiers | Requires `isDryRun=false`. Counts higher-level classified live script errors, including downstream failures; dry-run/test execution results use `automation_script_test_runs_total` and never increment this family. | | `automation_script_output_budget_exceeded_total` | `service`, `scope`, `script_kind`, `reason`, `plugin_origin` | exact or authored identifiers | Requires `isDryRun=false` and is emitted only for live handler runs rejected because emitted work exceeded a bounded output ceiling. Current legacy materialized dry-run/test failures and target ADR 0114 preview failures use `automation_script_test_runs_total` with the bounded test result and their applicable handler or isolated preview result/audit surface; they never increment this live family. | | `automation_script_test_runs_total` | `service`, `scope`, `script_kind`, `event_class`, `result`, `plugin_origin` | exact or authored identifiers | Dry-run/test counterpart for live work-item outcomes and classified execution results. Increment exactly once per materialized handler-scoped dry-run/test execution attempt or target ADR 0114 isolated command-plan preview operation, including a `ScriptDryRunCapacityService` denial with bounded `result=quota_denied` or another execution failure. A target preview may return or retain its isolated result without a handler `script_event_audit` row, but uses only these bounded test labels and never increments live-traffic families. Event-scope ingress denials use the event-scope ingress audit and drop consequence above; dry-run catch-up candidate denials use only the durable candidate audit/settlement surface and emit no metric family, including this one. Neither kind of pre-handler denial increments this family; completion must not increment it again. Keep it separate from live-traffic counters. | | `automation_script_test_runtime_seconds` | `service`, `scope`, `script_kind`, `event_class`, `plugin_origin` | exact or authored identifiers | Dry-run/test runtime latency; must remain separate from live runtime histograms. | | `automation_script_test_sandbox_failures_total` | `service`, `scope`, `script_kind`, `event_class`, `reason`, `plugin_origin` | exact or authored identifiers | Dry-run/test-only sandbox failures; must not increment live sandbox failure counters. | | `automation_script_test_capacity_denied_total` | `service`, `scope` | exact or authored identifiers | Counts handler-scoped `ScriptDryRunCapacityService` denials exactly once. `scope` is bounded to `tenant` or `cluster`; this is not a per-script quota decision, a live `ScriptTenantBudgetService` decision, or an event-level catch-up candidate ceiling. | | `automation_script_timer_catchup_truncated_total` | `service`, `scope`, `script_kind`, `event_class`, `reason` | exact or authored identifiers | Counts exactly once per cap-excluded catch-up candidate when its durable candidate-audit settlement completes. Cap-excluded candidates never create a firing claim or firing; use the bounded `reason=resume_window_cap` for that candidate settlement. | | `automation_script_timer_runtime_fence_dropped_total` | `service`, `scope`, `script_kind`, `event_class`, `reason` | exact or authored identifiers | Counts due points intentionally dropped because runtime scope or epoch changed before the scheduler could admit them. | | `automation_pin_convergence_timeout_total` | `service`, `scope`, `operation`, `reason` | exact or authored identifiers | Game Session-owned family, with `service=game-session-service`; incremented once when promotion or rollback orchestration reaches timeout terminal state before convergence acknowledgment; `operation` distinguishes the immutable workflow kind. | | `automation_plugin_policy_violations_total` | `service`, `scope`, `plugin_origin`, `component_class`, `reason` | exact or authored identifiers | Counts plugin component-policy violations in both report-only and enforcing modes. | | `automation_rollback_drain_canceled_total` | `service`, `scope`, `operation`, `finalStage`, `reason` | exact or authored identifiers | Increment once per admitted old-epoch execution intentionally fenced during rollback draining before live work can persist or hand off. Ordinary cancel requests, ordinary purge activity, and pre-admission skips do not increment this family; use the work-item cancellation/purge families above for those actions. | ## Documentation Drift Guardrails To keep contracts consistent across docs: - `design/` markdown validation in CI must include a scripting-contract lint pass (for example `./gradlew lintMarkdown` invoking `dev-tools/docs/lint-scripting-contracts.sh`) that fails on: - Deprecated aliases in normative fields (for example `skipped_disabled`, `skipped_version_unavailable`). - Conflicting ownership language for ingress identity fields (for example `scriptEventId`). - Multiple documents claiming incompatible “authoritative/source-of-truth” ownership for the same contract surface. - The scripting platform maintainers own these lint rules under CODEOWNERS and must update them when canonical contracts change. - Docs that define non-normative examples must link back to this table for outcome and label names instead of redefining names locally.