Skip to content

Commit bf7c07b

Browse files
committed
fix(V2): resolve home org without shared-setup state in data-short
The non-home project wait loop called getSharedHomeOrgId(), which throws unless runSharedSetup() ran in the same process. runSharedSetup only runs inside the spawned mocha child processes, never in the data-short orchestrator, so the accessor threw and main()'s catch called process.exit(1) — crashing the entire V2 live-api run before the PUT and DELETE phases. Resolve the home org directly via getHomeOrgId(request) inside a try/catch so the orchestrator no longer depends on child-process state.
1 parent e9f826b commit bf7c07b

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tests/v2/live-api/data-short.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
verifyMirrorRecordsBatch,
1818
closeMirrorDbPool,
1919
} from './helpers/mysql-mirror-helpers.js';
20-
import { getSharedHomeOrgId } from './helpers/shared-setup.js';
2120

2221
const __filename = fileURLToPath(import.meta.url);
2322
const __dirname = dirname(__filename);
@@ -357,7 +356,7 @@ async function main() {
357356
console.log('');
358357

359358
// Clear staging table and ALL shared state before starting tests
360-
const { getLiveApiRequest, clearStagingTable } = await import('./helpers/live-api-helpers.js');
359+
const { getLiveApiRequest, clearStagingTable, getHomeOrgId } = await import('./helpers/live-api-helpers.js');
361360
const { clearAllState } = await import('./helpers/verification-state.js');
362361
// Use V2 API version for health checks since this uses V2 endpoints
363362
const request = await getLiveApiRequest({ apiVersion: 'v2' });
@@ -424,7 +423,14 @@ async function main() {
424423

425424
// Wait for governance to sync at least one non-home project before PUT/DELETE
426425
// tests that verify ownership guards reject mutations on foreign records.
427-
const homeOrgId = getSharedHomeOrgId();
426+
// Resolve the home org directly here: shared-setup state lives in the spawned
427+
// mocha child processes, not in this orchestrator process.
428+
let homeOrgId = null;
429+
try {
430+
homeOrgId = await getHomeOrgId(request);
431+
} catch (err) {
432+
console.log(` ⚠ Could not resolve home org id for non-home project wait: ${err.message}`);
433+
}
428434
if (homeOrgId) {
429435
console.log('--- Waiting for non-home project from governance sync ---');
430436
const maxWaitMs = 600_000;

0 commit comments

Comments
 (0)