Skip to content

Add has_transcript cleanup command - #11

Merged
biast12 merged 1 commit into
masterfrom
transcript-repair-utility
Sep 29, 2026
Merged

biast12 merged 1 commit into
masterfrom
transcript-repair-utility

Conversation

@biast12

@biast12 biast12 commented Sep 26, 2026

Copy link
Copy Markdown
Contributor

Description

Some tickets have has_transcript = true but no transcript in S3, e.g. guilds that imported v1 ticket data without the transcripts. The dashboard shows a "View" button for them that fails.

  • New cmd/fix-has-transcript: a one-off command that sets has_transcript = false for closed tickets whose transcript is missing from every bucket.
    • Checks all guilds by default. -guildid, -ticket, -csv and -after/-before narrow the scope; -dry-run only reports.
    • Prints each changed guild_id,ticket_id to stdout, which doubles as an undo list.
    • Uses logarchiver's DATABASE_URI/S3_* env; the main DB is passed with -dburi.
    • Safety: lists S3 twice before unsetting, skips tickets closed after the run started, aborts if recent transcripts can't be found (wrong env), and skips a guild on any error.
  • GetTicket: a missing key now returns ErrTicketNotFound, so GET / responds 404 instead of 500 and the dashboard shows "Transcript not found".
  • Upload handler: now responds 500 when the existing-object lookup fails. Before, it returned 200 without storing anything, so the worker set has_transcript = true for a transcript that was never saved.

Type of Change

  • Bug fix
  • New feature
  • Breaking change

Testing

  • Run the command end-to-end against local Postgres + MinIO:
    • open and reopened tickets
    • dry run, apply, -ticket, and a -csv round trip
  • Compared the server before/after: missing transcript 500 → 404, failed objects lookup 200 → 500, normal upload and GET unchanged.

Checklist

  • My code follows the style of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works

Add a fix-has-transcript command that detects missing transcript objects across S3 buckets and repairs ticket flags, with filtering, dry-run, retries, and concurrency support. Also return upload errors to clients and normalize lazy S3 missing-object errors to ErrTicketNotFound.
@biast12
biast12 requested a review from a team as a code owner September 26, 2026 22:20
@github-actions github-actions Bot added type:bug Bug Fixes type:feature New Feature labels Sep 26, 2026
@biast12
biast12 merged commit 92f0b13 into master Sep 29, 2026
1 check passed
@biast12
biast12 deleted the transcript-repair-utility branch September 29, 2026 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:bug Bug Fixes type:feature New Feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants