Skip to main content

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 classMGCWardenAuditGuardIngestion
Menu itemMGCWardenAuditIngestionMenuItem, label Guard event ingestion
Menu pathSystem administration → Setup → Guard event ingestion
Who may run itMGCWardenAuditAdministrationPriv (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 toggleNone. run() reads no feature toggle
Company scopePer 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 defaultNo. Nothing in the product creates a batch job for it
RecurrenceYou choose. Neither the code nor the existing docs state one
Setup-gap rules watching itGuardIngestionNotScheduled (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 recordNone. The batch log carries one summary line
Overlap guardNot 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 MGCWardenGuardForwardRetry for 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 rowForwarded?Store event kind
UngovernedAction (fail-open pass-through attestation)YesUngovernedAction
WorkClaimed, ExceptionRetried, DeprovisioningOverdueYesWrite
Any other typeYesGuardDecision
AnchorPublished, EvidencePackPublishedNo (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​

  1. Reads every event-log row in this company with AuditForwarded = No, oldest first.
  2. For each row, asks forwardsRowToStore(EventType, RefTableId). A declined row is counted and left alone; it is not flagged.
  3. For each admitted row, forwardRow runs in its own transaction:
    • re-reads the row under pessimisticlock with AuditForwarded = No in the where clause; if another run forwarded it meanwhile, nothing happens;
    • appends one store row through MGCWardenAuditWriter::appendStoreRow: partition and company curExt(), the event-log row's Actor, RefTableId, RefRecId, its DocumentKey as the record key, its EventDateTime as first and last occurrence, SourceRef = EVENTLOG:<RecId>, and the event-log Detail carried verbatim under the GuardEventForwarded template, tagged Unclassified;
    • sets AuditForwarded = Yes on the event-log row with skipDataMethods(true) and doUpdate(), the one permitted mutation of that append-only table. The append and the flag commit together or not at all.
  4. 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 MGCWardenGuardForwardRetry and the row's RecId.
  5. 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​

DirectionTableWhat
Reads, locks, updatesMGCWardenEventLogUnforwarded rows; the AuditForwarded flag
InsertsMGCWardenAuditEvent, MGCWardenAuditDetailParamOne store row per forwarded event, with its detail
Reads, insertsMGCWardenIdentityVaultThrough toRef
InsertsMGCWardenExecutionExceptionOne 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: GuardIngestionNotScheduled when 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​

SymptomCause 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 packsThe batch is not scheduled in that company. That company's setup gaps page shows GuardIngestionNotScheduled; schedule it there
A large declined countExpected 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. GuardDecision and Write rows can be purged under dual control; UngovernedAction rows 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.