Skip to content

fix: resolve release calendar date at build time and add render tests - #566

Closed
Alex Iannicelli (atiannicelli) wants to merge 4 commits into
mainfrom
atiannicelli-release-calendar-review-fixes
Closed

Alex Iannicelli (atiannicelli) wants to merge 4 commits into
mainfrom
atiannicelli-release-calendar-review-fixes

Conversation

@atiannicelli

Copy link
Copy Markdown
Contributor

Pull Request

Summary

Stacked on #565 (feat/release-calendar-json), with suggested fixes for the three "should fix" items from the deep-dive review of that PR. Intended to be merged into the feature branch (or cherry-picked by John McCall (@lowlydba)) before #565 lands.

Refs #565, #525, OvertureMaps/ops-team#588

Changes

1. Resolve "today" at build time, not in the browser (docusaurus.config.js, src/releaseCalendar.js, src/components/ReleaseCalendar.jsx)

ReleaseCalendar.jsx called splitReleases(calendar.releases) at module scope, which defaulted today to new Date(). That runs once during SSR and again in the browser, so once a scheduled release date passes before the next deploy the client splits the rows differently from the server-rendered HTML and React warns on hydration. The config now computes buildDate once, uses it for the STAC fallback, and exposes it via customFields (same mechanism as releaseNoteDates). The component reads it through a useReleases() hook. splitReleases now requires today explicitly; the existing unit tests already passed it.

2. Add render tests for the new React code (vitest.config.mjs, src/__mocks__/*, src/components/__tests__/ReleaseCalendar.test.jsx, src/__tests__/codeBlock.test.jsx)

Follows the existing RTL pattern (SmartTable.test.jsx, CommunityTable.test.jsx) and the existing @docusaurus/useBaseUrl alias-to-mock approach. Adds aliases + mocks for @docusaurus/useDocusaurusContext (with setCustomFields() for tests), @docusaurus/Link, and @theme-original/CodeBlock. The calendar JSON is replaced with a small fixture via vi.mock so the tests exercise ordering, the shipped/upcoming boundary (including a release dated on buildDate), the * marker and footnote, TBD, release-notes links (shared by patch releases), and the pre-1.0 schema-link rule. The CodeBlock swizzle is renamed index.js → index.jsx so vitest can parse its JSX (Docusaurus resolves either extension); its tests cover placeholder replacement, non-string children pass-through, and prop forwarding.

3. Collapse ReleaseTable render props into one renderer (src/components/ReleaseCalendar.jsx)

releaseNotesPath() returns null for versions with no notes post and schemaLink(null) is null, so upcoming rows naturally render without links — one renderer serves both tables. This also removes the inconsistency where the history table wrapped TBD/schema in <code> and the schedule didn't. The "*reserved for quarterly major breaking change release" footnote now only renders when an upcoming row is actually marked majorChangeMonth.

Not included (left as "consider" items in the review): cwd-relative readdirSync('blog'), the majorChangeMonth: false entries in the JSON, and the duplicated JSON mention in release-calendar.mdx.

Testing

Command Result
npm test (vitest run) ✅ 7 files passed, 1 skipped; 190 tests passed, 7 skipped (13 new)
npm run lint ✅ 0 errors (9 pre-existing warnings, none in changed files)
npx prettier --check <changed files> ✅ all pass (src/__mocks__/docusaurus-useBaseUrl.js already fails on the base branch; not touched)
npm run build ✅ [SUCCESS] Generated static files; build/release-calendar/index.html renders footnote, 3× TBD, 28 schema links, 28 notes links; __OVERTURE_RELEASE resolved to 2026-09-23.1 in all 5 example pages (wherobots, spark, sedona, pandas, ibis) with 0 unresolved placeholders

John McCall (lowlydba) and others added 4 commits October 8, 2026 15:02
Add static/release-calendar.json and its JSON Schema, render the release schedule and history from it, and replace hardcoded release versions in docs examples with the __OVERTURE_RELEASE placeholder. Rename the 2024 release notes posts to the standard filename and redirect their old paths.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: John McCall <john@overturemaps.org>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: John McCall <john@overturemaps.org>
Remove an extra blank line in ibis.mdx, render TBD for a null schemaVersion in the history table, validate release dates with the date format, and drop the stale tutorial pinning example from CONTRIBUTING.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: John McCall <john@overturemaps.org>
Follow-up to #565 addressing the three should-fix items from the deep-dive review.

- Compute today's date once in docusaurus.config.js (buildDate) and expose it
  via customFields so ReleaseCalendar.jsx splits shipped/upcoming with the same
  date on the server and in the browser, avoiding a hydration mismatch once a
  scheduled release date passes before the site is rebuilt. splitReleases now
  requires today explicitly.
- Collapse ReleaseTable's render props into a single renderer; upcoming rows
  naturally have no notes post or schema link, so both tables render the same
  way. The major-change footnote only renders when an upcoming row carries it.
- Add RTL render tests for ReleaseSchedule/ReleaseHistory and the CodeBlock
  swizzle (renamed to index.jsx so vitest can parse it), with vitest aliases
  and mocks for @docusaurus/useDocusaurusContext, @docusaurus/Link and
  @theme-original/CodeBlock.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Signed-off-by: Alex Iannicelli <atiannicelli@gmail.com>
Base automatically changed from feat/release-calendar-json to main October 8, 2026 19:50
@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

✅MegaLinter analysis: Success

Descriptor Linter Files Fixed Errors Max errors Warnings Elapsed time
✅ JAVASCRIPT eslint 38 0 0 13.14s
✅ MARKDOWN markdownlint 286 0 0 0.3s
✅ SQL sqlfluff 79 0 0 3.91s

See detailed reports in MegaLinter artifacts

Your project could benefit from a custom flavor, which would allow you to run only the linters you need, and thus improve runtime performances. (Skip this info by defining FLAVOR_SUGGESTIONS: false)

  • Documentation: Custom Flavors
  • Command: npx mega-linter-runner@10.1.0 --custom-flavor-setup --custom-flavor-linters JAVASCRIPT_ES,MARKDOWN_MARKDOWNLINT,SQL_SQLFLUFF

MegaLinter is provided by OX Security
Show us your support by starring ⭐ the repository

@atiannicelli

Copy link
Copy Markdown
Contributor Author

bad A.I.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants