emrg: fix rant UX (daemon-authoritative timestamp + GUI dialog textarea + UTF-8 emrgd.log) + locale-safe tests - #556
Merged
Conversation
argszero
reviewed
Aug 7, 2026
argszero
left a comment
Owner
There was a problem hiding this comment.
✅ 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 sentnew 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 > textareamatches 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
reviewed
Aug 7, 2026
argszero
left a comment
Owner
There was a problem hiding this comment.
✅ 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
reviewed
Aug 7, 2026
argszero
left a comment
Owner
There was a problem hiding this comment.
✅ 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.
This was referenced Aug 7, 2026
argszero
added a commit
that referenced
this pull request
Aug 7, 2026
This was referenced Aug 7, 2026
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes three issues found on a UTC+8 Windows host (Chinese locale), plus a test-only locale bug.