Skip to content

Order PR stack tables by base chain#20

Open
fjord-oai wants to merge 2 commits into
magus:masterfrom
fjord-oai:fjord/stack-table-ordering
Open

Order PR stack tables by base chain#20
fjord-oai wants to merge 2 commits into
magus:masterfrom
fjord-oai:fjord/stack-table-ordering

Conversation

@fjord-oai
Copy link
Copy Markdown
Contributor

@fjord-oai fjord-oai commented Apr 28, 2026

Summary

Order PR stack tables from the explicit base chain instead of relying on the current commit_range.group_list order.

This fixes cases where the stack table in PR descriptions can appear reversed or otherwise misordered after sync. range() still returns groups in git-log-oriented order, but the PR body update path needs base-to-tip stack order. Since each stack group already records its intended base, we can derive the display order directly from those base links.

Details

  • Updates CommitMetadata.stack_order(...) to derive canonical stack order from group.base relationships.
  • Uses that canonical order when building the PR URL list rendered into stack tables.
  • Preserves all groups even if a base link is missing or incomplete, falling back to the original input order for disconnected groups.
  • Aligns ManualRebase and rebase_order() with the new canonical ordering semantics so callers do not reinterpret stack_order() inconsistently.
  • Adds a regression test that reproduces the user-visible bug: even if group_list is reversed, the rendered stack table rows still come out in base-chain order.

Test plan

  • bun test src/app/SyncGithub.test.ts src/core/CommitMetadata.order.test.ts
  • ./node_modules/.bin/tsc

magus added a commit that referenced this pull request Apr 29, 2026
@fjord-oai fjord-oai force-pushed the fjord/stack-table-ordering branch from 150172b to 8ae3932 Compare May 12, 2026 19:59
@fjord-oai fjord-oai force-pushed the fjord/stack-table-ordering branch from 8ae3932 to 92efd2c Compare May 12, 2026 21:16
@magus
Copy link
Copy Markdown
Owner

magus commented May 17, 2026

Do you have a repro? I spent some time thinking about this and I don't think it's possible for things to ever be out of order actually they are always the order of the commits in the local branch.

a7b8d27
ca13756
5b3b3ef

I added some instructions for running locally, maybe you move your fork to master briefly, build it and run it locally for awhile and see

2e966d5

Either we will get a repro or we might have confidence the coverage landed is sufficient now.

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.

2 participants