unbridled-41 opened a new pull request, #5904:
URL: https://github.com/apache/rocketmq-dashboard/pull/5904

   ### Which Issue(s) This PR Fixes
   
   Fixes #5903
   
   ### Problem / Evidence
   
   `K8sCertService` stamps both instants from `Clock.systemUTC()` and its own 
comment states the wire contract:
   
   ```java
   // Serialize certificate instants as UTC wall time: the frontend 
(formatUtcDateTime)
   // interprets the zoneless wire value as UTC and renders it in the viewer's 
zone
   ```
   
   but `MybatisPlusK8sCertRepository.toEntity` replaced one of them:
   
   ```java
   entity.setGmtCreate(cert.getGmtCreate());     // the service's UTC instant
   entity.setGmtModified(LocalDateTime.now());   // the JVM default zone
   ```
   
   `POST /api/k8s-certs` answers from the in-memory VO (UTC) while the next 
`GET /api/k8s-certs` reads the row back, so the same field differs by the whole 
server offset (the compose deployment sets `TZ=Asia/Shanghai`) and disagrees 
with `gmt_create` of its own row. Measured with the default zone set to 
Asia/Shanghai:
   
   ```
   expected: 2026-10-09T16:17:12.996162568
    but was: 2026-10-10T01:17:13.120986256
   ```
   
   ### Root cause / Fix
   
   A repository re-stamping a service-owned timestamp with the JVM clock. 
Persist `cert.getGmtModified()` and only fall back to 
`LocalDateTime.now(ZoneOffset.UTC)` when the VO carries none - the same 
convention `MybatisPlusAlertStateRepository` already uses.
   
   ### Priority and scoring
   
   **PRIORITY 48** — impact 14/40 (a wrong instant in the certificate API; the 
bundled UI does not render it today, API consumers read it), blast radius 10/20 
(every created/updated certificate on a non-UTC server zone), reproducibility 
16/20 (deterministic, pinned by the new test), maintenance value 8/20 (one more 
place where the zone depended on the host).
   
   **FIX_CONFIDENCE 88** — the value and its intended zone are both explicit in 
the service; the fix is a passthrough.
   
   ### Tests
   
   `cd server && mvn -o -B -ntp test 
-Dtest='MybatisPlusK8sCertRepositoryTest,K8sCertServiceTest'` -> `Tests run: 
30, Failures: 0, Errors: 0`.
   
   | Test | Before | After |
   |---|---|---|
   | 
`MybatisPlusK8sCertRepositoryTest#saveShouldPersistTheUtcModifiedInstantTheServiceStampedTest`
 | FAIL (offset applied: `but was 2026-10-10T01:17`) | PASS |
   
   `mvn -o -B -ntp checkstyle:check` passes.
   
   ### Risk
   
   Only the zone of the persisted modified instant changes; a row created 
before this fix keeps its old value until it is next written.


-- 
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