Problem
Once both browser-extension client packages are deleted (previous sub-issue), a substantial backend surface in the root Cloudflare Worker becomes unreachable dead code — it exists solely to serve those two clients, and nothing else in the repo calls it. Left in place, it's live, tested, auth-scoped code with zero real callers: a maintenance and audit-surface liability, not neutral dead weight (it still executes, still ships in the Worker bundle, still needs to pass every future security/auth review with no functional justification). This issue removes it.
Full audit findings (2026-07-25), all in src/:
src/api/routes.ts (7,180 lines total at audit time)
- The dedicated comment-delimited section
// ─── Extension contributor-context endpoints (#556) ─── and everything under it.
- Route handlers:
POST /v1/auth/extension/session, GET /v1/extension/pull-context, GET /v1/extension/contributors/:login/issue-fit, GET /v1/extension/contributors/:login/issue-badges, GET /v1/extension/contributors/:login/pr-status.
- Imports of
buildExtensionIssueFit, buildExtensionIssueBadges, buildExtensionPrStatus from ../signals/extension-contributor-context.
- Helper/type block:
ExtensionContributorContext, ExtensionPullContextSection, EXTENSION_REVIEWABILITY_TONES, buildExtensionPullContextPayload, sanitizeExtensionPrivateText, isExtensionScopedSession, isExtensionContributorScopedSession, EXTENSION_PULL_CONTEXT_SCOPE, EXTENSION_CONTRIBUTOR_CONTEXT_SCOPE, buildExtensionPublicSafePacket, buildExtensionPrivateBlockers, ensureExtensionPublicSafeText.
- Every call site passing
surface: "browser_extension" (confirm each is exclusively inside the code being removed before deleting the enum member in src/types.ts below — do not remove the type member if any surviving call site still sets it).
src/signals/extension-contributor-context.ts
Delete the entire file (137 lines) — redactExtensionText, buildExtensionIssueFit, buildExtensionIssueBadges, buildExtensionPrStatus, and the ExtensionIssueFit/ExtensionIssueBadge/ExtensionPrStatus types. Confirm no other file imports from it before deleting (at audit time, only src/api/routes.ts and its own test did).
src/openapi/spec.ts
Remove the three registrations: the /v1/auth/extension/session entry, the /v1/extension/pull-context entry (including its "Hard-coded by apps/loopover-extension... keep this path stable" comment — no longer applicable once that client is gone), and the path === "/v1/auth/extension/session" branch inside the auth-paths check.
src/auth/rate-limit.ts
Remove "/v1/auth/extension/session" from the SESSION_AUTHENTICATED_AUTH_PATHS set (and its preceding comment line referencing it), leaving "/v1/auth/github/token" as the remaining entry.
src/types.ts
Remove "browser_extension" from the ProductUsageSurface union type — only after confirming (per the routes.ts cleanup above) that no surviving call site anywhere in src/** still passes that literal.
Tests
- Delete
test/unit/routes-extension.test.ts and test/unit/extension-contributor-context.test.ts entirely.
- Regenerate
apps/loopover-ui/public/openapi.json (npm run ui:openapi) after the spec.ts edits and commit the result — it currently documents the three removed endpoints on the public /api reference page.
Requirements
- Every symbol/route/type listed above is confirmed to have zero remaining references anywhere in
src/** before its containing file/block is deleted — do not leave an unused-but-present helper behind "just in case."
npm run typecheck and the full unsharded npm run test:coverage pass after removal, with no coverage regression on any surviving line (deleting dead code should not lower codecov/patch-relevant coverage on anything still shipped).
npm run ui:openapi:check passes against the regenerated spec (no drift between spec.ts and the committed openapi.json).
Deliverables
Links & Resources
Parent epic; the package-deletion sub-issue (blocked-by — this cannot land until no client code references these endpoints). src/api/routes.ts, src/signals/extension-contributor-context.ts, src/openapi/spec.ts, src/auth/rate-limit.ts, src/types.ts.
Boundaries
Backend only — apps/** and root config/CI are already clean by the time this lands (both prior sub-issues). Do not remove ProductUsageSurface's other members or any other auth-scope constant unrelated to the extension surface.
maintainer-only — auth-scope and public API-surface authority.
Problem
Once both browser-extension client packages are deleted (previous sub-issue), a substantial backend surface in the root Cloudflare Worker becomes unreachable dead code — it exists solely to serve those two clients, and nothing else in the repo calls it. Left in place, it's live, tested, auth-scoped code with zero real callers: a maintenance and audit-surface liability, not neutral dead weight (it still executes, still ships in the Worker bundle, still needs to pass every future security/auth review with no functional justification). This issue removes it.
Full audit findings (2026-07-25), all in
src/:src/api/routes.ts(7,180 lines total at audit time)// ─── Extension contributor-context endpoints (#556) ───and everything under it.POST /v1/auth/extension/session,GET /v1/extension/pull-context,GET /v1/extension/contributors/:login/issue-fit,GET /v1/extension/contributors/:login/issue-badges,GET /v1/extension/contributors/:login/pr-status.buildExtensionIssueFit,buildExtensionIssueBadges,buildExtensionPrStatusfrom../signals/extension-contributor-context.ExtensionContributorContext,ExtensionPullContextSection,EXTENSION_REVIEWABILITY_TONES,buildExtensionPullContextPayload,sanitizeExtensionPrivateText,isExtensionScopedSession,isExtensionContributorScopedSession,EXTENSION_PULL_CONTEXT_SCOPE,EXTENSION_CONTRIBUTOR_CONTEXT_SCOPE,buildExtensionPublicSafePacket,buildExtensionPrivateBlockers,ensureExtensionPublicSafeText.surface: "browser_extension"(confirm each is exclusively inside the code being removed before deleting the enum member insrc/types.tsbelow — do not remove the type member if any surviving call site still sets it).src/signals/extension-contributor-context.tsDelete the entire file (137 lines) —
redactExtensionText,buildExtensionIssueFit,buildExtensionIssueBadges,buildExtensionPrStatus, and theExtensionIssueFit/ExtensionIssueBadge/ExtensionPrStatustypes. Confirm no other file imports from it before deleting (at audit time, onlysrc/api/routes.tsand its own test did).src/openapi/spec.tsRemove the three registrations: the
/v1/auth/extension/sessionentry, the/v1/extension/pull-contextentry (including its "Hard-coded by apps/loopover-extension... keep this path stable" comment — no longer applicable once that client is gone), and thepath === "/v1/auth/extension/session"branch inside the auth-paths check.src/auth/rate-limit.tsRemove
"/v1/auth/extension/session"from theSESSION_AUTHENTICATED_AUTH_PATHSset (and its preceding comment line referencing it), leaving"/v1/auth/github/token"as the remaining entry.src/types.tsRemove
"browser_extension"from theProductUsageSurfaceunion type — only after confirming (per theroutes.tscleanup above) that no surviving call site anywhere insrc/**still passes that literal.Tests
test/unit/routes-extension.test.tsandtest/unit/extension-contributor-context.test.tsentirely.apps/loopover-ui/public/openapi.json(npm run ui:openapi) after thespec.tsedits and commit the result — it currently documents the three removed endpoints on the public/apireference page.Requirements
src/**before its containing file/block is deleted — do not leave an unused-but-present helper behind "just in case."npm run typecheckand the full unshardednpm run test:coveragepass after removal, with no coverage regression on any surviving line (deleting dead code should not lowercodecov/patch-relevant coverage on anything still shipped).npm run ui:openapi:checkpasses against the regenerated spec (no drift betweenspec.tsand the committedopenapi.json).Deliverables
openapi.jsonregenerated and committedLinks & Resources
Parent epic; the package-deletion sub-issue (blocked-by — this cannot land until no client code references these endpoints).
src/api/routes.ts,src/signals/extension-contributor-context.ts,src/openapi/spec.ts,src/auth/rate-limit.ts,src/types.ts.Boundaries
Backend only —
apps/**and root config/CI are already clean by the time this lands (both prior sub-issues). Do not removeProductUsageSurface's other members or any other auth-scope constant unrelated to the extension surface.maintainer-only — auth-scope and public API-surface authority.