refactor(telegram): split MessageView into pure reconcile + executor #49
No reviewers
Labels
No labels
epic
in-review
ready-for-agent
ready-for-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
weiwen/evie!49
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "refactor/message-view-reconcile-seam"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What
Splits
MessageViewout oftelegram/mod.rsinto a newtelegram/view.rs, separating the edit-vs-send-vs-skip decision from the teloxide IO.reconcile(current, pages, markup) -> Vec<ViewOp>— the prefix-stable rolling seal, now a pure free function over&[String].plan_plain(current, text)— the error-notice path, folded into the sameViewOpvocabulary.execute(&mut self, …)— the sole teloxide-touching method; replays ops, records sent message IDs, anddebug_asserts theids.len() == rendered.len()invariant.apply/apply_with_buttons/set_plainwrappers preserve the caller-facing interface, sodeliver_streaming/render_finalare unchanged.Why
The reconciliation logic — the most intricate code in the delivery path — was previously reachable only through a live Telegram API and had no tests. Moving the decision behind a pure function gives it the same table-testable surface
paginatealready enjoys.Tests
9 new table tests assert on
ViewOpequality: the prefix-stable seal, changed-tail-only edits, markup-on-unchanged-last-page, markup-only-on-last-op, bothplan_plainpaths, and one documenting the preserved shrink-orphan quirk (a shrinking response leaves trailing messages untouched — behavior is preserved exactly, not fixed here).executeis intentionally left untested: its edit-vs-send branch is now 1:1 with the op variant.cargo test: 113 passed, 0 failedcargo clippy --all-targets: cleanBehavior preserved exactly. One-line
CONTEXT.mdarchitecture note added; no new glossary term.