Skip to content

Commit b2775aa

Browse files
committed
test(V2): stop running governance sync in v2 live-api job
Enabling GOVERNANCE_BODY_ID for the v2 live-api job made governance sync run continuously and contend with test operations for SQLite's single writer. The XLSX round-trip re-import held a write transaction that stalled under that contention, hanging the job for ~55 minutes (logs show repeated "SQLITE_BUSY: database is locked" from the sync task). Revert GOVERNANCE_BODY_ID to empty for that job and remove the live ownership-rejection tests and non-home wait loop that depended on synced foreign data. Ownership enforcement remains covered by the v2 integration suite (project/rating reject update/delete, staging and join-table retarget). The harmless orgUid=me scoping in the empty-db, XLSX, and prerequisite paths is kept.
1 parent cde41fc commit b2775aa

3 files changed

Lines changed: 2 additions & 111 deletions

File tree

.github/workflows/tests.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ jobs:
230230
yq -yi '.APP.WALLET_HOST = "https://127.0.0.1:9256"' ~/.chia/mainnet/cadt/config.yaml
231231
yq -yi '.APP.DATALAYER_FILE_SERVER_URL = "https://127.0.0.1:8575"' ~/.chia/mainnet/cadt/config.yaml
232232
yq -yi '.APP.AUTO_MIRROR_EXTERNAL_STORES = false' ~/.chia/mainnet/cadt/config.yaml
233-
yq -yi '.V2.GOVERNANCE.GOVERNANCE_BODY_ID = "4212425c8e053ad58279f1d1a498afec4a1e6b00da356a49ac72780fe13e98e8"' ~/.chia/mainnet/cadt/config.yaml
233+
yq -yi '.V2.GOVERNANCE.GOVERNANCE_BODY_ID = ""' ~/.chia/mainnet/cadt/config.yaml
234234
# Enable V2 for V2 live API tests
235235
yq -yi '.V2.ENABLE = true' ~/.chia/mainnet/cadt/config.yaml
236236
yq -yi '.V1.ENABLE = false' ~/.chia/mainnet/cadt/config.yaml

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

