Skip to content

chore(v7): remove dead exports and unreachable telemetry middleware - #1397

Open
tusharpandey13 wants to merge 2 commits into
feat/auth-separation-v6from
feat/v7-cleanup
Open

chore(v7): remove dead exports and unreachable telemetry middleware#1397
tusharpandey13 wants to merge 2 commits into
feat/auth-separation-v6from
feat/v7-cleanup

Conversation

@tusharpandey13

@tusharpandey13 tusharpandey13 commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Description

Cleanup follow-up to the v7 auth-separation work (#1390), which orphaned several public exports and a middleware hook. Tracked in the deferred-items comment on #1390.
See #1390 (comment)

Remove dead exports (breaking, must land within v7):

  • ResponseError and FetchError (src/lib/errors.ts) and JSONApiResponse (src/lib/models.ts) were exported from the package entrypoint but no longer back any live code path after the auth layer was removed. TimeoutError is kept: it is still used by the retry path (src/lib/retry.ts).

Remove unreachable telemetry middleware:

  • The pre() hook on Auth0ClientTelemetry is dead after the middleware pipeline was dismantled. Removed it along with the now-unused Middleware/FetchParams/RequestContext imports and the implements Middleware clause. Only getAuth0ClientHeader() is still called (from auth-helpers.ts). The class is internal-only (never re-exported), so this is not a public-contract change.

Document and test the fetch option:

  • fetch is already a typed public option on ManagementClient (inherited from the base client, not excluded by the options Omit). Added a test asserting Management API requests actually route through a user-supplied fetch, and documented the option in the README.

Notes / out of scope

  • Middleware/FetchParams/RequestContext remain public (they back Configuration.middleware). Deciding whether to remove that surface too is a separate call.
  • Token-path domain validation and the migration-guide removed-exports list are tracked separately (the latter is owed in [BREAKING] feat!: remove Authentication layer #1390 itself).
  • CHANGELOG entry for the breaking removals to be added before the GA cut.

Testing

  • tsc --noEmit clean.
  • Management wrapper unit suites: 559/559 passing, including the new management-client-fetch-option test.

🤖 Generated with Claude Code

Cleanup follow-up to the auth-separation work, which orphaned several
public exports and a middleware hook.

- Remove the dead ResponseError and FetchError classes from src/lib/errors.ts
  and JSONApiResponse from src/lib/models.ts. These were exported from the
  package entrypoint but no longer back any live code path after the auth
  layer was removed. Removing public exports is breaking, so this must land
  within v7. TimeoutError stays: it is still used by the retry path.
- Remove the unreachable pre() middleware hook from Auth0ClientTelemetry and
  drop the now-unused Middleware/FetchParams/RequestContext imports and the
  'implements Middleware' clause. The middleware pipeline was dismantled by
  the auth-separation; only getAuth0ClientHeader() is still called. The class
  is internal-only (never re-exported), so this is not a contract change.
- Add a test asserting Management API requests route through a user-supplied
  fetch option, and document the fetch option in the README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tusharpandey13
tusharpandey13 requested a review from a team as a code owner September 1, 2026 16:59
These low-level HTTP wrapper types were removed from the public API in
this PR but had no migration coverage. Document them in the error-handling
section so consumers upgrading from v6 know what replaced them.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@tusharpandey13

Copy link
Copy Markdown
Contributor Author

Reviewer notes (beyond the description)

Points that are not obvious from the diff:

  • TimeoutError is intentionally kept exported. It is still thrown by the retry path (src/lib/retry.ts:93), so it is not dead like the others. An earlier plan draft floated hiding it from the entrypoint; dropped on purpose to avoid converting the export * barrel to named re-exports. No doc claims it was removed, so no stale guidance.
  • Telemetry edit is regen-safe. src/lib/ is under .fernignore, so the hand edit to auth0-client-telemetry.ts will not be clobbered on the next Fern generation. Auth0ClientTelemetry is never re-exported, so removing pre() is not a contract change.
  • fetch was already public before this PR (inherited from the base client, not excluded by the options Omit) — the new test and docs cover existing surface, they do not add it.
  • Removable-but-left-alone: VoidApiResponse (models.ts) and the dead src/lib/index.ts barrel also look orphaned; left out to keep the diff scoped. Flagging so they are not mistaken for oversights.
  • CI noise: the repo-wide MSW/wire suites show pre-existing load errors (msw import), unrelated to this change — 0 actual test failures. Management wrapper unit suites are green (559/559).

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.

1 participant