Skip to content

test(website): keep upcoming-events coverage when nothing is scheduled - #15160

Merged
christian-byrne merged 3 commits into
mainfrom
glary/website-upcoming-events-test-resilience
Aug 23, 2026
Merged

test(website): keep upcoming-events coverage when nothing is scheduled#15160
christian-byrne merged 3 commits into
mainfrom
glary/website-upcoming-events-test-resilience

Conversation

@christian-byrne

Copy link
Copy Markdown
Contributor

PR Created by the Glary-Bot Agent


Summary

The "Upcoming events" list on /events is derived from the wall clock, so it empties out once the newest configured event ends — which silently reduced every assertion about those rows to a no-op. This restores that coverage in a form that does not depend on the calendar.

Changes

  • What:
    • New UpcomingEventsSection.test.ts stubs the derived upcomingEvents list (vi.mock + importOriginal) and covers what the e2e can no longer see: one row per event, localized title/blurb/location/date, and the streamed-vs-external link branch (/events/{id} vs the external href with target=_blank + rel), including the zh-CN event-page href.
    • events.spec.ts now asserts the list container renders even when there are no rows, so a zero-row page is still a real assertion rather than a vacuous toHaveCount(0).
    • Corrected the comment on the derivation (BUILD_NOWNOW): the events islands re-evaluate it in the browser on hydration, so classification is not fixed at build time as the old comment claimed.

Review Focus

Why prod is empty is not a bug in the fetch/render logic. The data is not remote — it is the hard-coded array in src/data/events.ts. The only dynamic input is the clock: deriveUpcomingEvents keeps events whose end (start + 1h default) is still in the future. The newest configured event, video-model-showdown, ended 2026-08-12T18:00Z, and nothing is scheduled after it, so upcomingEvents is [] and the ul renders as <!--[--><!--]-->. A locally built dist/events/index.html reproduces the reported prod markup byte-for-byte. The page needs a content refresh, not a code fix.

Two findings worth separate follow-ups (deliberately not changed here):

  1. <UpcomingEventsSection client:visible /> ships the full events array plus new Date() to the client, so the upcoming/past split is re-derived from the visitor's clock at hydration. Freezing the browser clock to 2026-08-01 against the current build makes 2 rows appear where the build rendered 0, along with a burst of Vue Hydration text/children mismatch warnings — i.e. real visitors on a build older than an event's end get a visible post-hydration content shift on /events. Making it deterministic per-deploy is a behaviour change (a finished livestream would linger as "upcoming" until the next deploy), so it needs a product call.
  2. With zero upcoming events the section still renders its heading over an empty card (first screenshot). An empty state — hiding the section, or a "nothing scheduled yet" line — would be an improvement, but that is a design decision.

Follows up #15150, which stopped the CI failure by guarding the one unguarded test; this addresses the coverage hole that guard left behind.

Screenshots

Both taken against a local production build. The first is today's real clock (reproduces prod); the second freezes the browser clock to 2026-08-01, showing the render logic itself is healthy.

Verification

  • pnpm test:unit (website): 42 files, 399 tests passing, including the 3 new ones.
  • pnpm typecheck (astro check): 0 errors, 0 warnings.
  • oxfmt, oxlint --type-aware, and eslint clean on the changed files (also via pre-commit hooks).
  • playwright test events.spec.ts --project=desktop --project=mobile: 7 passed, 2 skipped (the two time-dependent tests, correctly skipped with zero upcoming events).
  • Mutation-checked rather than assumed: inverting the link branch fails 2 of the new tests, deleting the location text fails a third, and replacing the ul with a div fails the new e2e assertion — which previously passed silently.

Screenshots

Upcoming events section on a local production build with the real clock: heading over an empty card, reproducing the empty ul reported on prod

Same build with the browser clock frozen to 2026-08-01: two upcoming event rows render with location, date, Add to calendar, and Livestream links

The upcoming list is derived from the wall clock, so it empties out once the
newest configured event ends. Every assertion about those rows then scaled to
zero and the section's behaviour silently stopped being tested.

Cover the rows in a component test that stubs the derived list, so row markup,
localization, and link targets stay verified whatever the date. Keep the e2e
clock-honest and have it assert the list container renders even with no rows.

Also correct the comment on the derivation: the events islands re-evaluate it
in the browser on hydration, so classification is not fixed at build time.
The list is re-derived on hydration, so an event drops out on the first page
load after it ends -- not the instant it ends.
@coderabbitai

coderabbitai Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 9b90a515-8178-4c0e-85a4-155fb047f7a3

📥 Commits

Reviewing files that changed from the base of the PR and between d6977c9 and e7c3b25.

📒 Files selected for processing (1)
  • apps/website/src/templates/events/UpcomingEventsSection.test.ts

