mirror of
https://github.com/harvard-edge/cs249r_book.git
synced 2026-07-21 17:57:24 -05:00
[PR #1843] [MERGED] fix(staffml): derive PaperCitationCard year from buildDate, not new Date()
#30947
Closed
opened 2026-06-21 20:35:27 -05:00 by GiteaMirror
·
0 comments
No Branch/Tag Specified
dev
audit/mlperf-edu-readiness
feat/mlperf-edu-precondition
gh-pages
vol1/all-final
main
vol1/appendices-final
vol1/ch16-final
vol1/ch15-final
vol1/ch14-final
vol1/ch13-final
vol1/ch11-final
vol1/ch12-final
vol1/ch10-final
vol1/ch9-final
vol1/ch8-final
vol1/ch7-final
vol1/ch6-final
vol1/ch5-final
vol1/ch4-final
vol1/ch3-final
vol1/ch2-final
vol1/frontmater-final
kai/fixing-profile-setting-and-map
chore/staffml-ci-path
fix/callout-flow
vol1/ch10-pass4
vol1/ch9-pass4
vol1/ch8-pass4
vol1/ch7-pass4
vol1/ch6-pass4
vol1/ch5-pass4
vol1/apC-pass3
vol1/ch4-pass4
vol1/ch3-pass4
vol1/ch2-pass4
vol1/ch1-pass4
vol1/frontmatter
vol1/apE-pass3
vol1/apD-pass3
fmt-fix
vol1/ch14-pass3
kai/clarify-community-map-totals
vol1/ch13-pass3
vol1/ch12-pass3
vol1/ch11-pass3
vol1/ch10-pass3
vol1/ch7-pass3
vol1/ch9-pass3
vol1/ch8-pass3
vol1/ch6-pass3
vol1/ch5-pass3
vol1/ch4-pass3
vol1/ch3-pass3
vol1/ch2-pass3
vol1/ch1-pass3
vol1/ch6-pass2
vol1/ch5-pass2
vol1/ch4-pass2
vol1/ch3-pass2
vol1/ch2-pass2
fix/badge-fixes
chore/precommit-cleanup
cleanup/book-validate-paths
fix/staffml-trigger-on-workflow-edits
fix/staffml-reusable-concurrency
feat/container-preflight-urls
instructors-v0.1.1
vol1-pr1957-merged
vol2-v0.2.1
vol1-v0.7.1
vol1-v0.7.0+vol2-v0.2.0
slides-v0.1.0
vol2-v0.2.0
vol1-v0.7.0
tinytorch-v0.1.13
mlsysim-v0.2.0
vol2-v0.1.2
vol1-v0.6.2
tinytorch-v0.1.12
vol2-v0.1.1
vol1-v0.6.1
mlsysim-v0.1.3
vol2-v0.1.0
vol1-v0.6.0
mlsysim-v0.1.2
staffml-v0.1.1
tinytorch-v0.1.11
labs-v0.1.0
kits-v0.1.0
slides-latest
instructors-v0.1.0
staffml-v0.1.0
mlsysim-v0.1.1
mlsysim-v0.1.0
tinytorch-v0.1.10
build-verified-windows-v1
tinytorch-v0.1.9
tinytorch-v0.1.8
mit-submission-v1
tinytorch-v0.1.7
tinytorch-v0.1.6
tinytorch-v0.1.5
tinytorch-slides-v0.1.0
tinytorch-v0.1.3
tinytorch-v0.1.4
tinytorch-v0.1.2
tinytorch-v0.1.1
tinytorch-v0.1.0
book-v0.5.1
tinytorch-audio-v0.1.1
tinytorch-audio-assets-v0.1
book-v0.5.0
book-v0.4.2
book-v0.4.1
book-v0.4.0
book-v0.3.0
book-v0.2.0
book-v0.1.0
Labels
Clear labels
area: book
area: collabs
area: kits
area: labs
area: socratiq
area: staffml
area: tinytorch
area: tools
area: website
bug
dependencies
format: epub
format: pdf
javascript
link-health
link-rot
priority-high
pull-request
staffml
type: bug
type: citation
type: code
type: errata
type: improvement
type: new
type: question
vault-sli
Mirrored from GitHub Pull Request
No labels
pull-request
Milestone
No items
No Milestone
Projects
Clear projects
No projects
No Assignees
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/cs249r_book#30947
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
📋 Pull Request Information
Original PR: https://github.com/harvard-edge/cs249r_book/pull/1843
Author: @farhan523
Created: 6/6/2026
Status: ✅ Merged
Merged: 6/10/2026
Merged by: @profvjreddi
Base:
dev← Head:fix/papercitation-deterministic-year📝 Commits (1)
d7a7c38fix(staffml): derive PaperCitationCard year from buildDate, notnew Date()📊 Changes
2 files changed (+81 additions, -6 deletions)
View changed files
➕
interviews/staffml/src/__tests__/paper-citation-card.test.tsx(+66 -0)📝
interviews/staffml/src/components/PaperCitationCard.tsx(+15 -6)📄 Description
Summary
The BibTeX entry in
PaperCitationCardtook its year fromnew Date().getFullYear()— the render-time year on the client. With Next's static export the HTML is generated at build time and hydrates on the client whenever the user visits, so server (build) and client (hydrate) could disagree on the year:Hydration mismatch warning either way, and the wrong anchor for a citation regardless — the year in a software citation should be the release year, not the year the reader happened to view the page.
Changes
buildDaterequired onPaperCitationCardProps. The only call site atapp/about/page.tsxalready passes it fromBUILD_DATEinlib/stats, so this is a type-level alignment with the existing real-world usage.new Date(buildDate).getUTCFullYear()so the year matches the build server's UTC reference regardless of viewer timezone.buildDateLabelsimplifies: nobuildDate ? ... : nullternary, just the formatted string. The&&short-circuit at the render site is now redundant but harmless — left as defense-in-depth.Out of scope
The displayed
buildDateLabelstill usestoLocaleDateStringwith no timezone option, which CAN mismatch on a build like2026-04-22T03:00:00Zviewed in PT (renders "April 22, 2026" on the build server, "April 21, 2026" on a PT client). That's a separate, smaller hydration concern with a UX trade-off (UTC vs viewer's local date) — happy to file a follow-up if it's worth fixing.Test plan
npx vitest run→ 60/60 individual cases (was 57 on dev; +3 new for the year derivation, including a clock-mock test that catches future regressions tonew Date()).npx tsc --noEmit→ unchanged from dev baseline (the 2 pre-existingkatex/js-quantitieserrors are env-local)./about, expand "Cite this release", confirm the BibTeX year matchesBUILD_DATE's UTC year.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.