Repository navigation
feat(pr): show a Stack on the pull request page and land or rebase it - #191
Conversation
Name Stack, Layer, Trunk, Stack Chip, Stack Detail, Stack Merge, and Stack Rebase, and record that a Stack Merge lands the prefix while a Stack Rebase stays GitHub's server-side cascade.
# Conflicts: # tests/pr-conversation.test.ts
The published stacks REST surface still lists create, add, and unstack, and GraphQL stack fields stay read-only. A not-linear Layer shows neither control, unknown history shows no Stack Rebase, and the same conversation offers Stack Merge again once the history is linear.
The status read uses the private GET coalescing handler. Polling continues while the outcome is in progress and this caller is still current, and a request error or a result that cannot be polled shows failed. One Layer fixture drives the chip, the detail, and the merge request, and the Layer state labels and outcome type are shared.
The Stack Rebase dialog borrowed Bulma's button classes and had no close control, so it read as a different product. Give it the same header, close button, card list and footer the other PR modals use, and split the description into a sentence and a force-push warning. The Stack Merge layer list set its fields apart with a text interpolation, which left the number, title and state sharing one font and one colour. Lay the row out as a flex line with a gap, give the number the code face, and colour the state per layer state. A Stack Merge in progress already shows the button spinner, so drop the second line that repeated it; only a landed, queued or failed Stack Merge keeps a line of its own.
A Stack Rebase finished, the detail page re-read the pull request, and the stack history turning linear made the Merge Box clear its status and re-fetch. The status going null unmounted everything under it, dialog included, so the rebase result vanished and came back as a fresh confirmation step. One function was doing two jobs: adopting a status, and clearing it before a reread. Split it, and split the watch by trigger source. Only a different pull request may forget the status now; the same pull request re-read in place. A failed reread also threw the status away, which is the same bug reached from the other side. It keeps the last known status and reports the failure above the box instead of replacing it. The timeline showed "force-pushed the head branch" with no branch and no commits, because REST reports neither for a force push. GraphQL knows both, and its event id is the node id REST already carries, so the two join on it. That supplement now arrives in the same request as review threads and review provenance, which were two separate calls.
Splitting the watch left the reread watcher's first run comparing against an absent previous value, so every Layer looked like it had just changed shape and asked GitHub for a status the identity watch had already asked for. A pull request without a stack compares equal and never showed the duplicate, which is why only Layer pages read twice. Treat the first run as nothing having moved: the identity watch owns that read.
Three tests broke when a commit gave PRHeader and PRReviewWorkspace a PRStackChip child: compileVue rewrites every import to modules['...'].default, so a child the test did not list crashed on undefined.default. Adding a child was therefore a breaking change for every test that mounts the parent. A child the test does not steer now renders nothing, so the parent's own output is unchanged and its assertions still hold. Anything else missing is a setup error named in the message, so a renamed import points at the fix instead of a TypeError that never says what is absent.
nuxi typecheck failed on the GraphQL supplement: a conditional type inferred the review nodes as never, so collectReviewMetadata rejected both call sites and the team nodes went untyped. Name the node shape once and read it at both call sites. SortableTimelineItem carried a bare index signature, so ref, beforeCommit and afterCommit were unknown and applyPRForcePushRefs could neither spread the ref nor read a commit URL. Declare the three fields. The thread payload's id is optional because GitHub may omit it, so mergeById accepts that.
Stack Rebase rebuilt a throwaway repository and checked out the whole tree for every Layer. That checkout was over half of each call. Replay the Layer in a bare repository instead. A Git with the replay subcommand does the whole Layer in one call, so the cost no longer grows with the number of patches; older Git falls back to one merge-tree per patch. Measured on a 400-file repository, one Layer: 2450ms to 416ms for a single patch, 4545ms to 700ms for twenty. The replayed trees are identical to the rebase ones.
Concurrent redemption of one grant failed intermittently with a 500. On Windows, the `wx` open of a just-unlinked lock answers EPERM while the previous holder's handle is still closing. The lock loop only retried EEXIST, so that window escaped as an error, the request answered 500, and "simultaneous redemption mints exactly one session" saw three 409s instead of five. Treat EPERM as the same "lock is busy" answer EEXIST already got. Anything else still fails loudly rather than being retried.
Review of the rebase change found the per-patch fallback dropping a commit that was already empty before the replay. `git rebase` keeps those and only drops a commit that becomes empty, so the two cases have to be told apart: a commit is born empty when its tree already equals its own parent's tree, which one `rev-parse` answers for the whole Layer. The fallback test never ran the fallback. A PATH shim cannot hide a built-in subcommand from `execFile` on Windows: the shim is ignored and the fast path runs anyway, so the test passed without reaching the branch it names. The strategy is now injected, and a test asserts both paths build the same history. Also: - answer 503 when Git is missing, refuse a merge commit, and rebase a Layer that the new base already contains, none of which had a test; - read the replay probe from stderr too, so a Git that prints usage there is not silently stuck on the slow path; - name the conflict message once instead of matching it by pattern; - take head and base in separate `rev-parse` calls, so the base is a string rather than a possibly-undefined destructured element; - record in ADR 0054 that the replay runs in a bare repository.
|
@sourcery-ai review |
There was a problem hiding this comment.
嘿——我发现了 14 个问题
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/stack-merge.post.ts" line_range="1-12" />
<code_context>
+import { normalizeMergePullRequestBody } from '#server/utils/pr-merge-status-utils';
+import { requestPullRequestStackMerge } from '#server/utils/pr-stack-merge-utils';
+import { extractPullRouteParams, executeGitHubRequest } from '#server/utils/repo-route-utils';
+
+export default defineEventHandler(async (event) => {
+ const { owner, repo, pullNumber } = extractPullRouteParams(event);
+ const body = normalizeMergePullRequestBody(await readBody(event));
+
+ return executeGitHubRequest(
+ event,
+ (octokit) => requestPullRequestStackMerge(octokit, owner, repo, pullNumber, body),
+ 'Failed to merge stack'
+ );
+});
</code_context>
<issue_to_address>
**Non-Layers can be submitted for Stack Merge**
When an authenticated caller posts directly to this endpoint for a standalone or non-linear pull request, `stack-merge.post` forwards the request without checking that the pull request is a Layer or that its Stack history is linear. An authenticated caller can submit this endpoint directly for a standalone or non-linear pull request and initiate a merge outside the conditions enforced by the Merge Box.
Before forwarding, fetch and validate the pull request’s stack membership and linear history on the server.
</issue_to_address>
### Comment 2
<location path="server/utils/pr-stack-utils.ts" line_range="133-134" />
<code_context>
reactions: reactionSummary.items,
+ stack,
};
} catch (error: unknown) {
console.error('Error fetching GitHub pull request:', error);
</code_context>
<issue_to_address>
**Rebase proceeds without conflict clearance**
When the Stack is not linear and GitHub's conflict GraphQL request fails, `fetchPullRequestStack` leaves `hasConflicts` unset when the GraphQL check fails, while `showStackRebase` treats `!stack.hasConflicts` as clear. The dialog can therefore push lower Layers before Git finds a conflict higher in the Stack, leaving a partial rebase.
Only offer Stack Rebase when the conflict check completed successfully and confirmed no conflicts.
Also at `app/components/dashboard/pr/PRMergeBox.vue:781`.
</issue_to_address>
### Comment 3
<location path="app/components/dashboard/pr/PRMergeBox.vue" line_range="797" />
<code_context>
+ const current = status.value;
+ if (!current?.viewerCanMerge || current.draft) return false;
+ if (stack) return stack.history === 'linear';
+ return true;
+});
+
</code_context>
<issue_to_address>
**Unmergeable Layers enter Stack Merge**
When a closed or draft Layer occurs below the selected Layer in a linear Stack, `showMergeActions` gates on the current pull request and linear history, while `landingLayers` includes the whole prefix without checking each Layer's state. A closed or draft Layer below the selected Layer is therefore offered in a Stack Merge, which GitHub rejects and the user sees fail.
Only offer Stack Merge when every unmerged Layer in the landing prefix is open, and explain why it is unavailable otherwise.
</issue_to_address>
### Comment 4
<location path="server/utils/native-login-handoff.ts" line_range="129" />
<code_context>
+// free while its handle is still closing. Both mean "someone else has it", so
+// anything else keeps failing loudly instead of silently retrying.
+function isLockBusy(code: unknown) {
+ return code === 'EEXIST' || code === 'EPERM';
+}
+
</code_context>
<issue_to_address>
**Permission errors appear as busy locks**
When opening the lock file returns EPERM for a persistent permission problem rather than a brief Windows release window, `isLockBusy` treats every `EPERM` as lock contention, so `withTransactionLock` retries instead of surfacing the permission error; the request eventually waits or returns a misleading transaction-busy response.
Treat `EPERM` as contention only for the known brief Windows release window, and otherwise propagate the filesystem error.
Also at `server/utils/native-login-handoff.ts:152-153`.
</issue_to_address>
### Comment 5
<location path="app/components/dashboard/pr/PRMergeBox.vue" line_range="1229" />
<code_context>
+watch(
+ () => [owner, repo, pullNumber] as const,
+ ([owner, repo, pullNumber]) => {
+ resetMergeBoxState();
+ resetMergeStatus();
+
</code_context>
<issue_to_address>
**Old merge results affect the new pull request**
When the reader switches pull requests while a Stack Merge request is still running, the identity watcher resets the visible state but does not invalidate the old `mergeStack` request; when it settles, `performMerge` updates the new box, can emit `merged` for the wrong pull request, and can start a stale `fetchMergeStatus` that overwrites the new status.
Invalidate the old merge request on identity changes and guard its later state updates, events, and status fetches against the current pull request.
Also at `app/composables/usePRMergeStatus.ts:283`.
</issue_to_address>
### Comment 6
<location path="app/components/dashboard/pr/PRMergeBox.vue" line_range="1273-1275" />
<code_context>
+
+ // The detail payload may already carry a fresh status; otherwise re-read it
+ // while still showing the one on screen.
+ if (initialStatus) {
+ setMergeStatus(initialStatus);
+ } else if (stackMoved) {
+ fetchMergeStatus(owner, repo, pullNumber);
+ }
</code_context>
<issue_to_address>
**Reopened pull requests stay closed**
When a closed, unmerged pull request is reopened while its detail page remains mounted, the reread watcher only adopts a non-null `initialStatus` or fetches after a stack-shape change. When a closed pull request is reopened, `initialStatus` becomes null without a stack change, so the old terminal status remains and the Merge Box continues to show the pull request as closed.
Reread merge status when `initialStatus` changes to null, as well as when it becomes non-null.
</issue_to_address>
### Comment 7
<location path="server/utils/pr-stack-rebase-utils.ts" line_range="299" />
<code_context>
+ statusMessage: 'Stack rebase requires Git on the server',
+ });
+ }
+ throw createError({ statusCode: 409, statusMessage: message });
+ }
+ };
</code_context>
<issue_to_address>
**Git failures look like merge conflicts**
When a Git command fails for a reason other than a clean rebase conflict or a missing Git executable, the `git` wrapper maps operational failures such as timeouts, permission failures, and disk errors to HTTP 409, so callers receive a conflict response and a misleading rebase failure message.
Map only actual rebase conflicts and missing Git to their specific errors, and propagate other Git failures as operational errors.
</issue_to_address>
### Comment 8
<location path="server/utils/pr-stack-utils.ts" line_range="141" />
<code_context>
body?: string | null;
reactions?: ReactionSummaryItem[];
+ stack?: PullRequestStack | null;
}
const { pullRequest, repoOwner, repoName } = defineProps<{
</code_context>
<issue_to_address>
**Incomplete stacks appear as complete**
When the Stack resource request fails or returns fewer layers than the membership count, `fetchPullRequestStack` returns a normalized Stack with missing or incomplete `layers`, and `PRStackChip` still exposes it; readers can open a detail modal showing an empty or incomplete list despite the advertised Stack size.
Do not return a Stack for display unless its layer data is complete, including when the Stack resource fetch fails.
Also at `server/utils/pr-stack-utils.ts:108`, `server/utils/pr-stack-utils.ts:140`.
</issue_to_address>
### Comment 9
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts" line_range="82" />
<code_context>
- console.warn('Failed to fetch pull request review metadata:', error);
- return new Map();
+ console.warn('Failed to fetch pull request timeline supplement:', error);
+ return { reviewThreads: [], reviewMetadata: new Map(), forcePushRefs: [] };
}
}
</code_context>
<issue_to_address>
**Supplement failures drop all timeline metadata**
When the combined GraphQL supplement request fails, the combined GraphQL read is caught as one unit and replaced with empty threads, provenance, and force-push refs. A failure affecting any part of that request therefore also removes the review-thread and provenance data that the previous independently handled reads could still provide.
Preserve independent fallbacks for the supplement's components, or retain any partial data returned by GraphQL when one component fails.
</issue_to_address>
### Comment 10
<location path="app/composables/usePRMergeStatus.ts" line_range="283" />
<code_context>
+ { method: 'POST', body: payload }
+ );
+
+ while (caller() && result.outcome === 'in-progress') {
+ if (!result.id) return failed(result.message);
+ const current = await waitForStackMergePoll(requestId);
</code_context>
<issue_to_address>
**Stack merge polling never stops**
When gitHub leaves an asynchronous Stack Merge in progress for an extended period, the `while` loop polls every two seconds for as long as GitHub reports `in-progress`, with no deadline or backoff. A prolonged pending operation leaves the Merge Box spinning indefinitely and continues making authenticated status requests until the reader leaves the page.
Use bounded, backed-off polling and show a pending state with a way to check again after the limit.
</issue_to_address>
### Comment 11
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/stack-rebase.post.ts" line_range="39" />
<code_context>
+ if (!verifyStackRebaseSnapshot(expectedProof, body.proof)) {
+ throw createError({ statusCode: 409, statusMessage: 'Reload the stack before rebasing' });
+ }
+ const octokit = createGitHubClient(accessToken);
+
+ try {
</code_context>
<issue_to_address>
**Rebase route bypasses auth accessor**
When the Stack Rebase endpoint handles a request, the route calls `createGitHubClient(accessToken)` directly instead of obtaining its client through the event-bound GitHub access helpers, giving this new API route a separate token/client acquisition path from the repository convention.
Use the prescribed event-bound GitHub client/context helper, extending it if needed to provide the token required by the Git transport.
</issue_to_address>
### Comment 12
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts" line_range="161" />
<code_context>
enrichedTimeline.flatMap((rawEvent) => normalizePRTimelineEvent(rawEvent, { owner, repo }))
)
);
+ applyPRForcePushRefs(normalizedTimeline, supplement.forcePushRefs);
const timeline = enrichPRTimelineWithReviewData(
normalizedTimeline,
</code_context>
<issue_to_address>
**Timeline behavior exceeds requested scope**
When a pull-request timeline is read, `fetchPRTimelineSupplementForTimeline` now fetches and applies force-push details on pull-request timeline reads, changing an unrelated timeline behavior alongside the Stack feature; readers see the added force-push information.
Move the force-push timeline fix to a separate change, or omit it from this PR.
</issue_to_address>
### Comment 13
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts" line_range="161" />
<code_context>
enrichedTimeline.flatMap((rawEvent) => normalizePRTimelineEvent(rawEvent, { owner, repo }))
)
);
+ applyPRForcePushRefs(normalizedTimeline, supplement.forcePushRefs);
const timeline = enrichPRTimelineWithReviewData(
normalizedTimeline,
</code_context>
<issue_to_address>
**Unrelated fixes change existing flows**
When a pull-request timeline is read or a native-login lock is busy on Windows, the timeline enrichment changes existing pull-request timeline behavior, and `withTransactionLock` changes native-login lock retries; neither change supports the Stack feature, so this patch also changes unrelated flows that readers and sign-in callers use.
Move these unrelated fixes into separate changes.
Also at `server/utils/native-login-handoff.ts:128-153`.
</issue_to_address>
### Comment 14
<location path="server/utils/native-login-handoff.ts" line_range="128-129" />
<code_context>
+// `EPERM` instead: the previous holder already unlinked the file, so the name is
+// free while its handle is still closing. Both mean "someone else has it", so
+// anything else keeps failing loudly instead of silently retrying.
+function isLockBusy(code: unknown) {
+ return code === 'EEXIST' || code === 'EPERM';
+}
+
</code_context>
<issue_to_address>
**Unnecessary helper obscures lock retry**
When the lock loop checks an open error code, `isLockBusy` only wraps a two-code comparison and has one call site, adding a single-use abstraction to the lock retry path instead of keeping the check local.
Inline the `EEXIST`/`EPERM` comparison in the retry loop and remove the helper.
Also at `server/utils/native-login-handoff.ts:153`.
</issue_to_address>Original comment in English
Hey - I've found 14 issues
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/stack-merge.post.ts" line_range="1-12" />
<code_context>
+import { normalizeMergePullRequestBody } from '#server/utils/pr-merge-status-utils';
+import { requestPullRequestStackMerge } from '#server/utils/pr-stack-merge-utils';
+import { extractPullRouteParams, executeGitHubRequest } from '#server/utils/repo-route-utils';
+
+export default defineEventHandler(async (event) => {
+ const { owner, repo, pullNumber } = extractPullRouteParams(event);
+ const body = normalizeMergePullRequestBody(await readBody(event));
+
+ return executeGitHubRequest(
+ event,
+ (octokit) => requestPullRequestStackMerge(octokit, owner, repo, pullNumber, body),
+ 'Failed to merge stack'
+ );
+});
</code_context>
<issue_to_address>
**Non-Layers can be submitted for Stack Merge**
When an authenticated caller posts directly to this endpoint for a standalone or non-linear pull request, `stack-merge.post` forwards the request without checking that the pull request is a Layer or that its Stack history is linear. An authenticated caller can submit this endpoint directly for a standalone or non-linear pull request and initiate a merge outside the conditions enforced by the Merge Box.
Before forwarding, fetch and validate the pull request’s stack membership and linear history on the server.
</issue_to_address>
### Comment 2
<location path="server/utils/pr-stack-utils.ts" line_range="133-134" />
<code_context>
reactions: reactionSummary.items,
+ stack,
};
} catch (error: unknown) {
console.error('Error fetching GitHub pull request:', error);
</code_context>
<issue_to_address>
**Rebase proceeds without conflict clearance**
When the Stack is not linear and GitHub's conflict GraphQL request fails, `fetchPullRequestStack` leaves `hasConflicts` unset when the GraphQL check fails, while `showStackRebase` treats `!stack.hasConflicts` as clear. The dialog can therefore push lower Layers before Git finds a conflict higher in the Stack, leaving a partial rebase.
Only offer Stack Rebase when the conflict check completed successfully and confirmed no conflicts.
Also at `app/components/dashboard/pr/PRMergeBox.vue:781`.
</issue_to_address>
### Comment 3
<location path="app/components/dashboard/pr/PRMergeBox.vue" line_range="797" />
<code_context>
+ const current = status.value;
+ if (!current?.viewerCanMerge || current.draft) return false;
+ if (stack) return stack.history === 'linear';
+ return true;
+});
+
</code_context>
<issue_to_address>
**Unmergeable Layers enter Stack Merge**
When a closed or draft Layer occurs below the selected Layer in a linear Stack, `showMergeActions` gates on the current pull request and linear history, while `landingLayers` includes the whole prefix without checking each Layer's state. A closed or draft Layer below the selected Layer is therefore offered in a Stack Merge, which GitHub rejects and the user sees fail.
Only offer Stack Merge when every unmerged Layer in the landing prefix is open, and explain why it is unavailable otherwise.
</issue_to_address>
### Comment 4
<location path="server/utils/native-login-handoff.ts" line_range="129" />
<code_context>
+// free while its handle is still closing. Both mean "someone else has it", so
+// anything else keeps failing loudly instead of silently retrying.
+function isLockBusy(code: unknown) {
+ return code === 'EEXIST' || code === 'EPERM';
+}
+
</code_context>
<issue_to_address>
**Permission errors appear as busy locks**
When opening the lock file returns EPERM for a persistent permission problem rather than a brief Windows release window, `isLockBusy` treats every `EPERM` as lock contention, so `withTransactionLock` retries instead of surfacing the permission error; the request eventually waits or returns a misleading transaction-busy response.
Treat `EPERM` as contention only for the known brief Windows release window, and otherwise propagate the filesystem error.
Also at `server/utils/native-login-handoff.ts:152-153`.
</issue_to_address>
### Comment 5
<location path="app/components/dashboard/pr/PRMergeBox.vue" line_range="1229" />
<code_context>
+watch(
+ () => [owner, repo, pullNumber] as const,
+ ([owner, repo, pullNumber]) => {
+ resetMergeBoxState();
+ resetMergeStatus();
+
</code_context>
<issue_to_address>
**Old merge results affect the new pull request**
When the reader switches pull requests while a Stack Merge request is still running, the identity watcher resets the visible state but does not invalidate the old `mergeStack` request; when it settles, `performMerge` updates the new box, can emit `merged` for the wrong pull request, and can start a stale `fetchMergeStatus` that overwrites the new status.
Invalidate the old merge request on identity changes and guard its later state updates, events, and status fetches against the current pull request.
Also at `app/composables/usePRMergeStatus.ts:283`.
</issue_to_address>
### Comment 6
<location path="app/components/dashboard/pr/PRMergeBox.vue" line_range="1273-1275" />
<code_context>
+
+ // The detail payload may already carry a fresh status; otherwise re-read it
+ // while still showing the one on screen.
+ if (initialStatus) {
+ setMergeStatus(initialStatus);
+ } else if (stackMoved) {
+ fetchMergeStatus(owner, repo, pullNumber);
+ }
</code_context>
<issue_to_address>
**Reopened pull requests stay closed**
When a closed, unmerged pull request is reopened while its detail page remains mounted, the reread watcher only adopts a non-null `initialStatus` or fetches after a stack-shape change. When a closed pull request is reopened, `initialStatus` becomes null without a stack change, so the old terminal status remains and the Merge Box continues to show the pull request as closed.
Reread merge status when `initialStatus` changes to null, as well as when it becomes non-null.
</issue_to_address>
### Comment 7
<location path="server/utils/pr-stack-rebase-utils.ts" line_range="299" />
<code_context>
+ statusMessage: 'Stack rebase requires Git on the server',
+ });
+ }
+ throw createError({ statusCode: 409, statusMessage: message });
+ }
+ };
</code_context>
<issue_to_address>
**Git failures look like merge conflicts**
When a Git command fails for a reason other than a clean rebase conflict or a missing Git executable, the `git` wrapper maps operational failures such as timeouts, permission failures, and disk errors to HTTP 409, so callers receive a conflict response and a misleading rebase failure message.
Map only actual rebase conflicts and missing Git to their specific errors, and propagate other Git failures as operational errors.
</issue_to_address>
### Comment 8
<location path="server/utils/pr-stack-utils.ts" line_range="141" />
<code_context>
body?: string | null;
reactions?: ReactionSummaryItem[];
+ stack?: PullRequestStack | null;
}
const { pullRequest, repoOwner, repoName } = defineProps<{
</code_context>
<issue_to_address>
**Incomplete stacks appear as complete**
When the Stack resource request fails or returns fewer layers than the membership count, `fetchPullRequestStack` returns a normalized Stack with missing or incomplete `layers`, and `PRStackChip` still exposes it; readers can open a detail modal showing an empty or incomplete list despite the advertised Stack size.
Do not return a Stack for display unless its layer data is complete, including when the Stack resource fetch fails.
Also at `server/utils/pr-stack-utils.ts:108`, `server/utils/pr-stack-utils.ts:140`.
</issue_to_address>
### Comment 9
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts" line_range="82" />
<code_context>
- console.warn('Failed to fetch pull request review metadata:', error);
- return new Map();
+ console.warn('Failed to fetch pull request timeline supplement:', error);
+ return { reviewThreads: [], reviewMetadata: new Map(), forcePushRefs: [] };
}
}
</code_context>
<issue_to_address>
**Supplement failures drop all timeline metadata**
When the combined GraphQL supplement request fails, the combined GraphQL read is caught as one unit and replaced with empty threads, provenance, and force-push refs. A failure affecting any part of that request therefore also removes the review-thread and provenance data that the previous independently handled reads could still provide.
Preserve independent fallbacks for the supplement's components, or retain any partial data returned by GraphQL when one component fails.
</issue_to_address>
### Comment 10
<location path="app/composables/usePRMergeStatus.ts" line_range="283" />
<code_context>
+ { method: 'POST', body: payload }
+ );
+
+ while (caller() && result.outcome === 'in-progress') {
+ if (!result.id) return failed(result.message);
+ const current = await waitForStackMergePoll(requestId);
</code_context>
<issue_to_address>
**Stack merge polling never stops**
When gitHub leaves an asynchronous Stack Merge in progress for an extended period, the `while` loop polls every two seconds for as long as GitHub reports `in-progress`, with no deadline or backoff. A prolonged pending operation leaves the Merge Box spinning indefinitely and continues making authenticated status requests until the reader leaves the page.
Use bounded, backed-off polling and show a pending state with a way to check again after the limit.
</issue_to_address>
### Comment 11
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/stack-rebase.post.ts" line_range="39" />
<code_context>
+ if (!verifyStackRebaseSnapshot(expectedProof, body.proof)) {
+ throw createError({ statusCode: 409, statusMessage: 'Reload the stack before rebasing' });
+ }
+ const octokit = createGitHubClient(accessToken);
+
+ try {
</code_context>
<issue_to_address>
**Rebase route bypasses auth accessor**
When the Stack Rebase endpoint handles a request, the route calls `createGitHubClient(accessToken)` directly instead of obtaining its client through the event-bound GitHub access helpers, giving this new API route a separate token/client acquisition path from the repository convention.
Use the prescribed event-bound GitHub client/context helper, extending it if needed to provide the token required by the Git transport.
</issue_to_address>
### Comment 12
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts" line_range="161" />
<code_context>
enrichedTimeline.flatMap((rawEvent) => normalizePRTimelineEvent(rawEvent, { owner, repo }))
)
);
+ applyPRForcePushRefs(normalizedTimeline, supplement.forcePushRefs);
const timeline = enrichPRTimelineWithReviewData(
normalizedTimeline,
</code_context>
<issue_to_address>
**Timeline behavior exceeds requested scope**
When a pull-request timeline is read, `fetchPRTimelineSupplementForTimeline` now fetches and applies force-push details on pull-request timeline reads, changing an unrelated timeline behavior alongside the Stack feature; readers see the added force-push information.
Move the force-push timeline fix to a separate change, or omit it from this PR.
</issue_to_address>
### Comment 13
<location path="server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts" line_range="161" />
<code_context>
enrichedTimeline.flatMap((rawEvent) => normalizePRTimelineEvent(rawEvent, { owner, repo }))
)
);
+ applyPRForcePushRefs(normalizedTimeline, supplement.forcePushRefs);
const timeline = enrichPRTimelineWithReviewData(
normalizedTimeline,
</code_context>
<issue_to_address>
**Unrelated fixes change existing flows**
When a pull-request timeline is read or a native-login lock is busy on Windows, the timeline enrichment changes existing pull-request timeline behavior, and `withTransactionLock` changes native-login lock retries; neither change supports the Stack feature, so this patch also changes unrelated flows that readers and sign-in callers use.
Move these unrelated fixes into separate changes.
Also at `server/utils/native-login-handoff.ts:128-153`.
</issue_to_address>
### Comment 14
<location path="server/utils/native-login-handoff.ts" line_range="128-129" />
<code_context>
+// `EPERM` instead: the previous holder already unlinked the file, so the name is
+// free while its handle is still closing. Both mean "someone else has it", so
+// anything else keeps failing loudly instead of silently retrying.
+function isLockBusy(code: unknown) {
+ return code === 'EEXIST' || code === 'EPERM';
+}
+
</code_context>
<issue_to_address>
**Unnecessary helper obscures lock retry**
When the lock loop checks an open error code, `isLockBusy` only wraps a two-code comparison and has one call site, adding a single-use abstraction to the lock retry path instead of keeping the check local.
Inline the `EEXIST`/`EPERM` comparison in the retry loop and remove the helper.
Also at `server/utils/native-login-handoff.ts:153`.
</issue_to_address>| import { normalizeMergePullRequestBody } from '#server/utils/pr-merge-status-utils'; | ||
| import { requestPullRequestStackMerge } from '#server/utils/pr-stack-merge-utils'; | ||
| import { extractPullRouteParams, executeGitHubRequest } from '#server/utils/repo-route-utils'; | ||
|
|
||
| export default defineEventHandler(async (event) => { | ||
| const { owner, repo, pullNumber } = extractPullRouteParams(event); | ||
| const body = normalizeMergePullRequestBody(await readBody(event)); | ||
|
|
||
| return executeGitHubRequest( | ||
| event, | ||
| (octokit) => requestPullRequestStackMerge(octokit, owner, repo, pullNumber, body), | ||
| 'Failed to merge stack' |
There was a problem hiding this comment.
🟡 中 · 非 Layer 也可以提交 Stack Merge
当经过身份验证的调用方针对独立或非线性的拉取请求直接调用此端点时,stack-merge.post 会转发请求,却不检查该拉取请求是否为 Layer,也不检查其 Stack 历史是否线性。因此,经过身份验证的调用方可以直接对独立或非线性的拉取请求调用此端点,在 Merge Box 强制执行的条件之外发起合并。
转发请求前,应在服务器上获取并验证该拉取请求的 Stack 成员关系和线性历史。
供 AI 代理使用的提示
在 `server/api/pulls/[owner]/[repo]/[pull_number]/stack-merge.post.ts` 第 1-12 行:
**非 Layer 也可以提交 Stack Merge**
当经过身份验证的调用方针对独立或非线性的拉取请求直接调用此端点时,`stack-merge.post` 会转发请求,却不检查该拉取请求是否为 Layer,也不检查其 Stack 历史是否线性。因此,经过身份验证的调用方可以直接对独立或非线性的拉取请求调用此端点,在 Merge Box 强制执行的条件之外发起合并。
转发请求前,应在服务器上获取并验证该拉取请求的 Stack 成员关系和线性历史。Original comment in English
🟡 Medium · Non-Layers can be submitted for Stack Merge
When an authenticated caller posts directly to this endpoint for a standalone or non-linear pull request, stack-merge.post forwards the request without checking that the pull request is a Layer or that its Stack history is linear. An authenticated caller can submit this endpoint directly for a standalone or non-linear pull request and initiate a merge outside the conditions enforced by the Merge Box.
Before forwarding, fetch and validate the pull request’s stack membership and linear history on the server.
Prompt for AI agents
In `server/api/pulls/[owner]/[repo]/[pull_number]/stack-merge.post.ts` at lines 1-12:
**Non-Layers can be submitted for Stack Merge**
When an authenticated caller posts directly to this endpoint for a standalone or non-linear pull request, `stack-merge.post` forwards the request without checking that the pull request is a Layer or that its Stack history is linear. An authenticated caller can submit this endpoint directly for a standalone or non-linear pull request and initiate a merge outside the conditions enforced by the Merge Box.
Before forwarding, fetch and validate the pull request’s stack membership and linear history on the server.| // free while its handle is still closing. Both mean "someone else has it", so | ||
| // anything else keeps failing loudly instead of silently retrying. | ||
| function isLockBusy(code: unknown) { | ||
| return code === 'EEXIST' || code === 'EPERM'; |
There was a problem hiding this comment.
🟡 中 · 权限错误被误认为锁正忙
如果打开锁文件时因持续的权限问题返回 EPERM(而非 Windows 短暂的文件释放窗口),isLockBusy 会把所有 EPERM 都视为锁竞争,因此 withTransactionLock 会重试,而不是报告权限错误;最终请求会一直等待,或返回误导性的事务繁忙响应。
只有在已知的 Windows 短暂文件释放窗口内,才将 EPERM 视为锁竞争;其他情况下应向上传递文件系统错误。
另见 server/utils/native-login-handoff.ts:152-153。
供 AI 代理使用的提示
在 `server/utils/native-login-handoff.ts` 第 129 行:
**权限错误被误认为锁正忙**
如果打开锁文件时因持续的权限问题返回 EPERM(而非 Windows 短暂的文件释放窗口),`isLockBusy` 会把所有 `EPERM` 都视为锁竞争,因此 `withTransactionLock` 会重试,而不是报告权限错误;最终请求会一直等待,或返回误导性的事务繁忙响应。
只有在已知的 Windows 短暂文件释放窗口内,才将 `EPERM` 视为锁竞争;其他情况下应向上传递文件系统错误。
另见 `server/utils/native-login-handoff.ts:152-153`。Original comment in English
🟡 Medium · Permission errors appear as busy locks
When opening the lock file returns EPERM for a persistent permission problem rather than a brief Windows release window, isLockBusy treats every EPERM as lock contention, so withTransactionLock retries instead of surfacing the permission error; the request eventually waits or returns a misleading transaction-busy response.
Treat EPERM as contention only for the known brief Windows release window, and otherwise propagate the filesystem error.
Also at server/utils/native-login-handoff.ts:152-153.
Prompt for AI agents
In `server/utils/native-login-handoff.ts` at line 129:
**Permission errors appear as busy locks**
When opening the lock file returns EPERM for a persistent permission problem rather than a brief Windows release window, `isLockBusy` treats every `EPERM` as lock contention, so `withTransactionLock` retries instead of surfacing the permission error; the request eventually waits or returns a misleading transaction-busy response.
Treat `EPERM` as contention only for the known brief Windows release window, and otherwise propagate the filesystem error.
Also at `server/utils/native-login-handoff.ts:152-153`.| enrichedTimeline.flatMap((rawEvent) => normalizePRTimelineEvent(rawEvent, { owner, repo })) | ||
| ) | ||
| ); | ||
| applyPRForcePushRefs(normalizedTimeline, supplement.forcePushRefs); |
There was a problem hiding this comment.
⚪ 低 · 时间线行为超出本次请求范围
读取拉取请求时间线时,fetchPRTimelineSupplementForTimeline 现在会获取并应用强制推送详情,导致 Stack 功能之外的时间线行为也发生变化;用户会看到新增的强制推送信息。
将强制推送时间线修复移到单独的更改中,或从此 PR 中移除。
供 AI 代理使用的提示
在 `server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts` 第 161 行:
**时间线行为超出本次请求范围**
读取拉取请求时间线时,`fetchPRTimelineSupplementForTimeline` 现在会获取并应用强制推送详情,导致 Stack 功能之外的时间线行为也发生变化;用户会看到新增的强制推送信息。
将强制推送时间线修复移到单独的更改中,或从此 PR 中移除。来源:AGENTS.md L21-23:
- 不要添加请求范围之外的功能。
- 不要为只使用一次的代码创建抽象。
- 不要添加未被要求的“灵活性”或“可配置性”。Original comment in English
⚪ Low · Timeline behavior exceeds requested scope
When a pull-request timeline is read, fetchPRTimelineSupplementForTimeline now fetches and applies force-push details on pull-request timeline reads, changing an unrelated timeline behavior alongside the Stack feature; readers see the added force-push information.
Move the force-push timeline fix to a separate change, or omit it from this PR.
Prompt for AI agents
In `server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts` at line 161:
**Timeline behavior exceeds requested scope**
When a pull-request timeline is read, `fetchPRTimelineSupplementForTimeline` now fetches and applies force-push details on pull-request timeline reads, changing an unrelated timeline behavior alongside the Stack feature; readers see the added force-push information.
Move the force-push timeline fix to a separate change, or omit it from this PR.From AGENTS.md L21-23:
- No features beyond what was asked.
- No abstractions for single-use code.
- No "flexibility" or "configurability" that wasn't requested.| enrichedTimeline.flatMap((rawEvent) => normalizePRTimelineEvent(rawEvent, { owner, repo })) | ||
| ) | ||
| ); | ||
| applyPRForcePushRefs(normalizedTimeline, supplement.forcePushRefs); |
There was a problem hiding this comment.
⚪ 低 · 无关修复改变现有流程
读取拉取请求时间线,或 Windows 上的原生登录锁正忙时,时间线增强会改变现有的拉取请求时间线行为,而 withTransactionLock 会改变原生登录锁的重试行为;这两项改动都不支持 Stack 功能,因此此补丁还改变了读者和登录调用方正在使用的无关流程。
请将这些无关修复移到单独的更改中。
另见 server/utils/native-login-handoff.ts:128-153。
供 AI 代理使用的提示
在 `server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts` 第 161 行:
**无关修复改变现有流程**
读取拉取请求时间线,或 Windows 上的原生登录锁正忙时,时间线增强会改变现有的拉取请求时间线行为,而 `withTransactionLock` 会改变原生登录锁的重试行为;这两项改动都不支持 Stack 功能,因此此补丁还改变了读者和登录调用方正在使用的无关流程。
请将这些无关修复移到单独的更改中。
另见 `server/utils/native-login-handoff.ts:128-153`。来源:AGENTS.md L33-36、AGENTS.md L45:
修改现有代码时:
- 不要“改进”相邻代码、注释或格式。
- 不要重构没有问题的内容。Original comment in English
⚪ Low · Unrelated fixes change existing flows
When a pull-request timeline is read or a native-login lock is busy on Windows, the timeline enrichment changes existing pull-request timeline behavior, and withTransactionLock changes native-login lock retries; neither change supports the Stack feature, so this patch also changes unrelated flows that readers and sign-in callers use.
Move these unrelated fixes into separate changes.
Also at server/utils/native-login-handoff.ts:128-153.
Prompt for AI agents
In `server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts` at line 161:
**Unrelated fixes change existing flows**
When a pull-request timeline is read or a native-login lock is busy on Windows, the timeline enrichment changes existing pull-request timeline behavior, and `withTransactionLock` changes native-login lock retries; neither change supports the Stack feature, so this patch also changes unrelated flows that readers and sign-in callers use.
Move these unrelated fixes into separate changes.
Also at `server/utils/native-login-handoff.ts:128-153`.From AGENTS.md L33-36, AGENTS.md L45:
When editing existing code:
- Don't "improve" adjacent code, comments, or formatting.
- Don't refactor things that aren't broken.There was a problem hiding this comment.
🟡 Changes recommended
Unresolved critical safety gaps can leave Stack Rebase partially applied, replay discarded commits, or rewrite branches with unchecked conflicts, while stale merge status can permit merging an unverified revision.
8 open issues
Block merges after a failed reread until status is refreshed · New Run confirmed Stack cascades server-side so dialog unmounts cannot stop them · New Recover each Layer's replay boundary before rewriting the Stack · New Require successful conflict checks for every Layer before enabling rebase · New Reopening a PR leaves the Merge Box closed and duplicates rereads · New Preserve successful GraphQL connections when another field returns an error · New A failed pagination fallback discards all successfully fetched supplement data · New Reuse one fetched repository across all Layers in the rebase cascade · New
What changed in this PR
Implements #186 by adding GitHub Stack awareness to pull-request conversations and the review workspace, with Stack navigation, prefix landing, and custom Git-based repair.
Changes:
- Adds a shared Stack Chip and detail modal for navigating Layers.
- Extends the Merge Box with asynchronous Stack Merge, confirmed per-Layer rebasing, progress reporting, and status rereads.
- Consolidates timeline enrichment and adds tests, runtime dependencies, documentation, and a separate native-login lock adjustment.
| File | Description |
|---|---|
tests/stack-rebase.test.ts |
Tests replay behavior, snapshot proofs, conflicts, and head protection. |
tests/pr-timeline-force-push.test.ts |
Tests localized force-push branch and commit rendering. |
tests/pr-merge-status-reread.test.ts |
Tests status retention after failed rereads. |
tests/pr-merge-box.test.ts |
Tests initial reads and Stack status transitions. |
tests/pr-conversation.test.ts |
Tests Stack navigation, merge, rebase, and polling interactions. |
tests/helpers/compile-vue.ts |
Auto-stubs missing Vue children and clarifies missing-module errors. |
tests/github-timeline-utils.test.ts |
Tests force-push enrichment and combined timeline fetching. |
shared/types/pulls.ts |
Defines Stack payloads, Layer states, and merge outcomes. |
server/utils/pr-stack-utils.ts |
Reads Stack membership, history, and conflicts. |
server/utils/pr-stack-rebase-utils.ts |
Signs snapshots, replays commits, and pushes with leases. |
server/utils/pr-stack-merge-utils.ts |
Calls asynchronous merge endpoints and maps outcomes. |
server/utils/pr-merge-status-utils.ts |
Exposes the branch-behind counter for Stack checks. |
server/utils/native-login-handoff.ts |
Expands lock-contention retry handling outside the Stack flow. |
server/utils/github-timeline-utils.ts |
Combines GraphQL enrichment and joins force-push references. |
server/api/pulls/[owner]/[repo]/[pull_number]/timeline.get.ts |
Uses the combined timeline supplement. |
server/api/pulls/[owner]/[repo]/[pull_number]/stack-rebase.post.ts |
Validates confirmed snapshots and rebases one Layer. |
server/api/pulls/[owner]/[repo]/[pull_number]/stack-merge/[id].get.ts |
Validates operation IDs and reads merge progress. |
server/api/pulls/[owner]/[repo]/[pull_number]/stack-merge.post.ts |
Starts an asynchronous Stack Merge. |
server/api/pulls/[owner]/[repo]/[pull_number].get.ts |
Adds Stack details and signed rebase snapshots. |
i18n/locales/zh-cn.json |
Adds Chinese Stack and force-push copy. |
i18n/locales/en.json |
Adds English Stack and force-push copy. |
GLOSSARY.md |
Defines Stack terminology and updates Merge Box documentation. |
docs/self-hosted.md |
Documents the server Git dependency. |
docs/adr/0054-stack-rebase-is-server-side.md |
Records custom replay, leased pushes, and partial failures. |
docs/adr/0053-stack-merge-lands-the-prefix.md |
Records prefix landing and confirmation behavior. |
Dockerfile |
Installs Git and certificates in the runtime image. |
app/composables/usePRMergeStatus.ts |
Retains status on reread failure and polls Stack Merge. |
app/components/dashboard/pr/PRTimelineStateEvents.vue |
Localizes force-push branch and commit tags. |
app/components/dashboard/pr/PRStackRebaseDialog.vue |
Confirms rebasing and displays per-Layer progress. |
app/components/dashboard/pr/PRStackDetail.vue |
Lists the Trunk and navigable Layers. |
app/components/dashboard/pr/PRStackChip.vue |
Provides the shared Stack-position control. |
app/components/dashboard/pr/PRReviewWorkspace.vue |
Adds Stack navigation to the review header. |
app/components/dashboard/pr/PRMergeBox.vue |
Adds Stack actions, confirmations, outcomes, and reread handling. |
app/components/dashboard/pr/PRHeader.vue |
Shows the Stack Chip and emits Layer selections. |
app/components/dashboard/detail/PRDetail.vue |
Wires Stack data and navigation into detail surfaces. |
Review effort: Max
| <div v-if="error" class="merge-box__note merge-box__note--danger" role="alert"> | ||
| <CircleExclamationPointIcon :size="14" /> | ||
| <span>{{ error }}</span> | ||
| </div> |
| for (const layer of layers) { | ||
| if (unmounted) return; |
| ); | ||
| if (baseTip === commonBase) return 'current'; | ||
|
|
||
| const forkPoint = oldBaseOid ?? commonBase; |
| stack.hasConflicts = nodes.some((node) => node?.mergeable === 'CONFLICTING'); | ||
| } catch (error: unknown) { | ||
| console.warn('Failed to check pull request stack conflicts:', error); | ||
| } |
| () => [initialStatus, stack?.history, stack?.place] as const, | ||
| ([initialStatus, history, place], previous) => { | ||
| // `previous` is undefined on the first run, where nothing has moved yet. The | ||
| // identity watch owns that read; comparing against a missing previous would | ||
| // treat every Layer as having just changed shape and read the status twice. | ||
| const [previousHistory, previousPlace] = previous?.slice(1) ?? [history, place]; | ||
| const stackMoved = history !== previousHistory || place !== previousPlace; | ||
|
|
||
| if (stackMoved) { | ||
| // A Stack that turned linear or changed shape invalidates the open confirm | ||
| // step, but not the status the reader is looking at. | ||
| dropdownOpen.value = false; | ||
| confirming.value = false; | ||
| stackMergePhase.value = null; | ||
| updateMenuOpen.value = false; | ||
| updateConfirming.value = false; | ||
| resetCommitForm(); | ||
| clearCommitDefaults(); | ||
| } | ||
|
|
||
| // The detail payload may already carry a fresh status; otherwise re-read it | ||
| // while still showing the one on screen. | ||
| if (initialStatus) { | ||
| setMergeStatus(initialStatus); | ||
| } else if (stackMoved) { | ||
| fetchMergeStatus(owner, repo, pullNumber); |
| const response = (await octokit.graphql(PR_TIMELINE_SUPPLEMENT_QUERY, { | ||
| owner, | ||
| repo, | ||
| pullNumber, | ||
| })) as PRReviewThreadsGraphQLResponse & |
| const [moreThreads, moreMetadata, moreForcePushes] = await Promise.all([ | ||
| pullRequest?.reviewThreads?.pageInfo?.hasNextPage | ||
| ? fetchPRReviewThreads(octokit, owner, repo, pullNumber) | ||
| : [], | ||
| pullRequest?.reviews?.pageInfo?.hasNextPage | ||
| ? fetchPRReviewMetadata(octokit, owner, repo, pullNumber) | ||
| : new Map<string, TimelineReviewMetadata>(), | ||
| pullRequest?.timelineItems?.pageInfo?.hasNextPage | ||
| ? fetchPRForcePushRefs(octokit, owner, repo, pullNumber) | ||
| : [], | ||
| ]); |
| 'fetch', | ||
| '--quiet', | ||
| '--no-tags', | ||
| '--no-recurse-submodules', |
Stack Rebase needs Git on the server, but the Merge Box offered it regardless and only failed once a reader confirmed. Git is a capability of the deployment, not of one action, so the gate is named for Git and its answer is reusable. NUXT_GITPULSE_GIT_ENABLED (default true) says whether this deployment offers Git. A startup plugin probes the `git` binary once per process and caches the answer; a deployment that switched Git off spawns nothing. `git replay` is not probed, because a Git without it already falls back to the per-patch replay. With the capability off the Rebase stack action is not rendered and the route answers 404; with the binary missing the action stays on screen, disabled, with its reason. The merge action no longer vanishes for a Stack whose history is not linear: it stays and explains the refusal, which also closes the dead zone a Stack with an unreadable history used to leave. Both `NUXT_AUTH_*` and the new flag read through one shared boolean normalizer, so `=yes` no longer means different things in different parts of the process.
…sh, and scope lock retries


Summary
Implements #186 — a pull request that is one Layer of a GitHub Stack now shows where it sits, can open its neighbours, and can be landed or repaired from the Merge Box. 17 commits, 46 files, +4988/−240.
Server side:
PRStackChipis one control rendered by bothPRHeaderandPRReviewWorkspace; it stays absent when the detail payload has no Stack, so a standalone pull request is byte-identical to before.Scope — what is #186, and what went past it
Most of this branch is the issue as written. Five things are not, and each is a deliberate extension:
1. Stack Rebase ships — with a self-built rebase. #186 says the control ships only once GitHub's server-side call is identified, and explicitly lists "a GitPulse-built rebase that writes git refs" as out of scope. No such public API exists (the stacks REST surface still lists only create / add / unstack, and GraphQL stack fields are read-only). Rather than ship the page without repair,
73089543implements the cascade inpr-stack-rebase-utils.ts: a temporary bare Git repository on the server, one push per Layer with a lease on the confirmed head, stop on first failure. ADR 0054 was rewritten to record this. This is the decision most worth reviewing.Consequences the reviewer should weigh: it rewrites commits with GitPulse as committer, it fails on repositories that require signed commits, and it adds
gitto the runtime image (Dockerfile, documented indocs/self-hosted.md).2. The rebase is a capability, not a button.
829da9eeaddsNUXT_GITPULSE_GIT_ENABLED(defaulttrue). A startup plugin probesgit --versiononce per process and caches the answer; a deployment that switched Git off spawns nothing at all. The detail payload carriesgit: { available, reason }, proofs are minted only when Git is available, and the route answers 404 with the capability off, 503 with the binary missing. The flag is named for Git, not for Stack Rebase, because a host either runs Git or it does not — a second Git-backed feature reuses the same answer.3. Merge Box: disable beats vanish. Previously a Stack whose history was not linear removed the merge button entirely and replaced it with "Rebase stack". That made the button's absence mean two different things, and left a dead zone when
history === 'unknown', when Git was missing, and when the capability was off.829da9eeturns this into variant B: the merge action is always rendered for a reader who may merge, andmergeDisablednow includes the Stack-order guard so a Layer cannot be landed out of order. That guard is a correctness fix, not cosmetics — once the button stops vanishing,mergeable === trueon a single Layer would otherwise enable an out-of-order merge.4. Layer progress in the Stack Rebase dialog. The issue asks only that a failed rebase be reported. The dialog shows per-Layer progress and a partially-applied result.
5. A force-push timeline fix, unrelated to Stacks.
e45250fealso fixes "force-pushed the head branch" rendering with no branch and no commit. REST omits both for a force push; GraphQL knows them, and the eventnodeIdREST already carries joins the two. The supplement now rides the same GraphQL round trip as review threads and review provenance — collapsing what were two separate requests into one, so this touches timeline latency for every pull request, not just Layers.Evidence
Quality gates, all run from the branch tip:
Before: 3 failing tests / 3 unhandled errors, and
nuxi typecheckfailing with 18 diagnostics — all introduced by this branch, none present onmaster.After: both gates clean.
63de1556makescompileVueauto-stub a.vuechild the test did not list, so adding a child to an SFC no longer breaks every test that mounts the parent, and a missing non-component module now fails with its name instead ofundefined.default.6daf986anames the GraphQL review-node shape once (a conditional type was inferringnever) and declares the three force-push fieldsSortableTimelineItemhad been leaving to its index signature.The capability gate, shown rather than asserted
Each row is pinned by a test:
tests/git-availability.test.tsfor the probe, cache and route gate, andtests/pr-merge-box.test.ts/tests/pr-conversation.test.tsfor the rendered states.Merge Danger
Door: two-way — every surface is additive and gated on GitHub reporting a Stack. Reverting the branch restores the previous merge page exactly; no migration, no stored state, no schema change. The one new environment variable defaults to today's behaviour.
Blast Radius: pull request detail page, PR Review Workspace, Merge Box, the timeline request, the container image, and the environment surface of every deployment.
Beyond the Stack surfaces, four reach further than a Layer:
gitandca-certificates.giton the server against the reader's repository, behind CSRF and an HMAC-signed snapshot of the confirmed head. Worth a security read, since it is the only place GitPulse writes to a repository's branches.NUXT_AUTH_*andNUXT_GITPULSE_GIT_ENABLEDnow share one boolean normalizer, which widens whatnuxt.config.tsaccepts from1/true/0/falseto also honouryes/on/no/off. This is intentional (two boolean dialects in one process was a bug waiting to happen) but it is a config-behaviour change outside the Stack feature.Unchanged as the issue requires: Pull Request Cards, notifications, repository pull request lists, the Diff Viewer, and the legacy single-pull-request merge path.