Skip to content

feat(config): Add fingerprint ignore tags to some config fields#46

Open
dmcilvaney wants to merge 1 commit intomicrosoft:mainfrom
dmcilvaney:damcilva/component_change_detection_parts/4
Open

feat(config): Add fingerprint ignore tags to some config fields#46
dmcilvaney wants to merge 1 commit intomicrosoft:mainfrom
dmcilvaney:damcilva/component_change_detection_parts/4

Conversation

@dmcilvaney
Copy link
Copy Markdown
Contributor

@dmcilvaney dmcilvaney commented Mar 31, 2026

Prepare for fingerprint calculations in #47

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

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

This PR introduces a fingerprint:"-" struct tag on selected internal/projectconfig fields to mark them as excluded from “component fingerprinting”, and adds a test to ensure the exclusion list stays consistent over time.

Changes:

  • Add fingerprint:"-" tags to multiple config fields that are intended to be treated as non-build-input metadata.
  • Add a reflection-based unit test to detect accidental additions/removals of fingerprint:"-" exclusions.

Reviewed changes

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

Show a summary per file
File Description
internal/projectconfig/overlay.go Excludes ComponentOverlay.Description from the fingerprint via tag.
internal/projectconfig/build.go Excludes check/failure/hints “reason/policy” fields from the fingerprint via tag.
internal/projectconfig/component.go Excludes bookkeeping/back-reference fields and SourceFileReference.Origin from the fingerprint via tag.
internal/projectconfig/distro.go Excludes DistroReference.Snapshot from the fingerprint via tag.
internal/projectconfig/fingerprint_test.go Adds a test that asserts the expected set of fingerprint exclusions.


// Origin for this source file. When omitted, the file is resolved via the lookaside cache.
Origin Origin `toml:"origin,omitempty" json:"origin,omitempty"`
Origin Origin `toml:"origin,omitempty" json:"origin,omitempty" fingerprint:"-"`
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

Excluding SourceFileReference.Origin from the fingerprint assumes the source file’s content is fully captured by Filename + Hash/HashType, but hash/hash-type are optional and downloads proceed without validation when they’re empty (see downloadAndValidate in internal/providers/sourceproviders/sourcemanager.go). If the fingerprint is used to decide whether sources/build outputs are up-to-date, consider including Origin when hash info is missing, or enforce that hash + hash-type are required for source-files entries so changes in origin can’t silently change inputs without changing the fingerprint.

Suggested change
Origin Origin `toml:"origin,omitempty" json:"origin,omitempty" fingerprint:"-"`
Origin Origin `toml:"origin,omitempty" json:"origin,omitempty"`

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

Good point.

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.

Will add a check to the calculation step that errors on this case

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.

Version string `toml:"version,omitempty" json:"version,omitempty" jsonschema:"title=Version,description=Version of the referenced distro"`
// Snapshot date/time for source code if specified components will use source as it existed at this time.
Snapshot string `toml:"snapshot,omitempty" json:"snapshot,omitempty" jsonschema:"format=date-time,title=Snapshot,description=If specified use source code as it existed at this date/time"`
Snapshot string `toml:"snapshot,omitempty" json:"snapshot,omitempty" jsonschema:"format=date-time,title=Snapshot,description=If specified use source code as it existed at this date/time" fingerprint:"-"`
Copy link

Copilot AI Mar 31, 2026

Choose a reason for hiding this comment

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

DistroReference.Snapshot directly affects which upstream commit is checked out when upstream-commit isn’t set (see checkoutTargetCommit in internal/providers/sourceproviders/fedorasourceprovider.go). Ignoring snapshot in the fingerprint can therefore miss real input changes when the snapshot time changes. If you intend to keep snapshot out of the fingerprint, the resolved commit hash used for the checkout should be captured elsewhere and included in the fingerprint/state instead.

Suggested change
Snapshot string `toml:"snapshot,omitempty" json:"snapshot,omitempty" jsonschema:"format=date-time,title=Snapshot,description=If specified use source code as it existed at this date/time" fingerprint:"-"`
Snapshot string `toml:"snapshot,omitempty" json:"snapshot,omitempty" jsonschema:"format=date-time,title=Snapshot,description=If specified use source code as it existed at this date/time"`

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

Agreed.

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.

The fully resolved commit for each component is part of the fingerprint. That is more reliable than the snapshot date (also, updating the snapshot date would cause a rebuild of every single package, even if many of them didn't change).

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.

@dmcilvaney dmcilvaney marked this pull request as draft March 31, 2026 01:41
@dmcilvaney dmcilvaney force-pushed the damcilva/component_change_detection_parts/4 branch from daeff90 to 33ef430 Compare April 1, 2026 23:02
@dmcilvaney dmcilvaney marked this pull request as ready for review April 1, 2026 23:02
Copilot AI review requested due to automatic review settings April 1, 2026 23:02
Copy link
Copy Markdown

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 5 changed files in this pull request and generated 2 comments.

Copy link
Copy Markdown

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 6 out of 6 changed files in this pull request and generated no new comments.

@dmcilvaney
Copy link
Copy Markdown
Contributor Author

Should add a blurb in copilot instructions about the fingerprint tag.

Copilot AI review requested due to automatic review settings April 2, 2026 01:57
Copy link
Copy Markdown

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 7 out of 7 changed files in this pull request and generated 1 comment.

@dmcilvaney
Copy link
Copy Markdown
Contributor Author

Test failure looks transient and unrelated to changes

In preparation for the upcoming component change detection feature, this
commit selects which config fields should be ignored when computing the
identity of a component using a fingerprinting mechanism.
@dmcilvaney dmcilvaney force-pushed the damcilva/component_change_detection_parts/4 branch from d298954 to 44142f2 Compare April 2, 2026 16:07
type PackageConfig struct {
// Publish holds the publish settings for this package.
Publish PackagePublishConfig `toml:"publish,omitempty" json:"publish,omitempty" jsonschema:"title=Publish settings,description=Publishing settings for this binary package"`
Publish PackagePublishConfig `toml:"publish,omitempty" json:"publish,omitempty" jsonschema:"title=Publish settings,description=Publishing settings for this binary package" fingerprint:"-"`
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.

Are we sure about this one? I understand it doesn't affect the generated package, but how would we change where something is published to and have the re-publishing happen?

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.

I asked a few folks about this one, consensus was do not track. Once a binary is "built" it should just be moved/retagged etc. I'd assume?

}
```

## Component Fingerprinting — `fingerprint:"-"` Tags
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.

Can we get a general overview of this new tag added to some of the human-targeted docs too?

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.

Final PR has a section on it, figured I'd put the whole feature set in a doc.

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