Skip to content

fix(ticket): archive namespace isolation + no-ping transcripts (v3.1.42)#6

Merged
NindroidA merged 1 commit into
mainfrom
fix/ticket-archive-grouping-and-mentions
Jun 1, 2026
Merged

fix(ticket): archive namespace isolation + no-ping transcripts (v3.1.42)#6
NindroidA merged 1 commit into
mainfrom
fix/ticket-archive-grouping-and-mentions

Conversation

@NindroidA

@NindroidA NindroidA commented Jun 1, 2026

Copy link
Copy Markdown
Owner

Two archive bugs reported from prod.

1. Wrong-user archive (the email-import collision). Ticket archives group per user — createdBy for normal tickets, emailSender for email-import tickets. But an email-import ticket's createdBy is the importing admin, not the player, so a normal ticket the admin opened could match (and append into) an email-import archive sharing their createdBy → one user's ticket lands in another's thread. findExistingArchive now scopes each lookup to its own namespace via the isEmailTicket discriminator, so email-import and normal archives can never cross-contaminate.

2. Archived transcripts could ping people. Every forum post in the ticket and application archive paths now uses allowedMentions: { parse: [] }, and content is captured via cleanContent (mentions render as readable @name/#name, not raw <@id>). Historical transcript content can never notify users/roles or fire @everyone/@here.

Verified: tsc clean, biome clean, bun test 1172/0 (closeWorkflow 12/0 incl. a new cross-namespace regression test).

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed archive thread lookups to prevent cross-contamination between normal and email-import ticket archives when archiving tickets.
    • Updated transcript archival to disable mention notifications—historical messages now render mentions as readable text instead of pinging users, roles, or triggering @everyone/@here alerts.

Two archive bugs reported from prod.

1. Wrong-user archive: ticket archives are grouped per user (createdBy for
   normal tickets, emailSender for email-import tickets). But an email-import
   ticket's createdBy is the importing admin, not the player — so a normal
   ticket the admin opened could match (and append into) an email-import
   archive sharing their createdBy, landing one user's ticket in another's
   thread. findExistingArchive now scopes each lookup to its own namespace via
   the isEmailTicket discriminator (email→{isEmailTicket:true,emailSender},
   normal→{isEmailTicket:false,createdBy}), so the two can never cross.

2. Archived transcripts could ping people. Every forum post in BOTH the ticket
   and application archive paths now uses allowedMentions:{parse:[]}, and
   message content is captured via cleanContent — mentions render as readable
   @name/#name text instead of raw <@id>, and @everyone/@here/user/role can
   never notify when historical content is re-posted.

Verified: tsc clean, biome clean, bun test 1172/0 (closeWorkflow 12/0 incl. a
new cross-namespace regression test; updated the email-ticket lookup assertion).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 1, 2026 01:01
@coderabbitai

coderabbitai Bot commented Jun 1, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: fdca6b69-72f5-4ea4-af29-7d2f8ed9273a

📥 Commits

Reviewing files that changed from the base of the PR and between 5965e41 and 7206dca.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • CLAUDE.md
  • package.json
  • src/utils/application/closeWorkflow.ts
  • src/utils/fetchAllMessages.ts
  • src/utils/ticket/closeWorkflow.ts
  • tests/unit/utils/ticket/closeWorkflow.test.ts

📝 Walkthrough

Walkthrough

This patch (v3.1.42) fixes archive thread scoping for email-import vs. normal tickets and suppresses Discord mentions in archived transcripts. Email-import and normal tickets now use separate archive namespaces via isEmailTicket discrimination. Archived messages use cleanContent to render mentions as text, and posting operations set allowedMentions: { parse: [] } to prevent mention pings.

Changes

Archive and Transcript Mention Handling

Layer / File(s) Summary
Archive lookup scoping by ticket type discriminator
src/utils/ticket/closeWorkflow.ts, tests/unit/utils/ticket/closeWorkflow.test.ts
findExistingArchive now includes isEmailTicket discrimination, querying email tickets by guildId + isEmailTicket: true + emailSender, and normal tickets by guildId + isEmailTicket: false + createdBy. Tests updated to verify both paths prevent archive namespace leakage.
Mention sanitization via cleanContent in transcript extraction
src/utils/fetchAllMessages.ts
fetchMessagesAsTranscript now prefers cleanContent over raw content when mapping messages and replies, rendering mention syntax as readable names instead of Discord tokens.
Mention suppression via allowedMentions in archive posting
src/utils/application/closeWorkflow.ts, src/utils/ticket/closeWorkflow.ts
Archive transcript posting in both application and ticket closeWorkflow now sets allowedMentions: { parse: [] } on header and chunk messages when creating or appending to threads, preventing Discord mention parsing of archived content.
Release metadata and version updates
CHANGELOG.md, CLAUDE.md, package.json
Version incremented to 3.1.42 with changelog documenting archive scoping and transcript mention handling fixes.

🎯 2 (Simple) | ⏱️ ~12 minutes

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/ticket-archive-grouping-and-mentions

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@NindroidA NindroidA merged commit c80db99 into main Jun 1, 2026
1 of 3 checks passed
@NindroidA NindroidA deleted the fix/ticket-archive-grouping-and-mentions branch June 1, 2026 01:02

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants