Summary
cost.assert_snapshot("name") currently fails with a raw numeric comparison error when costs regress:
assertion failed: snapshot 'heavy_computation_cost' cost regressed
left: 5123456
right: 4987654
This doesn't help the developer understand which instruction type increased or by how much.
Proposed Output
COST REGRESSION: heavy_computation_cost
┌─────────────────────┬────────────┬────────────┬──────────┐
│ Metric │ Baseline │ Current │ Delta │
├─────────────────────┼────────────┼────────────┼──────────┤
│ Instructions │ 4,987,654 │ 5,123,456 │ +2.72% ⚠│
│ Memory (bytes) │ 98,304 │ 98,304 │ +0.00% │
│ Fee (stroops) │ 1,245 │ 1,278 │ +2.65% ⚠│
└─────────────────────┴────────────┴────────────┴──────────┘
Threshold: 5.00% | Status: EXCEEDED on [Instructions, Fee]
Implementation Notes
- Extend
CostReport to store per-metric breakdowns
- Snapshot file format should be JSON for easy parsing
- Diff table should be printed to stderr on failure
Acceptance Criteria
Summary
cost.assert_snapshot("name")currently fails with a raw numeric comparison error when costs regress:This doesn't help the developer understand which instruction type increased or by how much.
Proposed Output
Implementation Notes
CostReportto store per-metric breakdownsAcceptance Criteria