Skip to content

Commit 283dee4

Browse files
committed
fix pre-existing red: derive pipelineSeries schema version in dataSync test
The 10→11 pipelineSeries bump (#2179) left dataSync.pipelineUniverse.test.js asserting a hardcoded senderV: 11 / receiverV: 10 for the "sender ahead" gate — but the receiver is now 11, so sender==receiver and the snapshot applied instead of blocking, reddening CI on main. Derive both versions from PORTOS_SCHEMA_VERSIONS (sender = receiver + 1) so this test stops drifting on every future bump. Dynamic-imported after the vi.mock hoist.
1 parent 2a925d3 commit 283dee4

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

server/services/dataSync.pipelineUniverse.test.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,13 @@ vi.mock('../lib/fileUtils.js', async () => {
2222
afterAll(cleanup);
2323

2424
const dataSync = await import('./dataSync.js');
25+
// Derive the receiver's pipelineSeries version from the source of truth so this
26+
// test doesn't false-fail every time the constant is bumped (it drifted red on
27+
// the 10→11 bump). "Sender ahead" is always receiver + 1. Dynamic-imported after
28+
// the vi.mock hoist so the static import doesn't disturb mock initialization.
29+
const schemaVersionsMod = await import('../lib/schemaVersions.js');
30+
const RECEIVER_PIPELINE_SERIES_V = schemaVersionsMod.PORTOS_SCHEMA_VERSIONS.pipelineSeries;
31+
const SENDER_AHEAD_PIPELINE_SERIES_V = RECEIVER_PIPELINE_SERIES_V + 1;
2532
const conflictJournal = await import('../lib/conflictJournal.js');
2633
const { PORTOS_SCHEMA_VERSIONS } = await import('../lib/schemaVersions.js');
2734

@@ -1053,12 +1060,12 @@ describe('dataSync — per-category schema gate (cross-key isolation)', () => {
10531060
const result = await dataSync.applyRemote('pipeline', {
10541061
series: [{ id: 'ser-1', name: 'Foundry', updatedAt: '2026-05-17T11:00:00Z' }],
10551062
issues: [],
1056-
}, { portosMeta: { portosVersion: '99.0.0', schemaVersions: { universes: 5, pipelineSeries: 11, pipelineIssues: 1, mediaCollections: 1 } } });
1063+
}, { portosMeta: { portosVersion: '99.0.0', schemaVersions: { universes: 5, pipelineSeries: SENDER_AHEAD_PIPELINE_SERIES_V, pipelineIssues: 1, mediaCollections: 1 } } });
10571064
expect(result.applied).toBe(false);
10581065
expect(result.blockedBySchema).toBeDefined();
10591066
// The reported gap is scoped to the relevant category — NOT mis-attributed.
10601067
expect(result.blockedBySchema.ahead).toEqual([
1061-
{ category: 'pipelineSeries', senderV: 11, receiverV: 10 },
1068+
{ category: 'pipelineSeries', senderV: SENDER_AHEAD_PIPELINE_SERIES_V, receiverV: RECEIVER_PIPELINE_SERIES_V },
10621069
]);
10631070
expect(readSeriesState()).toEqual([]); // nothing written
10641071
});

0 commit comments

Comments
 (0)