Skip to content

v0.8.7 — dedup idioms as trusted contracts

Choose a tag to compare

@tiagoschmitt tiagoschmitt released this 17 Aug 16:32
· 18 commits to main since this release

The answer to "my code already deduplicates — how do I satisfy the uniqueBy requires?": the verifier now reads the idiom.

const deduped = [...new Map(rules.map((m) => [m.key, m])).values()];
new FeeCalculator(deduped, item);   // uniqueBy obligation ✓ PROVED

Recognized shapes — Map-by-key grants uniqueBy(v, key); [...new Set(arr)] / Array.from(new Set(arr)) grant unique(v) — both also granting v.length <= arr.length, with the content havoc'd. Same trusted-idiom model as Array.prototype.sort. Works in the SSA translation path and in the call-site checker, and assume() statements now count as facts in scope at call sites — so a hand-written dedup with a documented assume discharges obligations the same way.

The contract grammar, complete: a requires is satisfied by proving, inheriting (the same requires on the caller), harvesting a schema fact (the canonical Set-size refine), assuming with a written justification, or now deduplicating with an idiom the tool reads.

Also: tRPC .input(Schema.standardSchemaV1(X)) is unwrapped — Effect's Standard Schema bridge was hiding the inner schema from handler-fact extraction. Two silent translation drops died along the way.

327 core tests — first fully clean serial run.