📝 Walkthrough

Walkthrough

Event classification now uses a module-load timestamp during server rendering and browser hydration. Upcoming-event tests cover rendered links, localization, security attributes, and empty configured event lists.

Changes

Event behavior

Layer / File(s) Summary
Hydration-time event classification
apps/website/src/data/events.ts
upcomingEvents, pastEvents, and featuredEvents now use NOW sampled at module load instead of BUILD_NOW.
Upcoming-event rendering validation
apps/website/src/templates/events/UpcomingEventsSection.test.ts, apps/website/e2e/events.spec.ts
Unit tests cover event content, internal and external links, zh-CN URLs, security attributes, and empty lists. The E2E test waits for the upcoming list before checking its rows.

Estimated code review effort: 2 (Simple) | ~10 minutes

Mergeability Score: ⚪ Minimal · up to e7c3b

This PR strengthens upcoming-events test coverage without changing production behavior, and no actionable merge-blocking risk remains after normal checks and review.

Possibly related PRs

🚥 Pre-merge checks | ✅ 6
✅ Passed checks (6 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
End-To-End Regression Coverage For Fixes ✅ Passed The title uses test language, not bug-fix language, and all listed changes are exclusively under apps/website, which the check exempts.
Adr Compliance For Entity/Litegraph Changes ✅ Passed The changed files are limited to website event tests and data; none are under src/lib/litegraph/, src/ecs/, or graph-entity-related paths.
Title check ✅ Passed The title clearly summarizes the main change: preserving upcoming-events test coverage when the event list is empty.
Description check ✅ Passed The description covers the required summary, changes, review focus, screenshots, and verification details.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch glary/website-upcoming-events-test-resilience

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 12, 2026

Copy link
Copy Markdown

🌐 Website E2E

Tip

All tests passed.

Status ✅ Passed
Report View Report

🔗 Website Preview

Website Preview: https://comfy-website-preview-pr-15160.vercel.app

This commit: https://website-frontend-rdlix8sfw-comfyui.vercel.app

Last updated: 2026-08-12T22:45:13Z for e7c3b25

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/website/src/templates/events/UpcomingEventsSection.test.ts`:
- Around line 42-45: Extend the tests around the mocked upcomingEvents data to
cover an empty list, rendering the relevant section with no events and asserting
that the list remains attached. Keep the existing two-event coverage unchanged
and use the existing render/query helpers and list selector.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: a84e0dea-7df7-457f-8c79-d91b8a7f1121

📥 Commits

Reviewing files that changed from the base of the PR and between c4f9b91 and d6977c9.

📒 Files selected for processing (3)
  • apps/website/e2e/events.spec.ts
  • apps/website/src/data/events.ts
  • apps/website/src/templates/events/UpcomingEventsSection.test.ts

Comment thread apps/website/src/templates/events/UpcomingEventsSection.test.ts Outdated
Read the stubbed list through a getter so a test can empty it, and assert the
list element survives an empty derivation. That is the state the live page is
in whenever the schedule runs dry, and the e2e only reaches it by accident of
the calendar.
@christian-byrne
christian-byrne marked this pull request as ready for review August 23, 2026 07:46
@christian-byrne
christian-byrne requested a review from a team August 23, 2026 07:46
@dosubot dosubot Bot added the size:S This PR changes 10-29 lines, ignoring generated files. label Aug 23, 2026
@github-actions github-actions Bot added the risk:R2 PR risk grade (advisory shadow check; grader-owned) label Aug 23, 2026

@mobeenabdullah mobeenabdullah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM. Tests are behavioral, not change-detectors: they assert the link branch (streamed to /events/{id} with no target, external outbound with rel=noopener noreferrer), that the list survives an empty derivation, and zh-CN localization including asserting the English string is absent. vi.mock + importOriginal with a getter stubs only upcomingEvents and leaves the rest real, and satisfies ComfyEvent keeps the fixtures from drifting. Vitest picks up the new path and the happy-dom docblock overrides the node default. The events.ts change is a rename plus a comment fix, and the corrected comment is right: hydration re-derives, so classification is not build-fixed.

One thing: finding #1 in your description is a real user-facing bug (post-hydration content shift plus Vue hydration warnings on /events), and there's no open issue for it. PR bodies disappear into the squash commit, so please file it before merge.

@christian-byrne
christian-byrne added this pull request to the merge queue Aug 23, 2026
Merged via the queue into main with commit 296fc5c Aug 23, 2026
61 checks passed
@christian-byrne
christian-byrne deleted the glary/website-upcoming-events-test-resilience branch August 23, 2026 08:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:R2 PR risk grade (advisory shadow check; grader-owned) size:S This PR changes 10-29 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants