mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-30 11:53:55 +01:00
Clearer errors for GitHub email-privacy pushes, approval refusals and bisect case names (#4748)
/ship now tells you to fix your commit email when GitHub refuses a push with GH007, instead of sending you into a pointless merge; `gstack-approvals` says which `--owner-ref` check failed; and the merge queue's bisect accepts a red judge case whose name has a space. Why: three small, plainly correct fixes from outside reports (#4738, #4718 with #4720, #4724 for #3580), taken as one batch. Nothing to do. Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com> Co-authored-by: Barack-zero-to-one <121355791+Barack-zero-to-one@users.noreply.github.com> Review-Finding: p1/outside-voice#1 reader=outside-voice Review-Finding: p1/outside-voice#2 reader=outside-voice Review-Finding: p1/adversarial-native#1 reader=adversarial-native Review-Finding: p1/adversarial-native#3 reader=adversarial-native Review-Finding: p1/specialist-batched#1 reader=testing
This commit is contained in:
14 files changed
+174
-21
No files matched your search
@@ -13,7 +13,7 @@ export const CAPY_RESULT_CODES = {
|
||||
APPROVAL_RECORD_INVALID: {
|
||||
anchor: 'approval-record-invalid',
|
||||
summary: 'an approval row is missing a required field, holds a value outside its enum, or exceeds a length cap',
|
||||
fix: 'rerun gstack-approvals add with every required flag (--ask, --words, --scope, --by) inside the caps it names; nothing was written',
|
||||
fix: 'rerun the command this line names with the flag its detail names, inside its caps (gstack-approvals --help lists each command\'s flags); nothing was written',
|
||||
},
|
||||
APPROVAL_RULING_RUN_OPEN: {
|
||||
anchor: 'approval-ruling-run-open',
|
||||
|
||||
@@ -701,7 +701,7 @@ export const RELEASE_RESULT_CODES = {
|
||||
PUSH_REJECTED: {
|
||||
anchor: 'push-rejected',
|
||||
summary: 'git push was rejected: the remote branch has commits this branch lacks (non-fast-forward) or the remote refused the update, so nothing was pushed',
|
||||
fix: 'fetch and merge the remote under Step 3\'s conflict rules, run Steps 5-16 again, then rerun push; never force-push',
|
||||
fix: 'for a non-fast-forward, fetch and merge the remote under Step 3\'s conflict rules, run Steps 5-16 again, then rerun push; when the remote refused the update (GH007 email privacy, a protected branch), change what the STOP: line names instead (for GH007, the noreply email on every commit); never force-push',
|
||||
},
|
||||
PUSH_GIT_FAILED: {
|
||||
anchor: 'push-git-failed',
|
||||
|
||||
@@ -30,6 +30,8 @@ export const RULED_NOTE_SCOPE = /^\s*ruled_note\b/;
|
||||
export const ruledNoteRow = (finding: string, head: string, reason: string) => ({ scope: `ruled_note ${finding} ${head}`, ask: `ruled_note ${finding} at ${head}: ${reason}` });
|
||||
/** Where a lane relays the owner's ruling from: `<thread code>:<message id or timestamp>`, a message a reader can look up. */
|
||||
export const OWNER_REF = /^[A-Z][A-Z0-9]*-[1-9]\d*:[A-Za-z0-9][\w.:+-]*$/;
|
||||
/** OWNER_REF in words, for the refusals and help that name it; a refusal never echoes the rejected ref, which may hold anything (#4718). */
|
||||
export const OWNER_REF_SHAPE = '<thread code>:<message id or timestamp>, where the thread code is an uppercase letter, then uppercase letters or digits, a dash and a number from 1, and the message part starts with a letter or digit (GSTA-36:2026-11-19T12:29:59Z)';
|
||||
const RED_TEAM = /:red-team$/i;
|
||||
/** A ruling row's source: `relayed:<owner ref>` for a relayed ruling and `not-security` for a red-team finding the owner ruled not security class. */
|
||||
export const ruledNoteSource = (o: { ownerRef?: string; notSecurity?: boolean }) => [o.ownerRef ? `relayed:${o.ownerRef}` : '', o.notSecurity ? 'not-security' : ''].filter(Boolean).join(' ') || undefined;
|
||||
|
||||
+7
-3
@@ -32,6 +32,7 @@ import { reviewRoundGrants } from './review-round-grant';
|
||||
import { dispositionedOn, gateDispositionText, gateKey, readGateDispositions } from './gate-dispositions';
|
||||
import { parseReviewLoopException, type ReviewLoopException } from './ship-receipt-depth';
|
||||
import { parseReceiptDocs, type ReceiptDocs } from './ship-receipt-docs';
|
||||
import { redactFindingSpans } from './redact-engine';
|
||||
import { resolveStateRoot } from './state-root';
|
||||
import { bumpVersion, cmpVersion, fmtVersion, parseVersion, versionWidth, type Bump } from './version-source';
|
||||
import { waitForRun } from './ci-carry';
|
||||
@@ -833,9 +834,12 @@ function pushOnce(argv: readonly string[], cwd: string, r: Report): string {
|
||||
if (plain.length) { r.add(`BRANCH: refused ${plain.map(f => `"${f.match}"`).join(', ')}`); return refuse(`the branch name ${branch} is not plain words (docs/ship-policy.md#plain-titles): rename it with git branch -m <plain words>[-<issue code>], then rerun push --branch <new name>`); }
|
||||
const p = git(cwd, ['push', '-u', 'origin', branch], 600_000);
|
||||
if (p.status !== 0) {
|
||||
const nff = /non-fast-forward|fetch first|rejected/.test(p.stderr);
|
||||
return nff ? refuse('non-fast-forward: fetch and merge the remote under Step 3\'s conflict rules, run Steps 5-16, then push again; never force-push', 'PUSH_REJECTED')
|
||||
: refuse(`push failed (${firstLine(p.stderr)}): repair the auth, hook or network cause, repeat Step 16, then push; never bypass a guard`, 'PUSH_GIT_FAILED');
|
||||
if (/^remote: error: GH007:|\[remote rejected\][^\n]*\(push declined due to email privacy restrictions\)/m.test(p.stderr)) return refuse(`GitHub refused the push (GH007): a commit carries the private email address your account blocks from command-line pushes. Set git config user.email to your GitHub noreply address (github.com/settings/emails), rewrite every commit that carries the private one (git rebase origin/${flag('--base') ?? '<base>'} --exec 'git commit --amend --reset-author --no-edit'), repeat Step 16, then push; a fetch and merge will not fix it`, 'PUSH_REJECTED');
|
||||
if (/^ ! \[rejected\][^\n]*\((?:non-fast-forward|fetch first)\)$/m.test(p.stderr)) return refuse('non-fast-forward: fetch and merge the remote under Step 3\'s conflict rules, run Steps 5-16, then push again; never force-push', 'PUSH_REJECTED');
|
||||
const declined = (/^remote: error: (GH\d{3}:.+)$/m.exec(p.stderr) ?? /^remote: error: (.+)$/m.exec(p.stderr) ?? /^ ! \[remote rejected\][^(\n]*\(([^)\n]+)\)$/m.exec(p.stderr))?.[1];
|
||||
const quoted = declined && redactFindingSpans(declined.replace(/[\x00-\x1f\x7f]/g, ' ').trim());
|
||||
if (declined) return refuse(`the remote refused the push (${quoted ? quoted.slice(0, 240) : 'its reason is withheld: the secret scanner could not redact it'}): change what it names, repeat Step 16, then push; a fetch and merge will not fix it; never force-push or bypass a guard`, 'PUSH_REJECTED');
|
||||
return refuse(`push failed (${firstLine(p.stderr)}): repair the auth, hook or network cause, repeat Step 16, then push; never bypass a guard`, 'PUSH_GIT_FAILED');
|
||||
}
|
||||
r.next('Step 18');
|
||||
return `PUSH: pushed remote=origin ref=${branch} head=${local}`;
|
||||
|
||||
Reference in new issue
Block a user