Align branch naming behavior, API, tests, and documentation #35

Closed
opened 2026-10-27 13:34:41 +00:00 by sam · 0 comments
Owner

branchPrefix ignores title and body despite the documented title-prefix contract, and branchSlug documents 40 characters while implementing 60.

Re-verified against main (internal/worktree/worktree.go). Three of the four original defects remain; the checked-in FIXME is already gone.

  • archieBranch (line 610-612) documents "conventional commit prefix from the issue title when possible, falls back to labels", but branchPrefix(title, body, labels) (line 632) switches only on labels and returns "feat" otherwise. title and body are dead parameters.
  • strings.TrimSuffix(prefix, "") (line 616) is a no-op: TrimSuffix with an empty suffix always returns its input, so the guard it appears to express does nothing.
  • branchSlug's doc comment (line 652-653) says "max 40 chars"; the implementation breaks at b.Len() >= 60 (line 662).
  • No FIXME or TODO remains in the file.

Steps to Reproduce

  1. Call archieBranch(12, "fix: crash on empty payload", "", "") with no labels.
  2. Expected per the doc comment: prefix fix derived from the title. Actual: feat/12-fix-crash-on-empty-payload — the title prefix is ignored and also left duplicated in the slug, because the strip branch only fires when prefix already matches the title.
  3. Call archieBranch(12, "<title of 80+ characters>", "", "bug") and observe the slug runs to 60 characters, not the 40 the doc comment promises.

Acceptance Criteria

The chosen title/label precedence is explicit and tested for unlabeled and conflicting inputs; dead parameters and the TrimSuffix no-op are removed; slug documentation and boundary tests agree with the implemented limit; scoped lint passes.

Acceptance criteria

The chosen title/label precedence is explicit and tested for unlabeled and conflicting inputs; dead parameters and no-op residue are removed; slug documentation and boundary tests agree with 60; scoped lint passes.

Close reason

Fixed: precedence is now title-first via parseTitlePrefix with a labels fallback and 'feat' default; the strings.TrimSuffix(prefix, "") no-op is gone; the dead body parameter is removed from archieBranch and its call site (worktree.go:131); branchSlug's doc now says 60, matching the implementation. go fix later modernised parseTitlePrefix to strings.Cut -- verified equivalent (Cut splits on the first separator; ok mirrors idx != -1). Verified by inspection rather than a red run, since the signature change prevents compiling the tests against pre-fix code. task check green; fresh adversarial review zero findings.


Imported from beads archie-core-1ysw.9 · GitHub #597 · type bug · priority P2 · created 2026-08-22 · closed 2026-08-24

branchPrefix ignores title and body despite the documented title-prefix contract, and branchSlug documents 40 characters while implementing 60. Re-verified against main (internal/worktree/worktree.go). Three of the four original defects remain; the checked-in FIXME is already gone. - `archieBranch` (line 610-612) documents "conventional commit prefix from the issue title when possible, falls back to labels", but `branchPrefix(title, body, labels)` (line 632) switches only on `labels` and returns "feat" otherwise. `title` and `body` are dead parameters. - `strings.TrimSuffix(prefix, "")` (line 616) is a no-op: TrimSuffix with an empty suffix always returns its input, so the guard it appears to express does nothing. - `branchSlug`'s doc comment (line 652-653) says "max 40 chars"; the implementation breaks at `b.Len() >= 60` (line 662). - No FIXME or TODO remains in the file. ## Steps to Reproduce 1. Call `archieBranch(12, "fix: crash on empty payload", "", "")` with no labels. 2. Expected per the doc comment: prefix `fix` derived from the title. Actual: `feat/12-fix-crash-on-empty-payload` — the title prefix is ignored and also left duplicated in the slug, because the strip branch only fires when `prefix` already matches the title. 3. Call `archieBranch(12, "<title of 80+ characters>", "", "bug")` and observe the slug runs to 60 characters, not the 40 the doc comment promises. ## Acceptance Criteria The chosen title/label precedence is explicit and tested for unlabeled and conflicting inputs; dead parameters and the TrimSuffix no-op are removed; slug documentation and boundary tests agree with the implemented limit; scoped lint passes. ### Acceptance criteria The chosen title/label precedence is explicit and tested for unlabeled and conflicting inputs; dead parameters and no-op residue are removed; slug documentation and boundary tests agree with 60; scoped lint passes. ### Close reason Fixed: precedence is now title-first via parseTitlePrefix with a labels fallback and 'feat' default; the strings.TrimSuffix(prefix, "") no-op is gone; the dead body parameter is removed from archieBranch and its call site (worktree.go:131); branchSlug's doc now says 60, matching the implementation. go fix later modernised parseTitlePrefix to strings.Cut -- verified equivalent (Cut splits on the first separator; ok mirrors idx != -1). Verified by inspection rather than a red run, since the signature change prevents compiling the tests against pre-fix code. task check green; fresh adversarial review zero findings. --- _Imported from beads `archie-core-1ysw.9` · GitHub #597 · type bug · priority P2 · created 2026-08-22 · closed 2026-08-24_
sam added the mediumbug labels 2026-10-27 13:34:41 +00:00
sam self-assigned this 2026-10-27 13:34:41 +00:00
sam closed this issue 2026-10-27 13:34:41 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sam/archie#35