MGCWardenBatchService
Backend test-automation surface, slice S5: run any Warden batch NOW, synchronously, in the caller's session, so an automated test can do "act -> run the drain/sweep -> assert" over HTTP without waiting for a recurrence. Then: * MGCWardenInitialize and MGCWardenAuditCatalogSeed are plain static main() classes with no dialog, prompt, Box:: or FormRun dependency, so they go through MGCWardenApiDispatch::runAction - the menu item itself, via MenuFunction, exactly as a click. * The other 25 are RunBaseBatch classes whose main() is `new; if (prompt()) runOperation();`. prompt() builds a dialog, which has no meaning on a service thread, so those operations run the class's underlying logic directly, still behind canRun() on the same menu item. ============================ run() AND NOT runOperation(), AND WHY THAT IS THE FAITHFUL CHOICE ============================ runOperation() is final and is only SysOperationSandbox::startOperation(this) (pinned by in verify-metadata.ps1). What the sandbox does with it depends on canExecuteInNewSession(), which is false unless the session is interactive (hasGUI()), outside a transaction, and allowed by SysClientPerf.AllowAsyncSandboxExecution. A service session is not interactive, so on this path: * a class answering canRunInNewSession() = false (DirectRun - MGCWardenAuditPackBuilder is the only one here) has run() called inline, in this session; * a class answering true (MarshalledRun - the other 22) is serialized as [classId, pack()], rebuilt by operationExecutionWrapper with makeObject() + unpack(), run() in THIS session, and its packed state unpacked back into the original. Both branches end in run() on an instance holding exactly what pack() carries. That is also precisely what the batch framework does for a scheduled task - BatchRun::runJobStaticCodeFromBuffer is buffer.object(), unpack(buffer.Parameters), run() - so this service does that directly: 1. build the operation and set its dialog parameters through the class's own parmScope(); 2. REHYDRATE: a fresh instance of the same class takes unpack(configured.pack()). Calling runOperation() instead would add nothing on the service path and would make the behavior hinge on hasGUI(): invoked from an interactive session the MarshalledRun branch opens SysOperationSandboxForm, a modal wait form. canRunInNewSession() is therefore not consulted at all: its only job is to choose between two branches that, off the GUI, both reduce to step 4. NOT DONE, DELIBERATELY: parmInBatch(true) is not set, because this is not a batch task. Both Warden readers of isInBatch() want it unset here: MGCWardenAuditPurgeProposalGenerator stamps Origin from it, and an on-demand API run is correctly Manual, as a click is; MGCWardenBatchOverlapGuard excludes the caller's OWN task from the overlap predicate through it, and an API run has no task of its own to exclude - it must yield to every running task, never claim a place among them. SysLastValue is neither read nor written: the dialog pre-fill is a per-user UI convenience, and a test must get the scope it passed, not the one somebody last typed. initParmDefault() IS called before parmScope(), which is what a dialog with no stored last value starts from. ============================ TRANSACTIONS AND SECURITY CONTEXT ============================ Nothing here opens a transaction, and every operation refuses to start at ttsLevel != 0 (MGCWardenApiDispatch::insideTransaction): the batches own their transactions, and their fail-open catch blocks - the "never throw out of run()" rule most of them follow - cannot execute inside an outer one. A direct run() executes under the service operation's entry point rather than the menu item's (MenuFunction pushes the latter). No Warden table sets AOSAuthorization, so that changes nothing about what the code may read or write; it is why the gate is canRun() on the menu item and not merely the grant on this service. ATTRIBUTION: the run executes as the CALLER. curUserId() is the API user wherever a batch stamps one - RequestedBy/ExecutedBy in run records, the event log, and, for the four route drains, the originator of every workflow they activate. That is what an administrator's Run-now does too; a scheduled run stamps the batch account instead. Tests that exercise segregation-of-duties gates downstream of a drain must pick the calling user accordingly. COMPANY: every batch runs in the session company (curExt()) - for a service call, the company the platform assigned the session, normally the caller's default company. No operation takes a company parameter, because the client action does not either. ============================ THE RESULT: STATUS, EVIDENCE, AND WHAT Completed DOES NOT MEAN ============================ Denied - the caller cannot run the menu item. Nothing was attempted. Refused - (a) a parameter is invalid: an ISO date or enum name that does not parse, or the batch's own validate() said no, with the message the dialog would show; nothing ran. (b) the batch ran and took its OWN refusal path - its feature is switched off, a prerequisite is missing - which it reports itself; the Message is the batch's own. Where a batch writes a run record on that path (status Skipped) the key is returned. (c) the OVERLAP GUARD below: a batch task of the same class is executing; nothing ran. Failed - the batch did not complete: an exception escaped run(), or its own fail-open handler fired (a run record closed Failed, a batch that returned without its run record, or the batch-level execution exception its outer catch raises - matched per batch in failedDuringRun), or its parameters did not survive pack()/unpack(). Completed - run() returned normally and the batch neither refused nor failed. IT DOES NOT MEAN ANYTHING WAS DONE: a drain with nothing to drain completes, legitimately. A test must assert on the evidence, which is why every result carries it: * RecordKey / RecordId of the run record, where the batch writes one, as OData entity key text - RunId='...' prefixed with dataAreaId='...' for per-company run tables (quotes doubled) - and its counts in Message; * the batch's own infolog summary (its counts line) in Message, always; * the number of execution exceptions this call raised, always. Per-item errors inside a completed run (a document whose route could not be raised, a count group whose journal name is wrong) leave the status Completed and appear in Message and in the counts, because the batch isolated them and carried on - that is the batch working, and turning it into Refused would say the batch refused to run. Evidence is read back as "rows created by this user since the call started" (to the second), so two concurrent calls by the same user, or a scheduled instance writing to the same shared table in the same second, can blur it; tests should call these operations one at a time. ============================ DURATION ============================ These are synchronous HTTP calls with no async machinery, deliberately. Several batches are bounded only by the size of the estate: the audit writer (the whole shared queue, one transaction per row), audit ingestion (every unforwarded event-log row), integrity verification (re-walks EVERY anchored store range on every run, so it grows with the store), the pack builder (whole-period section queries plus the native database-log survey), retention cleanup (row-by-row purges), the journal route drain (every unposted inventory journal) and deprovisioning (every worker). On a test estate they are seconds; on a mature one they can outlive an HTTP client's timeout. Nothing here observes the client going away, so the run is expected to continue to its end on the AOS - a caller that times out should read the run record / evidence rather than call again. The three sweeps and the purge-proposal generator are bounded by the caps their callers pass. ============================ OVERLAP GUARD: THE PRODUCT'S, ASKED THE STRICTER WAY ============================ An API run alongside the recurring task of the same batch is, mechanically, an administrator's Run-now. For six batches overlap can DUPLICATE OR CONTRADICT EVIDENCE, because each has no claim or lock of its own: the audit writer reads queue rows unlocked; role capture's snapshot check and event insert are separate transactions; the integrity batch reads the last anchor outside a transaction; the purge generator's open-proposal check takes no lock; two duplicate sweeps can both read an unstamped index row; deprovisioning's open-entry check and insert have no unique key behind them. The predicate that refuses such a run - "another batch task of this class is Executing or Canceling" - was born HERE, as an API-only check, which meant the recurring task and Run-now were exactly as exposed as before and the API merely avoided adding to it. It is now a product control, defined ONCE in MGCWardenBatchOverlapGuard and asked by the six batches from their own run() (excluding the caller's own task, with a deterministic tie-break for two tasks that start together, scoped to where each class's evidence lives - all argued on that class) and by this service, through the same method (overlapRefusal). THIS SERVICE ASKS THE WIDER QUESTION: a running task in ANY company refuses the call, whatever the class's own scope, as it always did here. Role capture and deprovisioning refuse themselves only within their company, because their evidence is per company; for an HTTP test the cost of the wider rule is one retry, and one rule is easier to reason about than six. Parity forbids the API being looser than the client; being stricter to protect evidence integrity is allowed. The check comes after Denied and after parameter validation, immediately before run(). If a task is claimed in the instant between this check and the batch's own, the batch refuses itself, and the result still reads Refused: the two batches with a run record close it Skipped (read by evidenceSince), and for the four without one the guard's own trace is read back (MGCWardenBatchOverlapGuard::refusalRecordedSince) - a row shared with any scheduled run refused in the same second, which is the same blur the evidence read-back below already accepts. Initialize and the catalog seed are idempotent keyed upserts and are not batch tasks. The guard cannot see an interactive Run-now or another API call - neither is a batch task - so tests should still call these operations one at a time; and a scheduled task that starts while an API run is in progress cannot see the API run either, for the same reason. EnableIdempotence is left at its default (No) on every operation: a batch run is not idempotent in the sense that property declares - each call is a new run with its own run record - so a retried request must not be treated as the same call.
Methods
runInitialize
Runs Warden initialization now. Mirrors MGCWardenInitializeMenuItem, through the menu item itself (MGCWardenApiDispatch::runAction): MGCWardenInitialize::main is headless - static calls and info() lines only. A re-run changes nothing - except that a test which somehow got BreakGlassGrantHours to zero will find it filled again. Completed guarantees the caller holds the menu item and main() returned without logging an error (the dispatcher's rule for a menu-item run). The current company only.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the initialization infolog.
No parameters.
runInitializeCounted
The runInitialize operation as its service endpoint runs it: runs runInitialize and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runRetentionCleanup
Runs the retention cleanup now. Mirrors MGCWardenRetentionCleanupMenuItem (MGCWardenRetentionCleanup). No parameters: the windows come from MGCWardenParameters. THIS DELETES DATA - released holds, resolved exceptions, evidence past its window, orphaned side records - exactly as a scheduled run would, on the configured windows. No run record; the three infolog lines carry every purge count. Refused when the evidence retention window is out of range (MGCWardenParameters:: evidenceYearsOutOfBounds): the batch refuses the evidence purge with its own error, and - its documented behavior - STILL runs every other purge, whose counts are in the same Message. Failed when anything escapes run() (the class has no fail-open catch). Completed guarantees every purge ran to its end; the counts may all be zero. Can be long on a first run over a mature estate.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the purge counts.
No parameters.
runRetentionCleanupCounted
The runRetentionCleanup operation as its service endpoint runs it: runs runRetentionCleanup and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runBreakGlassExpiry
Runs the break-glass grant expiry now. Mirrors MGCWardenBreakGlassExpiryMenuItem (MGCWardenBreakGlassExpiryBatch). No parameters. Refused when BreakGlassGrantHours is not configured (the batch's own guard: it expires nothing and says so). Failed when its fail-open handler fired (the execution exception it files under document key BREAK-GLASS). Completed guarantees the pass over enabled break-glass role assignments finished; the "N grant(s) disabled" line in Message is the count, and each expiry has an event-log row. The expiry disables SecurityUserRole assignments, so the caller needs the same platform rights to do that as a Run-now click would.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the number of grants disabled.
No parameters.
runBreakGlassExpiryCounted
The runBreakGlassExpiry operation as its service endpoint runs it: runs runBreakGlassExpiry and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runDeltaRouteDrain
Runs the delta route drain now. Mirrors MGCWardenDeltaRouteDrainMenuItem (MGCWardenDeltaRouteDrainBatch). No parameters. The drain reaps stale route claims, then completes every Pending diff-set route through MGCWardenChangeInterceptor::completePendingRoute - so the approval workflows it activates are ORIGINATED BY THE CALLER. Failed when its outer fail-open handler fired (an Error-severity execution exception on MGCWardenDiffSet with no record). A reaper failure alone is a Warning the drain continues past and is reported in the exception count, not as Failed. Completed guarantees the pass finished; "N pending approval route(s) processed" is the count, and a drain with nothing pending completes with 0.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the routes processed and any reaper line.
No parameters.
runDeltaRouteDrainCounted
The runDeltaRouteDrain operation as its service endpoint runs it: runs runDeltaRouteDrain and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runFirmingRouteDrain
Runs the firming route drain now. Mirrors MGCWardenFirmingRouteDrainMenuItem (MGCWardenFirmingRouteDrainBatch). No parameters. Raises the owed firming approval for every PendingApproval request held for firming with no workflow; activations are ORIGINATED BY THE CALLER. Failed when its outer fail-open handler fired (an Error-severity execution exception on MGCWardenFirmingRequest with no record). Completed guarantees the pass finished; Message carries its five-way tally (raised / already routed / escalated / left alone / suppressed), and per-order activation failures are escalations counted there, not a failed call.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the drain tally.
No parameters.
runFirmingRouteDrainCounted
The runFirmingRouteDrain operation as its service endpoint runs it: runs runFirmingRouteDrain and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runTARouteDrain
Runs the trade agreement route drain now. Mirrors MGCWardenTARouteDrainMenuItem (MGCWardenTARouteDrainBatch). No parameters. Refused when Trade Agreement Governance is switched off (the batch's own first guard; it routes nothing and says so). Failed when its outer fail-open handler fired (an Error-severity execution exception on MGCWardenTAGateState with no record). Completed guarantees the pass over gated price journals finished; Message carries its five-way tally. Activations are ORIGINATED BY THE CALLER.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the drain tally.
No parameters.
runTARouteDrainCounted
The runTARouteDrain operation as its service endpoint runs it: runs runTARouteDrain and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runJournalRouteDrain
Runs the journal route drain now. Mirrors MGCWardenJournalRouteDrainMenuItem (MGCWardenJournalRouteDrainBatch). No parameters. Refused when journal governance is switched off (the batch's own first guard). NOT refused when no journal policy is active: that guard is private to the batch and silent, so the call completes with every count at zero - read the tally, not the status. Failed when its outer fail-open handler fired (an Error-severity execution exception on MGCWardenJournalGovState with no record). Completed guarantees the pass finished; Message carries its six-way tally. Visits every unposted inventory journal, so its duration grows with the open-journal count. Activations are ORIGINATED BY THE CALLER.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the drain tally.
No parameters.
runJournalRouteDrainCounted
The runJournalRouteDrain operation as its service endpoint runs it: runs runJournalRouteDrain and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runSetupGapSnapshot
Refreshes the setup-gap snapshot now. Mirrors MGCWardenSetupGapSnapshotMenuItem (MGCWardenSetupGapSnapshotBatch). No parameters. The snapshot is rewritten wholesale for the company, so there is no single record to key; Message carries the number of gap rows the snapshot now holds (entity WardenSetupGapSnapshots). Failed when the refresh's fail-open handler fired - it files a WARNING-severity exception on MGCWardenSetupGapSnapshot, keeps the previous snapshot, and its info line then reads "0 gap(s)", which is exactly the false Completed this check exists to prevent. Completed guarantees the snapshot was replaced; zero gaps is a legitimate result.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the gap count.
No parameters.
runSetupGapSnapshotCounted
The runSetupGapSnapshot operation as its service endpoint runs it: runs runSetupGapSnapshot and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runDuplicateSweep
Runs the duplicate customer-requisition sweep now. Mirrors MGCWardenDuplicateSweepMenuItem (MGCWardenDuplicateSweepBatch). The three parameters are the dialog's three fields, set through the class's own parmScope(), round-tripped through pack()/unpack() and judged by its validate(). RecordKey is the MGCWardenDuplicateSweepRun (entity WardenDuplicateRequisitionSweepRuns) this call wrote; Message carries its status and counts. Refused when the run closed Skipped - Sales Governance switched off, or no active policy asks for duplicate detection - or when validate() refuses the cap. Failed when the run closed Failed or no run record was written. Completed guarantees the run closed Completed or Partial (cap reached; Message says which); zero findings is a legitimate result. Audit cases filed by the sweep are real native cases. OVERLAP GUARD: Refused, with nothing run, while a batch task of MGCWardenDuplicateSweepBatch is executing in any company - two sweeps can both read an unstamped index row, so an overlap can file one duplicate pair as two audit cases (class summary). This check follows validate(). The batch refuses itself too, as a Skipped run, within its company or across all of them when a policy asks for cross-company detection; this service asks the any-company question regardless.
- Visibility:
public - Returns:
MGCWardenApiResultThe result.
| Name | Type | Optional | Description |
|---|---|---|---|
_customerAccount | str | No | Customer account filter; blank sweeps every customer. |
_maxIndexRows | int | No | Ceiling on index rows scanned; the dialog pre-fills the shipped default (1 to the class's absolute maximum; anything else is refused by validate()). |
_resumeFromLastRun | boolean | No | True continues above the index row the last Partial run for the same filter stopped at; false restarts at the top of the index. |
runDuplicateSweepCounted
The runDuplicateSweep operation as its service endpoint runs it: runs runDuplicateSweep and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
| Name | Type | Optional | Description |
|---|---|---|---|
_customerAccount | str | No | |
_maxIndexRows | int | No | |
_resumeFromLastRun | boolean | No |
runSalesGovSweep
Runs the sales governance policy sweep now. Mirrors MGCWardenSalesGovSweepMenuItem (MGCWardenSalesGovSweep). The three parameters are the dialog's three fields, set through the class's own parmScope(), round-tripped through pack()/unpack() and judged by its validate(). RecordKey is the MGCWardenSalesGovSweepRun (entity WardenSalesGovernanceSweepRuns) this call wrote; Message carries its status and counts (examined / routed / compliant / skipped held / failed). Refused when the run closed Skipped (Sales Governance switched off) or validate() refuses the cap. Failed when the run closed Failed or no run record was written. Completed guarantees the run closed Completed or Partial; a routed document now carries a governance route raised by the CALLER.
- Visibility:
public - Returns:
MGCWardenApiResultThe result.
| Name | Type | Optional | Description |
|---|---|---|---|
_customerAccount | str | No | Customer account filter; blank sweeps every customer and prospect. |
_maxDocuments | int | No | Ceiling on documents examined (1 to the class's absolute maximum; anything else is refused by validate()). |
_includeUnstamped | boolean | No | True treats a verdict reached before policy stamping existed as stale (the dialog's shipped default). |
runSalesGovSweepCounted
The runSalesGovSweep operation as its service endpoint runs it: runs runSalesGovSweep and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
| Name | Type | Optional | Description |
|---|---|---|---|
_customerAccount | str | No | |
_maxDocuments | int | No | |
_includeUnstamped | boolean | No |
runTAGovSweep
Runs the trade agreement approval sweep now. Mirrors MGCWardenTAGovSweepMenuItem (MGCWardenTAGovSweep). The three parameters are the dialog's three fields, set through the class's own parmScope(), round-tripped through pack()/unpack() and judged by its validate(). RecordKey is the MGCWardenTAGovSweepRun (entity WardenTradeAgreementApprovalSweepRuns) this call wrote; Message carries its status and counts (examined / superseded / skipped gated / skipped held / failed). Refused when the run closed Skipped (Trade Agreement Governance switched off) or validate() refuses the cap. Failed when the run closed Failed or no run record was written. Completed guarantees the run closed Completed or Partial.
- Visibility:
public - Returns:
MGCWardenApiResultThe result.
| Name | Type | Optional | Description |
|---|---|---|---|
_journalFilter | str | No | Journal number or pattern (for example TA-2026*); blank sweeps every unposted journal. |
_maxJournals | int | No | Ceiling on journals examined (1 to the class's absolute maximum; anything else is refused by validate()). |
_includeUnstamped | boolean | No | True treats an approval granted before price-guard policy stamping existed as stale (the dialog's shipped default). |
runTAGovSweepCounted
The runTAGovSweep operation as its service endpoint runs it: runs runTAGovSweep and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
| Name | Type | Optional | Description |
|---|---|---|---|
_journalFilter | str | No | |
_maxJournals | int | No | |
_includeUnstamped | boolean | No |
runCountConsolidation
Runs count consolidation now. Mirrors MGCWardenCountConsolidationMenuItem (MGCWardenCountConsolidationRun). No parameters. Creates one native counting journal per queued warehouse/window group, and auto-posts it where the policy says so. Refused when Count Governance is switched off (the batch's own first guard). A group that cannot be consolidated (for example a missing counting journal name) is marked Failed on the queue with its own execution exception and the run carries on, so it reads as Completed with the error in Message and the exception counted - assert on the queue rows (WardenCountJournalQueue...) rather than the status. Failed only when something escapes run().
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the number of window groups processed.
No parameters.
runCountConsolidationCounted
The runCountConsolidation operation as its service endpoint runs it: runs runCountConsolidation and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runMissingMonitor
Runs the missing-queue SLA monitor now. Mirrors MGCWardenMissingMonitorMenuItem (MGCWardenMissingQueueMonitor). No parameters. Ages quarantined missing entries past their SLA date and alerts the configured recipients. Refused when Count Governance is switched off. Failed when its fail-open handler fired - it files an Error-severity execution exception with no table, record or key, rolls the whole pass back, and still prints "0 entry(ies) aged", so without this check a failed pass would read as a clean Completed. Completed guarantees the pass committed; Message carries the aged count. "Past SLA" is judged against the session date (systemDateGet()).
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the number of entries aged.
No parameters.
runMissingMonitorCounted
The runMissingMonitor operation as its service endpoint runs it: runs runMissingMonitor and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runCountRetention
Runs count retention now. Mirrors MGCWardenCountRetentionMenuItem (MGCWardenCountRetention). No parameters. THIS DELETES DATA: closed count cases past ClosedCaseRetentionDays (with their lineage, except where a missing entry is still open) and old counter-log rows. A zero window purges nothing. No run record; the two info lines carry the counts. Failed only when something escapes run() (the class has no fail-open catch); Completed guarantees both purges ran to their end.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the purge counts.
No parameters.
runCountRetentionCounted
The runCountRetention operation as its service endpoint runs it: runs runCountRetention and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditWriter
Runs the audit queue writer now. Mirrors MGCWardenAuditWriterMenuItem (MGCWardenAuditWriter). No parameters. Drains EVERY undropped row of the shared audit queue (all companies) into the append-only store, one transaction per row - long-running on a backlog. A row that cannot be stored gets its own execution exception and the drain continues, so per-row failures read as Completed with the "N failures" count in Message. Failed only when something escapes run(). Completed guarantees the queue was walked to its end. OVERLAP GUARD: Refused, with nothing run, while a batch task of MGCWardenAuditWriter is executing in any company. The writer claims nothing, so two concurrent writers can store one capture twice; the writer refuses itself on the same predicate (class summary).
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries rows stored, failures and overflow drops.
No parameters.
runAuditWriterCounted
The runAuditWriter operation as its service endpoint runs it: runs runAuditWriter and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditIngestion
Runs the guard event-log ingestion into the audit store now. Mirrors MGCWardenAuditIngestionMenuItem (MGCWardenAuditGuardIngestion). No parameters. Walks every event-log row not yet forwarded, forwarding evidence and declining operational telemetry. Per-row failures get their own (retryable) execution exception and the pass continues, so they read as Completed with the "N failures" count in Message. Failed only when something escapes run(). Completed guarantees the walk finished.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries forwarded / declined / failure counts.
No parameters.
runAuditIngestionCounted
The runAuditIngestion operation as its service endpoint runs it: runs runAuditIngestion and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditRoleCapture
Runs role-assignment capture now. Mirrors MGCWardenAuditRoleCaptureMenuItem (MGCWardenAuditRoleCapture). No parameters. Refused when Warden Evidence and Compliance is switched off (the batch's own first guard; it records the feature-off outcome and leaves the role snapshot unchanged). Failed when its fail-open handler fired (the execution exception it files under document key ROLE-CAPTURE). Completed guarantees grants and revocations since the last snapshot were captured; Message carries both counts, which are zero when no role assignment changed. OVERLAP GUARD: Refused, with nothing run, while a batch task of MGCWardenAuditRoleCapture is executing in any company - its snapshot check and event insert are separate transactions, so an overlap records the same grant twice (class summary). The batch refuses itself within its own company only, because its evidence is per company; this service asks the wider question.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries grants and revocations recorded.
No parameters.
runAuditRoleCaptureCounted
The runAuditRoleCapture operation as its service endpoint runs it: runs runAuditRoleCapture and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditRoleRetention
Runs role-event retention now. Mirrors MGCWardenAuditRoleRetentionMenuItem (MGCWardenAuditRoleEventRetention). No parameters. THIS DELETES DATA: store-forwarded role events older than the fixed seven-year floor. Failed when its fail-open handler fired (the execution exception under document key ROLE-RETENTION). Completed guarantees the purge committed; Message carries the count, normally zero on a test estate.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the number of rows purged.
No parameters.
runAuditRoleRetentionCounted
The runAuditRoleRetention operation as its service endpoint runs it: runs runAuditRoleRetention and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditIntegrity
Runs the audit integrity batch now. Mirrors MGCWardenAuditIntegrityMenuItem (MGCWardenAuditIntegrityBatch). No parameters. Computes anchors for new store rows, publishes anchors and retirement reconciliations, then RE-VERIFIES EVERY ANCHORED RANGE - the costliest batch here, and it grows with the store. It writes one MGCWardenAuditVerificationRun row per range (entity WardenAuditVerificationRuns), so there is no single record to key: Message carries new anchors and the Pass / Reconciled / Fail verdict counts. A Fail VERDICT is a finding - the store was tampered with or damaged - and reads as Completed with a non-zero Fail count, which is what a tamper test asserts. Failed when a step-level handler fired (an Error-severity execution exception on the anchor, reconciliation or verification table with no record, which includes a partition whose anchoring failed). Verification rows carry no user stamp, so a concurrent integrity run in the same second would be counted too. OVERLAP GUARD: Refused, with nothing run, while a batch task of MGCWardenAuditIntegrityBatch is executing in any company - anchoring has no claim, so an overlap produces a spurious anchoring failure and attests every range twice (class summary).
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries anchors and verdict counts.
No parameters.
runAuditIntegrityCounted
The runAuditIntegrity operation as its service endpoint runs it: runs runAuditIntegrity and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditHealth
Runs the audit health monitor now. Mirrors MGCWardenAuditHealthMenuItem (MGCWardenAuditHealthBatch). No parameters. Ensures the shipped rules exist, evaluates every enabled rule and raises an alert per breach. Message carries rules evaluated and breached plus the number of MGCWardenAuditHealthAlert rows raised by this call (alerts are shared and carry no user stamp, so a concurrent monitor run in the same second would be counted too). A rule that cannot be evaluated gets its own exception and the run continues (Completed). Failed when the monitor's outer handler fired (an Error-severity execution exception on MGCWardenAuditHealthRule with no record). Completed guarantees every enabled rule was attempted; zero breaches is a legitimate result.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries evaluation and alert counts.
No parameters.
runAuditHealthCounted
The runAuditHealth operation as its service endpoint runs it: runs runAuditHealth and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditDeprovisioning
Runs the deprovisioning proposal batch now. Mirrors MGCWardenAuditDeprovisioningMenuItem (MGCWardenAuditDeprovisioning). No parameters. Proposes a deprovisioning entry for every worker whose employment has ended but whose user is still enabled and has no open entry; visits every worker, so it scales with the worker count. Refused when Warden Evidence and Compliance is switched off (the batch's own first guard). Failed when its fail-open handler fired (the execution exception under document key DEPROVISIONING). Completed guarantees the pass finished; Message carries the number of proposals created, zero when nobody qualifies. OVERLAP GUARD: Refused, with nothing run, while a batch task of MGCWardenAuditDeprovisioning is executing in any company - the open-entry check and the insert have no unique key behind them, so an overlap can propose the same user twice (class summary). The batch refuses itself within its own company only, because its entries are per company; this service asks the wider question.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the proposals created.
No parameters.
runAuditDeprovisioningCounted
The runAuditDeprovisioning operation as its service endpoint runs it: runs runAuditDeprovisioning and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runDeprovisioningOverdueMonitor
Mirrors MGCWardenDeprovisioningOverdueMenuItem (MGCWardenDeprovisioningOverdueMonitor). No parameters. Alerts the deprovisioning overdue alert recipients about every proposed entry past its SLA date whose next escalation step is due, records each escalation on the entry, and writes a DeprovisioningOverdue governance event per escalation. Running it twice on one day escalates nothing the second time: each step is alerted once per entry. NOT refused when Warden Evidence and Compliance is switched off - the monitor is deliberately ungated (class summary). Failed when its fail-open handler fired (the execution exception under document key DEPROV-OVERDUE with no record). An entry that could not be escalated is an execution exception on that entry and leaves the status Completed, with the count in Message. "Past SLA" is judged against the session date. No overlap guard is needed: each escalation locks its entry (class summary).
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the overdue, escalated and failed counts.
No parameters.
runDeprovisioningOverdueMonitorCounted
The runDeprovisioningOverdueMonitor operation as its service endpoint runs it: runs runDeprovisioningOverdueMonitor and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditPackBuilder
Builds an evidence pack now. Mirrors MGCWardenAuditPackBuilderMenuItem (MGCWardenAuditPackBuilder). The three parameters are the dialog's three fields, set through the class's parmScope(), round-tripped through pack()/unpack() and judged by its validate(). This is the one class here answering canRunInNewSession() = false (DirectRun); the service path is run() either way - see the class summary. RecordKey is the MGCWardenAuditPackRun (entity WardenAuditPackRuns) this call wrote - the key the export and render operations take. Message carries its status and section count. Refused when a parameter does not parse, when validate() refuses the period (the dialog's own message), or when the run closed Skipped (Warden Evidence and Compliance switched off). Failed when the run closed Failed (assembly failed and its sections were discarded) or no run record was written. Completed guarantees a Completed pack run. Can be long for a wide period.
- Visibility:
public - Returns:
MGCWardenApiResultThe result.
| Name | Type | Optional | Description |
|---|---|---|---|
_packType | str | No | Pack type by enum name, for example SOXITGC or CFRPart11. |
_periodFrom | str | No | First day of the reporting period, ISO yyyy-MM-dd. |
_periodTo | str | No | Last day of the reporting period, ISO yyyy-MM-dd. |
runAuditPackBuilderCounted
The runAuditPackBuilder operation as its service endpoint runs it: runs runAuditPackBuilder and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
| Name | Type | Optional | Description |
|---|---|---|---|
_packType | str | No | |
_periodFrom | str | No | |
_periodTo | str | No |
runAuditPurgePropose
Runs the audit purge proposal generator now. Mirrors MGCWardenAuditPurgeProposeMenuItem (MGCWardenAuditPurgeProposalGenerator). The four parameters are the dialog's four fields, set through the class's own parmScope(), round-tripped through pack()/unpack() and judged by its validate() - which checks the proposer is an enabled user, the cap is in range and an override cutoff is no later than the shortest retention class allows. The accountable proposer is whoever the caller names, exactly as the dialog allows; the API adds no path the dialog lacks, and proposer-is-not-approver is enforced on the approval, not here. The run's Origin is Manual (this is not a batch task). RecordKey is the MGCWardenAuditPurgeProposalRun (entity WardenAuditPurgeProposalRuns, a SHARED table, so no dataAreaId) this call wrote; Message carries status, cutoff, and partition / proposal / row counts. Refused when a parameter does not parse, validate() refuses, or the run closed Skipped - the generator's own refusals: Auditor switched off, no proposer, no retention classes, the export gate, an out-of-range stored cutoff - with the generator's reason. Failed when the run closed Failed or no run record was written. Completed guarantees a Completed or Partial run; proposals raised are undecided and still need a second person's approval. OVERLAP GUARD: Refused, with nothing run, while a batch task of MGCWardenAuditPurgeProposalGenerator is executing in any company - its open-proposal check takes no lock, so an overlap can raise two undecided proposals for one partition (class summary). This check follows validate(), so an invalid parameter is reported first.
- Visibility:
public - Returns:
MGCWardenApiResultThe result.
| Name | Type | Optional | Description |
|---|---|---|---|
_proposedBy | str | No | User id of the accountable proposer. Required: blank is refused by validate(), as a cleared dialog field is. |
_partitionFilter | str | No | Store partition (company id); blank covers every partition. |
_cutoffOverride | str | No | Earlier-than-derived cutoff, ISO yyyy-MM-dd; blank uses the derived cutoff. |
_maxProposals | int | No | Ceiling on proposals raised (1 to the class's absolute maximum; anything else is refused by validate()). |
runAuditPurgeProposeCounted
The runAuditPurgePropose operation as its service endpoint runs it: runs runAuditPurgePropose and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
| Name | Type | Optional | Description |
|---|---|---|---|
_proposedBy | str | No | |
_partitionFilter | str | No | |
_cutoffOverride | str | No | |
_maxProposals | int | No |
runAuditPurgeExecute
Mirrors MGCWardenAuditPurgeExecuteMenuItem (MGCWardenAuditPurgeExecutionBatch). No parameters. THIS DELETES DATA: it executes every purge proposal a second person has APPROVED - re-checks dual control against the approver of record the workflow history names and that a retention class still exists, re-screens, exports and reads back where an export is configured, mints the certificate and deletes the audit store rows. It decides nothing: a proposal that is not Approved is not touched, and a proposal whose approver of record is its proposer is refused. A proposal it cannot execute gets its own Critical execution exception (one per proposal per cause, counted on repeat) and stays Approved; those read as Completed, with the refused and failed counts in Message, because the batch isolated them and carried on. Failed when an exception escaped run() or its outer handler fired (the execution exception under document key PURGE-EXECUTION). Completed guarantees every proposal that was Approved when the call started was attempted; zero is a legitimate count. No overlap guard: the engine claims each proposal under a pessimistic lock and asks its state there, so a scheduled run alongside this call serializes on the proposal and the second finds it Executed (counted as "already finished by another execution").
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries examined, executed, refused, failed and already-finished counts.
No parameters.
runAuditPurgeExecuteCounted
The runAuditPurgeExecute operation as its service endpoint runs it: runs runAuditPurgeExecute and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runErasureExecute
Mirrors MGCWardenErasureExecuteMenuItem (MGCWardenErasureExecutionBatch). No parameters. THIS DESTROYS IDENTITIES: it carries out every erasure request a second person approved, and every deferred one whose earliest execution has passed, through the erasure executor, which asks every precondition again under a lock on the vault row, writes the erasure certificate and tombstones the identity. It decides nothing: a request that is not due is not touched, and one a precondition still refuses keeps its state with the reason recorded on it. Completed means the run finished; Message carries the examined, executed, waiting and no-longer-due counts.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the counts.
No parameters.
runErasureExecuteCounted
The runErasureExecute operation as its service endpoint runs it: runs runErasureExecute and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.
runAuditCatalogSeed
Seeds or refreshes the shipped Sensitivity-Register catalog now. Mirrors MGCWardenAuditCatalogSeedMenuItem, through the menu item itself (MGCWardenApiDispatch::runAction): MGCWardenAuditCatalogSeed::main is headless - keyed upserts and infolog lines only. Idempotent by CatalogId; a customer-edited row is never touched; nothing is enrolled. Rows naming a table absent from this deployment are skipped with a warning, which leaves the status Completed. Completed guarantees main() returned without logging an error; Message carries the catalog summary (shipped rows, customer-edited rows, rows enrolled). The catalog is cross-company.
- Visibility:
public - Returns:
MGCWardenApiResultThe result; Message carries the catalog summary.
No parameters.
runAuditCatalogSeedCounted
The runAuditCatalogSeed operation as its service endpoint runs it: runs runAuditCatalogSeed and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).
- Visibility:
public - Returns:
MGCWardenApiResult
No parameters.