Skip to content
quarry Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a0184fccac03fb717ba83e5c38b22e7e81605940dbb3526c63b15683728035e0
Ticket: dd828b32a1928fb32d8aed70ab00ddfafb150309
Ticket capability audit against fossil: what we have, what we lack
User & Date: dmestas on 2026-08-19 10:09:24
Changes

  1. comment changed to:
    ## Audit: triage, measured against fossil
    
    Read against fossil's own sources at `references/fossil/src` (`tktsetup.c`,
    `report.c`, `schema.c`) and against our index schema and ops.
    
    ### What we have
    
    We **capture** everything and **query** almost none of it.
    
    `ticket_field` (index.go:133) stores every field verbatim, one row per
    (change hash, name), and `ticket.get` returns them. A real sqlite ticket
    comes back today carrying `severity=Minor`, `type=Optimization`,
    `status=Open`, `private_contact=<hash>`. The data is in the index.
    
    But the folded summary row — the only thing the list reads — is
    `id, created, updated, title, status, private` (index.go:151), with a
    single index on `updated DESC, id`. So `ticket.list` answers
    `id/title/status/updated` and nothing else.
    
    Net triage capability: hide closed tickets, and full-text search. No
    filter by severity, no sort by priority, no column choice, no view that
    two people can agree to call "the bug queue".
    
    ### What fossil has
    
    Two separable things, and the separation is the design.
    
    **1. Vocabulary — per-repository configuration, not a built-in.**
    
    The default ticket table (tktsetup.c:67) is
    `type, status, subsystem, priority, severity, foundin, private_contact,
    resolution`, with choice lists: priority `Immediate/High/Medium/Low/Zero`,
    severity `Critical/Severe/Important/Minor/Cosmetic`, status
    `Open/Verified/Review/Deferred/Fixed/Tested/Closed`, and twelve
    resolutions including `Works_As_Designed`, `Overcome_By_Events`,
    `Duplicate`, `Unable_To_Reproduce`.
    
    Crucially it is loaded as `db_get("ticket-table", zDefaultTicketTable)` —
    the schema is the *project's*, not the tool's. A tracker may add or drop
    fields, and fossil renders whatever it finds. Hardcoding
    `severity_choices` in quarry would mean we cannot faithfully render the
    trackers we have already ingested, which is most of the corpus.
    
    **2. Mechanism — saved queries.**
    
    `reportfmt` (schema.c:176): `rn, owner, title, mtime, cols, sqlcode, jx`.
    A report is a named, owned SQL SELECT plus a color key. That *is* fossil's
    triage UI — it chooses the columns, the ordering, and shades each row by a
    magic `bgcolor` column that is computed and then not displayed. The
    shipped example colors by status; the docs show the same shape keyed on
    priority instead.
    
    ### The part we must not copy naively
    
    Reports are user-authored SQL against the forge database. Fossil contains
    them with an SQLite authorizer (report.c:180), and it is not decoration:
    
    - only `SELECT` (anything else: "only SELECT statements are allowed");
    - reads restricted to a 13-table allowlist (`ticket`, `ticketchng`,
      `blob`, `event`, `tag`, `tagxref`, `mlink`, `plink`, `filename`,
      `backlink`, `unversioned`, `json_each`, `json_tree`) plus any table
      named `fx_*`;
    - `sqlite3_stmt_readonly()` as an independent second gate;
    - any column named `private_*` returns `SQLITE_IGNORE` unless the caller
      holds `RdAddr`.
    
    That last rule is our #8518c09b21 and #9561ac07b1, enforced one layer
    lower than we are proposing to enforce them — in the query engine rather
    than in a template. A saved-query feature without the authorizer is not a
    reports feature; it is arbitrary read access to the forge database.
    
    ### Recommendation
    
    Split this into the cheap 80% and the general mechanism.
    
    **Step 1 — fold the triage fields into the summary row.** The fold pass
    that writes `title` and `status` has the other fields in hand at that
    moment, so this is denormalize-at-write-time again, not a new source of
    truth. Add the fields, index them, and give `ticket.list` filtering,
    sorting and column choice. Real triage, no query language, no new attack
    surface. Keep the field set discovered from the tracker rather than
    hardcoded, per fossil's `db_get`.
    
    **Step 2 — reports (#aa28c880b6)** as the general mechanism, with the
    authorizer written in the first commit rather than added later.
    
    Step 1 is most of the value and is small. Step 2 should not start until
    the field-capability question (#9561ac07b1) has an answer, because the
    authorizer is where that answer has to live.
    
  2. mimetype: "text/x-markdown"