Skip to content

gstack-issue-links names the older commit of each issue mention (#4378) - #4388

Closed
Davmunrey wants to merge 2 commits into
garrytan:mainfrom
Davmunrey:fix/issue-links-older-commit
Closed

Davmunrey wants to merge 2 commits into
garrytan:mainfrom
Davmunrey:fix/issue-links-older-commit

Conversation

@Davmunrey

Copy link
Copy Markdown
Contributor

Why (in your own words)

/ship's Issue links step lists each issue mention with the commit it came from, so the user can decide whether to promote a Refs #N to Fixes #N. Any mention outside the newest commit on the branch read commit : with an empty id, on stderr and in --json sources. The user was not told which commit a candidate came from. git log ends each commit's --format output with a newline, so after split('\0') every entry except the first starts with \n and the hash read as empty. Each entry now drops that one leading newline before the hash is read. The change covers both the origin/<base> log and its <base> fallback (fixes #4378).

Live evidence

$ git log --format='%h %s' main..HEAD
d74c9a9 tidy again        # message body: Refs #12
46e5f05 tidy              # message body: Refs #11

# before (main 0326b14)
$ bun bin/gstack-issue-links --base main --no-auto-links
Refs #11
Refs #12
  reference #12 ← commit d74c9a9739e2: Refs #12 (promote: fix #12)
  reference #11 ← commit : Refs #11 (promote: fix #11)

# after (this branch)
$ bun bin/gstack-issue-links --base main --no-auto-links
Refs #11
Refs #12
  reference #12 ← commit d74c9a9739e2: Refs #12 (promote: fix #12)
  reference #11 ← commit 46e5f051452d: Refs #11 (promote: fix #11)

$ bun test test/ship-issue-intent.test.ts
 15 pass, 0 fail   # the new two-commit case fails on main: "commit : Refs #11"
$ bun run typecheck && bun run typecheck:test
test typecheck ratchet: 812 known diagnostics, none new.
$ bin/gstack-prose-lint changelog.d/fix-issue-links-older-commit.md --gate
PROSE_LINT: ok files=1

Scope

  • Changed: bin/gstack-issue-links (3 lines), a two-commit CLI test in test/ship-issue-intent.test.ts, and a changelog fragment.
  • Verified live by: Running gstack-issue-links on a throwaway two-commit repo before and after the change (output above), plus the issue-links test file.
  • Did NOT test: A full /ship run, and the --json output; that output carries the same source string from the same code path. I did not run the full free suite.

Liveness proof (required for external contributors)

Checklist

  • Liveness screenshot attached (GSTACK PR typed live into a real surface) or PR author is @garrytan (owner exemption)
  • This is not a generated-file-only diff (I edited the source/template and regenerated)
  • No ETHOS.md edits, and no changes to voice / founder perspective / YC references
  • New public command / external service / host adapter has an accepted issue linked (or N/A)
  • Linked issue or reproduction: gstack-issue-links prints an empty commit id for issue mentions from older commits #4378

…ytan#4378)

git log ends each commit's --format output with a newline, so after
split('\0') every entry except the first starts with '\n'. The hash
lookup then found that newline at index 0, the label's hash was empty,
and mentions from any commit but the newest read `commit :` on stderr
and in --json sources. Each entry now drops that one leading newline
before the hash is read, which covers both the origin/<base> log and
its <base> fallback.

A two-commit CLI test checks that both reference lines name their own
commit; it fails on main with `reference garrytan#11 <- commit : Refs garrytan#11`.
@trunk-io

trunk-io Bot commented Nov 15, 2026

Copy link
Copy Markdown

Merging to main in this repository is managed by Trunk.

  • To merge this pull request, check the box to the left or comment /trunk merge below.

After your PR is submitted to the merge queue, this comment will be automatically updated with its status. If the PR fails, failure details will also be posted here

@capy-ai

capy-ai Bot commented Nov 15, 2026

Copy link
Copy Markdown
Contributor

Thank you for this, and for the before/after run and the two-commit test. The fix is right: dropping the one leading newline covers both git log calls. Outside code is rebuilt by a maintainer agent on current main rather than merged directly, so we'll rebuild this change with you credited as co-author and close this PR with a link once it lands. It's queued behind other finished work, so it may take a few days.

@capy-ai capy-ai Bot added bug Something isn't working S3 Severity 3: everything else labels Nov 15, 2026
main renamed the list the commit loop fills (mentions to named) for the
cross-repo reference work in garrytan#4454, on the lines this branch changes.
Keep both: the loop fills named, and still drops the newline git log
leaves at the start of every entry after the first.
@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thank you for this. We're picking up the idea. A maintainer agent working through a batch of fixes (our tracking thread GSTA-796) will first reproduce the problem on current main. If it reproduces, the agent rebuilds the fix on main with you credited as co-author, because we don't merge outside branches directly, and we'll close this PR with a link when it lands. If it no longer reproduces, we'll close this and say what changed.

@capy-ai

capy-ai Bot commented Nov 22, 2026

Copy link
Copy Markdown
Contributor

Thank you, @Davmunrey. Your fix for #4378 is now on main: we rebuilt it on current main in #4672, which keeps your test, uses git log -z to read the commit list, and credits you as co-author. Closing this one as taken.

@capy-ai capy-ai Bot closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working S3 Severity 3: everything else

Projects

None yet

Development

Successfully merging this pull request may close these issues.

gstack-issue-links prints an empty commit id for issue mentions from older commits

1 participant