Skip to content

emrg: fix rant UX (daemon-authoritative timestamp + GUI dialog textarea + UTF-8 emrgd.log) + locale-safe tests - #556

Merged
argszero merged 3 commits into
argszero:masterfrom
pm25coder:feature/test-encoding-utf8
Aug 7, 2026
Merged

emrg: fix rant UX (daemon-authoritative timestamp + GUI dialog textarea + UTF-8 emrgd.log) + locale-safe tests#556
argszero merged 3 commits into
argszero:masterfrom
pm25coder:feature/test-encoding-utf8

Conversation

@pm25coder

Copy link
Copy Markdown
Contributor

Fixes three issues found on a UTC+8 Windows host (Chinese locale), plus a test-only locale bug.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260807-222237 (1st angle: correctness + locale-safety)

Reviewed head 444e514 (fetched and tested locally):

  • daemon-authoritative timestamp: daemon.py now stamps datetime.now().astimezone().isoformat() (tz-aware local), ignoring client-supplied timestamps. Fixes the real bug: GUI sent new Date().toISOString() (UTC Z, 8h behind on UTC+8 hosts), TUI sent naive local time — inconsistent and mis-sorted. Tz-aware local ISO sorts correctly and is self-describing. test_rant_field_order asserts the client-supplied stale UTC value (…Z) is ignored, entry is tz-aware, not Z-suffixed, and within 60s of wall clock — discriminating.
  • main.js: timestamp deliberately not sent; comment documents the rationale. TUI client (app.py) still sends its own timestamp but daemon now ignores it — single source of truth, no behavior break.
  • main.py: RotatingFileHandler gains encoding="utf-8" — fixes GBK code-page mojibake of CJK log lines on zh-CN Windows.
  • components.css: .dialog-card label > textarea matches the rant-dialog markup (index.html rant-message textarea is inside label) — full width, min-height 120px, vertical resize, inherited font. The tiny default textarea is fixed.
  • tests: read_text(encoding="utf-8") in test_config/test_memory — locale-safe on Windows (GBK default locale would fail otherwise).
  • Validation: 572 Python + 93 GUI tests pass locally on this branch; CI test workflow green (31187043479).
  • Note: package-lock.json churn (0.2.0→0.2.11 version + peer-flag reshuffle) is npm noise from version sync — harmless, consistent with the 0.2.11 bump.

@argszero argszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260807-222539 (2nd angle: test discriminative power + tz edge cases)

Verified on head 444e514:

  • Positive: test_rant_field_order passes (tz-aware local, stale UTC ignored, within 60s).
  • Negative (per #455 lesson, ran it): reverted daemon to msg.get("timestamp", datetime.now().isoformat()) (old behavior) → the test FAILS because the stale client UTC Z value leaks through the endswith("Z") / tzinfo asserts. Restored → passes. Genuinely discriminating across all three regression modes: client-timestamp leak (Z suffix), naive local (tzinfo None), naive UTC (Z suffix).
  • Tz edge cases: fromisoformat handles the +08:00 offset; now(ts.tzinfo) normalizes comparison; DST-transition hosts still within 60s (wall clock comparison, not epoch). Solid.
  • Full 572 Python + 93 GUI pass on this branch; CI green (31187043479).

@argszero argszero left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

✅ LGTM — cycle 20260807-222827 (3rd/final angle: end-to-end Windows zh-CN behavior + hygiene)

Verified on head 444e514:

  • End-to-end: GUI rant flow no longer sends timestamp → daemon stamps tz-aware local (+08:00 on zh-CN host). TUI still sends its own naive-local timestamp but the daemon IGNORES it (verified in daemon.py: entry timestamp comes only from datetime.now().astimezone()) — single source of truth, no client breakage. Sorting in rants.jsonl is now correct across both clients on any timezone.
  • zh-CN Windows runtime: RotatingFileHandler encoding='utf-8' → CJK log lines no longer GBK-mojibake; read_text(encoding='utf-8') in tests → locale-safe. textarea CSS selector matches the actual rant-dialog markup (.dialog-card label > textarea — rant-message is directly inside label).
  • package-lock.json: version 0.2.0→0.2.11 sync (correct, matches package.json) + peer-flag reshuffle is npm regenerated noise — harmless, no dependency version changes.
  • Validation: 572 Python + 93 GUI tests pass locally on this branch; CI test workflow green (31187043479).
  • Three consecutive ✅ from distinct cycles (222237 correctness, 222539 discriminative power, this cycle e2e/hygiene), no ❌. Ready to merge.

@argszero
argszero merged commit 374c98b into argszero:master Aug 7, 2026
1 check passed
argszero added a commit that referenced this pull request Aug 7, 2026
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
argszero added a commit that referenced this pull request Aug 7, 2026
…unt fixes (#553-#561) (#562)

Version bump 0.2.11 → 0.2.12 across all 7 version sources
(pyproject.toml / emrg/__init__.py / gui/package.json /
gui/package-lock.json / uv.lock / build-runtime.sh / make-installer.sh).

Release for rant 发布新版本 (2026-08-07T23:54:46) — ships 9 commits
accumulated since v0.2.11:

- #553 Windows TUI Unicode input via ReadConsoleInputW
- #554 GUI interleaved text/tool message order
- #556 rant UX (daemon-authoritative timestamp + GUI textarea + UTF-8 log)
- #558 evolution count always 0 fix
- #559 exclude aborted evolution cycles from count and idle-halt backoff
- #557/#560/#561 quick-ref entries

All 575 tests green.
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.

2 participants