Skip to content

A Civilization-style strategy game about governing Israel from 15 May 1948. Real ministers, real map, every fact sourced. Unity + deterministic C# sim.

Release gate: count the history scan's open non-secret rows instead of listing 1,300 of them (Refs #2655) (#2795)

Bericd7c1c6e84ae
diff --git a/scripts/oss/scan_history.py b/scripts/oss/scan_history.py
index ab2f48a80..f50aec9a2 100644
--- a/scripts/oss/scan_history.py
+++ b/scripts/oss/scan_history.py
@@ -4,7 +4,8 @@
# ///
"""Read-only scan of every ADDED line in every commit reachable from the given ref (merge commits included, diffed
against each parent), plus every commit message and author/committer email, for secret shapes, personal emails and
-home paths (the patterns in oss_policy.py). Prints commit, file and pattern type, NEVER the matched text.
+home paths (the patterns in oss_policy.py). Prints commit, file and pattern type, NEVER the matched text; OPEN rows
+that are not secret-shaped print as one count per pattern type.
Findings are information only (owner ruling 2026-10-11: no history rewriting, no history enforcement) and do not change
the exit code. A command failure is non-zero because the scan is incomplete.
@@ -90,10 +91,18 @@ def main(argv: list[str] | None = None) -> int:
return 1
done = accepted(args.repo)
open_secrets = 0
+ # OPEN rows that are not secret-shaped (personal emails, home paths) print as one count per kind: on main they are
+ # over a thousand commit identities, and listed one by one they buried the summary line (#2655 item 7).
+ other_open: dict[str, int] = {}
for commit, path, kind in hits:
state = "accepted" if (commit, path, kind) in done else "OPEN"
open_secrets += state == "OPEN" and kind in SECRET_KINDS
+ if state == "OPEN" and kind not in SECRET_KINDS:
+ other_open[kind] = other_open.get(kind, 0) + 1
+ continue
print(f"{commit} {path} {kind} {state}")
+ for kind, n in sorted(other_open.items()):
+ print(f"{kind} {n} OPEN rows (not secret-shaped, not listed)")
count = len(subprocess.run(["git", "-C", str(args.repo), "rev-list", *refs], capture_output=True, text=True,
check=True).stdout.split())
print(f"scanned {count} commits ({' '.join(refs)}): {len(hits) or 'no'} findings, "
diff --git a/scripts/oss/tests/test_scan_history.py b/scripts/oss/tests/test_scan_history.py
index cd7b231bf..a8ed54dea 100644
--- a/scripts/oss/tests/test_scan_history.py
+++ b/scripts/oss/tests/test_scan_history.py
@@ -104,3 +104,19 @@ def test_the_cli_clearly_refuses_a_failed_streaming_git_log(tmp_path, monkeypatc
captured = capsys.readouterr()
assert "HISTORY SCAN FAILED" in captured.err and "incomplete" in captured.err
assert "scanned" not in captured.out and "open secret-shape findings" not in captured.out
+
+
+def test_open_rows_that_are_not_secret_shaped_print_as_one_count_per_kind(tmp_path, capsys):
+ # #2655 item 7: main's 1,311 OPEN personal-email rows (mostly commit identities) buried the gate's summary line.
+ root = new_repo(tmp_path)
+ for i in range(3):
+ write(root, f"{i}.txt", "x\n")
+ git(root, "add", "-A")
+ git(root, "-c", "user.name=t", "-c", f"user.email=person{i}" + "@" + "corp.com", "commit", "-qm", f"c{i}")
+ write(root, "promo/k.py", f'K = "{FAKE}"\n')
+ c4 = commit_all(root, "add tool")
+ scan_history.main(["--repo", str(root)])
+ out = capsys.readouterr().out
+ assert "(identity) personal-email OPEN" not in out
+ assert "personal-email 3 OPEN rows (not secret-shaped, not listed)" in out
+ assert f"{c4} promo/k.py elevenlabs-key OPEN" in out and "1 open secret-shape findings" in out