You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(syncer): fit Azure DevOps fingerprints in the content_hash column - #22395
Azure DevOps fingerprints are opaque remote tokens, not content digests: azureDevOpsItemFingerprint returned the 40-character commit id and azureDevOpsPullRequestFingerprint returns status + ":" + RFC3339Nano (40+ characters). document.content_hash is varchar(32) (internal/entity/document.go), so on MySQL the sync write fails with Error 1406 (22001): Data too long for column 'content_hash' at row 1 — the reported Azure DevOps sync failure.
Every other connector emits a contentFingerprint (xxh128, 32 hex characters), so the column width is the established contract; Azure DevOps was the outlier.
Fix
azureDevOpsItemFingerprint and azureDevOpsPullRequestFingerprint now pass their token through azureDevOpsFingerprint: values that fit the 32-character column pass through unchanged (short refs stay readable), wider values are folded into the same xxh128 digest the other connectors use.
Both the skip-check (includeAzureDevOpsItem / includeAzureDevOpsPullRequest) and the stored SourceDocument.Fingerprint call the same function, so an unchanged revision still compares equal to its stored value. There is no stored-value migration: the raw 40-character value could never be written.
document.metadata["commit_id"] keeps the raw commit id; only the fingerprint is compacted.
Tests
Red on unmodified c6467548f (40-character commit id → fingerprint length 40), green after the change:
CGO_ENABLED=0 go test -count=1 -vet=off ./internal/syncer/connector/ # box, Linux
TestAzureDevOpsFingerprintFitsTheContentHashColumn: item fingerprint is 32 characters, different commits stay distinct, the stored fingerprint still skips an unchanged item, and the pull request fingerprint fits the column.
TestAzureDevOpsDocumentKeepsTheRawCommitIDInMetadata: the built document carries the 32-character fingerprint while commit_id keeps the full 40-character id.
Full internal/syncer/connector package passes; the pre-existing TestAssertConnectorHostSafeLoopbackHookAllowsOnlyLoopback fails on the box for lack of DNS (dial udp 8.8.4.4:53: network is unreachable) on both the unmodified baseline and this branch.
Azure DevOps fingerprints are opaque remote tokens: a commit id is 40
hex characters and the pull request fingerprint is a status plus an
RFC3339 timestamp, while document.content_hash is varchar(32). Storing
the raw token failed the sync with "Data too long for column
'content_hash'". Fold anything wider than the column into the same
xxh128 digest the other connectors use; the comparison path calls the
same function, so an unchanged revision still matches its stored value,
and the raw commit id stays in document metadata.
Fixesinfiniflow#20972
No actionable comments were generated in the recent review.
Walkthrough
Azure DevOps item and pull-request fingerprints are normalized to a maximum of 32 characters. Code-document metadata retains the full commit ID. Regression tests cover fingerprint length, comparison, and metadata.
Changes: Azure DevOps fingerprint normalization
Layer / File(s)
Summary
Fingerprint generation and validation internal/syncer/connector/azure_devops.go, internal/syncer/connector/azure_devops_test.go
Item and pull-request fingerprints use normalized tokens. Code documents use the normalized fingerprint while preserving the raw commit ID in metadata. Tests cover fingerprint length, comparison, and metadata.
Azure DevOps fingerprints now fit the 32-character content_hash column, which should fix the sync failure. The raw commit ID stays in metadata. No merge-blocking risk is evident.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the actual fix: Azure DevOps fingerprints are shortened so they fit the 32-character content_hash column. The raw summary and PR description describe this same change, so the title is …
Description check
The description covers the problem (Azure DevOps fingerprints exceed the 32-character content_hash column, causing MySQL Error 1406), the fix (azureDevOpsFingerprint with xxh128 fallback, shared betwe…
Linked Issues check
Issue #20972 reports that Azure DevOps sync fails on MySQL because a 40-character commit ID exceeds the 32-character document.content_hash column (internal/entity/document.go, size:32). The requiremen…
Out of Scope Changes check
The whole-PR diff against merge base c646754 changes only internal/syncer/connector/azure_devops.go (+22/-4 lines) and azure_devops_test.go (+53 lines, per the summary). Every hunk in azure_devops.g…
Full details: Title check
Explanation
The title names the actual fix: Azure DevOps fingerprints are shortened so they fit the 32-character content_hash column. The raw summary and PR description describe this same change, so the title is related to the main change. It uses the conventional fix(syncer) prefix and is a single sentence, though at 69 characters it is slightly long.
Full details: Description check
Explanation
The description covers the problem (Azure DevOps fingerprints exceed the 32-character content_hash column, causing MySQL Error 1406), the fix (azureDevOpsFingerprint with xxh128 fallback, shared between skip-check and stored fingerprint), the metadata behavior, and the tests run. The template asks for a Summary section with background, and the description has a What section and Fix section but no heading named Summary. The content still covers the template's intent, so it passes.
Full details: Linked Issues check
Explanation
Issue #20972 reports that Azure DevOps sync fails on MySQL because a 40-character commit ID exceeds the 32-character document.content_hash column (internal/entity/document.go, size:32). The requirement is a sync that writes successfully. The suggested fix is to normalize Azure DevOps fingerprints to 32 characters consistently, or to change the schema. The reviewed head takes the normalization path. In internal/syncer/connector/azure_devops.go, azureDevOpsItemFingerprint and azureDevOpsPullRequestFingerprint now call azureDevOpsFingerprint. That function returns tokens of 32 bytes or fewer unchanged. Longer tokens return contentFingerprint(data), which is xxh3 Hash128 encoded as 32 hex characters (internal/syncer/connector/fingerprint.go). The code document builder uses azureDevOpsItemFingerprint for SourceDocument.Fingerprint and keeps the raw commit ID in metadata. Every stored fingerprint is now at most 32 characters, so the column limit is met. The PR states that the skip-check functions use the same helper. I did not open includeAzureDevOpsItem or the test file, so that part rests on the PR description and the shared helper. The author reports that the new tests pass. I did not run them.
Full details: Out of Scope Changes check
Explanation
The whole-PR diff against merge base c646754 changes only internal/syncer/connector/azure_devops.go (+22/-4 lines) and azure_devops_test.go (+53 lines, per the summary). Every hunk in azure_devops.go serves the #20972 fix: the new azureDevOpsFingerprint helper, its use in the item and pull request fingerprint functions, and the code document builder change that keeps commit_id as the raw value in metadata. The tests cover the same fix. No unrelated changes were found.
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
A rabbit checks each commit token, Long ones shrink to hashes neat. The raw ID stays in metadata, Tests confirm the lengths align, Then off I hop on nimble feet.
Recent review info
Run configuration
Source mode: Auto
Repository: Unavailable
Branch: Unavailable
File: No configuration file from this repository applied
Commit: Unavailable
Layers: Organization UI
Review profile: CHILL
Plan: Advanced
Run ID: 5f6e489f-9f37-4397-97fe-d2d897cce6fe
Commits
Reviewing files that changed from the base of the PR and between c646754 and ae3762a.
Files selected for processing: 2
internal/syncer/connector/azure_devops.go
internal/syncer/connector/azure_devops_test.go
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review.
Already reviewed the last commit. Use @coderabbitai full review to rerun a review of the entire changeset.
Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #20972
What
Azure DevOps fingerprints are opaque remote tokens, not content digests:
azureDevOpsItemFingerprintreturned the 40-character commit id andazureDevOpsPullRequestFingerprintreturnsstatus + ":" + RFC3339Nano(40+ characters).document.content_hashisvarchar(32)(internal/entity/document.go), so on MySQL the sync write fails withError 1406 (22001): Data too long for column 'content_hash' at row 1— the reported Azure DevOps sync failure.Every other connector emits a
contentFingerprint(xxh128, 32 hex characters), so the column width is the established contract; Azure DevOps was the outlier.Fix
azureDevOpsItemFingerprintandazureDevOpsPullRequestFingerprintnow pass their token throughazureDevOpsFingerprint: values that fit the 32-character column pass through unchanged (short refs stay readable), wider values are folded into the same xxh128 digest the other connectors use.includeAzureDevOpsItem/includeAzureDevOpsPullRequest) and the storedSourceDocument.Fingerprintcall the same function, so an unchanged revision still compares equal to its stored value. There is no stored-value migration: the raw 40-character value could never be written.document.metadata["commit_id"]keeps the raw commit id; only the fingerprint is compacted.Tests
Red on unmodified
c6467548f(40-character commit id → fingerprint length 40), green after the change:TestAzureDevOpsFingerprintFitsTheContentHashColumn: item fingerprint is 32 characters, different commits stay distinct, the stored fingerprint still skips an unchanged item, and the pull request fingerprint fits the column.TestAzureDevOpsDocumentKeepsTheRawCommitIDInMetadata: the built document carries the 32-character fingerprint whilecommit_idkeeps the full 40-character id.internal/syncer/connectorpackage passes; the pre-existingTestAssertConnectorHostSafeLoopbackHookAllowsOnlyLoopbackfails on the box for lack of DNS (dial udp 8.8.4.4:53: network is unreachable) on both the unmodified baseline and this branch.