Skip to main content
← Back to list
01Issue
BugShippedSwamp CLI
Assigneesstack72

Relationships

#1010 Session credential revocation scans entire credential map on every dispatch completion

Opened by stack72 · 7/7/2026· Shipped 7/7/2026

Summary

`revokeDispatch` and `revokeAllForWorker` in `src/domain/remote/session_credential.ts` scan the entire `#byCredential` map to find matching entries. `revokeDispatch` is called on every dispatch completion (`worker_gateway.ts:366`), and `revokeAllForWorker` on every disconnect/grace-expiry. With a capacity-32 worker under churn, each of 32 completions triggers an O(total-credentials) scan.

Fix

Add secondary indexes for direct lookup:

```typescript readonly #byDispatch = new Map<string, string>(); // dispatchId → credential readonly #credentialsByWorker = new Map<string, Set>(); // workerId → Set ```

Populate them in `issue`, `issueForDispatch`, and `revokeForWorker`. Then:

  • `revokeDispatch`: look up credential via `#byDispatch.get(dispatchId)`, delete from `#byCredential` — O(1)
  • `revokeAllForWorker`: iterate `#credentialsByWorker.get(workerId)`, delete each from `#byCredential` — O(dispatches-per-worker), not O(total-credentials)

Files

  • `src/domain/remote/session_credential.ts`
  • `src/domain/remote/session_credential_test.ts`
02Bog Flow
OPENTRIAGEDIN PROGRESSSHIPPED+ 1 MOREASSIGNED+ 3 MOREFINDINGS+ 4 MOREPR_MERGED+ 1 MORENOTIFICATION_SKIPPED

Shipped

7/7/2026, 2:54:51 AM

Click a lifecycle step above to view its details.

03Sludge Pulse
stack72 assigned stack727/7/2026, 2:21:30 AM

Sign in to post a ripple.