Repository navigation
Bump client/shared and server/shared: admin-only timezone-fix action - #167
Conversation
Picks up: - buzz-code/nra-server#45: generic admin-only 'fixTimezoneShift' doAction on BaseEntityService, correcting createdAt/updatedAt for rows written before the mysql connection was pinned to UTC (nra-server#44) - buzz-code/nra-client#43: matching admin-only bulk action button, auto-offered on any list whose rows carry createdAt/updatedAt No per-entity wiring needed on either side - every list backed by BaseEntityService with createdAt/updatedAt (att_report, klass, student, teacher, ...) picks this up automatically. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn
There was a problem hiding this comment.
🟡 Changes recommended
Bulk timestamp-fix action lacks safety guardrails (confirm/cutoff) and can be triggered in ways that risk corrupting correct data.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Bump client/shared + server/shared submodules to add admin-only bulk action that backfills wrong createdAt/updatedAt timestamps written before MySQL connection pinned to UTC.
Changes:
- Update
client/sharedsubmodule to include bulk action button (fixTimezoneShift) hidden for non-admin users. - Update
server/sharedsubmodule to include admin-onlyBaseEntityServiceactionfixTimezoneShiftthat rewrites timestamp columns DST-aware (Asia/Jerusalem).
Review notes (cannot place inline PR comments without diff hunks in prompt):
- Client bulk action appears to execute immediately (no confirm dialog). Risk: accidental click causes irreversible timestamp mutation.
- Server implementation appears to allocate
Intl.DateTimeFormatrepeatedly inside offset calculation (3x per timestamp). Large selections can get slow; cache formatter per timezone. - Server action can corrupt already-correct rows if admin selects post-fix records; add explicit confirmation gate and/or cutoff guard.
File summaries
| File | Description |
|---|---|
| client/shared | Submodule pointer bump to nra-client change adding admin-only bulk action button. |
| server/shared | Submodule pointer bump to nra-server change adding admin-only fixTimezoneShift action + timestamp rewrite util. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Addresses a Copilot review finding on buzz-code/react-admin-nestjs#167: getTimeZoneOffsetMinutes constructed a fresh Intl.DateTimeFormat on every call (up to 3x per date column per row), which is comparatively expensive and unnecessary since the formatter is stateless across the dates it formats. Cache one instance per timezone instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn
Addresses a Copilot review finding on buzz-code/react-admin-nestjs#167: getTimeZoneOffsetMinutes constructed a fresh Intl.DateTimeFormat on every call (up to 3x per date column per row), which is comparatively expensive and unnecessary since the formatter is stateless across the dates it formats. Cache one instance per timezone instead. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn
Addresses a Copilot review finding on buzz-code/react-admin-nestjs#167: the button fired immediately on click, no confirmation, for an action that can corrupt already-correct data if run on the wrong rows. Passing children to BulkActionButton switches it to dialog mode (via BulkRequestButton/ActionOrDialogButton), so it now shows a warning with the selected-row count and requires an explicit confirm click. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn
Addresses a Copilot review finding on buzz-code/react-admin-nestjs#167: getTimeZoneOffsetMinutes constructed a fresh Intl.DateTimeFormat on every call (up to 3x per date column per row), which is comparatively expensive and unnecessary since the formatter is stateless across the dates it formats. Cache one instance per timezone instead. Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn Co-authored-by: Claude <noreply@anthropic.com>
Addresses a Copilot review finding on buzz-code/react-admin-nestjs#167: the button fired immediately on click, no confirmation, for an action that can corrupt already-correct data if run on the wrong rows. Passing children to BulkActionButton switches it to dialog mode (via BulkRequestButton/ActionOrDialogButton), so it now shows a warning with the selected-row count and requires an explicit confirm click. Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn Co-authored-by: Claude <noreply@anthropic.com>
Picks up: - buzz-code/nra-server#46: cache the Intl.DateTimeFormat instance in fixTimezoneShift (was constructed fresh up to 3x per date column per row) - buzz-code/nra-client#44: BulkFixTimezoneShiftButton now confirms before firing (was immediate on click) Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn
|
Addressed the Copilot review's findings:
Both submodules re-bumped in this PR's latest commit. On the cutoff-guard suggestion: no heuristic can tell "correctly-written post-fix row" apart from "wrong pre-fix row" from the stored value alone — both are just valid Date values. The confirmation dialog is the mitigation that actually holds, since the admin selecting the rows is the one who knows which ones are pre-fix. Generated by Claude Code |
Summary
Follow-up to #166 (pinned the mysql connection to UTC): that fix is forward-only, so rows written before it went live keep their wrong
createdAt/updatedAt. Adds an admin-only way to correct them from the UI.Change
Bumps both submodules to pick up:
'fixTimezoneShift'doAction onBaseEntityService, available on every entity withcreatedAt/updatedAt. Reinterprets each selected row's stored digits as the Israel-local wall-clock reading they actually were (DST-aware) and writes the corrected UTC instant back.createdAt/updatedAt; self-hides for non-admins.No per-entity wiring needed on either side — every affected list (att_report, klass, student, teacher, lesson, grade, …) picks this up automatically once the submodules are bumped.
Testing
cd server && yarn test— 115 suites / 1022 tests passingcd server && yarn build— cleancd client && yarn test— 31/32 suites passing (1 pre-existing skip, unrelated)cd client && yarn build— clean🤖 Generated with Claude Code
https://claude.ai/code/session_01KeX6BFe7P4pHLPm3VwFjPn
Generated by Claude Code