feat(audit): ScriptTrace channel + RouteCall/ScriptRun/AttributeWrite/AttributeWait kinds

Flow Debugger (design 2026-09-05 §5.1): trace steps are audit rows. New
AuditChannel.ScriptTrace appended after Cluster and four kinds appended after
ManualFailover so stored ordinals never move; lock-in tests + alog.md §4 updated.

Claude-Session: https://claude.ai/code/session_01GSLkkHKz9JrAtmJjmQK3cP
This commit is contained in:
Joseph Doherty
2026-09-05 23:41:50 -04:00
parent 61d1785fcb
commit 352e0bfa37
5 changed files with 62 additions and 6 deletions
+5 -1
View File
@@ -135,7 +135,7 @@ Single wide table, polymorphic by `Channel` + `Kind` discriminators, JSON payloa
- `IX_AuditLog_Target_Occurred (Target, OccurredAtUtc)` — "what did we send to system X."
- Partitioning by month on `OccurredAtUtc` from day one (purge becomes a partition switch instead of a delete storm).
**`Kind` values (flat — 17 discriminators across all channels; pinned by `AuditEnumTests`):**
**`Kind` values (flat — 21 discriminators across all channels; pinned by `AuditEnumTests`):**
| Kind | Fires when |
|---|---|
@@ -156,6 +156,10 @@ Single wide table, polymorphic by `Channel` + `Kind` discriminators, JSON payloa
| `SecuredWriteExpire` | A `Pending` secured write aged past its server-side TTL and was transitioned to `Expired` without executing — emitted by the system (no verifier). |
| `ReconciliationAbandoned` | A reconciliation pull row failed to insert up to the permanent-abandon threshold and central advanced its cursor past it; one synthetic row so the loss is queryable in the Audit Log itself. |
| `ManualFailover` | An administrator triggered a manual failover of the central pair from the Health page; one row per invocation, written BEFORE the graceful `Cluster.Leave` is issued. `Target` = the leaving node's address. |
| `RouteCall` | Central `Route.To(...).Call(...)` round-trip completed (success or failure). **Always-on** — one row per routed call regardless of tracing; `Extra.childExecutionId` = the site run's `ExecutionId`. Channel `ScriptTrace`. (Flow Debugger, 2026-09-05) |
| `ScriptRun` | A traced site script run completed/failed/timed out; `Extra.trigger*` carries the trigger for value-change runs. Channel `ScriptTrace`, traced executions only. |
| `AttributeWrite` | A traced script wrote an attribute (or a batch); `Extra.writes[]` lists each write's outcome. Channel `ScriptTrace`, traced executions only. |
| `AttributeWait` | A traced script's `WaitAsync`/`WaitForAsync` resolved (satisfied / timeout / cancelled / error) with the observed value. Channel `ScriptTrace`, traced executions only. |
### Site: `AuditLog` (SQLite)