mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-28 03:12:46 +01:00
feat(assert): scripted pass/fail checks over a recording's findings, log, motion and notes
assert <session> --check "<kind> <args> <metric><op><number>" evaluates checks with the existing analyses (findings, logq, motion, blank, annotations), one Check trait and one registry line per kind. Exit 6 (ExitKind::Assertion) when a check fails; checks that cannot be measured are errors (2/3/4), never a pass. JSON envelope assert/1.
This commit is contained in:
1 parent
e7283ae45d
commit
13713d65e8
11 files changed
+1768
-6
No files matched your search
@@ -14,7 +14,7 @@ komorebi-recorder guide # the playbook, for an agent
|
||||
Every command takes `--json`, which prints an envelope `{ok, schema, data, warnings, truncated, next_cursor, error}`;
|
||||
`komorebi-recorder schema` lists the schemas and `komorebi-recorder schema brief/1` prints one. Exit codes: 0 ok, 1
|
||||
error, 2 usage, 3 not found, 4 the session cannot answer (still recording, or the recorder died: `reindex` it), 5 over
|
||||
budget.
|
||||
budget, 6 an `assert` check did not hold.
|
||||
|
||||
## The viewer
|
||||
|
||||
@@ -127,6 +127,7 @@ and `event:12.end` when it finished.
|
||||
| `framediff A B [--region ..] [--png FILE] [--against SESSION]` | How two frames differ: changed share, mean and peak brightness delta, the box of change, and a PNG with the changed pixels in red |
|
||||
| `blank --region x,y,w,h` | When a region was blank (one colour, named: `white`, `black`, a hex code) or frozen (identical to the frame before): "the window went white for 200 ms" |
|
||||
| `compare A B` | Two recordings side by side: duration, frames, effective fps, worst frame gap, motion, findings by kind, annotations, and the difference |
|
||||
| `assert --check "KIND ARGS METRIC<=N"` | Pass/fail checks for a scripted scenario, repeatable. Kinds: `findings kind=K [severity=S] count<=N`, `log "<logq query>" count==N`, `motion [region=x,y,w,h] [from=T] [to=T] segments\|active_ms\|peak_share<=N`, `blank region=x,y,w,h [from=T] [to=T] [color=white] ms<=N`, `annotations kind=note\|bug\|finding count>=N`. Operators `== != <= >= < >`. Prints `PASS`/`FAIL` per check; exit 0 if all pass, 6 if one fails, 4 if one cannot be measured (no video), 2 if malformed. `--json` gives `assert/1` |
|
||||
| `annotate`, `annotations` | Add, change and list bug regions, notes and findings |
|
||||
| `mark TEXT` | While recording: drop a named point note (author `script`) onto the timeline from a script; it then appears in `annotations`, `brief` and the viewer like any note |
|
||||
|
||||
|
||||
@@ -144,6 +144,31 @@ It marks the session named by `--session DIR`, else by the environment variable
|
||||
still running. A recording that has finished is refused: it has no "now" to mark; use `annotate <session> add` with a
|
||||
time instead. `--json` prints the `mark/1` envelope.
|
||||
|
||||
### Checking the result from a script
|
||||
|
||||
`assert` turns the recording into a pass or fail, so the same script that reproduces the bug can end by saying whether
|
||||
it happened. The exit status is the result: 0 when every check holds, 6 when one does not, 4 when one could not be
|
||||
measured (for example `motion` on a recording without video) and 2 when a check is malformed.
|
||||
|
||||
```
|
||||
komorebi-recorder record --until-exit --out ./repro -- ./repro.sh # repro.sh calls `komorebi-recorder mark` between steps
|
||||
komorebi-recorder assert ./repro --check "annotations kind=note count>=3" --check "findings kind=layout-mismatch count<=0" --check "log \"level=ERROR\" count==0" --check "blank region=0,0,800,600 color=white ms<=100"
|
||||
```
|
||||
|
||||
```
|
||||
PASS annotations kind=note count>=3 (observed 4)
|
||||
FAIL findings kind=layout-mismatch count<=0 (observed 2)
|
||||
f-3a9c1e invariant:layout-mismatch at 00:03.280: ...
|
||||
PASS log "level=ERROR" count==0 (observed 0)
|
||||
PASS blank region=0,0,800,600 color=white ms<=100 (observed 0)
|
||||
1 of 4 check(s): 1 failed
|
||||
```
|
||||
|
||||
The first check confirms the script's `mark`s were recorded. A check is a kind, its arguments and a comparison
|
||||
(`== != <= >= < >`); the kinds are `findings`, `log` (a `logq` query), `motion`, `blank` and `annotations`, and
|
||||
times in `from=` and `to=` are any time the other commands take, including `event:N` and `bug:<id>`. `--json` prints the
|
||||
`assert/1` envelope. `assert` only reads the session.
|
||||
|
||||
### Without video
|
||||
|
||||
`komorebi-recorder record --no-video` records everything but the screen: komorebi's events and log, the OS trace and
|
||||
|
||||
Reference in new issue
Block a user