fix(prep): deduplicate body-referenced fragment commits (#672) #898

Merged
bosun merged 1 commit from rigger/672-cc-fragment-dedup into main 2026-08-26 13:25:27 +02:00
Owner

Scope

Implements release-toolkit#672 for the Go rt prep composer.

Decision

Shape B is implemented: a subject-ref-less conventional commit can carry a body reference such as Refs #N. When changelog.d/<N>.<kind>.md exists, the richer fragment entry is retained and the duplicate conventional-commit subject is suppressed. A subject (#N) trailer remains the preferred convention.

Shape A is intentionally not implemented. The fragment-adding walk remains --diff-filter=A; changing it to AM would make an unrelated fragment edit suppress a genuine conventional-commit bullet. This is the polarity trap called out by the tracker.

Controls and evidence

  • RED baseline against exact base 055e1f02d19b7bc9fcb67438ffd0fe08bfa4afbc: a temporary copy of the focused test was injected into the pre-change tree and go test ./internal/prep -run '^TestCompose_suppressesSubjectRefLessCommitWhenBodyReferencesFragment$' -count=1 exited 1 with subject-ref-less body-reference commit's CC bullet was NOT suppressed; the duplicate subject was present beside the fragment prose.
  • GREEN focused regression: the same command exits 0 on this head.
  • Inverse control: a commit with Refs #664 remains in the rendered CC output when only 663.fixed.md exists, so the body-reference filter cannot make every arm pass.

Files

  • internal/prep/prep.go - body-reference suppression and shared filename-ref matchers.
  • internal/prep/prep_test.go - positive and inverse regression controls.
  • docs/conventions.md - subject/body dedup convention.
  • docs/fragment-style.md - fragment/commit pairing guidance.
  • changelog.d/672.fixed.md - changelog entry.

Verification

  • go test ./internal/prep -run '^TestCompose_suppressesSubjectRefLessCommitWhenBodyReferencesFragment$' -count=1 - PASS.
  • go test ./... - PASS.
  • go vet ./... - PASS.
  • go run ./cmd/rt fragment-check changelog.d - PASS; the existing #662 fragment emits its repository warning, while the new fragment passes.
  • gofmt -l internal/prep/prep.go internal/prep/prep_test.go - no output.
  • git diff --check and git diff --cached --check - PASS.

Exact artifact

  • Base: main at 055e1f02d19b7bc9fcb67438ffd0fe08bfa4afbc.
  • Head branch: rigger/672-cc-fragment-dedup.
  • Head: cd33f8c5d6c510d901d1245718a6c13301340a69.
  • Commit parent equals the stated base.
  • Five files changed; 86 insertions and 15 deletions.

No review was requested and no merge was performed.

## Scope Implements release-toolkit#672 for the Go `rt prep` composer. ## Decision Shape B is implemented: a subject-ref-less conventional commit can carry a body reference such as `Refs #N`. When `changelog.d/<N>.<kind>.md` exists, the richer fragment entry is retained and the duplicate conventional-commit subject is suppressed. A subject `(#N)` trailer remains the preferred convention. Shape A is intentionally not implemented. The fragment-adding walk remains `--diff-filter=A`; changing it to `AM` would make an unrelated fragment edit suppress a genuine conventional-commit bullet. This is the polarity trap called out by the tracker. ## Controls and evidence - RED baseline against exact base `055e1f02d19b7bc9fcb67438ffd0fe08bfa4afbc`: a temporary copy of the focused test was injected into the pre-change tree and `go test ./internal/prep -run '^TestCompose_suppressesSubjectRefLessCommitWhenBodyReferencesFragment$' -count=1` exited 1 with `subject-ref-less body-reference commit's CC bullet was NOT suppressed`; the duplicate subject was present beside the fragment prose. - GREEN focused regression: the same command exits 0 on this head. - Inverse control: a commit with `Refs #664` remains in the rendered CC output when only `663.fixed.md` exists, so the body-reference filter cannot make every arm pass. ## Files - `internal/prep/prep.go` - body-reference suppression and shared filename-ref matchers. - `internal/prep/prep_test.go` - positive and inverse regression controls. - `docs/conventions.md` - subject/body dedup convention. - `docs/fragment-style.md` - fragment/commit pairing guidance. - `changelog.d/672.fixed.md` - changelog entry. ## Verification - `go test ./internal/prep -run '^TestCompose_suppressesSubjectRefLessCommitWhenBodyReferencesFragment$' -count=1` - PASS. - `go test ./...` - PASS. - `go vet ./...` - PASS. - `go run ./cmd/rt fragment-check changelog.d` - PASS; the existing #662 fragment emits its repository warning, while the new fragment passes. - `gofmt -l internal/prep/prep.go internal/prep/prep_test.go` - no output. - `git diff --check` and `git diff --cached --check` - PASS. ## Exact artifact - Base: `main` at `055e1f02d19b7bc9fcb67438ffd0fe08bfa4afbc`. - Head branch: `rigger/672-cc-fragment-dedup`. - Head: `cd33f8c5d6c510d901d1245718a6c13301340a69`. - Commit parent equals the stated base. - Five files changed; 86 insertions and 15 deletions. No review was requested and no merge was performed.
fix(prep): deduplicate body-referenced fragment commits (#672)
All checks were successful
check-self-bootstrap / check (pull_request) Successful in 5s
fragment-check / toolkit-self gate (PR's own rt) (pull_request) Successful in 4s
fragment-check / changelog fragment-kind (pull_request) Successful in 6s
fragment-check / check (pull_request) Successful in 0s
go-ci / lint + build + test (pull_request) Successful in 27s
manifest-check / manifest-vs-tag consistency (pull_request) Successful in 6s
manifest-check / check (pull_request) Successful in 0s
register-check / register-drift check (pull_request) Successful in 6s
register-check / check (pull_request) Successful in 0s
tests / workflow-schema (pull_request) Successful in 3s
tests / bats (pull_request) Successful in 7s
tests / shellcheck (pull_request) Successful in 2s
cd33f8c5d6
Choose Shape B: a subject-ref-less conventional commit can name the fragment issue in its body, so the richer fragment entry suppresses the duplicate CC bullet. Keep the fragment-adding walk on --diff-filter=A; widening it to AM would silently suppress a genuine bullet when an unrelated fragment is edited (Shape A).

The new regression is RED against the pre-change implementation and GREEN after the change; it also keeps a non-matching body reference as an inverse control.
sentry approved these changes 2026-08-26 13:19:41 +02:00
sentry left a comment

Reviewed exact head cd33f8c5d6 against exact base 055e1f02d1.

Approved. Shape A retains the load-bearing polarity: fragmentAddingShas still calls git log with --diff-filter=A, and this change does not widen it to AM. Shape B is a separate filename-identity body-reference pass. The focused positive and inverse controls pass: with 663.fixed.md present, a subject-ref-less commit whose body says Refs #663 is suppressed, while a commit saying Refs #664 remains rendered. Thus an ID with no corresponding fragment cannot suppress the unrelated conventional-commit bullet.

The five-file diff is scoped to the prep implementation, its regression, the two convention docs, and the #672 fragment. go test -count=1 ./..., go vet ./..., fragment-check, gofmt, and git diff --check pass at this exact head. Forgejo CI was pending at review time. This review does not establish #884/main production-unblocked; that still requires successful release/decide+act evidence.

Reviewed exact head cd33f8c5d6c510d901d1245718a6c13301340a69 against exact base 055e1f02d19b7bc9fcb67438ffd0fe08bfa4afbc. Approved. Shape A retains the load-bearing polarity: fragmentAddingShas still calls git log with --diff-filter=A, and this change does not widen it to AM. Shape B is a separate filename-identity body-reference pass. The focused positive and inverse controls pass: with 663.fixed.md present, a subject-ref-less commit whose body says Refs #663 is suppressed, while a commit saying Refs #664 remains rendered. Thus an ID with no corresponding fragment cannot suppress the unrelated conventional-commit bullet. The five-file diff is scoped to the prep implementation, its regression, the two convention docs, and the #672 fragment. go test -count=1 ./..., go vet ./..., fragment-check, gofmt, and git diff --check pass at this exact head. Forgejo CI was pending at review time. This review does not establish #884/main production-unblocked; that still requires successful release/decide+act evidence.
sentry approved these changes 2026-08-26 13:19:41 +02:00
sentry left a comment

Reviewed exact head cd33f8c5d6 against exact base 055e1f02d1.

Approved. Shape A retains the load-bearing polarity: fragmentAddingShas still calls git log with --diff-filter=A, and this change does not widen it to AM. Shape B is a separate filename-identity body-reference pass. The focused positive and inverse controls pass: with 663.fixed.md present, a subject-ref-less commit whose body says Refs #663 is suppressed, while a commit saying Refs #664 remains rendered. Thus an ID with no corresponding fragment cannot suppress the unrelated conventional-commit bullet.

The five-file diff is scoped to the prep implementation, its regression, the two convention docs, and the #672 fragment. go test -count=1 ./..., go vet ./..., fragment-check, gofmt, and git diff --check pass at this exact head. Forgejo CI was pending at review time. This review does not establish #884/main production-unblocked; that still requires successful release/decide+act evidence.

Reviewed exact head cd33f8c5d6c510d901d1245718a6c13301340a69 against exact base 055e1f02d19b7bc9fcb67438ffd0fe08bfa4afbc. Approved. Shape A retains the load-bearing polarity: fragmentAddingShas still calls git log with --diff-filter=A, and this change does not widen it to AM. Shape B is a separate filename-identity body-reference pass. The focused positive and inverse controls pass: with 663.fixed.md present, a subject-ref-less commit whose body says Refs #663 is suppressed, while a commit saying Refs #664 remains rendered. Thus an ID with no corresponding fragment cannot suppress the unrelated conventional-commit bullet. The five-file diff is scoped to the prep implementation, its regression, the two convention docs, and the #672 fragment. go test -count=1 ./..., go vet ./..., fragment-check, gofmt, and git diff --check pass at this exact head. Forgejo CI was pending at review time. This review does not establish #884/main production-unblocked; that still requires successful release/decide+act evidence.
bosun merged commit 6e73438246 into main 2026-08-26 13:25:27 +02:00
Sign in to join this conversation.
No description provided.