Contention Console v5.3.0-stable

STATUS: OPERATIONAL

NODE: SHADOWCLONE-MAIN-01

/// INITIALIZING CONTENTION SCENARIOS

> Select a scenario to drive ScopedResourceManager's decision logic by hand.

> awaiting execution...

ABOUT shadowClone.js

This console is a browser-side mirror of the decision points inside the real ScopedResourceManager — it reimplements the branching logic (not the async machinery: no real setTimeout, no real structuredClone, no real Promise queue) so you can drive it by hand and see exactly which typed outcome a given state produces, without waiting on real timers.

ScopedResourceManager core guard
.withScope() entry point
.getMetrics() observability
.shutdown() waits for idle
ChainedHashTable / Shadow
makeShadowCloneable()
autoGuard() / secureModule()
TieLedger + aging
RetryLedger
NoCloneLedger
explicitTry()
StrictThrottler
RuntimeInvariantError
ThrottlingExhaustedError
TimeoutExceededError
OperationCancelledError
QueueOverflowError
// npm install, no deps, then:
import { ScopedResourceManager, ChainedHashTable } from "./shadowClone.js";

const mgr = new ScopedResourceManager(new ChainedHashTable(), { resourceId: "MemoryLobe" });

const result = await mgr.withScope("user:alice", async (res, isEphemeral, signal) => {
  if (signal.aborted) return; // cooperative early exit
  res.set("user:alice", 42);
  return res.get("user:alice");
}, 1000); // timeoutMs

// cancel one specific call from the outside:
const controller = new AbortController();
mgr.withScope("user:alice", op, 1000, { signal: controller.signal });
controller.abort(); // rejects with OperationCancelledError

> NOTE: the real module's clone merge-back is last-writer-wins per key and only happens on a successful clone operation — a thrown or timed-out clone is discarded unmerged. That distinction is exactly what the SCOPE_GUARD scenario below lets you toggle and observe.

> NOTE (v5.3.0): a timed-out operation keeps running in the background — JS can't preempt it — so the scope's lock/clone-slot now stays held until it actually settles, not until the race is merely lost. See RETRY_CANCEL for the retry-vs-cancel distinction this enables.