apply_rules
Re-run saved correction rules against takeoff rooms to apply deterministic deductions in one batch. Idempotent: skips rooms already covered; optionally scan a single sheet.
Instructions
Re-run the correction rules the takeoff arrived with (#207) — the lessons an estimator TAUGHT the canvas (#88): "every room like this loses the mechanical chase." A rule is a deterministic predicate (enclosed linework islands under a size cap, inside the rule's condition's rooms), never a re-prompt. Evaluation is the same pure rules.ts engine the canvas Preview runs; the commit is the one batch the canvas's Apply makes — ONE journal entry, undo_last takes the whole batch back. Everything lands reviewed: false (this server has no review gate), and the reply's per-rule disclosure — what each rule produced, what was skipped, with ids — IS your preview: read it, then view_sheet overlay:true. Idempotent by construction: any candidate an existing deduct already covers is dropped by the engine, so re-running after new rooms commit is the intended workflow and never double-deducts. Rules arrive ONLY via import_takeoff (minting a new rule is an estimator's correction and stays behind the canvas's human Preview→Apply gate); with none imported this refuses. Pass sheet to scan one sheet; omit it to scan every sheet holding the rules' rooms. Uncalibrated and scanned-raster sheets come back in skipped_sheets, named.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| sheet | No | Scan only this sheet (default: every sheet holding the rules' conditions' rooms) |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | Yes | ||
| rules | Yes | ||
| committed | Yes | Deducts committed across all rules — 0 is a result (idempotence) | |
| skipped_rules | Yes | Rules not evaluated, named — never silently dropped | |
| skipped_sheets | Yes | Sheets that could not be scanned (uncalibrated, or scanned raster with no linework mask) | |
| total_deduct_sf | Yes |