-
Notifications
You must be signed in to change notification settings - Fork 3
Refresh the pinned Lync durability boundary #82
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
Merged
Merged
Changes from all commits
Commits
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
114 changes: 114 additions & 0 deletions
114
client/interface/lync/__tests__/indexedDbDurability.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,114 @@ | ||
| import { describe, expect, it } from "bun:test"; | ||
| import { IDBFactory } from "fake-indexeddb"; | ||
| import { createIndexedDbEventStore } from "@deepfates/lync/idb-log"; | ||
| import type { LyncEventBody } from "@deepfates/lync/events"; | ||
| import { serializeLyncEvent } from "@deepfates/lync/store"; | ||
|
|
||
| const at = "2026-09-06T21:31:13.000Z"; | ||
|
|
||
| function event( | ||
| id: string, | ||
| kind: string, | ||
| parents: string[] = [], | ||
| payload: Record<string, unknown> = {}, | ||
| ): LyncEventBody { | ||
| return { | ||
| v: 1, | ||
| id, | ||
| kind, | ||
| at, | ||
| author: { actor: "textile-durability-regression" }, | ||
| parents, | ||
| payload, | ||
| }; | ||
| } | ||
|
|
||
| describe("installed Lync IndexedDB durability", () => { | ||
| it("reopens every resolved curation mutation while an archive batch is suspended", async () => { | ||
| const indexedDB = new IDBFactory(); | ||
| const dbName = "textile-import-curation-overlap"; | ||
| const store = createIndexedDbEventStore({ dbName, indexedDB }); | ||
| const importedRoot = event( | ||
| "019fcb10-0000-7000-8000-000000000001", | ||
| "twitter/tweet", | ||
| [], | ||
| { full_text: "Imported archive root" }, | ||
| ); | ||
| const importedReply = event( | ||
| "019fcb10-0000-7000-8000-000000000002", | ||
| "twitter/tweet", | ||
| [importedRoot.id], | ||
| { full_text: "Imported archive reply" }, | ||
| ); | ||
| const keep = event( | ||
| "019fcb10-0000-7000-8000-000000000003", | ||
| "lync/mark", | ||
| [importedRoot.id], | ||
| { label: "selection", target: importedRoot.id }, | ||
| ); | ||
| const note = event( | ||
| "019fcb10-0000-7000-8000-000000000004", | ||
| "curare/annotation", | ||
| [importedRoot.id], | ||
| { label: "note", text: "Keep this source context." }, | ||
| ); | ||
| const cluster = event( | ||
| "019fcb10-0000-7000-8000-000000000005", | ||
| "lync/mark", | ||
| [importedRoot.id], | ||
| { label: "cluster", target: importedRoot.id }, | ||
| ); | ||
|
|
||
| let announceSuspension!: () => void; | ||
| let releaseImport!: () => void; | ||
| const suspended = new Promise<void>((resolve) => { | ||
| announceSuspension = resolve; | ||
| }); | ||
| const released = new Promise<void>((resolve) => { | ||
| releaseImport = resolve; | ||
| }); | ||
| async function* archiveImport() { | ||
| yield importedRoot; | ||
| announceSuspension(); | ||
| await released; | ||
| yield importedReply; | ||
| } | ||
|
|
||
| const importing = store.appendMany(archiveImport()); | ||
| await suspended; | ||
|
|
||
| const expectDurableAfterReopen = async (id: string) => { | ||
| const reopened = createIndexedDbEventStore({ dbName, indexedDB }); | ||
| await expect(reopened.byId(id)).resolves.toMatchObject({ body: { id } }); | ||
| }; | ||
|
|
||
| try { | ||
| await expect(store.append(keep)).resolves.toMatchObject({ status: "added" }); | ||
| await expectDurableAfterReopen(keep.id); | ||
|
|
||
| await expect(store.union(serializeLyncEvent(note))).resolves.toMatchObject({ | ||
| status: "added", | ||
| }); | ||
| await expectDurableAfterReopen(note.id); | ||
|
|
||
| await expect(store.appendMany([cluster])).resolves.toEqual([ | ||
| expect.objectContaining({ status: "added" }), | ||
| ]); | ||
| await expectDurableAfterReopen(cluster.id); | ||
| } finally { | ||
| releaseImport(); | ||
| await importing; | ||
| } | ||
|
|
||
| const reopened = createIndexedDbEventStore({ dbName, indexedDB }); | ||
| await expect(reopened.byRoot(importedRoot.id)).resolves.toEqual( | ||
| expect.arrayContaining([ | ||
| expect.objectContaining({ body: expect.objectContaining({ id: importedRoot.id }) }), | ||
| expect.objectContaining({ body: expect.objectContaining({ id: importedReply.id }) }), | ||
| expect.objectContaining({ body: expect.objectContaining({ id: keep.id }) }), | ||
| expect.objectContaining({ body: expect.objectContaining({ id: note.id }) }), | ||
| expect.objectContaining({ body: expect.objectContaining({ id: cluster.id }) }), | ||
| ]), | ||
| ); | ||
| }); | ||
| }); |
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
Binary file not shown.
Binary file not shown.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When consumers read the README from this vendored package, its primary “Choose your path” links point to
docs/library.md,docs/cli.md,docs/relay.md, anddocs/architecture.md, but inspection of this exact tarball shows that nopackage/docs/files are included. The replacement therefore turns the installed package's main documentation entry points into broken links; include the referenced documentation in the packed files or keep the packed README self-contained.Useful? React with 👍 / 👎.