Repository navigation
refactor: collapse duplicate html escapers and dead timezone branch - #4770
Conversation
Behavior-preserving cleanup of debt introduced by last week's merges (#4763, #4762, #4740, #4722, #4741). - booking-web hand-rolled two partial HTML escapers while `escapeHtml` already existed in the backend. Move it to `@core/util/escape-html.util` so both callers share one implementation. - Collapse five copy-pasted `html.replace` calls for superseded base meta tags into one pattern list, dropping the reassigned `let html`. - `autoEffectiveTimeZone` returned the browser zone from both arms of its `isUtcLikeTimeZone` guard. Drop the dead branch and the two pass-through wrappers (`applyDayjsDefault`, `getStoredBrowserTimeZone`). - The welcome step guard probed sessionStorage three times and tested set membership twice, with one branch unreachable. One probe, one check. - Derive the event-form date key unions from the key lists instead of keeping hand-maintained `Set<string>` literals in sync with them. - Resolve the view zone and civil day once per day-column scan instead of once per timed event. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TzeokDYpEzrNDZeYkA1DzW
|
Boot bundle: 513.3 KB gzip (+0.0 KB vs main) |
|
| shard | specs | duration | budget |
|---|---|---|---|
| 1 | accessibility, allday | 2m36s | 8m |
| 2 | booking, oauth, auth, billing | 2m13s | 8m |
| 3 | timed, dst, event-form, parity | 6m06s | 8m |
| 4 | onboarding, calendars, life, navigation, attendees | 3m09s | 8m |
A shard sitting at 6m06s is one slow runner away from the 8m cap on any PR.
.github/workflows/test-e2e.yml says these lists were balanced to put "each
shard near 90s" in the 2026-09 audit, so shard 3 has drifted about 4x past its
intended share, mostly from specs added to e2e/timed, e2e/dst and
e2e/parity over the last week.
This diff changes no spec and no test helper. It is a behavior-preserving
refactor that only removes work (one getEffectiveTimeZone() call and one
dayjs format per timed event become one per day-column scan), so it cannot
make a shard slower. Shards 1, 2 and 4 all passed here.
What I did and did not do
Re-running the failed job once (my single allowed re-run) to confirm the
timeout rather than a hidden failure.
I am not rebalancing the shard lists in this PR. That fix exists and is
straightforward, moving a directory from shard 3 to shard 1 or 2 and updating
packages/scripts/src/testing/e2e-shards.test.ts, but it is a CI-config change
unrelated to this refactor, and folding it in would widen the PR and put the
required e2e check's own balance under the same commit as the cleanup it is
meant to gate. It wants its own PR, and I have flagged it as the week's other
debt item.
Generated by Claude Code
|
Re-run confirms it was the budget, not a hidden failure: shard 3 passed all 67 Same commit, same specs, 5m23s vs >7m56s is runner-speed variance on a shard
Generated by Claude Code |
Fixes #
What and why
No issue: this is the weekly technical-debt sweep over merges from the last
seven days. Six behavior-preserving cleanups, all in code landed by #4763,
#4762, #4740, #4722 and #4741.
apps/booking-web/render-meet-landing-html.tshand-rolled two partial escapers (
escapeHtmlAttrskipped>,escapeHtmlTextskipped") while a completeescapeHtmlalready existedin
packages/backend. Moved that helper and its test to@core/util/escape-html.util(the package that owns the concept, reachablefrom both a frontend app and the backend) and pointed all four call sites at
it. Output for the current landing copy is byte-identical; the copy contains
no
&,<,>or".html.replace(...)callsfor superseded base-shell meta tags collapsed into one pattern list, which
also lets
htmlbe aconst.autoEffectiveTimeZonereturnedbrowserTimeZoneStore.get()from both arms of itsisUtcLikeTimeZonecheck, leftover scaffolding from fix(web): calendar zone consistency when browser reports UTC #4763 that read as if UTC hosts were
special-cased. Dropped the branch and folded the function into
currentEffectiveTimeZone, plus the two single-call pass-through wrappersapplyDayjsDefaultandgetStoredBrowserTimeZone.emitWelcomeStepViewedOnceprobedsessionStorageavailability three times across two helpers and tested setmembership twice, with the second test unreachable (
readViewedStepsalreadyreturns a copy of the in-memory set when storage is unavailable). Now one
probe and one check.
written out longhand and repeated as hand-maintained
Set<string>literals, two places to keep in sync. The unions are now derived from the key
lists, so
switchexhaustiveness still covers exactly the accepted keys.calendarIdsWithVisibleEventsOnDaycalledgetEffectiveTimeZone()and re-formatted the view's civil day once per timedevent. Both are now resolved once per scan.
No public behavior or contract changes; no test was weakened, and none was
added because none of this changes behavior.
Verify
All three local failures are this sandbox, and CI contradicts each one:
test:backend:fast— 13 failures (GET /api/config, SSE Server) frommissing local backend env, not an assertion:
ZodErroronBASEURL,FRONTEND_URL,MONGO_URI,SUPERTOKENS_URI,SUPERTOKENS_KEY,TZ. Theidentical 13 reproduce on a stashed clean tree at this PR's base, and
unit-leg (backend)is green in CI. This PR's only backend edit is an importpath.
test:booking-web— passes standalone twice here (148 pass, 0 fail). Itfailed only inside
verify, which runs it alongside the Playwright suite ina sandbox that cannot afford both. Green in CI.
test:e2e— sandbox Playwright. In CI, shards 1, 2 and 4 passed; shard 3hit its 8-minute step cap at 64 of 67 specs passed with zero failures, which
is a pre-existing budget problem on this shard rather than anything in this
diff. Evidence and the base-commit timings are in
this comment.
Green locally:
test:core(1009 pass),test:web(714 pass),test:booking-web(148 pass),type-check,lint,knip,test:a11y.Green in CI on
25ac0db:unitand allunit-leglegs,static,delta,boot-bundle(+0.0 KB),macos,e2e-shard1/2/4, CodeQL.🤖 Generated with Claude Code
https://claude.ai/code/session_01TzeokDYpEzrNDZeYkA1DzW