Skip to content
quarry View Ticket
Login

View Ticket

2026-09-24
00:52 • Ticket [dd828b32a1] Ticket capability audit against fossil: what we have, what we lack status still Closed with 1 other change artifact: 76df5703bf user: zeitgeist
2026-08-23
10:36 • Closed ticket [dd828b32a1]. artifact: 0bed3c5350 user: ai-local
2026-08-19
12:10 • Ticket [dd828b32a1]: 1 change artifact: c94bf3940b user: dmestas
11:04 • Ticket [dd828b32a1]: 1 change artifact: f438a0edd3 user: dmestas
10:11 • Ticket [dd828b32a1]: 2 changes artifact: 9f0d79a3b5 user: dmestas
10:11 • Ticket [dd828b32a1]: 2 changes artifact: cfd7d36b15 user: dmestas
10:09 • Ticket [dd828b32a1]: 2 changes artifact: a0184fccac user: dmestas
2026-08-18
20:55 • New ticket [dd828b32a1]. artifact: 45487b309a user: dmestas

Ticket capability audit against fossil: what we have, what we lack

Closeddd828b32a1928fb32d8aed70ab00ddfafb150309Created 104.1 days agoUpdated 68.0 days ago
Description2026-08-18 20:55:34
Audited against fossil own source and docs in the corpus we serve (`www/tickets.wiki`, `www/custom_ticket.wiki`, `src/tktsetup.c`, `src/report.c`), not from memory.

## What we already match

- **Artifact model.** Fossil folds ticket-change artifacts in timestamp order into a TICKET (current state) and TICKETCHNG (per-change) pair. quarry does the same with `ticket`, `ticket_field` and `ticket_change`. Derived and rebuildable on both sides. - **Append vs replace.** Fossil marks a J card to append rather than replace; `comment` is appended, most fields replaced. quarry handles the `+` prefix (`index.go`, CutPrefix) — 1,569 `+comment` cards in the fossil corpus fold correctly. - **New-style tickets.** Per-comment `icomment` with its own `mimetype`, rather than one concatenated `comment` in a single format. We fold and render both. - **Arbitrary schema on READ.** Trackers define their own columns; we render whatever fields a ticket carries rather than a fixed list.

## Fixed while auditing

- **private_contact was published.** Fossil labels it "Not publicly visible" and gates it behind capability `e` (`enable_output [hascap e]`). We rendered it to everyone: 2,650 values across the corpus, some of them real e-mail addresses in fossil own tracker. Now dropped outright, since quarry has no equivalent capability to gate on.

## Gaps, ranked

1. **No saved reports.** Fossil `reportfmt` table stores named SQL reports with owner and column config, served at `/reportlist`, `/rptview`, `/rptnew`, `/rptedit`, addressable by tag. This is how anyone works a tracker of tk size — "my open tickets", "severity>=3 in subsystem X". We have one list plus an open/closed toggle. Biggest functional gap by far, and the one a maintainer would notice first.

2. **Fixed write form.** Fossil admins define the ticket table (`/tktsetup_tab`) AND the new/view/edit forms (TH1 templates: `tktsetup_newpage`, `viewpage`, `editpage`, plus `com`, `keytplt`, `rpttplt`, `timeline`, `change`). quarry writes only title/status/resolution/comment, so a repository whose schema has `subsystem`, `priority`, `assignee` or `foundin` can be READ but not fully authored — quarry can never set those fields.

3. **No capability model for fields.** `e` is not the only one; fossil gates ticket surfaces on `r` (read), `n` (new), `w` (write/append), `a`/`s` (admin). quarry has read/write/admin per repository and nothing field-level, which is why the private_contact fix had to be "drop" rather than "gate".

4. **No `is_private` ticket support.** Two repositories in the corpus carry the field. Fossil can mark a whole ticket private; we index the field and ignore its meaning.

## Recommended order

Reports first — it is the largest gap, it is pure read, and it needs no schema work. Then field-level write, which needs a form driven by the repository schema rather than a fixed one. The capability model can follow, since dropping private fields is already safe.

Deliberately NOT recommending TH1. Fossil templates are a scripting language embedded in the repository config; adopting it would put an interpreter in quarry render path for a customisation problem a schema-driven form solves without one.

2026-08-19 10:11:06

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.

2026-08-23 10:36:34

Re-audited 2026-08-23 against fossil's own source in the mirror we serve (src/tktsetup.c zDefaultTicketTable), not from memory. Every gap this ticket ranked is now either shipped or tracked, so it closes.

Gap 1 — no saved reports: SHIPPED

Saved views: a NAME for a report URL the tracker can already produce, per account and per listing, in the rail with a way to forget one. Deliberately not fossil's reportfmt, which stores and executes user-authored SQL — this ticket said not to copy that, and it wasn't. Closed as aa28c880.

Gap 2 — fixed write form: SHIPPED for the default schema

Fossil's default ticket table has ten authorable columns: type, status, subsystem, priority, severity, foundin, private_contact, resolution, title, comment. quarry now writes nine of them. private_contact is the tenth and stays unwritten on purpose — fossil withholds it, so we do not author it either.

Three defects found and fixed while auditing:

  • The new-ticket form discarded four fields. It has always rendered Type, Severity, Priority and Subsystem, and ticket.new has always accepted them, but the web handler forwarded only title, status and comment. A reader filled four controls, was told the ticket was filed, and the values were gone. A control that accepts what you type and drops it is worse than one that is not there.
  • foundin could be read and never written. It was in the fold, in the detail page's field order, and in no write path at all — not the op, not the new form, not the edit form, not the sidebar editor. All four now carry it.
  • The sidebar editor listed six fields where the schema has nine. It is the control a writer actually sees (the read-only field table only renders for readers who cannot edit), so a field missing from it is a field nobody can set.

Regression test: internal/harness/ticket_fields_test.go files a ticket with every field the form offers and asserts each one survives.

Arbitrary custom columns remain unauthorable — tracked by 0eafaa19.

Gap 3 — no capability model for fields: repository-level SHIPPED, field-level TRACKED

RFC 0004 landed fossil's capability model natively, and every ticket op now declares real fossil letters: ticket.new n, ticket.set cw, ticket.get/list/config r. That is the model this ticket said we lacked.

What it did not buy: e exists in the model (it is half of the stock developer category "ei") and is enforced NOWHERE — no op declares it, and the ticket page cannot see the viewer's capabilities at all. So private_contact and contact are still DROPPED rather than gated, exactly as this ticket described, and the reason is now precise: the letter exists, the plumbing to consult it on a render does not. Tracked by 9561ac07.

Gap 4 — no is_private support: SHIPPED

The index carries a folded private column (a column, not a row in ticket_field, so the privacy filter costs no join — a filter that costs a join is one somebody eventually skips), with a migration that re-derives it from is_private cards on existing indexes. Listings, counts and facets all exclude it; ticket.set resolves through TicketByPrefixAll so a private ticket can still be edited and un-privated by a token-holder.

Stricter than fossil: private tickets are hidden from every reader rather than shown to e holders. Same root cause as gap 3, same tracking ticket.

What the recommendation said, and what happened

"Reports first, then field-level write, then capabilities." Reports shipped first, field-level write shipped for the default schema, capabilities remain. TH1 was not adopted, as recommended.