OrmaosDocs

Examples

agent-change

A billing tool in a git repository and a change a coding agent made to it, recorded before and after.

View as Markdown

A small billing tool. Every day it reads the orders (orders.json) and the returned goods (returns.json) and writes invoices.csv (one row per order, with its total) and refunds.csv (one row per return, with the amount to give back). tiers.json has the loyalty tier of each customer. All amounts are in cents. billing.py has the prices; run.py reads and writes the files. change.patch is a change a coding agent made to it.

Run it#

bash
python run.py
agent-change
$ python run.py
12 invoices, 3 refunds written

Recorded#

bash
ormaos run -- python run.py
agent-change
$ ormaos run -- python run.py
12 invoices, 3 refunds written
ormaos: r1 exit 0 in …: 1 Python process, 75 calls, 0 exceptions, 6 io
ormaos: not collected: io: writes to the 2 files opened at run.py:18: opened for writing, and no `write` call by Python code was seen on a file of that name: if it was written, that was inside C code (`print(..., file=f)`, `csv.writer`)
ormaos: saved in .ormaos/r1, next: ormaos tree r1:c1
agent-change
$ ormaos show
r1 exit 0 in …: 1 Python process, 75 calls, 0 exceptions (0 swallowed, 0 uncaught)
command: python run.py
code: git commit 5b23406de1, no uncommitted changes
io: 6 events (file 6)
not collected: io: writes to the 2 files opened at run.py:18: opened for writing, and no `write` call by Python code was seen on a file of that name: if it was written, that was inside C code (`print(..., file=f)`, `csv.writer`)
never recorded: values, and 20 more kinds of things (`ormaos show --full` lists them with the reason)
next: ormaos tree r1:c1 | ormaos io r1

After the change#

bash
git apply change.patch
ormaos run -- python run.py
ormaos diff r1 r2
agent-change
$ ormaos diff r1 r2
r1 -> r2, matched by place in the code and order, not by address
  r1: exit 0, 75 calls, 0 exceptions, 6 io events
  r2: exit 0, 113 calls, 0 exceptions, 82 io events
code: the two code versions differ: the same git commit 5b23406de1, and the uncommitted changes are not the same (none in r1, 1 file changed in r2)
calls: 1 of 11 places differ
  discount_percent at billing.py:10: none in r1, 38 in r2  [r2:c9]
exceptions: the same in both (0 groups)
io: 2 of 8 groups differ
  file open tiers.json (read)  at billing.py:11 in discount_percent: none in r1, 38 in r2  [r2:i5]
  file read tiers.json  at billing.py:12 in discount_percent: none in r1, 38 in r2  [r2:i6]
logs: the same in both (0 groups)
data: the same in both (0 places)
not compared: values, shapes of arguments and results, durations, cpu and memory, the lines of `path`, which process or thread an event was in
next: ormaos tree r2:c9 | ormaos io r2:i5 | ormaos io r2:i6 | ormaos show r1 | ormaos show r2

On this site the folder is made a git repository with one commit before the first recording, so that the recordings say which code ran.