Skip to content

Bump client/shared and server/shared: admin-only timezone-fix action - #167

Merged
buzz-code merged 2 commits into
mainfrom
claude/admin-fix-timezone-shift-button
Sep 2, 2026
Merged

buzz-code merged 2 commits into
mainfrom
claude/admin-fix-timezone-shift-button

Conversation

@buzz-code

Copy link
Copy Markdown
Owner

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:

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 passing
  • cd server && yarn build — clean
  • cd 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

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
Copilot AI lite review requested due to automatic review settings September 2, 2026 08:41

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 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/shared submodule to include bulk action button (fixTimezoneShift) hidden for non-admin users.
  • Update server/shared submodule to include admin-only BaseEntityService action fixTimezoneShift that 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.DateTimeFormat repeatedly 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.

buzz-code pushed a commit to buzz-code/nra-server that referenced this pull request Sep 2, 2026
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
buzz-code pushed a commit to buzz-code/nra-server that referenced this pull request Sep 2, 2026
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
buzz-code pushed a commit to buzz-code/nra-client that referenced this pull request Sep 2, 2026
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
buzz-code added a commit to buzz-code/nra-server that referenced this pull request Sep 2, 2026
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>
buzz-code added a commit to buzz-code/nra-client that referenced this pull request Sep 2, 2026
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

Copy link
Copy Markdown
Owner Author

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

@buzz-code
buzz-code merged commit 2f619a6 into main Sep 2, 2026
4 checks passed
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.

3 participants