Skip to content

use struct-based SourceMetadataFunc signature across git sources#4813

Merged
amanfcp merged 6 commits intomainfrom
INS-310
Mar 24, 2026
Merged

use struct-based SourceMetadataFunc signature across git sources#4813
amanfcp merged 6 commits intomainfrom
INS-310

Conversation

@amanfcp
Copy link
Copy Markdown
Contributor

@amanfcp amanfcp commented Mar 13, 2026

Description:

  • Refactor SourceMetadataFunc from a 7-parameter function to a struct-based SourceMetadataInfo approach
  • Add LegacySourceMetadataFunc wrapper for backward compatibility with EE consumers
  • Update all OSS git-based source implementations (GitHub, GitLab, HuggingFace, GitHub Experimental, snifftest)

Benefits

  • Future extensibility: Adding new metadata fields (e.g. Branch) no longer requires changing the function signature across all consumers
  • Backward compatibility: LegacySourceMetadataFunc allows gradual EE migration

Testing

  • Existing tests pass unchanged — refactoring is type-level only with no behavioral modifications

Checklist:

  • Tests passing (make test-community)?
  • Lint passing (make lint this requires golangci-lint)?

Note

Low Risk
Low risk type-level refactor, but it touches core git scanning paths; any missed field mapping could degrade metadata (links/line numbers) across sources.

Overview
Refactors git metadata callback plumbing by replacing the 7-parameter SourceMetadataFunc with a struct-based SourceMetadataInfo, making the callback signature extensible without widespread breaking changes.

Updates git chunk/commit/staged scanning code to construct and pass SourceMetadataInfo (including RepositoryLocalPath/Line where relevant), and migrates OSS consumers (github, gitlab, huggingface, github_experimental, and hack/snifftest) to the new callback shape while preserving existing metadata fields/links.

Written by Cursor Bugbot for commit b160a79. This will update automatically on new commits. Configure here.

@amanfcp amanfcp requested a review from a team March 13, 2026 12:11
@amanfcp amanfcp requested review from a team as code owners March 13, 2026 12:11
Copy link
Copy Markdown
Contributor

@rosecodym rosecodym left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is super cool, thanks! I appreciate the addition of the deprecated wrapper function to ease legacy conversion, but I wanted to note that using it might not end up being any less work than modifying the underlying functions directly once we bring this in.

Comment thread pkg/sources/git/git.go Outdated
@amanfcp amanfcp merged commit 586f66d into main Mar 24, 2026
13 checks passed
@amanfcp amanfcp deleted the INS-310 branch March 24, 2026 11:22
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.

3 participants