Lines changed: 1 addition & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ async function main() {
356356
console.log('');
357357

358358
// Clear staging table and ALL shared state before starting tests
359-
const { getLiveApiRequest, clearStagingTable, getHomeOrgId } = await import('./helpers/live-api-helpers.js');
359+
const { getLiveApiRequest, clearStagingTable } = await import('./helpers/live-api-helpers.js');
360360
const { clearAllState } = await import('./helpers/verification-state.js');
361361
// Use V2 API version for health checks since this uses V2 endpoints
362362
const request = await getLiveApiRequest({ apiVersion: 'v2' });
@@ -421,43 +421,6 @@ async function main() {
421421
const xlsxTestFiles = ['xlsx-import-export.live.spec.js'];
422422
await runMochaTests('Step 1[1-6]a?:', 'XLSX Import/Export', xlsxTestFiles);
423423

424-
// Wait for governance to sync at least one non-home project before PUT/DELETE
425-
// tests that verify ownership guards reject mutations on foreign records.
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-
}
434-
if (homeOrgId) {
435-
console.log('--- Waiting for non-home project from governance sync ---');
436-
const maxWaitMs = 600_000;
437-
const pollIntervalMs = 30_000;
438-
const startTime = Date.now();
439-
let found = false;
440-
while (Date.now() - startTime < maxWaitMs) {
441-
const elapsed = Math.round((Date.now() - startTime) / 1000);
442-
try {
443-
const res = await request.get('/v2/project').query({ page: 1, limit: 100 });
444-
const data = Array.isArray(res.body) ? res.body : (res.body?.data || []);
445-
const nonHome = data.find(r => r.orgUid && r.orgUid !== homeOrgId);
446-
if (nonHome) {
447-
console.log(` ✓ Found non-home project after ${elapsed}s (orgUid=${nonHome.orgUid.slice(0, 12)}...)`);
448-
found = true;
449-
break;
450-
}
451-
} catch { /* ignore transient errors */ }
452-
console.log(` No non-home projects yet (${elapsed}s / ${maxWaitMs / 1000}s)...`);
453-
await new Promise(r => setTimeout(r, pollIntervalMs));
454-
}
455-
if (!found) {
456-
console.log(' ⚠ WARNING: No non-home projects appeared. Ownership guard tests will fail.');
457-
}
458-
console.log('');
459-
}
460-
461424
// Phase 4: PUT tests
462425
await runMochaTests('Step 7: PUT Request Tests', 'PUT Operations');
463426
await commitAndWait('PUT');

tests/v2/live-api/project-validation.live.spec.js

Lines changed: 0 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -25,36 +25,6 @@ import {
2525
getInvalidPicklistValue,
2626
} from './data/test-data-generators.js';
2727

28-
const findNonHomeProject = async (request, homeOrgId) => {
29-
let page = 1;
30-
const limit = 100;
31-
32-
while (page <= 10) {
33-
const response = await request
34-
.get('/v2/project')
35-
.query({ page, limit })
36-
.expect(200);
37-
const data = Array.isArray(response.body) ? response.body : (response.body?.data || []);
38-
const nonHomeProject = data.find(record => record.orgUid && record.orgUid !== homeOrgId);
39-
if (nonHomeProject) return nonHomeProject;
40-
41-
const totalPages = response.body?.pageCount || 1;
42-
if (page >= totalPages || data.length < limit) break;
43-
page++;
44-
}
45-
46-
return null;
47-
};
48-
49-
const requireNonHomeProject = async (request, homeOrgId) => {
50-
const nonHomeProject = await findNonHomeProject(request, homeOrgId);
51-
expect(
52-
nonHomeProject,
53-
'Expected at least one synced project from another subscribed organization',
54-
).to.exist;
55-
return nonHomeProject;
56-
};
57-
5828
describe('Project Live API Validation Tests', function () {
5929
this.timeout(600000); // 10 minute timeout
6030
let request;
@@ -208,28 +178,6 @@ describe('Project Live API Validation Tests', function () {
208178
});
209179
});
210180
describe('Step 7: PUT Request Tests', function () {
211-
it('should reject updating a project not owned by the home organization', async function () {
212-
const nonHomeProject = await requireNonHomeProject(request, homeOrgId);
213-
214-
const updateData = {
215-
projectName: `Should Not Update ${Date.now()}`,
216-
projectRegistryName: nonHomeProject.projectRegistryName,
217-
projectId: nonHomeProject.projectId,
218-
};
219-
220-
try {
221-
const response = await request
222-
.put(`/v2/project/${nonHomeProject.cadTrustProjectId}`)
223-
.send(updateData);
224-
225-
expect(response.status).to.equal(400);
226-
expect(response.body.success).to.be.false;
227-
expect(response.body.error).to.include('Restricted data');
228-
} finally {
229-
await clearStagingTable(request);
230-
}
231-
});
232-
233181
it('should update a project', async function () {
234182
// Get ID from createdIds (if available) or query for test records we created
235183
let id = createdIds[0];
@@ -343,11 +291,6 @@ describe('Project Live API Validation Tests', function () {
343291
}
344292
});
345293

346-
it('should include synced project data from another organization', async function () {
347-
const nonHomeProject = await requireNonHomeProject(request, homeOrgId);
348-
expect(nonHomeProject.orgUid).to.not.equal(homeOrgId);
349-
});
350-
351294
it('should support search functionality', async function () {
352295
// Test search if supported by endpoint
353296
const response = await request
@@ -359,21 +302,6 @@ describe('Project Live API Validation Tests', function () {
359302
});
360303
});
361304
describe('Step 9: DELETE Request Tests', function () {
362-
it('should reject deleting a project not owned by the home organization', async function () {
363-
const nonHomeProject = await requireNonHomeProject(request, homeOrgId);
364-
365-
try {
366-
const response = await request
367-
.delete(`/v2/project/${nonHomeProject.cadTrustProjectId}`);
368-
369-
expect(response.status).to.equal(400);
370-
expect(response.body.success).to.be.false;
371-
expect(response.body.error).to.include('Restricted data');
372-
} finally {
373-
await clearStagingTable(request);
374-
}
375-
});
376-
377305
it('should delete all created projects', async function () {
378306
// Query for test projects by orgUid and TEST- prefix
379307
// This works even when DELETE runs in a separate process

0 commit comments

Comments
 (0)