feat: add BingShuo system body validation reflex
This commit is contained in:
parent
cd1c9203c6
commit
893f8e6781
25 changed files with 488 additions and 34 deletions
|
|
@ -12,6 +12,7 @@ import {
|
|||
safeCacheRelative,
|
||||
selfTest,
|
||||
sha256,
|
||||
waitForPublicSnapshotAcceptance,
|
||||
} from "./finalize-development.mjs";
|
||||
|
||||
test("the finalizer accepts only the registered Fifth Domain code channel", () => {
|
||||
|
|
@ -88,3 +89,37 @@ test("macOS AppleDouble sidecars are never parsed as JSON records", () => {
|
|||
test("receipt hashes preserve exact trailing bytes", () => {
|
||||
assert.notEqual(sha256(Buffer.from("{}")), sha256(Buffer.from("{}\n")));
|
||||
});
|
||||
|
||||
test("public snapshot acceptance returns the accepted exact commit", async () => {
|
||||
let calls = 0;
|
||||
const result = await waitForPublicSnapshotAcceptance({
|
||||
expectedCommit: "abc123",
|
||||
expectedAnchorVersion: "test.3",
|
||||
attempts: 2,
|
||||
delayMs: 0,
|
||||
probe: async () => {
|
||||
calls += 1;
|
||||
return calls === 1
|
||||
? { status: 503, body: { navigation_source: { source_degraded: true } } }
|
||||
: { status: 200, body: { navigation_source: { source_degraded: false, source_commit: "abc123", anchor_version: "test.3" } } };
|
||||
},
|
||||
});
|
||||
assert.equal(result.result, "PASS_100");
|
||||
assert.equal(result.attempt, 2);
|
||||
});
|
||||
|
||||
test("public snapshot acceptance fails closed with actionable source feedback", async () => {
|
||||
await assert.rejects(
|
||||
waitForPublicSnapshotAcceptance({
|
||||
expectedCommit: "new",
|
||||
expectedAnchorVersion: "test.3",
|
||||
attempts: 1,
|
||||
delayMs: 0,
|
||||
probe: async () => ({
|
||||
status: 503,
|
||||
body: { navigation_source: { source_degraded: true, source_commit: "old", anchor_version: "test.2", source_error_code: "snapshot_map_version_mismatch:lighthouse_paths" } },
|
||||
}),
|
||||
}),
|
||||
/PUBLIC_SNAPSHOT_NOT_ACCEPTED.*snapshot_map_version_mismatch:lighthouse_paths/,
|
||||
);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in a new issue