Skip to content

Commit 2a2ad5b

Browse files
committed
fix(V2): avoid stale appear-waits during delete phase
Short-mode orchestration now builds wait targets from current phase verification records and skips DELETE entries, preventing stale POST IDs from blocking DELETE commits in live API CI.
1 parent 026afdf commit 2a2ad5b

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

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

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function getEndpointPath(type) {
134134

135135
async function commitAndWait(phase) {
136136
const { getLiveApiRequest, commitStagedRecords, waitForPendingCommits, waitForStagingEmpty, waitForBatchToAppear, validateDataInDatabase } = await import('./helpers/live-api-helpers.js');
137-
const { getAllCreatedIds, getBatchVerificationRecords, clearBatchVerificationRecords } = await import('./helpers/shared-state.js');
137+
const { getBatchVerificationRecords, clearBatchVerificationRecords } = await import('./helpers/shared-state.js');
138138

139139
// Use V2 API version for health checks since this uses V2 endpoints
140140
const request = await getLiveApiRequest({ apiVersion: 'v2' });
@@ -154,8 +154,17 @@ async function commitAndWait(phase) {
154154
await waitForPendingCommits(request);
155155
await waitForStagingEmpty(request);
156156

157-
// Wait for all created records to appear after batch commit
158-
const recordsToWaitFor = getAllCreatedIds();
157+
// Wait for records touched in this phase to appear after batch commit.
158+
// DELETE operations are validated separately and must NOT be waited on here.
159+
const verificationRecords = getBatchVerificationRecords();
160+
const recordsToWaitFor = [];
161+
for (const [type, typeRecords] of Object.entries(verificationRecords)) {
162+
for (const [id, recordInfo] of Object.entries(typeRecords)) {
163+
if (recordInfo.operation === 'POST' || recordInfo.operation === 'PUT') {
164+
recordsToWaitFor.push({ type, id });
165+
}
166+
}
167+
}
159168
if (recordsToWaitFor.length > 0) {
160169
const waitTimestamp = new Date().toISOString();
161170
console.log(`[${waitTimestamp}] Waiting for ${recordsToWaitFor.length} record(s) to appear after batch commit...`);
@@ -165,7 +174,6 @@ async function commitAndWait(phase) {
165174
}
166175

167176
// Verify records
168-
const verificationRecords = getBatchVerificationRecords();
169177
const verifyTimestamp = new Date().toISOString();
170178
console.log(`[${verifyTimestamp}] Verifying ${phase} operations...`);
171179

0 commit comments

Comments
 (0)