Skip to content

Commit 988068d

Browse files
committed
refactor(test): drop 'as unknown as' on tableState via V5 literal
Construct PlDataTableStateV2Normalized v5 directly instead of running createPlDataTableStateV2() (catalog SDK 1.77.0, emits v7) through an 'as unknown as' cast to satisfy mixcr-clonotyping-2's pin on SDK 1.63.1 (v5). The v5 shape is small and stable; literal-with-type-annotation keeps full type-checking with no escape hatches. Drops the now-unused createPlDataTableStateV2 import from helpers.ts.
1 parent e5336f6 commit 988068d

1 file changed

Lines changed: 19 additions & 6 deletions

File tree

test/src/helpers.ts

Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import type { BlockData as SamplesAndDataBlockData } from '@platforma-open/milab
3131
import { blockSpec as mixcrClonotypingBlockSpec } from '@platforma-open/milaboratories.mixcr-clonotyping-2';
3232
import type { BlockData as MixcrClonotypingBlockData } from '@platforma-open/milaboratories.mixcr-clonotyping-2.model';
3333
import { blockSpec as seqPropsBlockSpec } from 'this-block';
34-
import { createPlDataTableStateV2, uniquePlId } from '@platforma-sdk/model';
34+
import { uniquePlId } from '@platforma-sdk/model';
3535
import type { ML, RawHelpers } from '@platforma-sdk/test';
3636
import { awaitStableState } from '@platforma-sdk/test';
3737
import type { expect as vitestExpect } from 'vitest';
@@ -120,6 +120,23 @@ async function configureMixcrClonotyping(
120120
throw new Error('mixcr-clonotyping-2 inputOptions did not populate after samples-and-data');
121121
}
122122

123+
// mixcr-clonotyping-2@2.18 pins @platforma-sdk/model@1.63.1, whose
124+
// PlDataTableStateV2 is version 5. Our catalog SDK (1.77.0) exposes
125+
// createPlDataTableStateV2 that emits version 7. The two shapes are
126+
// structurally close, but the version literal differs and TS treats
127+
// them as incompatible. Constructing the v5 literal directly avoids
128+
// the cross-version helper and keeps the type fully checked.
129+
const tableState: MixcrClonotypingBlockData['tableState'] = {
130+
version: 5,
131+
stateCache: [],
132+
pTableParams: {
133+
sourceId: null,
134+
hiddenColIds: null,
135+
filters: null,
136+
sorting: [],
137+
},
138+
};
139+
123140
await rawPrj.mutateBlockStorage(clonotypingBlockId, {
124141
operation: 'update-block-data',
125142
value: {
@@ -128,11 +145,7 @@ async function configureMixcrClonotyping(
128145
input: inputOptions[0].ref,
129146
preset: { type: 'name', name: preset },
130147
chains,
131-
// Cast across SDK versions: mixcr-clonotyping-2@2.18 declares its
132-
// tableState against @platforma-sdk/model@1.63.1 (PlDataTableStateV2
133-
// version 5); our catalog is on 1.77.0 (version 7). The state field
134-
// is opaque to the workflow — runtime is compatible.
135-
tableState: createPlDataTableStateV2() as unknown as MixcrClonotypingBlockData['tableState'],
148+
tableState,
136149
runMode: 'full',
137150
} satisfies MixcrClonotypingBlockData,
138151
});

0 commit comments

Comments
 (0)