Guard event ingestion
Guard event ingestion copies the Guard half's governance event log into the audit evidence store, so that holds, approvals, refusals and fail-open attestations become hash-chained evidence beside the captured reads. It is the "Guard-ingestion contract".
At a glance
| Batch class | MGCWardenAuditGuardIngestion |
| Menu item | MGCWardenAuditIngestionMenuItem, label Guard event ingestion |
| Menu path | System administration → Setup → Guard event ingestion |
| Who may run it | MGCWardenAuditAdministrationPriv (granted at Update) → MGCWardenAuditAdministrationDuty → Warden audit administrator (MGCWardenAuditAdministrator). The API operation MGCWardenBatchService.runAuditIngestion is granted on the same privilege and re-checks the same menu item |
| Feature toggle | None. run() reads no feature toggle |
| Company scope | Per legal entity. MGCWardenEventLog is a per-company table, and the run reads only the company it runs in. The store rows it writes go into the partition curExt(). Schedule it in every company whose governance events you want in the store |
| Scheduled by default | No. Nothing in the product creates a batch job for it |
| Recurrence | You choose. Neither the code nor the existing docs state one |
| Setup-gap rules watching it | GuardIngestionNotScheduled (code GUARDINGEST): no job of this class carries a recurrence in this company, while a governance event-log row here is not yet forwarded. No toggle is read. Only a recurrence in this company clears it |
| Run record | None. The batch log carries one summary line |
| Overlap guard | Not guarded by MGCWardenBatchOverlapGuard. It protects itself: each row is re-read under pessimisticlock inside the forwarding transaction |
Purpose and business justification
The Guard half (Order Guard, sales, trade agreement, journal and count governance) records what it did
on a per-document timeline, MGCWardenEventLog. That log is append-only but it is not hash-chained, it
is per company, and it ages out on the evidence window. The audit store is chained, anchored, published
outside the tenant and purged only under dual control. Forwarding a governance event moves it from the
first regime into the second.
The control-downtime section of every evidence pack reads the UngovernedAction store rows this batch
writes. Without ingestion, a fail-open pass-through recorded on the Guard side never reaches the pack.
How and when it is triggered
- Scheduled from the menu item, with a recurrence, in each company.
- Run now from the same menu item.
canRunInNewSession()returns true. - API:
MGCWardenBatchService.runAuditIngestion(see Warden batch framework). - Retry on an execution exception it filed runs
MGCWardenGuardForwardRetryfor that one row.
Configuration and scheduling options
No dialog fields; pack() returns conNull(). No parameter is read.
What is forwarded is fixed in code, not configurable:
| Event-log row | Forwarded? | Store event kind |
|---|---|---|
UngovernedAction (fail-open pass-through attestation) | Yes | UngovernedAction |
WorkClaimed, ExceptionRetried, DeprovisioningOverdue | Yes | Write |
| Any other type | Yes | GuardDecision |
AnchorPublished, EvidencePackPublished | No (forwardsToStore) | - |
Any row whose RefTableId is an operational run table (MGCWardenRetentionCleanup::isOperationalRunTable: sales and trade agreement sweep runs, duplicate sweep runs, simulation runs, drop tallies) | No (forwardsRowToStore) | - |
eventKindFor also maps AnchorPublished and EvidencePackPublished to Write, but those two types
never reach it because forwardsToStore declines them first.
Choosing a recurrence. A row is evidence in the store only once forwarded. Until then it is
exposed to the evidence-window purge on the Guard side and is missing from the timeline and the packs.
The run re-reads every declined row on every pass (declined rows stay AuditForwarded = No), so the
cost of a run grows with the number of declined rows still inside the evidence window.
What it does
- Reads every event-log row in this company with
AuditForwarded = No, oldest first. - For each row, asks
forwardsRowToStore(EventType, RefTableId). A declined row is counted and left alone; it is not flagged. - For each admitted row,
forwardRowruns in its own transaction:- re-reads the row under
pessimisticlockwithAuditForwarded = Noin the where clause; if another run forwarded it meanwhile, nothing happens; - appends one store row through
MGCWardenAuditWriter::appendStoreRow: partition and companycurExt(), the event-log row'sActor,RefTableId,RefRecId, itsDocumentKeyas the record key, itsEventDateTimeas first and last occurrence,SourceRef=EVENTLOG:<RecId>, and the event-logDetailcarried verbatim under theGuardEventForwardedtemplate, tagged Unclassified; - sets
AuditForwarded = Yeson the event-log row withskipDataMethods(true)anddoUpdate(), the one permitted mutation of that append-only table. The append and the flag commit together or not at all.
- re-reads the row under
- A failure in step 3 is caught (at transaction level 0, after the row's transaction rolled back) and
filed as an Error execution exception in area EventLog, carrying the retry handler
MGCWardenGuardForwardRetryand the row's RecId. - Writes the summary: forwarded, declined as operational telemetry, failures.
Idempotency. The lock and the AuditForwarded = No predicate make a second run, or a retry, find
the row already forwarded. SourceRef = EVENTLOG:<RecId> makes every store row traceable to its
source.
Identity. appendStoreRow stores the actor through MGCWardenIdentityVault::toRef, so the store
row names a subject reference whether the event-log row held a reference or, on a row written before
D11 phase 2b, a clear user ID. The forwarded Detail and the DocumentKey are copied as written; an
old row may name a person in them.
Dependencies and prerequisites
- Nothing to configure. Rows appear in the event log as the Guard-side controls act in that company.
- The identity vault must be able to issue references.
- The integrity batch must run afterwards for the forwarded rows to be anchored and published.
Inputs and outputs
| Direction | Table | What |
|---|---|---|
| Reads, locks, updates | MGCWardenEventLog | Unforwarded rows; the AuditForwarded flag |
| Inserts | MGCWardenAuditEvent, MGCWardenAuditDetailParam | One store row per forwarded event, with its detail |
| Reads, inserts | MGCWardenIdentityVault | Through toRef |
| Inserts | MGCWardenExecutionException | One Error per failed row, with a Retry lever |
Logging and monitoring
- Batch history: Warden guard ingestion: N events forwarded to the audit store, N declined as operational telemetry (they stay in the event log and age out on the evidence window), N failures. The declined count is reported separately on purpose: a declined count in the same order as the forwarded one means a type is being dropped that should not be.
- Execution exceptions: one row per failed event-log row.
- Audit store inquiry and the User activity timeline show forwarded rows.
- Setup gaps:
GuardIngestionNotScheduledwhen this company has unforwarded event-log rows and no recurrence of the batch here. The row gives no count, because rows the batch declines to forward also stay unforwarded. No health rule watches this batch.
Errors, recovery and troubleshooting
| Symptom | Cause and recovery |
|---|---|
| Error exception Warden guard ingestion failed to forward event-log row N (type) | The append or the flag failed and both rolled back. Fix the cause (often the identity vault) and press Retry, or wait for the next run. MGCWardenGuardForwardRetry treats a row already forwarded, or a row whose type is declined, as success |
| Governance events never appear in the store or the packs | The batch is not scheduled in that company. That company's setup gaps page shows GuardIngestionNotScheduled; schedule it there |
| A large declined count | Expected for sweep and simulation run records. If it is close to the forwarded count, check forwardsRowToStore against the table the rows reference |
The class does not implement BatchRetryable; the batch framework does not retry it. Every per-row
failure is caught, so the task itself ends normally.
Impact on other functionality
- Guard-side retention. Warden retention cleanup deletes event-log rows past
Evidence retention (years) only where
AuditForwarded = No. A forwarded row therefore stays in the event log, and its copy in the store is governed by the audit retention classes and the dual-control purge instead. - Audit retention. Forwarded rows carry no
RetentionClassId, so the purge holds them to the longest configured class.GuardDecisionandWriterows can be purged under dual control;UngovernedActionrows never can (MGCWardenAuditPurgeScope::isControlEvidence). - Purge execution. The Purge approved event that purge execution checks is a governance event. Forwarded, it no longer ages out of the event log; unforwarded, it ages out on the evidence window and an approved purge older than that is refused. See Audit purge execution.
- Evidence packs. The control-downtime and control-operation sections read the store rows this batch writes. A company where it does not run has packs that show no control outages for that reason.