Skip to content

feat(component): Add deterministic component fingerprints#47

Open
dmcilvaney wants to merge 11 commits intomicrosoft:mainfrom
dmcilvaney:damcilva/component_change_detection_parts/5
Open

feat(component): Add deterministic component fingerprints#47
dmcilvaney wants to merge 11 commits intomicrosoft:mainfrom
dmcilvaney:damcilva/component_change_detection_parts/5

Conversation

@dmcilvaney
Copy link
Copy Markdown
Contributor

No description provided.

Copilot AI review requested due to automatic review settings March 31, 2026 00:53
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds a new internal fingerprinting utility intended to compute deterministic “component fingerprints” from resolved component configuration plus additional build context.

Changes:

  • Introduces internal/fingerprint package with ComputeIdentity to produce a SHA256-based fingerprint and an inputs breakdown.
  • Adds a comprehensive test suite covering many config/input variations.
  • Exports OpenProjectRepo in synthetic history code and adds hashstructure/v2 dependency.

Reviewed changes

Copilot reviewed 5 out of 6 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
internal/fingerprint/fingerprint.go New fingerprint computation logic (config hashing + overlay file hashing + SHA256 combiner).
internal/fingerprint/fingerprint_test.go New tests asserting determinism and expected sensitivity/insensitivity to various inputs.
internal/fingerprint/doc.go Package documentation for the new fingerprint module.
internal/app/azldev/core/sources/synthistory.go Renames openProjectRepo to exported OpenProjectRepo and updates call site.
go.mod Adds github.com/mitchellh/hashstructure/v2 dependency.
go.sum Adds checksums for the new dependency.

Comment thread internal/fingerprint/fingerprint.go Outdated
Comment thread internal/fingerprint/fingerprint.go
Comment thread internal/fingerprint/fingerprint.go Outdated
Comment thread internal/fingerprint/fingerprint_test.go
Comment thread internal/fingerprint/fingerprint_test.go
Comment thread internal/app/azldev/core/sources/synthistory.go
Comment thread internal/fingerprint/doc.go
Comment thread internal/fingerprint/fingerprint.go
@dmcilvaney dmcilvaney force-pushed the damcilva/component_change_detection_parts/5 branch from a7d028e to 3fb8df7 Compare March 31, 2026 01:06
Copilot AI review requested due to automatic review settings March 31, 2026 01:07
@dmcilvaney dmcilvaney force-pushed the damcilva/component_change_detection_parts/5 branch from 3fb8df7 to 759c099 Compare March 31, 2026 01:07
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 5 comments.

Comment thread internal/fingerprint/fingerprint.go Outdated
Comment thread internal/fingerprint/fingerprint.go Outdated
Comment thread internal/fingerprint/fingerprint_test.go
Comment thread internal/fingerprint/fingerprint_test.go
Comment thread internal/fingerprint/fingerprint_test.go
@dmcilvaney dmcilvaney force-pushed the damcilva/component_change_detection_parts/5 branch from 0140c52 to 94e19ff Compare April 10, 2026 22:27
Copilot AI review requested due to automatic review settings April 10, 2026 22:27
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 5 out of 6 changed files in this pull request and generated 3 comments.

Comment thread internal/fingerprint/fingerprint.go Outdated
Comment thread internal/fingerprint/fingerprint.go
Comment thread internal/fingerprint/fingerprint.go
Copilot AI review requested due to automatic review settings April 10, 2026 23:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 3 comments.

Comment thread internal/fingerprint/fingerprint.go
Comment thread internal/fingerprint/fingerprint.go Outdated
Comment thread internal/fingerprint/fingerprint.go Outdated
Copilot AI review requested due to automatic review settings April 10, 2026 23:43
@dmcilvaney dmcilvaney marked this pull request as ready for review April 10, 2026 23:48
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Comment thread internal/fingerprint/fingerprint.go
Comment thread internal/projectconfig/specsource.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 11, 2026 00:12
Copy link
Copy Markdown
Member

@reubeno reubeno left a comment

Choose a reason for hiding this comment

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

Apart from the individual comments, my main question... what's your thoughts on how we can ensure that this algorithm stays in sync with the component and overlay definitions as the latter evolve?

Comment thread internal/fingerprint/fingerprint.go Outdated
OverlayFileHashes map[string]string `json:"overlayFileHashes,omitempty"`
// AffectsCommitCount is the number of "Affects: <component>" commits in the project repo.
AffectsCommitCount int `json:"affectsCommitCount"`
// Distro is the effective distro name.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why does this need to be tracked?

Comment thread internal/fingerprint/fingerprint.go Outdated
func ComputeIdentity(
fs opctx.FS,
component projectconfig.ComponentConfig,
distroRef projectconfig.DistroReference,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Is this the distro that the component is being built for or the distro that the component's spec may have come from? Can we document and clarify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It should be the effective distro for the component, ie if one is set, pick that, otherwise the global default.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That said, we can probably drop it to just ReleaseVer, that might be the only bit we really care about.

Comment thread internal/fingerprint/fingerprint.go Outdated
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 1 comment.

Comment thread internal/fingerprint/fingerprint.go
Copilot AI review requested due to automatic review settings April 13, 2026 18:24
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 2 comments.

Comment thread internal/fingerprint/fingerprint.go
Comment thread internal/fingerprint/doc.go Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 14, 2026 18:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 8 out of 9 changed files in this pull request and generated 4 comments.

Comment on lines 11 to 15
"github.com/bmatcuk/doublestar/v4"
"github.com/brunoga/deep"
"github.com/microsoft/azure-linux-dev-tools/internal/global/opctx"
"github.com/microsoft/azure-linux-dev-tools/internal/utils/fileutils"
)
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This file uses filepath.Base and fmt.Errorf, but path/filepath and fmt are not imported in the shown import block. As written, this will not compile. Add the missing imports (and keep them grouped consistently with the existing imports).

Copilot uses AI. Check for mistakes.
return c.Filename
}

return filepath.Base(c.Source)
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This file uses filepath.Base and fmt.Errorf, but path/filepath and fmt are not imported in the shown import block. As written, this will not compile. Add the missing imports (and keep them grouped consistently with the existing imports).

Copilot uses AI. Check for mistakes.

contentHash, err := fileutils.ComputeFileHash(fs, fileutils.HashTypeSHA256, c.Source)
if err != nil {
return "", fmt.Errorf("hashing overlay source %#q:\n%w", c.Source, err)
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

This file uses filepath.Base and fmt.Errorf, but path/filepath and fmt are not imported in the shown import block. As written, this will not compile. Add the missing imports (and keep them grouped consistently with the existing imports).

Copilot uses AI. Check for mistakes.
// the config file that defines the overlay.
Source string `toml:"source,omitempty" json:"source,omitempty" jsonschema:"title=Source,description=For overlays that require a source file as input, indicates a path to that file; relative paths are relative to the config file that defines the overlay"`
// Excluded from fingerprint because it contains an absolute path that varies by checkout
// location. Overlay content is hashed separately by [fingerprint.ComputeIdentity].
Copy link

Copilot AI Apr 14, 2026

Choose a reason for hiding this comment

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

Similar to SpecSource, the Go doc link [fingerprint.ComputeIdentity] may not resolve from this package/file if fingerprint isn’t an imported identifier here. Consider replacing the bracket-link with plain text or referencing this behavior in internal/fingerprint docs instead.

Suggested change
// location. Overlay content is hashed separately by [fingerprint.ComputeIdentity].
// location. Overlay content is hashed separately by the internal fingerprint computation.

Copilot uses AI. Check for mistakes.
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