Skip to content

ref: Remove unused exports - #3579

Merged
MathurAditya724 merged 7 commits into
mainfrom
chore/remove-unused-exports
Nov 18, 2026
Merged

MathurAditya724 merged 7 commits into
mainfrom
chore/remove-unused-exports

Conversation

@sentry-junior

@sentry-junior sentry-junior Bot commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

This deletes code that nothing uses and makes helpers private when only their own file uses them.

Before: 34 exports that nothing outside their file used were still exported or kept around, for example parseActor, buildSentryTraceUrl, recordAuthenticationUnlinked and getProductionConversationStore.
After: 21 of them are deleted, along with the unused db/schema/vector.ts, and the other 13 are private to their file.

The reader for old authentication_unlinked events stays.

Possible follow-up, left out because third-party plugins use them: isPrivateSource and experimental_context in @sentry/junior-plugin-api, and the ./testing subpath exports of @sentry/junior-sentry and @sentry/junior-vercel.

via @MathurAditya724.

--

View Session [Sentry]

@vercel

vercel Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
junior-docs Ready Ready Preview Nov 17, 2026 9:03pm UTC

Request Review

@github-actions github-actions Bot added the risk: high PR risk score: high label Nov 17, 2026

@sentry-junior sentry-junior Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks good to me. I checked every one of the 21 deleted exports and found no callers anywhere in the repo or in other getsentry repos. The recordAuthenticationLinked fold writes the same event and the same idempotency key as before. The check runs in about 7s without pnpm build. It fails on a new unused export and when an entry is fixed but still in the baseline. It ignores probes I added to every package exports file. pnpm lint and pnpm typecheck pass on top of current main.

Two small things:

  • Clash with #3569. No git conflict, but #3569 deletes 14 exports from packages/junior/tests/fixtures/slack/factories/events.ts that this baseline lists. With both merged, unused-code:check fails with 14 "no longer unused" errors. Whichever PR lands second needs a rebase that drops those entries from scripts/unused-code-baseline.json.
  • scripts/check-unused-code.mjs:8 and :99 say knip.json, but the file is knip.jsonc. The error message sends people to a file that doesn't exist.

For a follow-up: knip treats a module as fully used when a test does await import("@/chat/x") and keeps the whole namespace. An unused export I added to chat/sentry-links.ts wasn't reported. About 67 test imports work like this. Also, the 16 entries for the re-export block in packages/junior/src/reporting.ts look like an easy group to remove.

@github-actions

Copy link
Copy Markdown
Contributor

12 screenshot changes — 12 changed · 0 added · 0 removed

Review screenshots in Frameshift

Automation Run Details · Desktop
Automation Run Details · Desktop
Changed
Automation Skill Editor · Desktop
Automation Skill Editor · Desktop
Changed
Automation Skill Editor · Mobile
Automation Skill Editor · Mobile
Changed
Automations Expanded Row · Desktop
Automations Expanded Row · Desktop
Changed
Automations Expanded Row · Mobile
Automations Expanded Row · Mobile
Changed
Automations Expanded Row Light · Desktop
Automations Expanded Row Light · Desktop
Changed
Show 6 more changed screenshots
Automations Expanded Row Light · Mobile
Automations Expanded Row Light · Mobile
Changed
Automations Runs Filters · Desktop
Automations Runs Filters · Desktop
Changed
Conversation Attachment Zoom · Desktop
Conversation Attachment Zoom · Desktop
Changed
Conversation Attachment Zoom · Mobile
Conversation Attachment Zoom · Mobile
Changed
Inbox In Flight · Desktop
Inbox In Flight · Desktop
Changed
System Cache Share · Desktop
System Cache Share · Desktop
Changed

sentry-junior Bot and others added 4 commits November 17, 2026 20:04
Delete exports that nothing uses, and drop `export` from helpers that only
their own file uses. Add `pnpm unused-code:check`, which runs knip and fails
on an unused file or export that scripts/unused-code-baseline.json does not
list. The baseline holds the existing findings and can only shrink.

Co-Authored-By: Aditya Mathur <[email protected]>
Delete core's db/schema/vector.ts (#3586 moved its column types to the
plugin API) and the unused MemoryEmbeddingDimensions type, unexport
MAX_SEARCHED_EVENT_CHARS, add the vitest preload hook as a knip entry, and
drop isBriefsEnabled from the baseline now that main uses it.

Co-Authored-By: Aditya Mathur <[email protected]>
@sentry-junior sentry-junior Bot changed the title ref: Remove unused exports and fail CI on new ones ref: Remove unused exports Nov 17, 2026
@MathurAditya724
MathurAditya724 merged commit bafa715 into main Nov 18, 2026
52 checks passed
@MathurAditya724
MathurAditya724 deleted the chore/remove-unused-exports branch November 18, 2026 07:42

This branch was successfully deployed

1 active deployment
Preview – junior-docs — 3a303a50 Deployed Nov 17, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk: high PR risk score: high

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant