Audit fixes: cache-hit node_id re-stamp, anon key, honest copy
Browse files* workflow_service: a step-cache hit now re-stamps the CURRENT
node's id onto the served StepResult. The prefix hash ignores node
ids, so a cached step written by a graph with different ids was
served verbatim (live-reproduced: an s1..s5 scenario run poisoned
a n1..n5 archive replay, which came back with node_ids s1..s3 the
frontend cannot map). NOTE this fix only repairs the id, not the
deeper pinned-cache identity hole — per-node seeds derive from
node ids but the pinned cache key does not include them, so
structurally-identical graphs with different ids can still serve
each other's draws under the same root seed (see audit report).
* FlowCanvas: ribbon-legend localStorage key renamed quaim-* ->
quda.* ("quaim" matched the identifying Space slug and shipped in
the VITE_ANON bundle, contradicting the doc's anon-audit claim).
* scenarios/doc: F3's expected stop corrected to the value the live
API actually produces (2,560 of 4096 shots; 512-shot batch
granularity makes "~2,400" unreachable). F1's comment no longer
claims its numbers match the archived record (different node ids
AND fidelity method; verified live: kept=1 vs archived kept=2).
* CompareView: interval-overlap tooltip no longer asserts the null
("difference is within noise"); overlap is a conservative screen,
not a hypothesis test.
Verified: tsc, both bundle variants, 77 backend tests green, anon
dist greps clean of jqub/jiang/yuchen/jovin/george mason/qudastudio/
nsf/quaim.
|
@@ -1335,7 +1335,13 @@ def _execute_pipeline(
|
|
| 1335 |
else:
|
| 1336 |
ctx.update(cached_ctx)
|
| 1337 |
_step_cache.move_to_end(prefix_key) # LRU refresh
|
| 1338 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1339 |
continue
|
| 1340 |
|
| 1341 |
# Cache miss: actually run the node. Stochastic handlers read
|
|
|
|
| 1335 |
else:
|
| 1336 |
ctx.update(cached_ctx)
|
| 1337 |
_step_cache.move_to_end(prefix_key) # LRU refresh
|
| 1338 |
+
# The prefix hash ignores node ids, so the cached result
|
| 1339 |
+
# may have been written by a graph with different ids —
|
| 1340 |
+
# re-stamp the CURRENT node's id or the frontend cannot
|
| 1341 |
+
# map this step back to its canvas node.
|
| 1342 |
+
yield cached_result.model_copy(
|
| 1343 |
+
update={"from_step_cache": True, "node_id": node.id}
|
| 1344 |
+
)
|
| 1345 |
continue
|
| 1346 |
|
| 1347 |
# Cache miss: actually run the node. Stochastic handlers read
|
|
@@ -403,7 +403,7 @@ here. Reviewers are vis people, not quantum people. Status per item:
|
|
| 403 |
vqc_2q_small, seed 336157917, auto-run), F2 multiverse board over
|
| 404 |
the bundled archive, F3 evidence funnel with ±2pp optional stop
|
| 405 |
(bell_state, 4096 shots, seed 424242, auto-run, early stop
|
| 406 |
-
|
| 407 |
card with the gate diff booted open (auto-run), F6 interval
|
| 408 |
comparison of the two most-replicated archive configurations.
|
| 409 |
Auto-run is sequenced through pendingRestore.autoRunAfter → the
|
|
|
|
| 403 |
vqc_2q_small, seed 336157917, auto-run), F2 multiverse board over
|
| 404 |
the bundled archive, F3 evidence funnel with ±2pp optional stop
|
| 405 |
(bell_state, 4096 shots, seed 424242, auto-run, early stop
|
| 406 |
+
at 2,560 of 4096 shots — bell's sampled point sits near 0.49), F4 lineage with the archived fork+replay, F5 QuCAD
|
| 407 |
card with the gate diff booted open (auto-run), F6 interval
|
| 408 |
comparison of the two most-replicated archive configurations.
|
| 409 |
Auto-run is sequenced through pendingRestore.autoRunAfter → the
|
|
@@ -303,7 +303,7 @@ export function CompareView() {
|
|
| 303 |
A {(va * 100).toFixed(2)}% · B {(vb * 100).toFixed(2)}% · Δ(B−A){" "}
|
| 304 |
{((vb - va) * 100).toFixed(2)}pp
|
| 305 |
{overlap === true && (
|
| 306 |
-
<span className="text-warn ml-1" title="The two 95% intervals overlap — this
|
| 307 |
— intervals overlap: not evidence
|
| 308 |
</span>
|
| 309 |
)}
|
|
|
|
| 303 |
A {(va * 100).toFixed(2)}% · B {(vb * 100).toFixed(2)}% · Δ(B−A){" "}
|
| 304 |
{((vb - va) * 100).toFixed(2)}pp
|
| 305 |
{overlap === true && (
|
| 306 |
+
<span className="text-warn ml-1" title="The two 95% intervals overlap — at these shot counts this view cannot distinguish the difference from run-to-run noise (overlap is a conservative screen, not a hypothesis test: a formal test could still detect a smaller real difference). Run more replicates or raise shots before reading anything into it.">
|
| 307 |
— intervals overlap: not evidence
|
| 308 |
</span>
|
| 309 |
)}
|
|
@@ -1548,7 +1548,7 @@ function colorForKind(kind: NodeKind): string {
|
|
| 1548 |
}
|
| 1549 |
|
| 1550 |
|
| 1551 |
-
const LEGEND_LS_KEY = "
|
| 1552 |
|
| 1553 |
/** Canvas encoding key — a small dismissible chip anchored to the
|
| 1554 |
* bottom-left of the canvas (right of the React Flow zoom controls).
|
|
|
|
| 1548 |
}
|
| 1549 |
|
| 1550 |
|
| 1551 |
+
const LEGEND_LS_KEY = "quda.ribbonLegendDismissed";
|
| 1552 |
|
| 1553 |
/** Canvas encoding key — a small dismissible chip anchored to the
|
| 1554 |
* bottom-left of the canvas (right of the React Flow zoom controls).
|
|
@@ -56,10 +56,11 @@ const QUCAD_GRAPH = chain([
|
|
| 56 |
|
| 57 |
/** Sampled-fidelity pipeline with a big shot budget — the F3 graph.
|
| 58 |
* 4096 requested shots + a ±2pp target: bell_state's sampled point
|
| 59 |
-
* sits near 0.
|
| 60 |
-
*
|
| 61 |
-
* stops early
|
| 62 |
-
*
|
|
|
|
| 63 |
const FUNNEL_GRAPH = chain([
|
| 64 |
{ k: "input_circuit" },
|
| 65 |
{ k: "fake_backend", p: { backend_name: "FakeFez", shots: 4096 } },
|
|
@@ -97,8 +98,12 @@ export interface Scenario {
|
|
| 97 |
export const SCENARIOS: Record<string, Scenario> = {
|
| 98 |
// F1 — ribbon canvas after a run: tapered ribbons (width ∝ √gates),
|
| 99 |
// green shrink taper on the QuCAD edge, delta-strip glyphs on node
|
| 100 |
-
// faces, legend chip bottom-left. Pinned seed 336157917 (
|
| 101 |
-
// bundled vqc demo
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
F1: {
|
| 103 |
key: "F1",
|
| 104 |
expect:
|
|
@@ -128,7 +133,7 @@ export const SCENARIOS: Record<string, Scenario> = {
|
|
| 128 |
F3: {
|
| 129 |
key: "F3",
|
| 130 |
expect:
|
| 131 |
-
"Evidence funnel: sampled fidelity on bell_state, ±2pp target reached
|
| 132 |
graph: FUNNEL_GRAPH,
|
| 133 |
sampleKey: "bell_state",
|
| 134 |
pinSeed: 424242,
|
|
|
|
| 56 |
|
| 57 |
/** Sampled-fidelity pipeline with a big shot budget — the F3 graph.
|
| 58 |
* 4096 requested shots + a ±2pp target: bell_state's sampled point
|
| 59 |
+
* sits near 0.49 (ideal |00⟩ probability is 0.5); batches are 512
|
| 60 |
+
* shots each, and the Wilson interval first reaches ±2pp at the 5th
|
| 61 |
+
* batch — the run stops early at 2,560 of 4096 shots and the
|
| 62 |
+
* evidence funnel shows both the narrowing AND the stop (verified
|
| 63 |
+
* against the live API with seed 424242: 1251/2560, ±1.94pp). */
|
| 64 |
const FUNNEL_GRAPH = chain([
|
| 65 |
{ k: "input_circuit" },
|
| 66 |
{ k: "fake_backend", p: { backend_name: "FakeFez", shots: 4096 } },
|
|
|
|
| 98 |
export const SCENARIOS: Record<string, Scenario> = {
|
| 99 |
// F1 — ribbon canvas after a run: tapered ribbons (width ∝ √gates),
|
| 100 |
// green shrink taper on the QuCAD edge, delta-strip glyphs on node
|
| 101 |
+
// faces, legend chip bottom-left. Pinned seed 336157917 (borrowed
|
| 102 |
+
// from a bundled vqc demo draw) — but NOTE: this graph's node ids
|
| 103 |
+
// (s1..s5) and fidelity method (statevector) differ from the
|
| 104 |
+
// archived record (n1..n5, sampled), and per-node seeds derive from
|
| 105 |
+
// node ids, so the numbers do NOT reproduce the archived record's.
|
| 106 |
+
// The figure is reproducible via its own pinned seed.
|
| 107 |
F1: {
|
| 108 |
key: "F1",
|
| 109 |
expect:
|
|
|
|
| 133 |
F3: {
|
| 134 |
key: "F3",
|
| 135 |
expect:
|
| 136 |
+
"Evidence funnel: sampled fidelity on bell_state, ±2pp target reached at 2,560 of 4096 shots → early stop.",
|
| 137 |
graph: FUNNEL_GRAPH,
|
| 138 |
sampleKey: "bell_state",
|
| 139 |
pinSeed: 424242,
|