Skip to content

Commit 4766fb3

Browse files
committed
fix(connectors): ado flags partial repo trees when items listing emits a continuation token
1 parent 9bcd613 commit 4766fb3

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

apps/sim/connectors/azure-devops/azure-devops.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -794,6 +794,23 @@ async function listRepositoryBlobs(
794794
})
795795
throw new Error(`Failed to list repository items: ${response.status}`)
796796
}
797+
/**
798+
* The Items list API documents no pagination, but very large trees may emit
799+
* an `x-ms-continuationtoken` response header. No request parameter exists
800+
* to follow it, so when it appears the tree is treated as incomplete: the
801+
* listing is flagged so deletion reconciliation cannot remove files that
802+
* were never returned.
803+
*/
804+
if (response.headers.get('x-ms-continuationtoken')) {
805+
if (syncContext) syncContext.listingCapped = true
806+
logger.warn(
807+
'Azure DevOps repository tree listing returned a continuation token; partial tree',
808+
{
809+
repoId,
810+
branch,
811+
}
812+
)
813+
}
797814
const data = await response.json()
798815
const items = (data.value as GitItem[] | undefined) ?? []
799816
return items.filter((item) => item.gitObjectType === 'blob' && !item.isFolder && item.path)

0 commit comments

Comments
 (0)