Skip to content

fix(mobile): mark audit report timestamps UTC and translate audit actors - #8248

Merged
iscekic merged 5 commits into
mainfrom
drain/audit-report-timestamp-actor
Oct 21, 2026
Merged

iscekic merged 5 commits into
mainfrom
drain/audit-report-timestamp-actor

Conversation

@iscekic

@iscekic iscekic commented Oct 20, 2026 •

Copy link
Copy Markdown
Collaborator

Change

Two copy gaps in the Security Agent audit report (apps/mobile/src/components/security-agent/audit-report-screen.tsx), both against the report's own UTC period line:

  1. Generated-at line — it formatted generatedAt in UTC but only as a date, so a reader west of UTC saw a generation day their own calendar had not reached yet. One formatUtcTimestamp helper now prints the date, the clock (the language's own 12/24-hour cycle) and an explicit UTC marker, and the same helper formats every event timestamp in an expanded finding. The existing securityAgent.auditReport.generated copy keeps its {{generatedAt}} placeholder, so no catalog sentence changed.
  2. Event actor — expanded event lines printed the server's English displayName ("Kilo system"). System actors and masked actors now render catalog labels (actorSystem, actorMaskedUser, actorMaskedKiloAdmin), chosen from the actor discriminator instead of the English string. A real user's display name is still shown verbatim.

For the masked case the report carries an additive optional maskedKind ('kilo_admin' | 'user'), so a localized client can tell the two masked identities apart without matching English copy. A response that predates the field falls back to the generic masked-user label, and the apps/web rendering is unchanged.

Three English keys were added to apps/mobile/src/i18n/locales/en.json and translated in all 86 other catalogs. German values: Kilo-System, Maskierter Benutzer, Kilo-Administrator.

Event labels ("Imported", "Analysis completed") are localized by #8072, which is merged into this branch, so this change does not duplicate that work.

Verification

  • pnpm --filter kilo-app exec vitest run src/components/security-agent — 21 files, 301 tests pass on the merged head, including the new audit-report-screen-timestamps.mounted.test.tsx (UTC marker and clock on the generated line; system, masked and named actor labels).
  • NODE_ENV=test pnpm --filter web exec jest src/lib/security-agent/db/security-audit-report.test.ts — 27 tests pass with the new maskedKind.
  • pnpm --filter kilo-app check:i18n (87 catalogs match en.json), check:plurals, typecheck, lint, check:unused; pnpm --filter web typecheck; pnpm format:changed.
  • Android emulator (omp36), device locale de-DE, device time zone America/Los_Angeles (local date 19.10.2026), local dev stack, owned fake account, audit rows seeded in the local database only. Header: Der Bericht wurde am 20.10.2026, 03:08 UTC erstellt. directly under 23.7.2026 – 20.10.2026 · UTC. Expanded finding:
    • 30.9.2026, 02:54 UTC · Kilo-System
    • 2.10.2026, 02:54 UTC · Kilo-Administrator
    • 3.10.2026, 02:54 UTC · Maskierter Benutzer
    • 4.10.2026, 02:54 UTC · Drain Test User
  • Screenshots of that screen are attached in the comment below.

Proxy answers

The owner's proxy gave these answers in the owner's place.

  1. Question: UTC marker: How should the generated-at line carry its UTC marker?
    Answer: In the formatted value, no catalog change
    Confidence: 0.75 · Precedent: Speed and least work: "do the least amount of work possible, with no drop in quality" (an earlier session). This matches the brief's value-embedded example and the existing period-line pattern, and avoids platform-dependent Intl zone-name output.
  2. Question: Event lines: The expanded-finding event lines render only the date (no time, no UTC marker), the same defect class as the header. Fix that too?
    Answer: Add time and UTC marker to event lines
    Confidence: 0.60 · Precedent: Autonomy and decisions: fix the class, not the single symptom, on every affected surface (earlier sessions).
  3. Question: Masked actors: The server also sends English labels for masked actors (displayName "Masked user" / "Kilo Admin"). Localize those in this screen too?
    Answer: Localize masked labels as well
    Confidence: 0.55 · Precedent: UX and design quality: the mobile app must always respect i18n, plus fix the class (earlier sessions). Key on the actor type or mask, and keep real user display names unchanged.

The audit report's period line is labelled UTC, but the generated-at line
formatted only a date in UTC with no clock and no zone, so a reader west of
UTC saw a generation day their own calendar had not reached. Both the
generated-at line and each event timestamp now use one formatter that prints
the date, the clock and an explicit UTC marker in the app language.

Expand a finding and the event actor printed the server's English display
name ("Kilo system"). System and masked actors now render catalog labels in
the app language, chosen from the actor discriminator the report already
sends; a masked actor's kind is a new optional field so a localized client
does not have to match an English string, and a real user's name is still
shown verbatim.
@iscekic iscekic added drain Work item from the findings drain explorer:android Finding surfaced by the Android explorer labels Oct 20, 2026
@iscekic

iscekic commented Oct 20, 2026

Copy link
Copy Markdown
Collaborator Author

bot: Android emulator (omp36, device locale de-DE, device time zone America/Los_Angeles, local date 19.10.2026) against the local dev stack, owned fake account, audit rows seeded in the local database.

Observed in the rendered screen:

  • Header: Der Bericht wurde am 20.10.2026, 03:08 UTC erstellt. directly under the UTC period line 23.7.2026 – 20.10.2026 · UTC — the generation line now names the clock and the zone, so the UTC day is reconcilable with the reader's local day.
  • Expanded finding, event lines: 30.9.2026, 02:54 UTC · Kilo-System, 2.10.2026, 02:54 UTC · Kilo-Administrator, 3.10.2026, 02:54 UTC · Maskierter Benutzer, and 4.10.2026, 02:54 UTC · Drain Test User — system and masked actors are in German, a named user stays verbatim.

Event labels (Imported, Analysis completed, …) are still the server's English copy here; localizing them is the separate work in #8072.

German audit report header and expanded finding events showing UTC timestamps and localized actor labels

Comment thread apps/mobile/src/i18n/locales/ig.json Resolved
Comment thread apps/mobile/src/i18n/locales/ms.json Resolved
Comment thread apps/mobile/src/i18n/locales/om.json Resolved
Comment thread apps/mobile/src/i18n/locales/yo.json Resolved
@kilo-code-bot

kilo-code-bot Bot commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Executive Summary

Incremental review of 72d2105..b5056e3 confirms all six prior suggestions are addressed and the follow-up edits (module-level renderer teardown in afterEach, corrected formatter comment, and the ig/ms/om/yo term alignment) introduce no new defect.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 0
Verification of previous findings (all fixed)
  • audit-report-screen.tsx:48 — comment now names formatDate/Intl as the formatter.
  • ig.json:1865 — admin term is Onye nchịkwa; masked user uses Onye na-eji ngwa, matching roleUser.
  • ms.json:1865 — Pentadbir Kilo, matching the catalog's other admin strings.
  • om.json:1867 — Sirna Kilo, matching the catalog's Sirna.
  • yo.json:1865 — Alákòóso Kilo matches organization.members.roles.admin, and Olùmúlò matches roleUser.
  • audit-report-screen-timestamps.mounted.test.tsx:172 — renderer is now held in module scope and unmounted inside act() before i18n.changeLanguage, matching collapsible-section.mounted.test.tsx.

The test still renders exactly one tree per test, so the shared module-scope renderer cannot leak a previous tree. No production-code leak was introduced: the incremental changes touch only a comment and locale values.

Files Reviewed (6 changed files in this increment)
  • apps/mobile/src/components/security-agent/audit-report-screen-timestamps.mounted.test.tsx
  • apps/mobile/src/components/security-agent/audit-report-screen.tsx
  • apps/mobile/src/i18n/locales/ig.json
  • apps/mobile/src/i18n/locales/ms.json
  • apps/mobile/src/i18n/locales/om.json
  • apps/mobile/src/i18n/locales/yo.json

Notes: reviewed at b5056e399cee213a5e26489b1af95ddaf1481bc8; HEAD was re-confirmed unchanged before publishing.

Previous Review Summary (commit 72d2105)

Current summary above is authoritative. Previous snapshots are kept for context only.

Previous review (commit 72d2105)

Status: 6 Issues Found | Recommendation: Address before merge

Executive Summary

No functional defect in the new UTC formatting or masked-actor labeling; the findings are non-blocking localized-copy inconsistencies in four catalogs, one misleading comment, and missing test-renderer cleanup.

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 6
Issue Details (click to expand)

SUGGESTION

File Line Issue
apps/mobile/src/components/security-agent/audit-report-screen.tsx 48 Comment says t formats the date; the formatting is done by formatDate/Intl
apps/mobile/src/i18n/locales/ig.json 1865 Onye nlekọta is the catalog's "maintainer" term; admin is consistently Onye nchịkwa
apps/mobile/src/i18n/locales/ms.json 1865 Leaves English "Admin"; this catalog renders admin as pentadbir everywhere else
apps/mobile/src/i18n/locales/om.json 1867 Sistema is not the catalog's term for "system"; sirna is used throughout
apps/mobile/src/i18n/locales/yo.json 1865 Alákoso/Olùlo drop the tone marks used by the catalog's existing Alákòóso/Olùlò
apps/mobile/src/components/security-agent/audit-report-screen-timestamps.mounted.test.tsx 171 Renderers are never unmounted, unlike sibling mounted tests; afterEach can re-render a mounted tree outside act()
Files Reviewed (91 files)
  • apps/mobile/src/components/security-agent/audit-report-screen.tsx - 1 issue
  • apps/mobile/src/components/security-agent/audit-report-screen-timestamps.mounted.test.tsx - 1 issue
  • apps/mobile/src/i18n/locales/en.json - no issues
  • apps/mobile/src/i18n/locales/ig.json - 1 issue
  • apps/mobile/src/i18n/locales/ms.json - 1 issue
  • apps/mobile/src/i18n/locales/om.json - 1 issue
  • apps/mobile/src/i18n/locales/yo.json - 1 issue
  • Other 82 locale catalogs (af, am, ar, az, be, bg, bn, bs, ca, ckb, cs, cy, da, de, el, es, et, eu, fa, fi, fil, fr, ga, gl, gu, ha, he, hi, hr, ht, hu, hy, id, is, it, ja, ka, kk, km, kn, ko, lo, lt, lv, mg, mi, mk, ml, mn, mr, mt, my, nb, ne, nl, or, pa, pl, ps, pt, pt-BR, ro, ru, si, sk, sl, so, sq, sr, sv, sw, ta, te, th, tr, uk, ur, uz, vi, zh-Hans, zh-Hant, zu) - no issues
  • apps/web/src/lib/security-agent/db/security-audit-report.ts - no issues
  • apps/web/src/lib/security-agent/db/security-audit-report.test.ts - no issues

Notes: verified that maskedKind is set on every masked: true branch (system, unattributed, masked kilo_admin, masked user, unmasked user, admin-requester), that the mobile actor.maskedKind type genuinely flows from the web router type, and that no consumer, strict-equality test, or cached payload depends on the old actor shape. No memory leak is introduced by the production code; the test-file cleanup note above is the only resource-lifetime observation.


Reviewed by deepseek-v4.1-flash-1017 · Input: 44.1K · Output: 3.5K · Cached: 244.6K

Review guidance: REVIEW.md from base branch main

Review follow-ups: the Oromo catalogs call a system "Sirna", Malay and Igbo
admin labels reuse "Pentadbir" and "Onye nchịkwa", and Yoruba writes
"Alákòóso"/"Olùmúlò". The timestamp comment now names the real formatter, and
the new mounted suite unmounts its renderer like its siblings.
@iscekic iscekic added merge:human Substantive functional risk requires human review. merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. and removed merge:human Substantive functional risk requires human review. labels Oct 20, 2026
@iscekic
iscekic added this pull request to the merge queue Oct 21, 2026
@iscekic
iscekic removed this pull request from the merge queue due to a manual request Oct 21, 2026
@iscekic iscekic removed the merge:bot Bot-owned review; merge when ready once readiness passes and a review approves. label Oct 21, 2026
…mestamp-actor

# Conflicts:
#	apps/mobile/src/i18n/locales/fi.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

drain Work item from the findings drain explorer:android Finding surfaced by the Android explorer merge:bot Bot-owned review; merge when ready once readiness passes and a review approves.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants