Skip to content

emrg: unified rant tool — submit/list/update/cleanup actions + tolerant rants.jsonl parsing (rant 2026-08-18T16:42:52) - #845

Merged
argszero merged 2 commits into
masterfrom
feature/unified-rant-tool
Aug 18, 2026
Merged

argszero merged 2 commits into
masterfrom
feature/unified-rant-tool

Conversation

@argszero

Copy link
Copy Markdown
Owner

Summary

Rant 2026-08-18T16:42:52: a parallel evolution session rewrote ~/.emrg/rants.jsonl with an inline python script, causing three kinds of damage:

  1. Format drift — canonical 6-field dict rows became positional array rows ([ts, project, status, progress, completed, message]), breaking every consumer that uses r.get(...) (AttributeError on lists).
  2. Field losscompleted/full message replaced by progress summaries.
  3. History pruning — old entries trimmed (host manually restored the file).

Root cause: agents were allowed to hand-write rants.jsonl with 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_rant previously crashed on array rows via .get() on a list).
    • _write_rants() — the single canonical writer (6-field order timestamp → project → status → progress → completed → message, sorted ascending by timestamp, ensure_ascii=False).
    • New list_rants(status, project) — filtered listing for curation.
    • New update_rant(timestamp, status, progress, completed) — state machine enforced (pending → in_progress → completed, no skipping; completed timestamp auto-written in local ISO time when status becomes completed).
    • New cleanup_rants(keep=10) — keeps all pending/in_progress + 10 most recent completed.
    • append_rant refactored onto the shared read/write helpers (behavior unchanged).
  • emrg/tools/submit_rant_tool.py — unified tool (name kept submit_rant so daemon/TUI/GUI references are unchanged) with action parameter: 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: all rants.jsonl read/write goes through the tool (listupdatecleanup), 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/ -v951 passed, 1 skipped (952 collected, doc-count guard green)
  • uv run python -c "from emrg.client.app import run_client" → OK
  • uv run python -m emrg --help → OK
  • The rants.jsonl file was normalized back to canonical dict format via the new update_rant path (both 16:09:45/16:24:01 rants marked completed)

Closes rant 2026-08-18T16:42:52 (pending).

EMRG Evolution added 2 commits August 18, 2026 16:52

@argszero argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

✅ 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 argszero left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

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

@argszero
argszero merged commit 7865478 into master Aug 18, 2026
2 checks passed
argszero added a commit that referenced this pull request Aug 18, 2026
Co-authored-by: EMRG Evolution <emrg@argszero.dev>
@argszero
argszero deleted the feature/unified-rant-tool branch August 18, 2026 13:09
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.

1 participant