Skip to content

Bug: cold /log-in loads every dashboard route and all three locales — 2.1 MB of JS against PERF-P10's 2.0 MB #4089

Closed

Description

@yannickmonney

What happened?

A cold load of the sign-in page downloads, parses and runs the code of every dashboard route and all three locales before it paints the form. On main eee0a1098 a fresh browser context opening /log-in fetches 46 script files with 2,115,972 bytes transferred (7.41 MB decoded). PERF-P10 (services/platform/tests/manual/suites/performance.md) expects about 34 files and at most 2.0 MB. The build's own check prints Cold-load JS: 44 preloaded modules, 2064 KB gzip. The box records a 1.93 MB baseline from #3498.

All numbers come from a local production build (bun run build), served by vite preview with gzip and the real backend, on synthetic data with no egress. Medians are shown with min–max; n=10 per row.

Flow on main eee0a1098 Visible module-load mark Long tasks JS fetched
Cold /log-in: password field painted 1,201 ms (1,046–1,327) 1,016 ms 470 ms 46 files, 2,066 KB
Cold /dashboard/{org}: the chat's Send message painted 1,804 ms (1,628–2,811) 1,124 ms 1,152 ms 46 files, 2,066 KB
Warm reload of the same (HTTP cache warm) 1,384 ms (1,250–1,729) 788 ms 886 ms 46 files revalidated, 13 KB

Most of the time before the sign-in form paints is spent loading the bundle. The module-load mark (app/lib/perf/cold-load-trace.ts) lands at about 1.0 s, and a warm reload pays most of that again.

Where the bytes come from. The 44 preloaded modules, attributed to their sources through the build's sourcemaps (entry-analyze.mjs, Node zlib level 6, 2,048 KB in all):

Chunk gzip What is in it
index-*.js (the entry) 1,178 KB Every route and feature:
• app/routes/dashboard ~171 KB
• features/settings ~138 KB
• chat ~55 KB
• tasks ~43 KB
• automations ~32 KB
• documents ~24 KB
• conversations, projects, analytics, home, skills ~11–18 KB each

Plus the libraries they reach:
• recharts ~64 KB
• parse5 ~33 KB
• react-datepicker ~28 KB
• ajv ~26 KB
• yaml ~26 KB
• jszip ~25 KB
• motion-dom ~24 KB
• luxon ~19 KB
• he ~18 KB
• date-fns ~16 KB
• shiki's textmate ~11 KB
• @dnd-kit/core ~10 KB
read-state-*.js 391 KB The platform catalogs:
• messages/fr.yml ~109 KB
• de.yml ~107 KB
• en.yml ~94 KB

Plus i18next ~12 KB
vendor-core-*.js 231 KB React, the router and query stack, Sentry.
Also:
• @xyflow/react + @xyflow/system ~37 KB
• @tanstack/table-core ~15 KB
vendor-katex-*.js 85 KB KaTeX, through the markdown renderer (the build already warns)

There are four causes:

  1. No route-level code splitting. tanstackRouter() in services/platform/vite.config.ts runs without autoCodeSplitting. None of the 125 route components under app/routes is a .lazy.tsx route, and none uses createLazyFileRoute or lazyRouteComponent. So the entry chunk carries every route's component and everything it imports. The sign-in page runs the settings, chat, tasks, automations, documents and analytics code (recharts included) before it paints.
  2. Every locale is in every cold load. services/platform/lib/i18n/i18n.ts imports en.yml, de.yml and fr.yml statically, plus de-CH through an eager glob. That's because initServiceI18n (packages/ui/src/i18n/init-service.ts) takes all three base bundles up front and deep-merges them at start. That's about 310 KB gzip (1.06 MB of minified JS) per load, and a session only needs one of the three catalogs, about 94–109 KB.
  3. coreChunk() matches any /react/ path. @xyflow/react, the flow-diagram library, lands in vendor-core, which every page preloads, and rolldown pulls its dependency @xyflow/system in with it. @tanstack/table-core rides along on the @tanstack match. Together that's about 52 KB gzip on the sign-in page, and it stays in the cold set even with routes split (experiment R).
  4. KaTeX is reached statically from the markdown renderer. This one is already known: check-entry-budget.ts reports it.

Two experiments. These are evidence, not proposed patches. Each was run ABBA against the same commit, with the same backend, database and fixture, one block at a time, n=10 per arm.

