GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||
GeezerVison is showing snappea.dev — Overview · Snap Pea docs Docs OverviewWhat P is, and how it differs from the tests you already write. Two clients each read a shared counter, add one and write it back. Your unit tests pass because they run the calls in one fixed order, but in production both clients can read 0, and one update is lost. P finds that ordering in milliseconds, from a short model of the design, before any service code exists. A model, a spec and your codeP is a language for writing small, runnable descriptions of a system's design. You use it to check two kinds of thing: You, or an agent, write a model of the design. snappea check runs it thousands of times, each with a different ordering of messages, and the spec flags any run that breaks a rule. None of your service code is involved.
How it differs from a unit testIn a unit test, you pick one scenario and its order of events. In a P test, you describe the setup, and the checker picks the order: which message arrives first and which component runs next. It runs thousands of orderings and stops at the first one that breaks a rule. counter0 A read– B read–
Two clients each read the counter, then write back what they read plus one. The answer should be 2. Simplified: each read here includes the counter's reply. The real model also lets each message wait in an inbox, so there are many more orderings.
Follow a counterexampleYour first model walks through the lost-update P code, its failure trace, and a design change that fixes it in the Playground. The same rules, checking your codeA spec observes events and asserts rules about them. This one checks an inventory service. Specs check models in the same way. Your code emits the events after each change succeeds, and your ordinary tests check them: There are helpers for Python, Rust, Java and Go. To check events from running services, see live observation across processes and snappea observe. The same emit calls can write production logs for Where P fits↺ bug found: change the design, update the model, check again Design. Write or update the design doc: components, messages, failure cases. AI agents are well suited to writing models: they can turn a design doc into machines and specs quickly, and rerun the checker after every change. Review the model boundaries and assumptions as well as the specs. The specs are the short, plain statement of what must always be true, and the part of the model worth reviewing line by line. What a passing check establishesChecks explore the model you wrote, including its input bounds, atomic operations and failure assumptions. Complete exploration covers that bounded model. A timed-out search may miss a bug. Coverage and mutation testing help find weak checks, but cannot establish that every requirement is represented. Application tests check the recorded events against the same specs; they do not automatically compare all implementation behavior with the model. Instrumentation and forced-interleaving tests need review too. Next
| |||||||||||||||
| You are visitor 01402775 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |