Harness Intelligence Wiki
Grilling

Property Testing in Delivery Brainstorm Brief

Property Testing in Delivery Brainstorm Brief

Status: brainstorm closed on 2026-10-28 with the user and Manuel (SWE, computation theory). Reopened and closed again on 2026-10-29 to add the five engineering principles and TLA-ts. Input to requirements-phase. No implementation has started.

1. Bounded System and Operators

  • System. The Harness delivery skills that shape and run tests and designs: requirements-grill, create-architecture, create-spec, create-plan (TDD shaping and plan schema), implement-spec with tdd, review-phase (Spec Axis), make-tsuite, domain-modeling, wait-what, and the effect skill. The skills' source is wearedevpunks/skills (local checkout ~/repos/skills, branch main).
  • Operators. Agents run these skills in consumer repositories (ci-app, apito, emera-platform). Humans approve specs and plans.
  • Target languages. TypeScript (Effect) first. Python is an open fork (§5).
  • Governing principles. The HI stack keeps Matt Pocock's five principles solid: Automated Review, Codebase Design, DDD & Ubiquitous Language, Mutation Testing, Feedback Loops.

2. Chosen Shape

A. Property testing through the pipeline

A human-approved rule moves down the pipeline until a test or a model enforces it:

  1. requirements-grill axioms carry a "checkable as" pattern hint.
  2. create-spec records an invariant table: rule → pattern → seam.
  3. create-plan tasks carry test_form and invariant_refs.
  4. tdd gets a properties.md reference: the pattern catalog and the spec signals that select each pattern, the order inside a slice, no generator narrowing, and replay evidence.
  5. review-phase Spec Axis checks that each invariant is covered in its declared form, and that any generator narrowing or rule loosening has recorded approval.
  6. make-tsuite merges a group of example tests that differ only in their inputs into one property.
  7. The effect skill teaches Schema → Arbitrary → it.effect.prop, plus a stateful property: a Schema array of tagged commands run against a fresh fixture per evaluation.

Pattern catalog: preservation, equivalence, round-trip, membership/monotonic, idempotence, security gate, oracle, no defects, and stateful command sequence.

B. Model checking with tsprover + tla-ts (T1–T5)

  • T1. Model checking returns, through tsprover (TypeScript models, *.proof.ts) and tla-ts (TLC-compatible checker, no JVM), each at a pinned exact version.
  • T2. create-architecture gets a model step. Trigger: two or more writers on shared state, a background job or retry that touches client-written state, recovery or resync, or a delivery guarantee. A violation trace returns as a compile gap to requirements-grill.
  • T3. A model lives next to the Effect service or feature it models, scoped to one service; the composition file is the map. CI runs tsprover on committed models and a violation fails CI.
  • T4. Each model counterexample trace becomes a Pinned Replay of a stateful property on the real code (tdd/properties.md).
  • T5. Acceptance pilot: the ci-app #402 entity change log and SSE resync, modeled before it ships.

C. Mutation testing as a Sensitivity Proof (P1)

A test that passes on its first run (a property against existing code, a characterization test, a model invariant) counts as evidence only with a Sensitivity Proof: a named mutant makes it fail, a diff against the pristine file proves the mutant landed, and a revert diff proves the file is clean again. It goes into tdd, tdd/properties.md and make-tsuite.

D. tdd alignment with upstream (P2 + refactor move)

  • Add the upstream Tautological anti-pattern, with the oracle-property warning.
  • Move refactoring out of the tdd loop, as upstream did; refactoring belongs to the per-task $simplify step and to review.

E. Glossary path (P3)

Fix the gap between skills that read GLOSSARY.md and HI's wiki-hosted glossaries (ask-hi/references/known-gaps.md:14). In scope for this delivery.

3. Rejected Shapes

  • Binary-level proof (Anthropic/Theorem method). V8 and CPython are too large and too dynamic.
  • A proved twin in Lean, Dafny or Rocq. Too costly for bugs that are mostly lifecycle, environment and concurrency errors.
  • LemmaScript. User: "confirmed no lemmascript". It is a tech preview, cannot model real await, and models number as an integer.
  • Quint. Superseded by tsprover + tla-ts: the same TLA+ semantics with TypeScript models and no new language.
  • Tool-based mutation testing (P5, for example Stryker or mutmut). Parked until a make-tsuite audit needs a mutation score.
  • Full upstream drift adoption of tdd, codebase-design and domain-modeling (P4). Parked as a separate delivery; only §2.D comes in now.

