Skip to content

fix(syncer): fit Azure DevOps fingerprints in the content_hash column - #22395

Open
ccclucky wants to merge 1 commit into
infiniflow:mainfrom
ccclucky:fix/ado-fingerprint-length
Open

ccclucky wants to merge 1 commit into
infiniflow:mainfrom
ccclucky:fix/ado-fingerprint-length

Conversation

@ccclucky

Copy link
Copy Markdown
Contributor

Fixes #20972

What

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.

Fixes infiniflow#20972
@ccclucky

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

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.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix · Severity of issue fixed: Medium

Suggested reviewers: erhanaydin, buua436, wangq8

Merge Risk: Minimal · up to ae376

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: Passed 4

Check name Status Explanation
Title check Passed 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 Passed 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 Passed 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 Passed 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.

Share

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.

@coderabbitai

coderabbitai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor
Action not completed

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.

@wangq8
wangq8 requested a review from JinHai-CN November 17, 2026 03:44
@yuzhichang
yuzhichang requested review from xugangqiang and removed request for JinHai-CN November 18, 2026 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Azure DevOps sync fails because content_hash is limited to 32 characters

2 participants