Repository navigation
Conversation
Tiny Code Reviewthe AI provider rate-limited the request This is advice, not a gate. Re-run with the |
unRekable
left a comment
There was a problem hiding this comment.
Code Review
🟡 2 findings (0 blocking).
The fix lets a Teams reply chain keep Teams' paging cursor the way a chat does, reads a chain at 200 per page so scrolling up passes the first page, and adds a jump-into-chain path, a tested fake, and the lab's e2e scenario. The paging design matches the existing chat flow and the caps hold. Two gaps sit in the new jump path: held_older samples the chain's oldest stored ids instead of the rows adjacent below the scroll edge, so it can skip the one fetch that reconnects a jump window, and a jump page near the chain's start makes record() stamp a partial reply count onto the post. Both are majors; the cursor and window handling themselves are sound.
Residual risk
- after() still returns early for chains on a line this diff does not touch, so rows newer than a jump target stay unread until the thread is reopened at its newest page.
- For a chain long enough that its final page holds a full 200 replies, exact_chain never runs and the post keeps the approximate count earlier pages produced; replies_held also caps at 800 stored replies, so chains of roughly 800 to 1000 replies can show a capped count even when fully read.
|
|
||
| /// True when a reply older than `before` is already stored, so this scroll was fetched. | ||
| fn held_older(&self, conversation: &str, before: &str) -> Result<bool, Fault> { | ||
| let ids = self.ctx.stored_ids(conversation, "", before, 8)?; |
There was a problem hiding this comment.
before. Once the new chain jump in around() has stored a detached window near the chain's start (say replies 1..30 while 51..450 are paged), every scroll at the 51 boundary returns true here and the catch-up fetch the server still queues for that window (the post-jump follow-up and blank-page anchors) is skipped, so the replies between the jump window and the paged region can never be fetched. Compare the ids nearest before (the tail of the query), or drop the early return; the cursor or time-window fetch is idempotent and record dedups.
| if chain { | ||
| self.remember_cursor(conversation, &messages, &older); | ||
| } | ||
| self.record(conversation, &messages, !older.is_empty()) |
There was a problem hiding this comment.
| self.record(conversation, &messages, !older.is_empty()) | |
| self.record(conversation, &messages, true) |
Scrolling up follows the cursor Teams sends with each page, and opening an old reply loads the page that ends there. Once the start of the chain is stored, the post counts every reply that was stored. Closes #633
58b3ab0 to
6d44597
Compare
What changed and why
A Teams thread longer than 200 replies can be read by scrolling up. Opening a link to an old reply loads the page that ends there. Once the start of the chain is stored, the post's reply count is every reply stored, not only the last page.
No client read names a reply-count field on the post, so the count is taken from the replies that were stored. This was not checked against a live tenant. The lab was not run.
Type
Platforms
Proof
Scenario: e2e/scenarios/teams-chain-paging
Lab run: not run
Compatibility
No protocol change. An older build ignores TINYCLIENT_PROVE and stays up, so the scenario fails there.
Risk and rollback
If a chain does not page with the same cursor a chat uses, scrolling asks for a page the service may not return. Revert this change.
Release note
A Teams thread longer than 200 replies loads the rest when you scroll up.
How tested
cargo test -p chatd --no-default-features --test teams(the new 450-reply chain and the existing channel test) andcargo clippy -p chatd --no-default-features --all-targets. Not tested on a live tenant. Lab not run.Closes #633