Skip to content

Commit

Permalink
[lib] Update threads-state-sync-spec to use more general `RawThread…
Browse files Browse the repository at this point in the history
…Info[s]`

Summary:
Updated types related to thread state sync spec to handle `RawThreadInfo[s]` instead of more specific `LegacyRawThreadInfo[s]`.

---

Depends on D10212

Test Plan: Flow/CI/etc. Will test state sync + set breakpoints to ensure that behavior continues to be as expected.

Reviewers: ashoat, ginsu, tomek, rohan

Reviewed By: rohan

Differential Revision: https://phab.comm.dev/D10223
  • Loading branch information
atulsmadhugiri committed Dec 13, 2023
1 parent 0e9dbe1 commit 04035ac
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 19 deletions.
8 changes: 3 additions & 5 deletions keyserver/src/shared/state-sync/threads-state-sync-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import { rawThreadInfoValidator } from 'lib/permissions/minimally-encoded-thread
import { threadsStateSyncSpec as libSpec } from 'lib/shared/state-sync/threads-state-sync-spec.js';
import type { ClientThreadInconsistencyReportCreationRequest } from 'lib/types/report-types.js';
import {
type LegacyRawThreadInfos,
type LegacyRawThreadInfo,
type RawThreadInfo,
type RawThreadInfos,
} from 'lib/types/thread-types.js';
Expand All @@ -17,9 +15,9 @@ import type { Viewer } from '../../session/viewer.js';
import { validateOutput } from '../../utils/validation-utils.js';

export const threadsStateSyncSpec: ServerStateSyncSpec<
LegacyRawThreadInfos,
LegacyRawThreadInfos,
LegacyRawThreadInfo,
RawThreadInfos,
RawThreadInfos,
RawThreadInfo,
$ReadOnlyArray<ClientThreadInconsistencyReportCreationRequest>,
> = Object.freeze({
fetch,
Expand Down
16 changes: 8 additions & 8 deletions lib/shared/state-sync/threads-state-sync-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ import {
} from '../../types/report-types.js';
import type { ProcessServerRequestAction } from '../../types/request-types.js';
import {
type LegacyRawThreadInfos,
type LegacyRawThreadInfo,
type RawThreadInfo,
type RawThreadInfos,
} from '../../types/thread-types.js';
import { actionLogger } from '../../utils/action-logger.js';
import { getConfig } from '../../utils/config.js';
Expand All @@ -24,8 +24,8 @@ import { ashoatKeyserverID } from '../../utils/validation-utils.js';
const selector: (
state: AppState,
) => BoundStateSyncSpec<
LegacyRawThreadInfos,
LegacyRawThreadInfo,
RawThreadInfos,
RawThreadInfo,
$ReadOnlyArray<ClientThreadInconsistencyReportCreationRequest>,
> = createSelector(
(state: AppState) => state.integrityStore.threadHashes,
Expand All @@ -43,8 +43,8 @@ const selector: (
);

export const threadsStateSyncSpec: StateSyncSpec<
LegacyRawThreadInfos,
LegacyRawThreadInfo,
RawThreadInfos,
RawThreadInfo,
$ReadOnlyArray<ClientThreadInconsistencyReportCreationRequest>,
> = Object.freeze({
hashKey: 'threadInfos',
Expand All @@ -55,8 +55,8 @@ export const threadsStateSyncSpec: StateSyncSpec<
},
findStoreInconsistencies(
action: ProcessServerRequestAction,
beforeStateCheck: LegacyRawThreadInfos,
afterStateCheck: LegacyRawThreadInfos,
beforeStateCheck: RawThreadInfos,
afterStateCheck: RawThreadInfos,
) {
if (_isEqual(beforeStateCheck)(afterStateCheck)) {
return emptyArray;
Expand Down
12 changes: 6 additions & 6 deletions lib/types/report-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { type PlatformDetails } from './device-types.js';
import { type RawEntryInfo, type CalendarQuery } from './entry-types.js';
import { type MediaMission } from './media-types.js';
import type { AppState, BaseAction } from './redux-types.js';
import { type LegacyRawThreadInfos } from './thread-types.js';
import { type RawThreadInfos } from './thread-types.js';
import type { UserInfo, UserInfos } from './user-types.js';
import { tPlatformDetails, tShape } from '../utils/validation-utils.js';

Expand Down Expand Up @@ -71,10 +71,10 @@ export type ActionSummary = {
};
export type ThreadInconsistencyReportShape = {
+platformDetails: PlatformDetails,
+beforeAction: LegacyRawThreadInfos,
+beforeAction: RawThreadInfos,
+action: BaseAction,
+pollResult?: ?LegacyRawThreadInfos,
+pushResult: LegacyRawThreadInfos,
+pollResult?: ?RawThreadInfos,
+pushResult: RawThreadInfos,
+lastActionTypes?: ?$ReadOnlyArray<$PropertyType<BaseAction, 'type'>>,
+lastActions?: ?$ReadOnlyArray<ActionSummary>,
+time?: ?number,
Expand Down Expand Up @@ -139,9 +139,9 @@ export type ReportCreationRequest =

export type ClientThreadInconsistencyReportShape = {
+platformDetails: PlatformDetails,
+beforeAction: LegacyRawThreadInfos,
+beforeAction: RawThreadInfos,
+action: BaseAction,
+pushResult: LegacyRawThreadInfos,
+pushResult: RawThreadInfos,
+lastActions: $ReadOnlyArray<ActionSummary>,
+time: number,
};
Expand Down

0 comments on commit 04035ac

Please sign in to comment.