Tutorial
Review a forum API
An agent built a forum. Can strangers read private threads? Who can edit a post? Does the reply cap hold? You can answer these without reading its code: Yichus runs requests on rows you choose, explains each run in sentences, and proves which rules hold over every handler.
Code & run Run the forum’s access policy
The tools report facts about the program and say what they could not measure. They do not score its design or approve it for you; you still judge whether it meets your requirements.
What you can ask
- What happened when
carol, who is not a member, asked for a members-only thread, and which of it holds for every caller. - Which follow-up run would tell you more, chosen by you from the tool’s proposals.
- How the handlers are written, and which one is written differently from its neighbours.
- What changed between the agent’s first draft and the delivered program.
- Which access rules are proven over every handler.
Here is one proven line: every write post_reply makes to the posts table happens after the members-only check on that thread.
Verbatim from docs/forum-demo/outputs/step1c-verify.txt, which scripts/forum-demo/replay.sh regenerates and a test holds this page to. Lines elided are marked ....
$ yichus api verify demos/service/forum.bosatsu
proven false
compiles proven
...
access:posts proven
...
Demo/Forum::post_reply tx_write on "posts": dominated by can_see(Principal.user_id, row of threads), on the row it was applied to (key thread_id)
...
Whether letting any member who can see a thread reply is the rule you wanted stays your call.
Reaching a verdict
A proven property counts once you have checked it says the rule you asked for and its assumptions match how you deploy. A single run can refute a rule but never establish it. When the materials cannot answer a question, the honest answer is Cannot tell, and your agent can name the run or report line that would settle it.
Start
Ask your agent to walk you through these readings on the forum, or on your own program. The organization lenses cover the pictures behind them.
Ask your agent about anything here; it has the detail.
Where this fits
What this is about: Lenses and Diagrams