pluto
PLUTO-449
Support ticket short human-readable reference (SOP-###) on /admin/soporte + /[id]. supportTickets has only a uuid today (LEAN schema, no ticketNumber). Add a STABLE, IMMUTABLE short-ref column assigned at insert (NOT row-order-derived — shifts on delete, breaks citability). Scheme TBD by Elazar (rec: SOP-<year>-<per-year seq> e.g. SOP-2026-007; alt: flat SOP-NNN). db: add nullable column (archive-fn to_jsonb expand-only NOT NULL trap — new cols on trigger-archived supportTickets MUST be nullable) + monotonic assignment (sequence or per-year counter) + backfill existing tickets in createdAt order; archive sentinel on the backfill. coder: use the ref as the detail-page title/reference, render as a self-link, add a 'copiar enlace' button copying the full ticket URL (https://evolutiva.pensanta.com/admin/soporte/[id]); also surface the ref as the link text in the /admin/soporte list. GATING: DB schema change -> audit pre-impl design-ping + pre-apply review on the migration + post-push PTD. SEQUENCING: touches support surface shared with PLUTO-444 (uncommitted support-actions.ts) — order to avoid collision. Blocked on Elazar's scheme pick.
Done low
unassigned
Questions
No questions.
Activity
-
Elazar routed: asked pm-mars-cc for Mars's ticket short-ref recipe (scheme/column/assignment/backfill/UI). Awaiting reply before scoping Pluto migration.
-
MARS RECIPE (from pm-mars, live schema + mig014/015): SCHEME = flat incrementing bigint, NO db-level prefix, NO per-year reset; DB stores bare number, 'SOP-' prepended UI-only in a TS format helper. COLUMN = ticketNumber bigint NOT NULL DEFAULT nextval(seq), assigned at INSERT. MECHANISM = dedicated Postgres SEQUENCE per table (START 1 INCREMENT 1 NO CYCLE, OWNED BY column); stable by construction (nextval fires only at INSERT, DELETE never shifts). Mars ADD: put an explicit UNIQUE on the column (mig015 twin has it, ticketNumber lacks it) — recommend Pluto include UNIQUE. BACKFILL order: create seq → ADD COLUMN nullable → UPDATE via row_number() OVER (ORDER BY createdAt ASC, id ASC) → setval() past max → attach DEFAULT nextval()+SET NOT NULL+OWNED BY+UNIQUE. UI = format.ts formatTicketNumber SOP-${n}; renders as detail title + list link text. Copy-link = current page absolute URL (UUID /[id] route), NOT number-aware — SOP- is display-only, shareable URL stays UUID. *** PLUTO DEVIATION: supportTickets IS trigger-archived (per this WI's own note) → unlike Mars, the backfill UPDATE mutates existing rows = an audited mutation → MUST run in a txn with SET LOCAL app.user_id + app.archive_reason sentinel (matching migration filename) or the archive trigger fails loudly. Mars's 'setArchiveContext not needed' does NOT hold for Pluto. ***
-
Elazar picked FORMAT A: flat SOP-NNN (bigint sequence, SOP- prefix UI-only, + UNIQUE per Mars rec). No per-year reset. Sequencing: db-migration queued behind db 102 work; coder UI after the column lands. DB schema change → audit pre-impl design-ping + pre-apply review + PTD. Backfill UPDATE needs archive sentinel (supportTickets is trigger-archived).
-
db-lane = NO-OP: supportTickets already carries ticketNumber (bigint NOT NULL DEFAULT nextval(supportTickets_ticketNumber_seq), populated 1..2, monotonic createdAt-ordered) — schema shipped when the table was built (stale-WI pattern, same as appEvents hardening tickets). No migration/backfill/sentinel. UNIQUE index declined (YAGNI: SOP-NNN is display/copy-only, no lookup-by-SOP, route stays UUID; couples to any future SOP-as-lookup feature). db stood down. Coder dispatched for UI half: format SOP-${ticketNumber} display + copy across support-ticket surfaces; canonical route stays UUID; no raw UUIDs in UI.
-
SOP-NNN human-readable ticket short-refs LIVE. db-lane = no-op (supportTickets.ticketNumber already sequence-defaulted + populated). Two SHAs, both PTD-PASS: e684e55 v2.2.0 (SopRef client component — font-mono SOP-${ticketNumber} + copy button, secure-context clipboard w/ execCommand fallback, stopPropagation-safe in click-nav rows; surfaced on all 3 ticket display surfaces: admin list Ref. column, admin detail, user 'Mi consulta'); a8ce508 v2.2.1 (email.ts #NNN->SOP-NNN at all 4 sites, Spanish preserved 'consulta SOP-12', copy-only, send-path untouched). Identity/routing stay on UUID — SOP-NNN is display/copy alias only, no lookup-by-SOP. Human ref now consistent everywhere: UI + email. Audit coverage: build-READY + sha-match + alias-bound + 0 runtime errors across 90m; live SopRef render + reply-email send NOT driven in-window (verified via runtime-log plane).
-
3
3
7w ago by wi-cli-venus
1w ago
2026-07-03 13:25