Skip to content

Add skipContentIdenticalDuplicates flag (default on) for compact baselines - #40

Merged
fornewid merged 2 commits into
mainfrom
feat/skip-content-identical-duplicates
Apr 24, 2026
Merged

Add skipContentIdenticalDuplicates flag (default on) for compact baselines#40
fornewid merged 2 commits into
mainfrom
feat/skip-content-identical-duplicates

Conversation

@fornewid

Copy link
Copy Markdown
Owner

Summary

Adds an opt-out flag for retaining # duplicate-safe entries in the baseline. Default is true — byte-identical duplicates are dropped from the file so only reviewable entries (# override, # conflict) remain.

Motivation from #39: PR #31 made the # conflict label trustworthy, but the baseline file length did not shrink — in the media3 + exoplayer-ui reproducer 241 of 244 entries simply switched tag. Keeping those lines defeats the point of the baseline. Matches the "compact by default" pattern already established by excludeAndroidXValues = true and the values id-slot skip.

Behavior

  • HighlanderCheckTask.processBaseline filters current entries where classification == DUPLICATE_SAFE before override promotion and serialization.
  • Scanners still compute byte-hash classification (cost is bounded by duplicate count), so toggling the flag only affects output — not scan semantics.
  • Drift detection is preserved both ways: a previously-identical duplicate that diverges later appears as a new # conflict on the next guard run.

API

New public property on HighlanderConfiguration:

public var skipContentIdenticalDuplicates: Boolean = true

highlander/api/highlander.api regenerated.

Closes #39

Migration

Existing 0.0.4 baselines that persist # duplicate-safe entries will diff against scanner output on the first guard run after upgrade — those entries disappear from current so the guard reports them as removed. Re-baseline once:

./gradlew :<project>:highlanderBaseline<Variant>

Users who want to keep historical # duplicate-safe records in the file can set skipContentIdenticalDuplicates = false.

Test plan

  • :highlander:test
  • :highlander:gradleTest (default-on filter, explicit false retention; prior tests updated to use divergent content where they relied on the old default)
  • :highlander:apiCheck
  • :sample:app:highlanderBaselineRelease --configuration-cache — sample baseline unchanged (# override drawable/ic_close kept since sample sources have divergent content)

…lines

After #31 shipped the duplicate-safe classification, the baseline length
did not shrink — the same 241-of-244 entries from the media3 /
exoplayer-ui reproducer just switched tags. The primary goal of the
baseline is quick review, so keeping those lines in the file defeats
the purpose.

Add a per-configuration flag that drops DUPLICATE_SAFE entries before
serialization. Default is true so new users see a compact,
review-ready baseline out of the box — consistent with
excludeAndroidXValues = true. Set skipContentIdenticalDuplicates = false
to keep the historical record of byte-identical duplicates.

The filter runs in HighlanderCheckTask.processBaseline, before override
promotion. Scanners keep their current behavior (classification is still
computed; hash cost is bounded by duplicate count, not enabled state) so
toggling the flag doesn't change scan semantics, only output.

Drift detection is preserved either way: a previously-identical
duplicate that diverges later still appears as a new # conflict on the
next guard run.

Adjusts existing gradleTest cases that relied on the old default (byte-
identical content in baseline) to use divergent content, and opts out
explicitly in the classification-flip test where the override ->
duplicate-safe transition needs duplicate-safe to remain serialized.
Adds two new gradleTest cases pinning the default-on and opt-out paths.

Existing 0.0.4 users will need to re-baseline once on upgrade —
duplicate-safe entries that were persisted in their baseline file will
disappear on the next scan.

Closes #39

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Code Review

This pull request introduces the skipContentIdenticalDuplicates configuration property, which defaults to true to omit byte-identical duplicates from baseline files, ensuring they remain compact and focused on actionable conflicts. The implementation includes updates to the Gradle task logic, documentation, and test suite. Review feedback recommends refining the test configurations by removing redundant default property values to enhance readability and maintainability.

Comment on lines +261 to +264
resources = true
nativeLibs = false
assets = false
skipContentIdenticalDuplicates = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

The test configuration includes properties set to their default values (resources = true, nativeLibs = false). To improve readability and focus on the specific configuration for this test, it's better to only specify non-default values. This makes the test's intent clearer and reduces maintenance if defaults change.

Suggested change
resources = true
nativeLibs = false
assets = false
skipContentIdenticalDuplicates = false
assets = false
skipContentIdenticalDuplicates = false

Comment on lines +303 to +306
resources = true
nativeLibs = false
assets = false
skipContentIdenticalDuplicates = false

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

medium

This configuration includes properties set to their default values (resources = true, nativeLibs = false). For better readability and maintainability, please only specify properties that deviate from the default. This highlights the specific setup required for the test.

Suggested change
resources = true
nativeLibs = false
assets = false
skipContentIdenticalDuplicates = false
assets = false
skipContentIdenticalDuplicates = false

@fornewid
fornewid merged commit e8a2e4b into main Apr 24, 2026
1 check passed
@fornewid
fornewid deleted the feat/skip-content-identical-duplicates branch April 24, 2026 13:25
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.

Add skipContentIdenticalDuplicates flag to keep baseline compact

1 participant