emrg: unified rant tool — submit/list/update/cleanup actions + tolerant rants.jsonl parsing (rant 2026-08-18T16:42:52) - #845
Conversation
…nt rants.jsonl parsing (rant 2026-08-18T16:42:52)
…ative timestamps — CI runs UTC)
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 727: unified rant tool (rant 2026-08-18T16:42:52). rants.py gains tolerant read (legacy array rows → canonical dicts) + list/update/cleanup with enforced pending→in_progress→completed state machine and keep-10 rule; submit_rant tool exposes the 4 actions (name unchanged, daemon/TUI/GUI references intact); evolution_prompt.md now mandates tool-only rants.jsonl access; +10 tests (UTC-safe after fix). Local: pytest 951+1 (952, doc-count guard green), import + CLI OK, GUI 259 green. CI test+test-windows PASS.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 728 (independent re-review): head 50277f9 unchanged since 727, CI test+test-windows PASS, MERGEABLE CLEAN. Re-verified the core diff: _normalize_rant converts both dict and legacy array rows to the canonical 6-field dict (unknown fields dropped), _read_rants tolerates corrupt lines, update_rant enforces pending→in_progress→completed with no skipping and auto-writes the completed timestamp, cleanup_rants keeps active + 10 most recent completed. Append path refactored onto the shared writer (behavior unchanged). No ❌ — 2/3.
argszero
left a comment
There was a problem hiding this comment.
✅ LGTM — cycle 729 (independent re-review): head 50277f9 unchanged (727/728 both LGTM'd this exact head), CI test+test-windows PASS (32119175749), MERGEABLE CLEAN. Re-verified state-machine edge cases (no skip pending→completed; in_progress→completed auto-timestamp), cleanup keep-10 + sort, and the tool's execute action routing. 3 consecutive LGTMs from 3 cycles, no ❌ — mergeable.
Summary
Rant 2026-08-18T16:42:52: a parallel evolution session rewrote
~/.emrg/rants.jsonlwith an inline python script, causing three kinds of damage:[ts, project, status, progress, completed, message]), breaking every consumer that usesr.get(...)(AttributeErroron lists).completed/fullmessagereplaced by progress summaries.Root cause: agents were allowed to hand-write
rants.jsonlwith arbitrary bash/python. Fix: make the rant tool the only entry point and give it the 4 curation actions.Changes
emrg/server/rants.py_read_rants()— tolerant parse: dict rows pass through, legacy array rows are converted back to dicts, unknown fields dropped, corrupt lines skipped (append_rantpreviously crashed on array rows via.get()on a list)._write_rants()— the single canonical writer (6-field ordertimestamp → project → status → progress → completed → message, sorted ascending by timestamp,ensure_ascii=False).list_rants(status, project)— filtered listing for curation.update_rant(timestamp, status, progress, completed)— state machine enforced (pending → in_progress → completed, no skipping;completedtimestamp auto-written in local ISO time when status becomes completed).cleanup_rants(keep=10)— keeps all pending/in_progress + 10 most recent completed.append_rantrefactored onto the shared read/write helpers (behavior unchanged).emrg/tools/submit_rant_tool.py— unified tool (name keptsubmit_rantso daemon/TUI/GUI references are unchanged) withactionparameter:submit(existing consent-gated path, project+message required),list(optional status/project filters, message summary ≤100 chars),update(by timestamp, state machine),cleanup(keep-10). Unknown action → error result.emrg/server/evolution_prompt.md— Rant management section now mandates: allrants.jsonlread/write goes through the tool (list→update→cleanup), never hand-written bash/python (prompt-specific change — the rant targets the prompt itself).tests/test_submit_rant_tool.py— +10 tests: array-row tolerance, list filters, state machine (valid + skip-back + no-skip), unknown timestamp/status, cleanup keep-10, tool list/update/cleanup/unknown-action, definition schema.Agent.md— Python test count 942 → 952.Verification
uv run pytest tests/ -v→ 951 passed, 1 skipped (952 collected, doc-count guard green)uv run python -c "from emrg.client.app import run_client"→ OKuv run python -m emrg --help→ OKupdate_rantpath (both 16:09:45/16:24:01 rants marked completed)Closes rant 2026-08-18T16:42:52 (pending).