Skip to main content

MGCWardenCountOperationsService

COUNT GOVERNANCE OVER HTTP (Package C; backend test-automation surface, slice S3). Everything else about their shape is the write-off pair's. UI PARITY (MGCWardenApiDispatch). Every operation first asks canRun() of the menu item the client button runs, and returns Denied; having looked nothing up, so a Denied never reveals whether the record exists; when the caller could not press that button. Authority therefore stays where it already is: MGCWardenCountProcessPriv for the four workbench actions, MGCWardenCountWriteOffProposePriv for the proposal, MGCWardenCountWriteOffPriv for the second signature, MGCWardenCountResolveProposePriv and MGCWardenCountResolvePriv for the two halves of the return to stock. A grant on this service adds none. Then NotFound, then the action. WHICH OPERATIONS RUN THE MENU ITEM AND WHICH RUN ITS LOGIC. Only Take runs its menu item through runAction(), because it is the only one of the six that is headless AND never reaches the electronic signature gate: * Accept, Quarantine, Propose and Write-off prompt a RunBase dialog, which has no meaning on a service thread; what the dialog captures arrives as an operation parameter instead. * Recount has no dialog, but it; like Accept, Quarantine and Write-off; goes through MGCWardenCountCaseService::applyOutcome, which demands the per-stage electronic signature when the case's count policy has ESignaturePerStage on. The action classes call it with the workbench defaults, i.e. interactively; run through its menu item on a service thread, Recount would attempt the modal capture. So those five call the SAME service methods their action classes call, with the same arguments, after repeating each action's pre-dialog checks in the action's order and with the action's words, and they tell the signature gate the channel is not interactive. Nothing else differs. E-SIGNATURE: REFUSED, NEVER BYPASSED. With _interactive false, MGCWardenESignatureGate::refusalForCountCase turns a required signature into the refusal that names the client as the route forward; applyOutcome throws it before any state moves, and it comes back Refused. The framework-unavailable and Warden-failure situations still fail open with an attestation, exactly as they do in the client, because that rule belongs to the gate and not to the channel. This is the shape MGCWardenWorkItemService gives on the approval channels. The comparison is against curUserId(), which on this channel is the authenticated caller: a test proposes as one user and approves as another, exactly as two people must in the client, and a single user holding both grants gets an operation that always refuses. The one other person a message here names is takeCase's current holder, the case's AssignedTo: a work-queue claim, clear by Q11 and shown in clear on the workbench and in WardenCountCases, so it stays as it stands by decision - its reference printed beside the clear value the caller can read there would be the forward lookup design section 2.5 keeps behind the resolver role. The rule is MGCWardenCountCaseService::refuseWhileNativePending, the one copy the client's actions call: propose and write-off ask it at the action's point in the action's order, and accept, recount and quarantine meet it inside applyOutcome. It records a ChangeRefused row on every channel. An unconditional "processed" line papers over all of that; it is why applyOutcome came to return whether the case moved, for a channel to report from; and an API a test asserts on has to go one step further than that answer. Every operation therefore RE-READS after the call and returns Completed only when the post-state its doc comment promises is in the database. When it is not, the result carries the client's own messages plus one line saying what did not change, and is Refused when a business rule (forward-only, two eyes, signature, a proposal already outstanding) left the row where it was, or Failed when Warden itself did. KEYS. Case operations take _caseId; CaseId, the key of MGCWardenCountCaseEntity (WardenCountCases). MISSING-queue operations take _recordId; RecordId, the key of MGCWardenMissingQueueEntryEntity (WardenMissingQueueEntries), which carries CaseId beside it so a test can find the entry its quarantine created; the table has no natural key, and that entity says why RecordId is the honest one. RecordKey in every result is the OData key text of the entity row the operation acted on; dataAreaId='usmf',CaseId='CC-000001' or dataAreaId='usmf',RecordId=5637144576; so a harness can GET /data/WardenCountCases() straight back. An entry resolves to its case exactly as the client's actions resolve the selected grid row (caseFromArgs), so the API acts on whatever the button would. Both keys are company-scoped; the operation runs in the company the request names. NEVER THROWS ACROSS THE BOUNDARY, and refuses to run inside a transaction, for the reasons MGCWardenApiDispatch gives.

