Add since_id filter to message.list (A1 — WS refactor follow-up) #15
Labels
No labels
prio_critical
prio_low
type_bug
type_contact
type_issue
type_lead
type_question
type_story
type_task
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
lhumina_code/hero_collab#15
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Follow-up to #13. Closes gap A1 from the post-refactor architectural assessment.
Problem: the refactor added a reconnect catch-up path that calls
rpc('message.list', { channel_id, since_id, limit: 100 }). But the server'smessage.listdoesn't honorsince_id— it just returns the latest 100 messages every reconnect. The client dedups by id so correctness holds, but on a quiet channel where 2 messages arrived during a 5s disconnect, the server still sends all 100 most recent. ~50× overfetch per reconnect.Solution: add optional
since_id: Option<u64>toMessageListinput; conditionally addAND id > ?to the query. Client already sends the field (the refactor left a TODO comment referencing this follow-up).Docs:
plan/feature-message-since-id.mdplan/impl-message-since-id.mdSize: ~70 lines total (25 production + 50 tests + JSON schema + SDK regen). 2 tasks.
Branch: lands on
feat/ws-refactor— removes a visible TODO we just added and pairs naturally with the other follow-ups.Implementation landed
Three commits on
feat/ws-refactor:bd19bf7feat(server): message.list since_id filter for reconnect delta fetchAdds
since_id: Option<u64>to themessage.listRPC params. Refactors the handler's SQL from a 2-branchwith_before/without_beforepattern into a dynamic builder that composeschannel_id/thread_id/before/since_id/limitconjunctively. Registers the param inopenrpc.json; proc-macro auto-regensMessageListInput.since_id: Option<i64>in the SDK.4187060refactor(ui): drop since_id TODO — server honours it nowRemoves the stale 5-line TODO comment referencing the pending server-side support.
32f299cfix(ui): wire since_id into reconnect catch-up message.list callFix commit — the original plan assumed P8.3 had wired
since_idinto the client's RPC call. P8.3's executor had actually chosen the Option-B fallback ("refetch 100 + dedup") and never wired it. A1.2 as briefed would have left A1 functionally inert on the client side. This commit addssince_id: state.messages[state.messages.length - 1].idto therpc('message.list', ...)call insideonWsReconnected.Architectural notes
from_user_id) is a 4-line conditional append instead of an N×M branch explosion.since_id > 0, the client still dedups received messages by id. Defence in depth: protects against any theoretical server-side bug where overlapping messages slip through.id > since_id, not>=. The client'slastIdis already in its view, so the inclusive form would re-send.Retrospective
Three plan errors were caught by implementers reading source instead of trusting the plan (
-32029vs-32005,raw_rpcreturn type, and A1's client-wiring assumption). This was a direct consequence of me re-using my memory of the P8.3 commit's intent instead of its content. Process note in #13's comment — going forward, first step of any plan task that assumes pre-existing behavior should be agreporgit showagainst the landed commit.Tests impact
cargo test -p hero_collab_server: integration 64 (+1 newmessage_list_filters_by_since_idtest covering no-filter / since_id=msg3 / since_id past end).Known follow-up debt
None for A1 itself. A future ergonomics pass could add a typed
MessageListstruct inhandlers/inputs.rs(currently the handler uses rawValueextraction). Non-blocking.