test: property-based tests for protocol-shaped code (RFC 001)

Adds fast-check + one tests/properties.spec.ts per protocol-shaped package
(llm/BlockAssembler, session, tools/schema DSL, agent-loop scheduling). The
tools suite includes the RFC 001<->005 composition property (generated args
satisfying a spec pass validateArgs), closing the validator/InferArgs drift
risk from ADR 0011. Loop properties are deterministic (settle on agent/status,
no sleeps).

The BlockAssembler suite found a real bug on first run: a duplicate block-end
at the same index overwrote an already-flushed block, so the streamed prefix
disagreed with final blocks(). Fixed (first close wins, matching the existing
straggler rule) + regression test. Graduates RFC 001 -> ADR 0013.
This commit is contained in:
Tianyi Cui
2026-06-14 00:06:25 +08:00
parent 89e63f1436
commit 2f6d3b8539
12 changed files with 601 additions and 2 deletions

View File

@@ -673,6 +673,7 @@ __metadata:
"@vitest/coverage-v8": "npm:^4.1.8"
"@yarnpkg/types": "npm:^4.0.1"
eslint: "npm:^10.4.1"
fast-check: "npm:^4.8.0"
knip: "npm:^6.16.1"
lefthook: "npm:^2.1.9"
publint: "npm:^0.3.21"
@@ -2829,6 +2830,15 @@ __metadata:
languageName: node
linkType: hard
"fast-check@npm:^4.8.0":
version: 4.8.0
resolution: "fast-check@npm:4.8.0"
dependencies:
pure-rand: "npm:^8.0.0"
checksum: 10c0/f72556a29db4ff386a8b6e50d420b06c7e5eaafff7db5560a99136c57d8d4777998155eb02d1bbeff396f575cc0b1442c8a1c4ddb798c4a919b542de1a1904ff
languageName: node
linkType: hard
"fast-deep-equal@npm:^3.1.1, fast-deep-equal@npm:^3.1.3":
version: 3.1.3
resolution: "fast-deep-equal@npm:3.1.3"
@@ -4048,6 +4058,13 @@ __metadata:
languageName: node
linkType: hard
"pure-rand@npm:^8.0.0":
version: 8.4.0
resolution: "pure-rand@npm:8.4.0"
checksum: 10c0/6414bbc1c6f45fb774173431c7205e79783b77cfae0e2145e741b6999363554dbd2f4210d2a5bc08683e0b2f6823198c9308766b1d0911e1dccd7beb8842f860
languageName: node
linkType: hard
"quansync@npm:^1.0.0":
version: 1.0.0
resolution: "quansync@npm:1.0.0"