Methods​

takeCase​

Take: assigns the count case to the calling user; MGCWardenCountTake, run through its menu item exactly as the workbench button runs it. COMPLETED GUARANTEES: when the call returns, the case exists, is not Closed, and its AssignedTo is the calling user. Taking a case the caller already holds is Completed too; the promised state holds, and the action ran (and re-recorded the claim) exactly as a second click would; and the message says the case was already the caller's. The one operation here that runs its menu item: MGCWardenCountTakeAction has no dialog and never reaches the signature gate. What it does not do is fail LOUDLY; on a closed case it warns and returns, and runAction() reads a warning as Completed. So the case is re-read, and an assignment that did not happen comes back Refused with the action's own warning and the reason.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenCountCases key.
NameTypeOptionalDescription
_caseIdstrNoThe case's CaseId, the key of WardenCountCases.

takeCaseCounted​

The takeCase operation as its service endpoint runs it: runs takeCase and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_caseIdstrNo

acceptCase​

Accept: the reason-coded Accepted outcome; the case closes and its decision-time delta is queued for windowed consolidation. Mirrors MGCWardenCountAccept. COMPLETED GUARANTEES: the case was not Closed before the call, and is now Closed with Outcome Accepted. The consolidation queue row that carries the delta is written by the same transaction, so it exists too (WardenCountJournalQueueEntries, filtered on CaseId). _reasonCode IS NOT IN THE BUILD CONTRACT'S SKETCH, and is here because the client records it: the Accept dialog asks for a "Reason code", and applyAccept writes it to the queue row's ReasonCode (which the consolidation journal reads) and to the governance event. Without it the API could only ever accept with a blank reason. The client does not refuse a blank one on Accept, so neither does this. The workbench button meets the same call before its dialog. Thrown by applyOutcome the same way, or refused quietly under the lock and classified by notAppliedRefusal.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenCountCases key.
NameTypeOptionalDescription
_caseIdstrNoThe case's CaseId, the key of WardenCountCases.
_reasonCodestrNoThe reason code the Accept dialog would have captured; may be blank.

acceptCaseCounted​

The acceptCase operation as its service endpoint runs it: runs acceptCase and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_caseIdstrNo
_reasonCodestrNo

recountCase​

Mirrors MGCWardenCountRecount, which passes a blank reason, as this does. COMPLETED GUARANTEES: the case's Outcome is Recount and its RecountCount is exactly one higher than before the call. Status is then InRecount, or Escalated; both are the Recount disposition applied, so both are Completed, and the message says ESCALATED when it did so a test need not infer it. Not run through its menu item although the action has no dialog: see the class summary.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenCountCases key.
NameTypeOptionalDescription
_caseIdstrNoThe case's CaseId, the key of WardenCountCases.

recountCaseCounted​

The recountCase operation as its service endpoint runs it: runs recountCase and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_caseIdstrNo

quarantineCase​

