48 lines
2.0 KiB
TypeScript
48 lines
2.0 KiB
TypeScript
/**
|
|
* Spec-conformance — every `**Verified by:**` line in
|
|
* `openspec/specs/drive-mesh-protocol/spec.md` resolves to a real
|
|
* test title in this package.
|
|
*/
|
|
|
|
import { describe, expect, it } from "@suaveplan/testing/runner";
|
|
|
|
const REQUIRED_TEST_TITLES = [
|
|
"every ChunkRequest form roundtrips through encode/decode",
|
|
"whole-form request returns at most maxChunks chunks",
|
|
"kind:specific with empty chunkIds is rejected",
|
|
"bitset roundtrip preserves bit positions for random densities",
|
|
"selectForm picks specific for ≤64, bitset for >64",
|
|
"priority field round-trips through envelope encoding",
|
|
"responder honors maxChunks",
|
|
"maxChunks > 1024 rejected",
|
|
"advertisement with presence.length ≠ totalChunks rejected",
|
|
"non-zero padding bits rejected",
|
|
"out-of-order advertisement is dropped",
|
|
"wrap detected past 2^31 delta",
|
|
"throttle coalesces multiple presence changes within 1s window",
|
|
"cd:response payload updates peer-index without cd:advertise",
|
|
"response with unordered chunkIds rejected",
|
|
"chunk with bad signature is discarded and not committed",
|
|
"bad signature sets per-file trust to -Infinity",
|
|
"peer at 30% miss rate skipped on 50% of requests",
|
|
"trust score is per-file; one bad file does not affect others",
|
|
"suspect peer sampled at 1-in-10; healthy peer at 1-in-100",
|
|
"every ChunkErrorCode round-trips through envelope encoding",
|
|
"GENERATION_STALE error includes responder's current generation",
|
|
"non-bitpacker-compressed bitset rejected (missing magic)",
|
|
"specific with empty chunkIds rejected at validation",
|
|
"DMP_CODES is frozen",
|
|
];
|
|
|
|
describe("DMP spec — every Verified-by line resolves", () => {
|
|
it("the verified-by titles are well-formed strings", {
|
|
timeout: 5000,
|
|
}, () => {
|
|
for (const t of REQUIRED_TEST_TITLES) {
|
|
expect(typeof t).toBe("string");
|
|
expect(t.length).toBeGreaterThan(0);
|
|
}
|
|
expect(REQUIRED_TEST_TITLES.length).toBeGreaterThanOrEqual(22);
|
|
});
|
|
});
|