Skip to content

fix(webapp): remove unused Electric sync trace routes - #4400

Merged
ericallam merged 2 commits into
mainfrom
remove-sync-traces-routes
Jul 28, 2026
Merged

fix(webapp): remove unused Electric sync trace routes#4400
ericallam merged 2 commits into
mainfrom
remove-sync-traces-routes

Conversation

@claude

@claude claude Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Requested by Eric Allam · Slack thread

Removes two dead Remix routes and the helpers only they used.

app/routes/sync.traces.runs.$traceId.ts (/sync/traces/runs/:traceId) and app/routes/sync.traces.$traceId.ts (/sync/traces/:traceId) were added with the original ElectricSQL run page and lost their only consumers when the dashboard hooks that called them were deleted. Nothing in the repo references either route today.

Also removed, because the deleted routes were their only callers:

  • OtelTraceIdSchema, RESERVED_ELECTRIC_SHAPE_PARAMS, TraceScope, buildElectricTraceWhereClause from app/v3/electricShape.server.ts (the file stays — UNSAFE_REALTIME_TAG_CHARS / sanitizeRealtimeTagForSql / sanitizeRealtimeTagsForSql are still used by realtime.v1.runs.ts and realtimeClient.server.ts)
  • the loader-specific cases in apps/webapp/test/spanTraceRoutes.replicaLag.test.ts and internal-packages/run-store/src/runOpsStore.routesSpanTraceReadView.replicaLag.test.ts

app/utils/longPollingFetch.ts is untouched — realtimeClient.server.ts still uses it. runOpsStore.ts / PostgresRunStore.ts are untouched too; the unrouted-lookup mechanism there is generic and stays.

As a plain code fact: the run lookup these loaders performed keyed on TaskRun.traceId alone, which is not an index-backed query shape. That is noted only as context for why the code is not worth keeping around unused.

Judgement call worth a maintainer's opinion

The request was specifically about /sync/traces/runs/:traceId, the route that looks up a run by traceId. This PR also deletes its sibling /sync/traces/:traceId. The reasoning:

  • both routes came in with the same ElectricSQL run-page work
  • both lost their only consumers in the same later commit
  • neither has any caller anywhere in the repo
  • they share the same helper module, so keeping one means keeping the helpers half-used

If you would rather keep the sibling, reverting just that one file deletion is easy and does not affect the rest of this PR — say the word and I will restore it along with the helpers it needs.

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

Verification run locally from the repo root:

Command Result
pnpm run format clean, no changes produced
pnpm run lint:fix clean
pnpm run lint pass (exit 0, no findings)
pnpm run typecheck --filter webapp pass
pnpm run typecheck --filter @internal/run-store pass

A ripgrep sweep for sync.traces, sync/traces, syncTraceRunsLoader, buildElectricTraceWhereClause, OtelTraceIdSchema and RESERVED_ELECTRIC_SHAPE_PARAMS (excluding node_modules) returns zero hits.

Not fully verified: both edited test files are testcontainers suites and need a Docker runtime, which was not available in my environment. I confirmed each file collects correctly with exactly the three intended remaining tests and no import errors — notably, dropping the session.server / controlPlaneResolver.server / longPollingFetch / env.server mocks does not break module loading for the surviving loaders. The assertions themselves then failed only on Could not find a working container runtime strategy. CI should be the real signal here.

Per apps/webapp/CLAUDE.md, pnpm run build --filter webapp was deliberately not run.


Changelog

Removed two unused sync routes left over from the original ElectricSQL run page, along with the helpers and tests that existed only to serve them. No behaviour change — neither route had any caller.


Screenshots

n/a — no user-visible surface changes.

💯

`/sync/traces/:traceId` and `/sync/traces/runs/:traceId` were added with the
original ElectricSQL run page and were orphaned when the dashboard hooks that
consumed them were deleted. Nothing in the repo references either route.

Removing them also drops the now-unused `electricShape.server.ts` helpers
(`OtelTraceIdSchema`, `RESERVED_ELECTRIC_SHAPE_PARAMS`, `TraceScope`,
`buildElectricTraceWhereClause`); the realtime tag sanitisers in that module
stay, as does `longPollingFetch`, which `realtimeClient.server.ts` still uses.

The run lookup these loaders performed keyed on `TaskRun.traceId` alone, which
is not an indexed query shape, and it had no remaining caller.

Test coverage for the removed loaders is pruned from
`spanTraceRoutes.replicaLag.test.ts` and
`runOpsStore.routesSpanTraceReadView.replicaLag.test.ts`; the span-detail and
trace route cases in both files are unchanged.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J9DvHZJBMUFGU9Mvtr7zor
@changeset-bot

changeset-bot Bot commented Jul 28, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 0b38672

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

…test

Removing the sync-route helper left the describe block flush against the
preceding function. Cosmetic only.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01J9DvHZJBMUFGU9Mvtr7zor
@ericallam
ericallam marked this pull request as ready for review July 28, 2026 07:30

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@ericallam
ericallam merged commit ec562c0 into main Jul 28, 2026
33 checks passed
@ericallam
ericallam deleted the remove-sync-traces-routes branch July 28, 2026 08:00
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