feat(merge-report): add Ports: <sha> trailer detection layer - #42
Merged
Conversation
Adds a deterministic escape hatch for the false-positive shape neither patch-id nor subject-match can resolve: a port whose content is a deliberate subset/superset of the original (e.g. it drops a version bump the target branch doesn't need), which changes both the patch-id and the subject enough that no heuristic recognizes the pairing. A target-branch commit can now carry a `Ports: <sha>` trailer (full or abbreviated) in its body, asserting it carries forward that specific source-branch commit. Trusted outright as a human assertion, checked right after the label/ignore-list lookups since trailer values are scanned once per target branch up front. On by default; togglable via ports-trailer in .gitflow-changelog.yml, the CLI, and the action.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new deterministic detection layer to
merge-reportfor the one false-positive shape none of the existing heuristics can resolve: a port whose content is a deliberate subset or superset of the original commit (e.g. the original bundled an unrelated version bump that the target branch's own version already covers). That kind of divergence changes both the patch-id and the subject enough that neithergit cherrynor subject-match can recognize the pairing — discovered in practice onaklivity/zilla-plus, where PR #1053 portedcommand-logsfromsupport/1.xbut deliberately dropped thezilla.versionbump the original commit bundled, sincedevelop's version already covered it.Ports: <sha>line in its body (full or abbreviated sha, same conventiongit log <prefix>accepts), asserting it carries forward a specific source-branch commit.ports-trailer: true); configurable via.gitflow-changelog.yml, the CLI (--ports-trailer), and the action (ports-trailerinput) — same override precedence assubject-match.New files
src/ports-trailer.ts— pure trailer parsing (parsePortsTrailers) and matching (portsTrailerMatches) logic, unit tested without a git fixture.src/git.ts—scanPortsTrailers(ref, options), a single history walk collecting everyPorts:trailer value reachable fromref.Test plan
npm run typechecknpm test— 235 passing (19 new: 13 intest/ports-trailer.test.ts, 2 intest/git-cherry.test.ts, 4 end-to-end intest/merge-report.test.ts)npm run buildGenerated by Claude Code