4. User-Stated Preferences

  • "we are to expand on how to encode this into tdd and the overall delivery-phase skills, and to include guidance in effect skill so we instruct about schema and arbitrary and it.effect.prop for property testing"
  • "ok then. we only go for property testing" (2026-10-28; superseded for model checking on 2026-10-29)
  • "i agree with this" (the candidate set C1–C4, C7, C9, plus stateful properties).
  • "so lets make sure that hour whole HI-stack keeps these principles solid and sound."
  • "we could try reopening the formal verification thing (we discarded since it was java runtime based) and understand how it can be useful for us, where it can fit"
  • On TLA-ts: T1 "yes good", T2 "yes", T3 "yes"; on the whole candidate set: "good agree all".
  • On the glossary gap: "yes lets fix glossary path".
  • On Tautological and the refactor move: "integrate these into our tdd then".
  • On mutation testing: "ok lets fix this. how?"
  • Manuel (Granola notes): "These patterns can be encoded into a skill so the AI knows where to apply property testing automatically."

5. Open Forks

  • F1 Order inside a slice. Default: example tracer bullet first, then the property as a generalisation step. A pure total function may start with the property.
  • F2 Run policy for properties. Default: CI runs every property. Pure properties use the default run count and DB-backed ones a reduced count. Each found counterexample becomes a pinned replay. Deep runs happen locally at RED/GREEN. Manuel proposed running properties locally only.
  • F3 Proof of value. Default: one throwaway bug replay as acceptance evidence, plus the T5 pilot.
  • F4 Python. Default: in scope. Add a pointer and Hypothesis specifics to python-testing-patterns.
  • F11 Sensitivity Proof scope. Default: every test that passes on its first run, every new property and every committed model invariant.
  • Planning input for create-plan, not a grill fork: rollout order C4 → C3 → C2 → C1, then C7.

6. Evidence Anchors

  • Timing on effect@4.0.1 (machine load average ~16): 100 runs of a 10-field record take ~20 ms to generate; a JSON round-trip takes ~24 ms; 25 runs at 5 ms per case take ~135 ms. Generation costs ~0.15 ms per run; the code under test dominates.
  • The benchmark found a real defect: Schema.Number generates NaN/Infinity, so a JSON round-trip fails; Schema.Finite passes.
  • ci-app has 3,211 test files and no property tests (search on 2026-10-27).
  • PR evidence: ci-app #310, #347, #353, #356, #363, #381; apito #34.
  • effect@4.0.1 dist/Arbitrary.d.ts: schema, checkEffect, CheckOptions{runs,size,seed,replay}, @stability unstable; it has no command or scheduler API. @effect/vitest@4.0.1: it.prop and it.effect.prop accept Schemas or Arbitraries.
  • aidenybai/tla-ts b1578d0; npm tla-ts@0.0.3 (2026-10-29, MIT, no dependencies) and tsprover@0.0.2. check() returns status and a structured violation.trace (action, label, state per step).
  • tsprover smoke test of #356 (two clients, refetch, hash job): the bug model fails staleOnlyByOtherClient with trace save("a") → hashJob in 0.73 s; the fixed model passes 109 states with liveness in 0.71 s; with @fair removed, liveness hashPending fails.
  • mattpocock/skills 59db609: no mutation-testing skill; diagnosing-bugs/SKILL.md:125 requires a diff against a pristine copy to prove a forced mutation landed; upstream tdd has the Tautological anti-pattern and "Refactoring is not part of the loop". HI tdd is pinned at 62f43a1 and still has a Refactor step (tdd/SKILL.md:118-128).
  • implement-spec/references/parallel-worker-brief.md:58 already runs $simplify on each task's changed code once GREEN.
  • HI has no root GLOSSARY.md or GLOSSARY-MAP.md; domain-modeling and wait-what read GLOSSARY.md; 18 wiki domains/*-glossary.mdx pages exist; ask-hi/references/known-gaps.md:14 records the gap.

On this page