Quarantine: records the case's missing stock in the MISSING queue with its SLA date and generates the quarantine movement. Mirrors MGCWardenCountQuarantine. COMPLETED GUARANTEES: the case's Outcome is Quarantine and it has exactly one more MISSING entry than before the call; the message names that entry by the RecordId proposeWriteOff and writeOff take. The case Status is deliberately left where it was (applyQuarantine's rule). This needs no pre-check here: MGCWardenCountCaseService::applyOutcome throws the refusal before any state moves; the same loud placement the two-eyes rule has; and the Exception::Error arm below turns a pre-state throw into Refused, exactly as it does for a signature refusal. Parity is therefore automatic rather than copied: the workbench button and this operation meet one rule in one place. The "one more MISSING entry" clause above is what would otherwise have made a repeat call report Failed, since a refused quarantine leaves the case Open and the generic not-moved branch reads an open case as Warden's own failure. _reasonCode IS THE DIALOG'S "Reason code", AND IT IS KEPT NOW. This operation used to take only _caseId, and deliberately: MGCWardenCountQuarantineAction's dialog captured a reason and passed it to applyOutcome, and nothing recorded it; applyQuarantine took no reason, the event-log row it wrote carried none, and the quarantine event did not use it. A parameter here would have been accepted and silently dropped, which tells a test author something false. That was a finding against the client and it was fixed there, not papered over here: applyQuarantine now writes the reason into the case's governance event (WardenGovernanceEvents, DocumentKey = the CaseId) as applyAccept and applyWriteOff do, and the event carries it in its decision note. The parameter follows the record, so the API quarantines with a reason exactly as the client does. Parity needs no code here and deliberately gets none; MGCWardenCountCaseService::applyOutcome throws on the blank reason before any state moves, exactly as it does for a write-off, and the Exception::Error arm below turns a pre-state throw into Refused. One rule in one place, met by the workbench button and this operation alike. Accept remains optional on both. The workbench button meets the same call before its dialog.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenCountCases key.
NameTypeOptionalDescription
_caseIdstrNoThe case's CaseId, the key of WardenCountCases.
_reasonCodestrNoThe reason code the Quarantine dialog captures; required, and a blank one comes back Refused.

quarantineCaseCounted​

The quarantineCase operation as its service endpoint runs it: runs quarantineCase and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_caseIdstrNo
_reasonCodestrNo

proposeWriteOff​

Records the caller as proposer with the stated basis and moves the case to PendingWriteOff; releases nothing. Mirrors MGCWardenCountProposeWriteOff. COMPLETED GUARANTEES: the case's Quarantined or Aged MISSING entry now has a ProposedBy that names the calling user - their subject reference since D11 phase 2a, asked through sameSubject - (with ProposalReason = _basis), and the case Status is PendingWriteOff. No stock moved and nothing was queued. _basis IS WHAT THE CLIENT RECORDS; _reasonCode IS NOT RECORDED. The client captures ONE field, the dialog's "Reason for proposing", which proposeWriteOff stores as ProposalReason; that is _basis, and a blank one is refused as the dialog refuses it. The build contract also lists a reason code for this operation, so the parameter is accepted; but there is nowhere the client can record one at proposal time; the reason code that reaches the consolidation queue is the approver's, given to writeOff; so a supplied value is NOT stored, and the message says so. Storing it (say, glued into ProposalReason) would put text in the record no person could have entered through the client. The checks run in MGCWardenCountProposeWriteOffAction::main's order and in its words, then the dialog's blank-reason refusal; the service repeats every one of them, authoritatively, under the row lock.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenMissingQueueEntries key.
NameTypeOptionalDescription
_recordIdRefRecIdNoThe MISSING entry's RecordId, the key of WardenMissingQueueEntries.
_reasonCodestrNoAccepted because the contract lists it; never stored (see above).
_basisstrNoThe proposer's stated basis; the dialog's "Reason for proposing"; required.

proposeWriteOffCounted​

The proposeWriteOff operation as its service endpoint runs it: runs proposeWriteOff and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_recordIdRefRecIdNo
_reasonCodestrNo
_basisstrNo

writeOff​

Mirrors MGCWardenCountWriteOff. COMPLETED GUARANTEES: the case is Closed with Outcome WriteOff. The same transaction marked its MISSING entry WrittenOff and queued the delta for consolidation with _reasonCode. PROPOSER IS NOT APPROVER, EXACTLY AS IN THE CLIENT. Nothing here compares users itself; a second copy of a comparison this specific would eventually disagree with the first. The pure rule is asked once more at the end, after applyOutcome, only to classify a write-off that did not happen as Refused rather than Failed; it records nothing, because that refusal was recorded where it was made. _reasonCode IS THE DIALOG'S "Reason code" and is load-bearing: it reaches the consolidation queue as MGCWardenCountJournalQueue.ReasonCode and is refused blank exactly as the dialog and the service refuse it. The build contract called this parameter "comment"; the client captures no comment on a write-off, only this reason code, so the parameter is named for what it records. When the count policy demands a per-stage signature the write-off comes back Refused with the gate's route to the client; never written off unsigned.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenMissingQueueEntries key.
NameTypeOptionalDescription
_recordIdRefRecIdNoThe MISSING entry's RecordId, the key of WardenMissingQueueEntries.
_reasonCodestrNoThe approver's reason code; required.

writeOffCounted​

The writeOff operation as its service endpoint runs it: runs writeOff and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_recordIdRefRecIdNo
_reasonCodestrNo

proposeResolve​

Records the caller as having found the stock, with where they found it; moves nothing. Mirrors MGCWardenCountProposeResolve. COMPLETED GUARANTEES: the MISSING entry named by _recordId now has a ResolveProposedBy that names the calling user (their subject reference since D11 phase 2a, asked through sameSubject), with ResolveProposalReason = _basis. Its State is unchanged and still Quarantined or Aged, no journal was created, the SLA clock is still running and the count case is untouched. IT ACTS ON THE ENTRY _recordId NAMES AND NEVER ON A SIBLING, which is the one behavioral difference from proposeWriteOff and is deliberate. That operation resolves the entry to its CASE (caseOfEntry) and then acts on whichever outstanding entry the service's `select firstonly` returns, because that is what the client's button does. A BLANK _basis IS REFUSED, as the dialog refuses it: the text says WHERE the stock was found, which is what the confirming reviewer walks to. There is no second reason-code parameter here, unlike proposeWriteOff: the client captures one field and so does this.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenMissingQueueEntries key.
NameTypeOptionalDescription
_recordIdRefRecIdNoThe MISSING entry's RecordId, the key of WardenMissingQueueEntries.
_basisstrNoWhere the stock was found; the dialog's "Where the stock was found"; required.

proposeResolveCounted​

The proposeResolve operation as its service endpoint runs it: runs proposeResolve and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_recordIdRefRecIdNo
_basisstrNo

resolveToStock​

Mirrors MGCWardenCountResolve. COMPLETED GUARANTEES: the MISSING entry named by _recordId is Resolved. NOTHING was queued for consolidation; this is the one disposition that settles quarantined stock without an inventory adjustment, because the stock was found. The message says whether a return transfer journal was created (it is not, when the quarantine journal was never posted; see MGCWardenQuarantineMovement::createReturnForEntry), what became of the case, and whether a sibling entry is still outstanding under it. THE CASE MAY LEGITIMATELY NOT CLOSE, and a test must not read that as a failure. Two situations leave it open or unchanged and both are Completed: another entry is still Quarantined or Aged for the case, or the case was already Closed; the orphan shape a pre-#1998 double quarantine leaves behind once a write-off has closed the case. The promised post-state is the ENTRY's, deliberately, because the entry is what this operation acts on. PROPOSER IS NOT CONFIRMER, EXACTLY AS IN THE CLIENT. Nothing here compares users itself. The comparison is against curUserId(), which on this channel is the authenticated caller: a test proposes as one user and confirms as another, exactly as two people must in the client. The pure rule is asked once more at the end, only to classify a return that did not happen; it records nothing. WHEN THE COUNT POLICY DEMANDS A PER-STAGE SIGNATURE THIS COMES BACK REFUSED, never resolved unsigned.

  • Visibility: public
  • Returns: MGCWardenApiResult The result; RecordKey is the WardenMissingQueueEntries key.
NameTypeOptionalDescription
_recordIdRefRecIdNoThe MISSING entry's RecordId, the key of WardenMissingQueueEntries.
_reasonCodestrNoThe confirmer's reason code; required.

resolveToStockCounted​

The resolveToStock operation as its service endpoint runs it: runs resolveToStock and counts the call for Magicite's usage report (MGCWardenApiDispatch::counted).

  • Visibility: public
  • Returns: MGCWardenApiResult
NameTypeOptionalDescription
_recordIdRefRecIdNo
_reasonCodestrNo