|
2026-09-24
| ||
| 00:52 | • Ticket [aa28c880b6] Ticket reports: saved, named queries over the tracker status still Closed with 1 other change artifact: 62494903f9 user: zeitgeist | |
|
2026-08-23
| ||
| 10:22 | • Closed ticket [aa28c880b6]. artifact: d459d7bcda user: ai-local | |
|
2026-08-19
| ||
| 12:10 | • Ticket [aa28c880b6]: 1 change artifact: 0db76d007b user: dmestas | |
| 11:04 | • Ticket [aa28c880b6]: 2 changes artifact: ddca166126 user: dmestas | |
|
2026-08-18
| ||
| 21:06 | • New ticket [aa28c880b6]. artifact: e2c70559da user: dmestas | |
Ticket reports: saved, named queries over the tracker
## How fossil does it
A `reportfmt` table in the repository holds saved reports: `rn` (integer key), `title`, `owner`, `sqlcode`, `cols`, `mtime`, and a `jx` JSON column carrying a `tag` for stable naming. Surfaces are `/reportlist`, `/rptview`, `/rptnew`, `/rptedit`, `/rptsql`. A report is addressable three ways โ by `rn`, by title, and by `jx->>tag`.
The report body is literal SQL against the TICKET/TICKETCHNG tables. Column naming drives presentation: a column named `bgcolor` colours the row rather than being displayed.
## What quarry must NOT copy
Storing user-authored SQL and executing it. Fossil can do this because its reports are admin-authored config on a repository the admin already controls. quarry serves 23 stores from one process with one index handle each; arbitrary SQL from a form is a read-anything primitive across a shared surface, and `ATTACH`, `pragma` and `load_extension` are all reachable from a SELECT.
## Recommended shape
A **structured filter**, not SQL:
- Predicates over indexed ticket fields: field, operator (is / is-not / contains / before / after), value. AND-ed, which covers essentially every real report. - Sort field and direction. - Persisted per repository in the forge OLTP (`ticket_report`: repo, tag, title, owner, spec JSON, mtime), NOT in the index โ a report is authored state, not derived, so 0001 ยง11 says it may not live somewhere wipeable. - Compiled to parameterised SQL by quarry. The user chooses fields and operators from what the schema actually has; they never supply syntax.
This is strictly less expressive than fossil and covers the real cases. If a genuine gap appears later, the answer is more operators, not an SQL box.
## Surfaces
- `report.list`, `report.get`, `report.save`, `report.delete` ops; the query itself is `ticket.list` with a spec. - `/r/{repo}/ticket?report=TAG`, and a report picker beside the open/all toggle. - Report authoring gated at write on the repository, matching fossil admin-only reports.
## Depends on
Nothing. This is pure read over the folded `ticket` and `ticket_field` tables that already exist. `ticket_field` will want an index on `(name, value)` for predicate pushdown; measure before adding it.
Shipped as saved views, without the part this ticket said not to copy: no user-authored SQL. A saved view is a NAME for a report URL the tracker can already produce, stored per account and per listing, and it appears in the rail with a way to forget it. Works on a repository tracker and on the cross-repository /tickets listing.