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
The `component identity` and `component diff-identity` subcommands compute deterministic fingerprints of component build inputs. For example, CI can compute fingerprints for the base and head commits of a PR, then diff them to determine exactly which components have changed and need to be rebuilt/tested.
1.**Config hash** — `hashstructure.Hash()` of the resolved `ComponentConfig` (after all merging). Fields tagged `fingerprint:"-"` are excluded.
18
+
2.**Source identity** — content hash for local specs (all files in the spec directory), commit hash for upstream.
19
+
3.**Overlay file hashes** — SHA256 of each file referenced by overlay `Source` fields.
20
+
4.**Distro name + version**
21
+
5.**Affects commit count** — number of `Affects: <component>` commits in the project repo.
22
+
23
+
Global change propagation works automatically: the fingerprint operates on the fully-merged config, so a change to a distro or group default changes the resolved config of every inheriting component.
24
+
25
+
## `fingerprint:"-"` Tag System
26
+
27
+
The `hashstructure` library uses `TagName: "fingerprint"`. Untagged fields are **included by default** (safe default: false positive > false negative).
28
+
29
+
A guard test (`TestAllFingerprintedFieldsHaveDecision`) reflects over all fingerprinted structs and maintains a bi-directional allowlist of exclusions. It fails if a `fingerprint:"-"` tag is added without registering it, or if a registered exclusion's tag is removed.
30
+
31
+
### Adding a New Config Field
32
+
33
+
1. Add the field to the struct in `internal/projectconfig/`.
34
+
2.**If NOT a build input**: add `fingerprint:"-"` to the struct tag and register it in `expectedExclusions` in `internal/projectconfig/fingerprint_test.go`.
35
+
3.**If a build input**: do nothing — included by default.
36
+
4. Run `mage unit`.
37
+
38
+
### Adding a New Source Type
39
+
40
+
1. Implement `SourceIdentityProvider` on your provider (see `localidentity.go` for a simple example).
41
+
2. Add a case to `sourceManager.ResolveSourceIdentity()` in `sourcemanager.go`.
42
+
3. Add tests in `identityprovider_test.go`.
43
+
44
+
## CLI
45
+
46
+
### `azldev component identity`
47
+
48
+
Compute fingerprints. Uses standard component filter flags (`-a`, `-p`, `-g`, `-s`). Exposed as an MCP tool.
49
+
50
+
### `azldev component diff-identity`
51
+
52
+
Compare two identity JSON files. The `--changed-only` / `-c` flag filters to only changed and added components (the build queue). Applies to both table and JSON output.
53
+
54
+
## Known Limitations
55
+
56
+
- It is difficult to determine WHY a diff occurred (e.g., which specific field changed) since the fingerprint is a single opaque hash. The JSON output includes an `inputs` breakdown (`configHash`, `sourceIdentity`, `overlayFileHashes`, etc.) that can help narrow it down by comparing the two identity files manually.
0 commit comments