Next function to fix
get_next_itemGet the next function to fix from the current trusted run, returned as a work packet with source and context. Use it to start a fix, or request multiple packets by setting top.
Instructions
Returns the next function to fix as a work packet, the newest trusted run's worst row by crap. Use it to start a fix, list_worklist to survey the same run by risk, and get_function_brief once a function is chosen. It runs no tests, and empty true means the queue is spent, not the work, so read reasons. Filters cut before top counts: top 3 with exclude ["tests/"] returns the three worst rows outside tests, and an unknown scope name is a config error.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| top | No | return the next N packets as items instead of one item (N >= 1, default 1) | |
| repo | No | path to the scored repo's root (default: the repo the server was started in) | |
| scope | No | restrict the ranking to these declared scopes (exact [[scope]] names from crapkit.toml, one --scope each) | |
| exclude | No | skip rows whose path or long function name contains any of these fragments (one --exclude each) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| item | No | the one packet, present when empty is false and top is absent or 1 | |
| empty | No | true when the queue has nothing to hand out; then reasons is present and item and items are absent | |
| items | No | up to top packets in crap-descending order, present when empty is false and top is above 1 | |
| stale | No | true when the run's commit is not HEAD, so cov, crap and uncovered_lines describe an older tree; crapkit coverage --reuse-unchanged (get_function_brief's commands.refresh) clears it | |
| commit | No | that run's commit, full sha | |
| run_id | No | id of the run these numbers come from: the newest trusted run (a coverage run, or a verify run whose verdict passed) | |
| schema | No | payload schema version, 1 | |
| reasons | No | why the queue is empty, present only when empty is true; the stop condition is empty true with skipped_claimed and no_lane_over_target both 0 or absent | |
| skipped_claimed | No | rows another session's claim hid; present only when non-zero, and list_claims names the holders | |
| skipped_no_lane | No | rows above the floor that no lane measures, kept out of the ranking because their cov 0 is a tooling gap, not a testing gap |