R: tanstackRouter({ autoCodeSplitting: true }), one line. The build passes with Cold-load JS: 65 preloaded modules, 877 KB gzip, and KaTeX leaves the cold set.

main R
Cold /log-in: JS fetched 46 files, 2,115,972 B 70 files, 921,350 B
Cold /log-in: password field painted 1,192 ms (1,074–1,522) 815 ms (697–921)
…module-load mark 974 ms 598 ms
Cold dashboard: Send message painted 1,755 ms (1,653–2,050) 2,080 ms (1,874–2,203)
…module-load → router-loaded 1,100 → 1,196 ms 633 → 1,562 ms
…JS fetched by the time the page settles 46 files, 2,066 KB 214 files (209–221), 1,606 KB
First visit of All projects in-app, hover then click (n=6) 126 ms (115–160) 142 ms (128–169)
First visit of Knowledge, hover then click (n=6) 119 ms (109–165) 144 ms (132–177)
First visit of Knowledge, click without hover (n=6) 124 ms (111–154) 134 ms (114–156)

R makes the sign-in page faster and the signed-in landing slower. Once the entry has run, the router fetches the chat route's chunks in a second wave. In the first sample's waterfall, 133 requests start 0.6–0.8 s in, and 146 of the 213 files are under 2 KB. That moves router-loaded from about 0.1 s after module-load to about 0.9 s after it. Route splitting has to avoid that waterfall: for example, preload the shell and the landing route for a signed-in session and keep shared code in fewer chunks. It also has to come with locale loading (with R, the three catalogs are 37% of the remaining cold set).

L: the de and fr imports pointed at en.yml. This is the upper bound of what an English session gains. It is not an implementation, since German and French users would get English. The build gives Cold-load JS: 44 preloaded modules, 1839 KB gzip.

main L
Cold /log-in: JS fetched 2,115,972 B 1,886,954 B
Cold /log-in: password field painted 1,268 ms (1,082–1,554) 1,172 ms (1,122–1,287)
Cold dashboard: Send message painted 1,976 ms (1,573–2,368) 1,710 ms (1,559–1,839)
…module-load mark 1,184 ms 1,008 ms
…JS heap after load 44 MB 41 MB

Limits

  • The host is a VM cgroup capped at 2 CPUs and 4 GiB, and everything runs on localhost. A real network adds transfer time on top of all of this, so the absolute times here undercount it.
  • Other tenants used 0.35–0.48 CPU on average over the sample windows (p90 of the 1-s intervals ≤ 0.68), and steal stayed ≤ 0.09.
  • The two ABBA runs saw different host load, so compare each table within itself.
  • The service worker was blocked in the harness, and vite preview serves assets with Cache-Control: no-cache, so warm loads revalidate every file.
  • Neither experiment ran the unit, browser or e2e suites, or visited any route other than sign-in, chat, All projects and Knowledge.

Steps to reproduce

  1. On main eee0a1098, run bun install --frozen-lockfile, then bun run build in services/platform. The log prints Cold-load JS: 44 preloaded modules, 2064 KB gzip and still preloaded, should become lazy: assets/vendor-katex-*.js.

  2. Serve dist/ (vite preview, as in the prod-build E2E path) with the backend up.

  3. In a brand-new browser context, open /log-in and run performance.getEntriesByType('resource').filter((r) => r.name.endsWith('.js')). It lists 46 entries, whose transferSize sums to about 2.1 MB.

  4. To replay everything above, use the kit in TALE-361's deliverable tale-361-perf-evidence-bundle.tar.gz, occ-20261002T1915/scripts/:

    • pg-up.sh, mkdb.mjs r5, backend-up.sh r5, preview-at.sh, seed-http.mjs r5;
    • nav-bench.mjs r5 login-cold|dash-cold|dash-warm|dash-nav <n>, plus ab.sh and ab-l.sh;
    • entry-analyze.mjs <dist> for the composition, and summarize-nav.py and contention2.py for the tables.

    The bundle also holds the raw samples (JSONL), six Chrome traces (one per build and flow), the build logs and the host monitor.

Expected behavior

