mirror of
https://github.com/garrytan/gstack.git
synced 2026-11-20 07:04:17 +01:00
fix(redact-prepush): strip every parent column from combined-diff lines, so a merged release bump is exempt like any other
This commit is contained in:
1 parent
10d845ab4d
commit
c0dc59d829
3 files changed
+32
-1
No files matched your search
@@ -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).
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"]);
|
||||
|
||||
Reference in new issue
Block a user