From c0dc59d829ea9ddfb20d4c0bea227aa5aaef4a4f Mon Sep 17 00:00:00 2001 From: garrytan Date: Thu, 8 Oct 2026 16:27:23 +0000 Subject: [PATCH] fix(redact-prepush): strip every parent column from combined-diff lines, so a merged release bump is exempt like any other --- CHANGELOG.md | 1 + bin/gstack-redact-prepush | 3 ++- test/redact-prepush-emails.test.ts | 29 +++++++++++++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb905e21e..c2c195fec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -58,6 +58,7 @@ Both are tracked in TODOS.md. - CI's GitHub Actions SHA pins are refreshed (docker/setup-buildx-action 4.4.1, docker/build-push-action 7.4.0, actions/attest 4.2.2, actions/setup-node 7.0.0), each with its exact version comment (#2988). #### Fixed +- The pre-push scan reads merge-commit lines without their second parent column, so a merge that resolves a release bump no longer reports its version strings as public IPs. - /autoplan's own section files and phase artifacts no longer raise permission prompts after a background reviewer's completion notice, in the foreground or with `claude --bg`. The publication guard's checks are unchanged. - The outside-review classifier reads a trailing `— Medium.` or `(High)` severity on a finding line, the shape Codex now writes. Before this, such a review was reported `unverified`. - `gstack-hook-check` checks the hooks skills register (/careful, /freeze, /guard, /investigate, /plan-ceo-review), the shell helpers they source, and conflict markers that still parse, including in imported modules. It also ignores the calling project's tsconfig.json and bunfig.toml. Thanks @BenjaminDSmithy (#3066). diff --git a/bin/gstack-redact-prepush b/bin/gstack-redact-prepush index 31a87c97e..b3ccdd7fa 100755 --- a/bin/gstack-redact-prepush +++ b/bin/gstack-redact-prepush @@ -339,7 +339,8 @@ function collectAddedLines(diff: string, commit?: string): AddedFile[] { const inResult = inHunk && !line.startsWith("\\") && !line.slice(0, parents).includes("-"); const lineNumber = inResult ? nextLine++ : 0; if (line.startsWith("+")) { - fileLines.push(line.slice(1)); + // A combined (--cc) body line carries one prefix column per parent. + fileLines.push(line.slice(inHunk ? parents : 1)); lineNumbers.push(lineNumber); } } diff --git a/test/redact-prepush-emails.test.ts b/test/redact-prepush-emails.test.ts index 8f7a90ad6..ee53f24f4 100644 --- a/test/redact-prepush-emails.test.ts +++ b/test/redact-prepush-emails.test.ts @@ -354,6 +354,35 @@ describe("MEDIUM lines point at the real file line (ENG-8)", () => { expect(found[0]).toContain("big.txt:20001"); }); + test("a merge that resolves a release bump does not read its version strings as public IPs", () => { + const fx = fixture(); + const release = (v: string) => `# Changelog\n\n## [${v}] - 2026-01-02\n\n- change\n`; + commitFile(fx, fx.repo, "VERSION", "1.0.0.0\n"); + commitFile(fx, fx.repo, "CHANGELOG.md", release("1.0.0.0")); + expect(push(fx, ["origin", "main"]).code).toBe(0); + git(fx, fx.repo, ["checkout", "-q", "-b", "feature"]); + commitFile(fx, fx.repo, "VERSION", "1.0.1.0\n"); + const featureTip = commitFile(fx, fx.repo, "CHANGELOG.md", release("1.0.1.0")); + expect(push(fx, ["origin", "feature"]).code).toBe(0); + git(fx, fx.repo, ["checkout", "-q", "main"]); + commitFile(fx, fx.repo, "VERSION", "1.0.2.0\n"); + const mainTip = commitFile(fx, fx.repo, "CHANGELOG.md", release("1.0.2.0")); + expect(push(fx, ["origin", "main"]).code).toBe(0); + git(fx, fx.repo, ["checkout", "-q", "feature"]); + fs.writeFileSync(path.join(fx.repo, "VERSION"), "1.0.3.0\n"); + fs.writeFileSync(path.join(fx.repo, "CHANGELOG.md"), release("1.0.3.0")); + git(fx, fx.repo, ["add", "VERSION", "CHANGELOG.md"]); + const tree = git(fx, fx.repo, ["write-tree"]); + const stamp = `${clock++} +0000`; + const object = [`tree ${tree}`, `parent ${featureTip}`, `parent ${mainTip}`, `author Someone <${at("me")}> ${stamp}`, + `committer Someone <${at("me")}> ${stamp}`, "", "merge main and re-slot", ""].join("\n"); + const merge = spawnSync("git", ["hash-object", "-t", "commit", "-w", "--stdin"], { cwd: fx.repo, input: object, encoding: "utf8", env: fx.env, timeout: 30_000 }); + git(fx, fx.repo, ["update-ref", "HEAD", merge.stdout.trim()]); + const { code, stderr } = push(fx, ["origin", "feature"]); + expect(code).toBe(0); + expect(stderr).not.toContain("pii.ip_public"); + }); + test("content removed before the pushed tip names the commit that added it", () => { const fx = fixture(); git(fx, fx.repo, ["checkout", "-q", "-b", "feature"]);