PERF-P10 holds with margin, and the signed-in landing is no slower for it. The acceptance budget below applies on this harness and host class. Each criterion is checked ABBA against the fix's base, n ≥ 10 per arm, with contention recorded.

  1. A cold /log-in transfers ≤ 1.0 MB of JavaScript, with no vendor-codemirror, vendor-katex or @xyflow code. Its password field paints in ≤ 0.9 s median (base 1.19–1.27 s here; R reached 0.82 s).
  2. A cold /dashboard/{org} paints Send message no later than on the base (median). router-loaded stays within 150 ms of module-load (base ~0.1 s; R ~0.9 s), so there is no second request wave on the critical path.
  3. The first in-app visit of a route not yet loaded (All projects or Knowledge, with and without hover) stays within +50 ms of the base median (0.12–0.13 s).
  4. An English session loads one base catalog. A German or French session paints in its own language on the first frame, with no English flash. The language switcher still works, and the i18n parity suites pass.
  5. scripts/check-entry-budget.ts fails the build above a gzip ceiling for the cold set, so it can't creep back, and the PERF-P10 box records the new baseline and file count.

Related:

Affected service

Platform

Version or commit

main eee0a1098f433c96fe2d3c9b83779f6eed32d6cc (2 Oct 2026). The experiments are this commit plus candidate-r.diff or candidate-l.diff, which were never pushed.

Browser and OS

  • Chromium 141.0.7390.37, headless, 1440×900, DPR 1, service workers blocked (Playwright-core 1.58).
  • Linux 7.0, a 4 vCPU VM in a cgroup of 2 CPUs and 4 GiB.
  • Node 24.21.0, bun 1.4.2, PostgreSQL 16.14 + pgvector 0.8.6.

Relevant log output

main:  Cold-load JS: 44 preloaded modules, 2064 KB gzip
         still preloaded, should become lazy: assets/vendor-katex-C6eDj1IC.js
R:     Cold-load JS: 65 preloaded modules, 877 KB gzip
L:     Cold-load JS: 44 preloaded modules, 1839 KB gzip
         still preloaded, should become lazy: assets/vendor-katex-C6eDj1IC.js

Before submitting

Activity

  1. added
    perf
    bug
    service: platform
    on Oct 2, 2026
  2. yannickmonney commented on Oct 3, 2026

    @yannickmonney
    ContributorAuthor

    Correction to the evidence, from the reporter's next performance occurrence (TALE-361).

    The 2 Oct 19:15 stack behind this issue ran its backend with an empty TALE_CONFIG_SYSTEM_DIR. A pre-created directory made the catalog copy skip itself, and the backend logged PII data tree unavailable. So that stack had no built-in providers, models or harnesses catalog.

    What that does and doesn't change:

    • Unchanged:
      • every byte and file count (the 46 scripts / 2,115,972 B on cold /log-in, the Cold-load JS lines, the composition table);
      • the A/B comparisons, since both arms shared that stack.
    • Remeasured: the absolute cold-dashboard time, with the full catalog, on main 8b916c0b9, own Postgres and backend, vite preview, the same harness.
      • Cold /dashboard/{org} → Send message painted: 1,620 ms (1,488–1,825), n=10, against 1,755–1,976 ms in this issue's tables.
      • It's the same order and a quieter host, so the dashboard numbers in this issue weren't flattered by the missing catalog.
      • The build's line on 8b916c0b9 is Cold-load JS: 44 preloaded modules, 2072 KB gzip.

    The acceptance budget is unchanged. Raw data is in the TALE-361 evidence bundle (occ-20261003T0315/results/r6/dash-cold-catalog.jsonl).

  3. added
    agent-ready
    on Oct 29, 2026
  4. added a commit that references this issue on Oct 31, 2026
    22cf589
  5. added 3 commits that reference this issue on Oct 31, 2026
    e83927b
    c2fd2d6
    14b14f6
  6. tale-code-bot commented on Nov 1, 2026

    @tale-code-bot
    Collaborator

    Landed on Tale's feature line: feature train #5241 landed on release/0.6 by rebase at 2026-11-01T01:56:42Z, and this change is now commit 14b14f6 there (test(platform): fail a build whose cold load outgrows its gzip ceiling). It ships with Tale 0.6.0.

    GitHub closes issues by itself only for commits on main, so the feature-train role closes this one as completed. Task: TALE-58.

  7. 5 remaining items

  8. added 13 commits that reference this issue on Nov 2, 2026
    212c1b4
    17bae10
    ea90385
    9437950
    ad17603
    7f33cb7
    bda8e9d
    f65e84e
    55de8d4
    52cc989
    6cf52e2
    25faa3e
    b4790ac
  9. added a commit that references this issue on Nov 15, 2026
    30c3fa2
  10. added a commit that references this issue on Nov 23, 2026
    90db9ea
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readybugperfservice: platform

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions