Skip to content

Commit f3e0485

Browse files
committed
test: bind adaptive oracle expectations to environments
1 parent ef8e7f5 commit f3e0485

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/browser-adaptive-exploration.test.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ import { executeBrowserInteractionStep } from "../packages/runtime-playground/sr
1717
import { browserPreviewTopology, routeBrowserPreviewContextNetwork } from "../packages/runtime-playground/src/browser-preview-routing.js"
1818
import { closeHttpServer, listenLocalHttpServer } from "../packages/runtime-playground/src/preview-server.js"
1919

20+
function environmentBoundOracleFingerprint(value: string): string {
21+
return browserAdaptiveDigest("oracle", { environmentDigest: browserAdaptiveExplorationContract({}).environmentDigest, value })
22+
}
23+
2024
const modalFixture = `<!doctype html>
2125
<style>button,input,select { display:block; width:180px; height:30px; margin:8px; }</style>
2226
<button id="open-modal">Open dynamic modal</button>
@@ -532,7 +536,7 @@ test("URL-less policy-block console records correlate before promotion and prese
532536
const message = urlLess.result.transitions[0]?.observations.consoleErrors[0]
533537
assert(message)
534538
assert.equal(urlLess.result.transitions[0]?.observations.oracleFingerprints.length, 1)
535-
assert.equal(urlLess.result.findings[0]?.fingerprint, browserAdaptiveDigest("oracle", message))
539+
assert.equal(urlLess.result.findings[0]?.fingerprint, environmentBoundOracleFingerprint(message))
536540
assert.equal(urlLess.result.findings[0]?.fingerprint, attributed.result.findings[0]?.fingerprint, "removing console location must not change the historical console fingerprint")
537541

538542
const mixed = await runNetworkOracleFixture("block", "mixed", {}, true)
@@ -544,7 +548,7 @@ test("URL-less policy-block console records correlate before promotion and prese
544548

545549
test("same-URL product errors require a matching failure token before policy correlation", async () => {
546550
const productMessage = "same-URL product defect"
547-
const productFingerprint = browserAdaptiveDigest("oracle", productMessage)
551+
const productFingerprint = environmentBoundOracleFingerprint(productMessage)
548552
const evidence = await runNetworkOracleFixture("block", "blocked", {}, false, true)
549553
assert.deepEqual(evidence.result.transitions[0]?.observations.oracleFingerprints, [productFingerprint])
550554
assert.equal(evidence.result.findings[0]?.fingerprint, productFingerprint)
@@ -555,7 +559,7 @@ test("same-URL product errors require a matching failure token before policy cor
555559
assert(blockMessage)
556560
assert.equal(fingerprints.length, 2)
557561
assert(fingerprints.includes(productFingerprint))
558-
assert(fingerprints.includes(browserAdaptiveDigest("oracle", blockMessage)))
562+
assert(fingerprints.includes(environmentBoundOracleFingerprint(blockMessage)))
559563
assert.equal(finding.result.transitions[0]?.observations.networkFailureSummary?.policyBlocks, 1)
560564
})
561565

0 commit comments

Comments
 (0)