Repository navigation
fix(mobile): stop pinning sent messages below newer history #23546
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
only21mil
wants to merge
8
commits into
pingdotgg:main
from
only21mil:r13/a110-stop-pinning-sent-messages-to-the-bottom
+212
−18
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cb427d0
refactor(mobile): isolate acknowledged message reconciliation
only21mil f8b4ea3
fix(mobile): stop pinning sent messages below newer history
only21mil e92a92c
Merge main (51273020db) into r13/a110-stop-pinning-sent-messages-to-t…
only21mil 9a96438
test(mobile): give thread mocks history and dispatch results
only21mil 2cd7f5d
Merge remote-tracking branch 'github/main' into takeover-23546
maria-rcks 2d60f93
fix(mobile): verify receipt reconciliation with the current composer
maria-rcks e928ec1
merge: sync main into mobile message reconciliation
maria-rcks aa84d79
fix(mobile): preserve reconciliation imports after main sync
maria-rcks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
60 changes: 60 additions & 0 deletions
60
apps/mobile/src/state/acknowledged-thread-messages.test.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,60 @@ | ||
| import { CommandId, EnvironmentId, MessageId, ThreadId } from "@t3tools/contracts"; | ||
| import { describe, expect, it, vi } from "vite-plus/test"; | ||
|
|
||
| import { unsettledAcknowledgedThreadMessages } from "./acknowledged-thread-messages"; | ||
|
|
||
| vi.mock("./threads", () => ({ environmentThreadDetails: {} })); | ||
|
|
||
| const environmentId = EnvironmentId.make("environment-1"); | ||
| const threadId = ThreadId.make("thread-1"); | ||
|
|
||
| function acknowledged(messageId: string, acknowledgedSequence?: number) { | ||
| return { | ||
| environmentId, | ||
| threadId, | ||
| messageId: MessageId.make(messageId), | ||
| commandId: CommandId.make(`command-${messageId}`), | ||
| text: messageId, | ||
| attachments: [], | ||
| // Client time can be ahead of the server, or equal for different sends. | ||
| createdAt: "2099-01-01T00:00:00.000Z", | ||
| ...(acknowledgedSequence === undefined ? {} : { acknowledgedSequence }), | ||
| }; | ||
| } | ||
|
|
||
| describe("acknowledged message reconciliation", () => { | ||
| it("settles an unloaded echo only after a bounded snapshot includes its receipt", () => { | ||
| const old = acknowledged("accepted-outside-window", 40); | ||
| const inFlight = acknowledged("accepted-after-snapshot", 51); | ||
| const unknown = acknowledged("no-ordering-evidence"); | ||
| const otherThread = { ...old, threadId: ThreadId.make("thread-2") }; | ||
| const otherEnvironment = { ...old, environmentId: EnvironmentId.make("environment-2") }; | ||
| const echoed = acknowledged("loaded-echo", 52); | ||
| const messages = [old, inFlight, unknown, otherThread, otherEnvironment, echoed]; | ||
| const echoes = new Set([echoed.messageId]); | ||
| const history = { environmentId, threadId, hasMoreHistory: true, snapshotSequence: 40 }; | ||
|
|
||
| expect(unsettledAcknowledgedThreadMessages(messages, echoes, history)).toEqual([ | ||
| inFlight, | ||
| unknown, | ||
| otherThread, | ||
| otherEnvironment, | ||
| ]); | ||
| expect( | ||
| unsettledAcknowledgedThreadMessages(messages, echoes, { ...history, snapshotSequence: 39 }), | ||
| ).toEqual([old, inFlight, unknown, otherThread, otherEnvironment]); | ||
| }); | ||
|
|
||
| it("keeps missing echoes without evidence of a bounded, committed history window", () => { | ||
| const message = acknowledged("still-waiting", 40); | ||
| const history = { environmentId, threadId, hasMoreHistory: false, snapshotSequence: 50 }; | ||
| expect(unsettledAcknowledgedThreadMessages([message], new Set(), history)).toEqual([message]); | ||
| expect( | ||
| unsettledAcknowledgedThreadMessages([message], new Set(), { | ||
| environmentId, | ||
| threadId, | ||
| hasMoreHistory: true, | ||
| }), | ||
| ).toEqual([message]); | ||
| }); | ||
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.