@@ -134,7 +134,7 @@ function getEndpointPath(type) {
134134
135135async 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