Skip to content

perf: remove Sentry — 17.4 MB → 13.6 MB - #793

Merged
thinkclay merged 3 commits into
mainfrom
perf/drop-sentry-and-duplicate-icons
Sep 17, 2026
Merged

thinkclay merged 3 commits into
mainfrom
perf/drop-sentry-and-duplicate-icons

Conversation

@thinkclay

Copy link
Copy Markdown
Contributor

The bundle audit in #791 found the web entry bundle was 17.4 MB, and that two
things accounted for over a third of it. Both are now gone.

entry bundle   17.42 MB  ->  12.07 MB   (-5.35 MB, -30.7%)
brotli         3.27 MB   ->   1.90 MB   (-42%)

Attribution before and after, through the source map:

@sentry/*    3.62 MB  ->  0.00 MB
lucide*      2.20 MB  ->  1.14 MB

Sentry, removed entirely

22.9% of the bundle, and roughly 2 MB of that was @sentry/core bundled five
times
— one version at the root (10.38.0) and a newer one (10.73.0) nested
under react, replay, replay-canvas, feedback and browser-utils. The
bundle showed it independently: 293 groups of byte-identical modules, almost all
in ×5 sets.

Removed rather than deduplicated, per the call to drop it. Gone: the
utils/sentry/ module and its four setup docs, SentryTestButtons (defined,
never used), scripts/setup-sentry.mjs and its doc, the setup-sentry step in
both prebuild scripts, four @sentry/* dependencies across three package.json
files, six EXPO_PUBLIC_SENTRY_DSN_* entries in eas.json, the DSN types in
environment.d.ts, the extra.sentry block in app.config.ts, and the test mock,
validator and validator registration.

What this costs, stated plainly: there is no remote error reporting any
more. logger.error prints and stops there. Two places were quietly relying on
Sentry to be the real sink, and both are corrected rather than left:

  • ErrorBoundary.componentDidCatch logged only under __DEV__ and otherwise
    handed the error to Sentry. That branch would have made every caught error in
    production silent, so it now logs unconditionally.
  • logger.warn sent production warnings to Sentry and printed nothing. It now
    prints in development and does nothing in production — by design rather than
    by accident, and the comment says so.

Two compliance documents named Sentry as a processor and would have been false:

  • PrivacyScreen listed "Crash data — Sentry crash reporting", a "Performance
    data" row that was Sentry's, and Sentry among service providers.
  • play-store-assets/metadata/data-safety.md used it in the reasoning for why
    "Shared" is No everywhere.

Both updated. If the privacy text is version-controlled in
core.legal_documents, this needs a published version per migration 342's
runbook — flagging rather than assuming.

The second icon set

lucide-react was imported in exactly one file, for two icons, while 369 files
use lucide-react-native. Metro tree-shakes neither barrel, so that one import
shipped a complete second icon set: 1,439 modules, 1.07 MB.

The fix was deleting BreadcrumbIcons.web.tsx — its sibling already exports the
same two names from lucide-react-native, and the three consumers import
./BreadcrumbIcons without an extension. Scaffald/ui#31, merged; the submodule
pointer moves to 27c91b8.

lucide-react-native still ships whole at 1.14 MB for the 147 icons actually
used. That is the next question and is deliberately not answered here.

Verified: typecheck clean on scf-core and scaffald-app, scf-core suite
1097 passed / 0 failed, production export green.

Refs #791


🤖 Generated with Claude Code

@thinkclay thinkclay added the ci:full Run the full nightly suites (Lighthouse, E2E) on this PR label Sep 17, 2026
thinkclay and others added 2 commits September 17, 2026 04:37
The bundle audit in #791 found the web entry bundle was 17.4 MB, and that two
things accounted for over a third of it. Both are now gone.

    entry bundle   17.42 MB  ->  12.07 MB   (-5.35 MB, -30.7%)
    brotli         3.27 MB   ->   1.90 MB   (-42%)

Attribution before and after, through the source map:

    @sentry/*    3.62 MB  ->  0.00 MB
    lucide*      2.20 MB  ->  1.14 MB

## Sentry, removed entirely

22.9% of the bundle, and roughly 2 MB of that was `@sentry/core` bundled **five
times** — one version at the root (10.38.0) and a newer one (10.73.0) nested
under `react`, `replay`, `replay-canvas`, `feedback` and `browser-utils`. The
bundle showed it independently: 293 groups of byte-identical modules, almost all
in ×5 sets.

Removed rather than deduplicated, per the call to drop it. Gone: the
`utils/sentry/` module and its four setup docs, `SentryTestButtons` (defined,
never used), `scripts/setup-sentry.mjs` and its doc, the `setup-sentry` step in
both prebuild scripts, four `@sentry/*` dependencies across three package.json
files, six `EXPO_PUBLIC_SENTRY_DSN_*` entries in eas.json, the DSN types in
environment.d.ts, the `extra.sentry` block in app.config.ts, and the test mock,
validator and validator registration.

**What this costs, stated plainly:** there is no remote error reporting any
more. `logger.error` prints and stops there. Two places were quietly relying on
Sentry to be the real sink, and both are corrected rather than left:

* `ErrorBoundary.componentDidCatch` logged only under `__DEV__` and otherwise
  handed the error to Sentry. That branch would have made every caught error in
  production silent, so it now logs unconditionally.
* `logger.warn` sent production warnings to Sentry and printed nothing. It now
  prints in development and does nothing in production — by design rather than
  by accident, and the comment says so.

Two compliance documents named Sentry as a processor and would have been false:

* `PrivacyScreen` listed "Crash data — Sentry crash reporting", a "Performance
  data" row that was Sentry's, and Sentry among service providers.
* `play-store-assets/metadata/data-safety.md` used it in the reasoning for why
  "Shared" is No everywhere.

Both updated. **If the privacy text is version-controlled in
`core.legal_documents`, this needs a published version per migration 342's
runbook — flagging rather than assuming.**

## The second icon set

`lucide-react` was imported in exactly one file, for two icons, while 369 files
use `lucide-react-native`. Metro tree-shakes neither barrel, so that one import
shipped a complete second icon set: 1,439 modules, 1.07 MB.

The fix was deleting `BreadcrumbIcons.web.tsx` — its sibling already exports the
same two names from `lucide-react-native`, and the three consumers import
`./BreadcrumbIcons` without an extension. Scaffald/ui#31, merged; the submodule
pointer moves to 27c91b8.

`lucide-react-native` still ships whole at 1.14 MB for the 147 icons actually
used. That is the next question and is deliberately not answered here.

Verified: typecheck clean on scf-core and scaffald-app, scf-core suite
1097 passed / 0 failed, production export green.

Refs #791

Co-Authored-By: Claude Opus 5 <[email protected]>
`@scaffald/ui-docs:build` failed on the previous commit:

    Module not found: Error: Can't resolve 'lucide-react-native'
      in '<repo>/packages/ui/dist'

Dropping the `lucide-react` fork moved the Breadcrumb's web path onto
`lucide-react-native`, and the Docusaurus site had never declared that package —
64 components in @scaffald/ui import it and the site renders them, so it had been
resolving through whatever pnpm hoisted, and regenerating the lockfile here moved
it out of reach. Scaffald/ui#32 declares it; the site already aliases
react-native → react-native-web, so it resolves the same way the app does.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay
thinkclay force-pushed the perf/drop-sentry-and-duplicate-icons branch from 4e34803 to 29444d4 Compare September 17, 2026 08:37
`@scaffald/ui-docs:build` fails in CI on the ui pointer bump:

    Module not found: Error: Can't resolve 'lucide-react-native'
      in '<repo>/packages/ui/dist'

The same build passes locally, and re-running the CI job reproduces it, so it is
environmental rather than flaky and I have not yet found the difference.
Scaffald/ui#32 declaring the dependency on the docs site was not enough.

Sentry removal does not depend on any of that, is verified, and is the larger
half of the saving. So the pointer goes back to what main has and the icon work
moves to its own PR, where the docs build can be debugged without holding this
up. Scaffald/ui#31 and #32 are already merged on the ui side; only the pointer
bump is deferred.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thinkclay thinkclay changed the title perf: remove Sentry, and the duplicate icon set — 17.4 MB → 12.1 MB perf: remove Sentry — 17.4 MB → 13.6 MB Sep 17, 2026
@thinkclay

Copy link
Copy Markdown
Contributor Author

Scope narrowed to Sentry only. The icon half is split out.

Bumping the ui submodule pointer broke @scaffald/ui-docs:build in CI:

Module not found: Error: Can't resolve 'lucide-react-native'
  in '<repo>/packages/ui/dist'

The same build passes locally, and re-running the CI job reproduces it, so it is environmental rather than flaky and I have not found the difference yet — Scaffald/ui#32 declaring the dependency on the docs site was not enough. Sentry removal does not depend on any of that and is the larger half, so the pointer goes back to what main has and the icons move to their own PR.

Scaffald/ui#31 (deleting the lucide-react fork) and #32 are already merged on the ui side; only the parent's pointer bump is deferred.

Measured, this PR alone:

entry bundle   17.42 MB  ->  13.60 MB   (-3.82 MB, -21.9%)
gzip            3.64 MB  ->   2.71 MB   (-25.5%)
@sentry/*       3.62 MB  ->   0.00 MB

The icon change is worth a further ~1.07 MB when the docs build is sorted.

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

Labels

ci:full Run the full nightly suites (Lighthouse, E2E) on this PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant