Skip to content

Commit fd47a18

Browse files
dbkrkegsayrichvdh
authored
Switch sliding sync support to simplified sliding sync (#4400)
* Switch sliding sync support to simplified sliding sync Experimental PR to test js-sdk with simlified sliding sync. This does not maintain support for regulaer sliding sync. * Remove txn_id handling, ensure we always resend when req params change * Fix some tests * Fix remaining tests * Mark TODOs on tests which need to die * Linting * Make comments lie less * void * Always sent full extension request * Fix test * Remove usage of deprecated field * Hopefully fix DM names * Refactor how heroes are handled in Room * Fix how heroes work * Linting * Ensure that when SSS omits heroes we don't forget we had heroes Otherwise when the room next appears the name/avatar reset to 'Empty Room' with no avatar. * Check the right flag when doing timeline trickling * Also change when the backpagination token is set * Remove list ops and server-provided sort positions SSS doesn't have them. * Linting * Add Room.bumpStamp * Update crypto wasm lib For new functions * Add performance logging * Fix breaking change in crypto wasm v8 * Update crypto wasm for breaking changes See https://github.com/matrix-org/matrix-rust-sdk-crypto-wasm/releases/tag/v8.0.0 for how this was mapped from the previous API. * Mark all tracked users as dirty on expired SSS connections See matrix-org/matrix-rust-sdk#3965 for more information. Requires `Extension.onRequest` to be `async`. * add ts extension * Fix typedoc ref * Add method to interface * Don't force membership to invite The membership was set correctly from the stripped state anyway so this was redundant and was breaking rooms where we'd knocked. * Missed merge * Type import * Make coverage happier * More test coverage * Grammar & formatting Co-authored-by: Richard van der Hoff <[email protected]> * Remove markAllTrackedUsersAsDirty from crypto API Not sure why this was in there, seems like it just needed to be in crypto sync callbacks, which it already was. * Remove I from interface * API doc * Move Hero definition to room-summary * make comment more specific * Move internal details into room.ts and make the comment a proper tsdoc comment * Use terser arrow function syntax Co-authored-by: Richard van der Hoff <[email protected]> * Move comment to where we do the lookup * Clarify comment also prettier says hi * Add comment Co-authored-by: Richard van der Hoff <[email protected]> * Add tsdoc explaining that the summary event will be modified * more comment * Remove unrelated changes * Add docs & make fields optional * Type import * Clarify sync versions Co-authored-by: Richard van der Hoff <[email protected]> * Make tsdoc comment & add info on when it's used. Co-authored-by: Richard van der Hoff <[email protected]> * Rephrase comment Co-authored-by: Richard van der Hoff <[email protected]> * Prettier * Only fetch member for hero in legacy sync mode * Split out a separate method to set SSS room summary Rather than trying to fudge up an object that looked enough like the old one that we could pass it in. * Type import * Make link work * Nope, linter treats it as an unused import * Add link the other way * Add more detail to doc Co-authored-by: Richard van der Hoff <[email protected]> * Remove unnecessary cast Co-authored-by: Richard van der Hoff <[email protected]> * Remove length > 0 check as it wasn't really necessary and may cause heroes not to be cleared? * Doc params * Remove unnecessary undefined comparison Co-authored-by: Richard van der Hoff <[email protected]> * Put the comparison back as it's necessary to stop typescript complaining * Fix comment * Fix comment --------- Co-authored-by: Kegan Dougal <[email protected]> Co-authored-by: Richard van der Hoff <[email protected]>
1 parent c233334 commit fd47a18

10 files changed

+319
-1144
lines changed

spec/integ/sliding-sync-sdk.spec.ts

+27-15
Original file line numberDiff line numberDiff line change
@@ -649,11 +649,13 @@ describe("SlidingSyncSdk", () => {
649649
ext = findExtension("e2ee");
650650
});
651651

652-
it("gets enabled on the initial request only", () => {
653-
expect(ext.onRequest(true)).toEqual({
652+
it("gets enabled all the time", async () => {
653+
expect(await ext.onRequest(true)).toEqual({
654+
enabled: true,
655+
});
656+
expect(await ext.onRequest(false)).toEqual({
654657
enabled: true,
655658
});
656-
expect(ext.onRequest(false)).toEqual(undefined);
657659
});
658660

659661
it("can update device lists", () => {
@@ -695,11 +697,13 @@ describe("SlidingSyncSdk", () => {
695697
ext = findExtension("account_data");
696698
});
697699

698-
it("gets enabled on the initial request only", () => {
699-
expect(ext.onRequest(true)).toEqual({
700+
it("gets enabled all the time", async () => {
701+
expect(await ext.onRequest(true)).toEqual({
702+
enabled: true,
703+
});
704+
expect(await ext.onRequest(false)).toEqual({
700705
enabled: true,
701706
});
702-
expect(ext.onRequest(false)).toEqual(undefined);
703707
});
704708

705709
it("processes global account data", async () => {
@@ -823,8 +827,12 @@ describe("SlidingSyncSdk", () => {
823827
ext = findExtension("to_device");
824828
});
825829

826-
it("gets enabled with a limit on the initial request only", () => {
827-
const reqJson: any = ext.onRequest(true);
830+
it("gets enabled all the time", async () => {
831+
let reqJson: any = await ext.onRequest(true);
832+
expect(reqJson.enabled).toEqual(true);
833+
expect(reqJson.limit).toBeGreaterThan(0);
834+
expect(reqJson.since).toBeUndefined();
835+
reqJson = await ext.onRequest(false);
828836
expect(reqJson.enabled).toEqual(true);
829837
expect(reqJson.limit).toBeGreaterThan(0);
830838
expect(reqJson.since).toBeUndefined();
@@ -835,7 +843,7 @@ describe("SlidingSyncSdk", () => {
835843
next_batch: "12345",
836844
events: [],
837845
});
838-
expect(ext.onRequest(false)).toEqual({
846+
expect(await ext.onRequest(false)).toMatchObject({
839847
since: "12345",
840848
});
841849
});
@@ -919,11 +927,13 @@ describe("SlidingSyncSdk", () => {
919927
ext = findExtension("typing");
920928
});
921929

922-
it("gets enabled on the initial request only", () => {
923-
expect(ext.onRequest(true)).toEqual({
930+
it("gets enabled all the time", async () => {
931+
expect(await ext.onRequest(true)).toEqual({
932+
enabled: true,
933+
});
934+
expect(await ext.onRequest(false)).toEqual({
924935
enabled: true,
925936
});
926-
expect(ext.onRequest(false)).toEqual(undefined);
927937
});
928938

929939
it("processes typing notifications", async () => {
@@ -1042,11 +1052,13 @@ describe("SlidingSyncSdk", () => {
10421052
ext = findExtension("receipts");
10431053
});
10441054

1045-
it("gets enabled on the initial request only", () => {
1046-
expect(ext.onRequest(true)).toEqual({
1055+
it("gets enabled all the time", async () => {
1056+
expect(await ext.onRequest(true)).toEqual({
1057+
enabled: true,
1058+
});
1059+
expect(await ext.onRequest(false)).toEqual({
10471060
enabled: true,
10481061
});
1049-
expect(ext.onRequest(false)).toEqual(undefined);
10501062
});
10511063

10521064
it("processes receipts", async () => {

0 commit comments

Comments
 (0)