Revert the resolveBase remote-prefix guard (regressed alice/base stacked bases); fringe case stays an open note

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
garrytanandcapy-ai[bot] committed 2026-11-03 03:37:02 +00:00
1 parent 73a7267aa6
commit 9417c7d380
3 files changed
+1 -14

No files matched your search

@@ -1,3 +1,2 @@
- **A bare `--base main` reads origin/main in every review and ship bin (GST-1036).** `gstack-review-plan` now prints `REVIEW_BASE: <ref> <sha>` and names a lagging local base on stderr. `gstack-banned-terms`, `gstack-prose-lint --base`, `gstack-docs-candidate`, `gstack-design-detect.ts scan --changed` and `gstack-pr-shots --base` no longer merge against a stale local main and report lines the branch only inherited. They all use the one resolver gstack-gate-diff already used.
- **`gstack-diff-scope` stops treating authorship files as auth (GST-1065).** `author-spec.md`, `AUTHORS`, `authority.ts` and `coauthors.ts` no longer raise a docs diff to gate class. Every other name with auth in it still does, including `auth.ts`, `/auth/`, `oauth`, `nextauthmiddleware.ts` and camelCase names like `useAuth.ts`.
- **A remote-qualified `--base origin/main` is never re-qualified.** When the tracking ref is missing it resolves to nothing instead of trying `origin/origin/main`.
+1 -2
View File
@@ -109,9 +109,8 @@ export function resolveBase(ref: string, cwd: string, head?: string): { ref: str
if (!isBranchName(ref)) { const sha = direct(); return sha ? { ref, sha } : null; }
const qualified = resolvesToCommit(`refs/remotes/` + ref, cwd);
if (qualified) return { ref, sha: qualified };
const remotes = remoteNames(cwd);
if (remotes.some((remote) => ref.startsWith(remote + '/'))) return null;
const local = resolvesToCommit(`refs/heads/` + ref, cwd);
const remotes = remoteNames(cwd);
const localRelated = !!local && related(local);
const twin = (remote: string) => {
const sha = resolvesToCommit(`refs/remotes/` + remote + '/' + ref, cwd);
-11
View File
@@ -11,7 +11,6 @@ import * as fs from 'node:fs';
import * as os from 'node:os';
import * as path from 'node:path';
import { BANNED_TERMS_SCHEMA } from '../lib/banned-terms';
import { resolveBase } from '../lib/gate-diff/git';
import { resolveCommit } from '../lib/pr-shots';
const BIN = path.join(import.meta.dir, '..', 'bin');
@@ -102,16 +101,6 @@ describe('a bare --base reads origin/<base> over a stale local branch (GST-1036)
expect(r.err).toContain(`gstack-docs-candidate: ${NOTE}`);
}, 120_000);
// Value: protects=a remote-qualified base is never re-qualified: origin/main reads refs/remotes/origin/main or nothing;
// fails_when=resolveBase falls through to refs/remotes/origin/origin/main when the tracking ref is missing; why_new=GST-1036 review (#3852 rule); seam=lib/gate-diff/git.ts resolveBase
test('resolveBase never re-qualifies origin/main when refs/remotes/origin/main is missing', () => {
const { work, sh, origin } = fixture();
expect(resolveBase('origin/main', work, 'HEAD')?.sha).toBe(origin);
sh(work, 'git update-ref refs/remotes/origin/origin/main HEAD && git update-ref -d refs/remotes/origin/main');
expect(resolveBase('origin/main', work, 'HEAD')).toBeNull();
expect(resolveBase('main', work, 'HEAD')?.ref).toBe('main');
}, 120_000);
// Value: protects=the PR screenshot's before side is origin's base, not a stale local copy; fails_when=resolveCommit reads refs/heads/main first;
// why_new=GST-1036 sibling bin; seam=lib/pr-shots.ts resolveCommit
test('gstack-pr-shots --base main reads origin/main; a sha resolves as given', () => {