unbridled-41 commented on PR #5886:
URL: 
https://github.com/apache/rocketmq-dashboard/pull/5886#issuecomment-6091013571

   ### Follow-up review of this fix: four writes still left the audit column to 
the database
   
   This PR's contract is that the app writes the zone-less audit instants in 
UTC, because the API serializes them as UTC. Four writes still left 
`gmt_modified` to the column's `ON UPDATE CURRENT_TIMESTAMP`, which uses the 
database session's zone:
   
   | write | column left to the database |
   | --- | --- |
   | `setUserEnabled` (`updateById`) | `rmq_studio_user.gmt_modified` — 
`updateById` only writes non-null fields, so the new entity's null timestamp is 
not in the `SET` |
   | `revokeUserSessions` | `rmq_studio_session.gmt_modified` |
   | `logout` | `rmq_studio_session.gmt_modified` |
   | the throttled `last_seen_at` refresh | `rmq_studio_session.gmt_modified` |
   
   So enabling/disabling a user or ending a session stored a timestamp that 
disagrees with every other timestamp the same API returns for that row. Commit 
`6fd3c615` closes that in this branch (first commit `4ed13473` untouched, no 
force-push): each of the four statements now sets `gmt_modified` to the same 
`now()` (UTC) it already uses for `revoked_at` / `last_seen_at` / `enabled`.
   
   Tests:
   
   - new `userAndSessionUpdatesStampTheUtcAuditInstantTest` (captures the 
`updateById` entity and asserts `gmtModified == 2026-08-13T00:00`),
   - new `revokingSessionsStampsTheUtcModifiedInstantTest` and 
`loggingOutStampsTheUtcModifiedInstantTest` (assert the `SET` contains 
`gmt_modified` and the bound value is the UTC instant),
   - `databaseAuthenticationUpdatesStaleLastSeenTimestamp` now asserts the same 
for the last-seen write.
   
   Red/green, both observed locally:
   
   ```
   # with the four stamps reverted
   cd server && mvn -o -B -ntp test -Dtest='AuthServiceDatabaseTest'
   Tests run: 36, Failures: 4, Errors: 0, Skipped: 0   <<< FAILURE!   (the four 
tests above)
   
   # with 6fd3c615
   cd server && mvn -o -B -ntp test 
-Dtest='org.apache.rocketmq.studio.auth.*Test'
   Tests run: 158, Failures: 0, Errors: 0, Skipped: 0
   BUILD SUCCESS
   ```
   
   Branch `fix/auth-audit-columns-utc`, HEAD `6fd3c615` (on top of `4ed13473`).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to