Explicit dedup_key, key lookup, link API, creator attribution and a reopen window for automated reporters (thor#1 contract) #123

Closed
opened 2026-11-25 19:34:11 -05:00 by jared · 0 comments
Owner

Part of the ticket contract between gandalf, hwmonDaemon and thor, decided in the thor#1 planning session (2026-11-25). The full plan is posted on LotusGuild/thor#1.

Why

helpers/TicketHash.php guesses "the same problem" from title keywords. That has three real failure modes:

  • Different problems merge. A title with no recognised keyword (for example "Unexpected reboot") gets an empty category, so every such auto ticket for a host shares one hash. Ticket 906739396 was opened for the 2026-10-27 compute-storage-01 outage, but its description was later overwritten on 2026-11-04 by a storage-01 outage, because both hashed the same.
  • Small wording changes re-key. "LXC 154" files under storage/lxc_154, "CT 154" under whatever keyword comes next.
  • Two apps on one hash overwrite each other. Title and description are refreshed by whichever reporter posted last.

Each reporter knows what "the same problem" means for its own checks, so the reporter should send the key and Tinker should enforce it exactly, keeping the atomic FOR UPDATE lookup (hwmonDaemon runs on 7 hosts at once). Pure client-side dedupe was considered and rejected: it can't give one ticket per incident across three apps without a shared lookup, and it loses track whenever a client's state is lost.

Changes requested

  1. Optional dedup_key on create_ticket_api.php.
    • Format ^[a-z0-9_.:-]{1,128}$, convention scope:subject:kind, e.g. host:compute-storage-01:oom, cluster:ceph:BLUESTORE_SLOW_OP_ALERT, site:rack1:power.
    • When present: hash = sha256("key:" + dedup_key) and keyword sniffing is skipped. The key: prefix keeps these hashes from ever colliding with legacy ones.
    • Stored in a new indexed column.
    • Callers that don't send it keep today's behaviour exactly.
  2. Lookup by key: GET api/tickets_api.php?dedup_key=... returns the matching ticket in any status (read scope). Thor uses this to find the ticket for an incident.
  3. Link API: POST api/ticket_link_api.php {ticket_id, other_ticket_id, relation} plus an unlink call, read_write scope, through the same DependencyService the web UI and MCP use, so audit entries match. Thor links symptom tickets to the root-cause ticket with relates_to.
  4. Creator attribution: record the API key's name (gandalf, hwmonDaemon, thor) as the ticket's creator, or in a new source column, instead of "System". Filterable in the list API and the UI.
  5. Reopen window for every automated caller (the operator wants the same rule for all three apps):
    • A create that matches a Closed ticket which closed under 7 days ago (configurable): reopen it, as today.
    • Closed longer ago: create a new ticket with the same key, link it relates_to the previous one, and add a history line (how many times in the last 7 and 30 days, when it last cleared). Response action: new_recurrence.
    • This replaces today's reopen-forever for Gandalf, hwmonDaemon and Thor alike.
  6. Backfill per app, not all at once: when an app starts sending keys, a script (like scripts/rehash_network_tickets.php) sets dedup_key on that app's existing open auto tickets, using the key scheme that app documents, so the switch doesn't open duplicates. Thor will adopt the open Ceph tickets (673679581, 629475198, 534304596, 510172934) this way when Ceph moves from hwmonDaemon.

Out of scope

  • The description refresh on dedupe stays. With per-owner keys, only the owner refreshes its own description; other apps comment.

Related title change (no Tinker code change needed)

Titles get an app tag after [auto]: [source][auto][app][area] Summary [scope][environment][type], with [gandalf], [hwmon], [thor]. Checked against TicketHash.php: adding the tag (and Gandalf moving its tags into the standard order) changes no existing hash, since the first tag, the environment tags and the keyword sniffing are unaffected and network subtypes slug the heading with tags stripped. The wiki title standard is updated to match.

Related

LotusGuild/thor#1 (plan) · gandalf and hwmonDaemon contract issues (linked from thor#1)

Part of the ticket contract between gandalf, hwmonDaemon and thor, decided in the thor#1 planning session (2026-11-25). The full plan is posted on LotusGuild/thor#1. ## Why `helpers/TicketHash.php` guesses "the same problem" from title keywords. That has three real failure modes: - **Different problems merge.** A title with no recognised keyword (for example "Unexpected reboot") gets an empty category, so every such auto ticket for a host shares one hash. Ticket 906739396 was opened for the 2026-10-27 compute-storage-01 outage, but its description was later overwritten on 2026-11-04 by a storage-01 outage, because both hashed the same. - **Small wording changes re-key.** "LXC 154" files under `storage/lxc_154`, "CT 154" under whatever keyword comes next. - **Two apps on one hash overwrite each other.** Title and description are refreshed by whichever reporter posted last. Each reporter knows what "the same problem" means for its own checks, so the reporter should send the key and Tinker should enforce it exactly, keeping the atomic `FOR UPDATE` lookup (hwmonDaemon runs on 7 hosts at once). Pure client-side dedupe was considered and rejected: it can't give one ticket per incident across three apps without a shared lookup, and it loses track whenever a client's state is lost. ## Changes requested 1. **Optional `dedup_key`** on `create_ticket_api.php`. - Format `^[a-z0-9_.:-]{1,128}$`, convention `scope:subject:kind`, e.g. `host:compute-storage-01:oom`, `cluster:ceph:BLUESTORE_SLOW_OP_ALERT`, `site:rack1:power`. - When present: hash = `sha256("key:" + dedup_key)` and keyword sniffing is skipped. The `key:` prefix keeps these hashes from ever colliding with legacy ones. - Stored in a new indexed column. - Callers that don't send it keep today's behaviour exactly. 2. **Lookup by key:** `GET api/tickets_api.php?dedup_key=...` returns the matching ticket in any status (read scope). Thor uses this to find the ticket for an incident. 3. **Link API:** `POST api/ticket_link_api.php {ticket_id, other_ticket_id, relation}` plus an unlink call, `read_write` scope, through the same `DependencyService` the web UI and MCP use, so audit entries match. Thor links symptom tickets to the root-cause ticket with `relates_to`. 4. **Creator attribution:** record the API key's name (gandalf, hwmonDaemon, thor) as the ticket's creator, or in a new `source` column, instead of "System". Filterable in the list API and the UI. 5. **Reopen window for every automated caller** (the operator wants the same rule for all three apps): - A create that matches a Closed ticket which closed **under 7 days ago** (configurable): reopen it, as today. - Closed **longer ago**: create a new ticket with the same key, link it `relates_to` the previous one, and add a history line (how many times in the last 7 and 30 days, when it last cleared). Response `action`: `new_recurrence`. - This replaces today's reopen-forever for Gandalf, hwmonDaemon and Thor alike. 6. **Backfill per app, not all at once:** when an app starts sending keys, a script (like `scripts/rehash_network_tickets.php`) sets `dedup_key` on that app's existing open auto tickets, using the key scheme that app documents, so the switch doesn't open duplicates. Thor will adopt the open Ceph tickets (673679581, 629475198, 534304596, 510172934) this way when Ceph moves from hwmonDaemon. ## Out of scope - The description refresh on dedupe stays. With per-owner keys, only the owner refreshes its own description; other apps comment. ## Related title change (no Tinker code change needed) Titles get an app tag after `[auto]`: `[source][auto][app][area] Summary [scope][environment][type]`, with `[gandalf]`, `[hwmon]`, `[thor]`. Checked against `TicketHash.php`: adding the tag (and Gandalf moving its tags into the standard order) changes no existing hash, since the first tag, the environment tags and the keyword sniffing are unaffected and network subtypes slug the heading with tags stripped. The wiki title standard is updated to match. ## Related LotusGuild/thor#1 (plan) · gandalf and hwmonDaemon contract issues (linked from thor#1)
jared closed this issue 2026-11-25 20:24:56 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/tinker_tickets#123