Skip to content

refactor: collapse duplicate html escapers and dead timezone branch - #4770

Merged
tyler-dane merged 1 commit into
mainfrom
claude/kind-dirac-p8igbj
Oct 23, 2026
Merged

tyler-dane merged 1 commit into
mainfrom
claude/kind-dirac-p8igbj

Conversation

@tyler-dane

@tyler-dane tyler-dane commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • Duplicated HTML escaper. apps/booking-web/render-meet-landing-html.ts
    hand-rolled two partial escapers (escapeHtmlAttr skipped >,
    escapeHtmlText skipped ") while a complete escapeHtml already existed
    in packages/backend. Moved that helper and its test to
    @core/util/escape-html.util (the package that owns the concept, reachable
    from 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 ".
  • Copy-pasted meta stripping. Five near-identical html.replace(...) calls
    for superseded base-shell meta tags collapsed into one pattern list, which
    also lets html be a const.
  • Dead timezone guard. autoEffectiveTimeZone returned
    browserTimeZoneStore.get() from both arms of its isUtcLikeTimeZone
    check, 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 wrappers
    applyDayjsDefault and getStoredBrowserTimeZone.
  • Redundant welcome-step guard. emitWelcomeStepViewedOnce probed
    sessionStorage availability three times across two helpers and tested set
    membership twice, with the second test unreachable (readViewedSteps already
    returns a copy of the in-memory set when storage is unavailable). Now one
    probe and one check.
  • Key lists duplicated as types. The event-form date field key unions were
    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 switch exhaustiveness still covers exactly the accepted keys.
  • Per-event timezone lookups. calendarIdsWithVisibleEventsOnDay called
    getEffectiveTimeZone() and re-formatted the view's civil day once per timed
    event. 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

Selected packages: core, web, backend, booking-web
Checks run: test:core, test:web, type-check, lint, knip, test:a11y
Checks skipped: (none)
Failed: test:backend:fast, test:booking-web, test:e2e
VERDICT: FAIL

All three local failures are this sandbox, and CI contradicts each one:

  • test:backend:fast — 13 failures (GET /api/config, SSE Server) from
    missing local backend env, not an assertion: ZodError on BASEURL,
    FRONTEND_URL, MONGO_URI, SUPERTOKENS_URI, SUPERTOKENS_KEY, TZ. The
    identical 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 import
    path.
  • test:booking-web — passes standalone twice here (148 pass, 0 fail). It
    failed only inside verify, which runs it alongside the Playwright suite in
    a sandbox that cannot afford both. Green in CI.
  • test:e2e — sandbox Playwright. In CI, shards 1, 2 and 4 passed; shard 3
    hit 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: unit and all unit-leg legs, static, delta,
boot-bundle (+0.0 KB), macos, e2e-shard 1/2/4, CodeQL.

🤖 Generated with Claude Code

https://claude.ai/code/session_01TzeokDYpEzrNDZeYkA1DzW

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
@github-actions

Copy link
Copy Markdown
Contributor

Boot bundle: 513.3 KB gzip (+0.0 KB vs main)

Copy link
Copy Markdown
Contributor Author

e2e-shard (3, e2e/timed e2e/dst e2e/event-form e2e/parity) — step timeout, not a failure in this diff

The failing job ended with:

Running 67 tests using 1 worker
context canceled
································································
##[error]The action 'Run e2e tests' has timed out after 8 minutes.

64 dots, no F and no ✘: 64 of 67 specs passed and none failed. The job was
cut off by the step's timeout-minutes: 8, mid-run.

Why this isn't this PR's

Shard 3 already runs at ~75% of its budget on this PR's own base commit
(47703fb). From the base's E2E run, Run e2e tests per shard:

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

@tyler-dane
tyler-dane marked this pull request as ready for review October 23, 2026 10:38
@tyler-dane tyler-dane added the agent-automerge Agent-loop finished; merge-guard may squash-merge label Oct 23, 2026 — with Claude
@tyler-dane
tyler-dane enabled auto-merge October 23, 2026 10:38
@tyler-dane
tyler-dane added this pull request to the merge queue Oct 23, 2026

Copy link
Copy Markdown
Contributor Author

Re-run confirms it was the budget, not a hidden failure: shard 3 passed all 67
specs in 5m23s on this same commit 25ac0db, against the 7m56s cut-off on
attempt 1. e2e is green and the PR is in the merge queue.

Same commit, same specs, 5m23s vs >7m56s is runner-speed variance on a shard
that sits at 5-6 minutes of an 8-minute cap. Numbers for whoever picks up the
rebalance:

attempt 1 attempt 2 base 47703fb
shard 3 Run e2e tests timed out at 8m00s (64/67 passed, 0 failed) 5m23s 6m06s

Generated by Claude Code

@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 23, 2026
@tyler-dane
tyler-dane added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 59e2902 Oct 23, 2026
40 of 42 checks passed
@tyler-dane
tyler-dane deleted the claude/kind-dirac-p8igbj branch October 23, 2026 11:09
tyler-dane pushed a commit that referenced this pull request Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-automerge Agent-loop finished; merge-guard may squash-merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants