You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@magpie.apache.org by po...@apache.org on 2026/10/04 23:03:54 UTC
(magpie) 02/05: fix(release-management): close four gaps a security review found in the scripts
This is an automated email from the ASF dual-hosted git repository.
potiuk pushed a commit to branch perf/release-sibling-scripts
in repository https://gitbox.apache.org/repos/asf/magpie.git
commit dc4420636e4bfff0a7937025be423fa0e6e8e7bd
Author: Jarek Potiuk <po...@apache.org>
AuthorDate: Sun Oct 4 18:47:41 2026 +0200
fix(release-management): close four gaps a security review found in the scripts
- keys-sync check_key.py read only strength and expiry, so a revoked,
invalid or disabled key passed. gpg's validity field now blocks it.
- vote-tally tally.py counted every vote, so one member voting twice,
or writing from two addresses, was counted twice. Votes are grouped
by person (roster Apache ID, else address); any repeat halts the
tally, even under --force-close, until the RM says which vote
stands.
- archive-sweep retention.py let a pre-release in the release area
count as a train's latest, which kept the RC and proposed archiving
the real latest release. Pre-releases are now listed for the RM and
never decide retention.
- audit-report render_record.py rendered planning-issue values into
the record unescaped, so a line break or `|` could break the tables
or add sections, and a link field could carry any target. Values are
confined to their cell or code span, and link fields accept only a
plain https:// URL.
Each fix has tests; the four skills describe the new output.
Generated-by: Claude Opus 5
---
.../skills/archive-sweep/SKILL.md | 6 ++-
.../skills/archive-sweep/scripts/retention.py | 20 +++++++++-
.../skills/archive-sweep/tests/test_retention.py | 22 +++++++++++
.../skills/audit-report/SKILL.md | 6 ++-
.../skills/audit-report/scripts/render_record.py | 33 +++++++++++-----
.../audit-report/tests/test_render_record.py | 33 ++++++++++++++++
.../skills/keys-sync/SKILL.md | 5 ++-
.../skills/keys-sync/scripts/check_key.py | 12 ++++++
.../skills/keys-sync/tests/test_check_key.py | 24 ++++++++++++
.../skills/vote-tally/SKILL.md | 8 +++-
.../skills/vote-tally/scripts/tally.py | 23 ++++++++++-
.../skills/vote-tally/tests/test_tally.py | 44 ++++++++++++++++++++++
.../fixtures/case-1-full-record/report.md | 2 +-
.../fixtures/case-2-missing-fields/report.md | 2 +-
.../case-3-injection-in-planning-issue/report.md | 2 +-
15 files changed, 220 insertions(+), 22 deletions(-)
diff --git a/plugins/magpie-release-management/skills/archive-sweep/SKILL.md b/plugins/magpie-release-management/skills/archive-sweep/SKILL.md
index 48d4fbc2..973027cd 100644
--- a/plugins/magpie-release-management/skills/archive-sweep/SKILL.md
+++ b/plugins/magpie-release-management/skills/archive-sweep/SKILL.md
@@ -26,7 +26,7 @@ capability:
- capability:triage
surface_hash: sha256:1665af8aae9c2b58
license: Apache-2.0
-measured_tokens: 4443
+measured_tokens: 4481
---
<!-- SPDX-License-Identifier: Apache-2.0
@@ -251,7 +251,9 @@ Return ONLY valid JSON with this structure:
Per train it keeps the newest `keep` (default 1) and marks earlier
versions past retention; releases on no train are `orphans`, never
- archived. `keep` below 1 would archive a train's latest release: the
+ archived. A pre-release in the release area is listed in `prereleases`,
+ never counted as a train's latest and never archived; it is a hand-off
+ to the RM. `keep` below 1 would archive a train's latest release: the
script sets `retention_rule_error` and empties `past_retention`, and
no archival command may be emitted.
diff --git a/plugins/magpie-release-management/skills/archive-sweep/scripts/retention.py b/plugins/magpie-release-management/skills/archive-sweep/scripts/retention.py
index 897f8837..a246cc58 100755
--- a/plugins/magpie-release-management/skills/archive-sweep/scripts/retention.py
+++ b/plugins/magpie-release-management/skills/archive-sweep/scripts/retention.py
@@ -75,6 +75,10 @@ def version_key(version: str) -> tuple[Any, ...]:
return (tuple(release), tail)
+def is_prerelease(version: str) -> bool:
+ return version_key(version)[1][0] == 0
+
+
def release_parts(version: str) -> list[int]:
match = VERSION_RE.match(version)
assert match
@@ -135,6 +139,14 @@ def sweep(listing: list[str], trains: list[dict[str, Any]]) -> dict[str, Any]:
else:
orphans.append(version)
+ # A pre-release in the release area must never count as a train's latest release:
+ # it would keep the RC and propose archiving the real latest release.
+ prereleases: list[str] = []
+ for label in members:
+ finals = [v for v in members[label] if not is_prerelease(v)]
+ prereleases += [v for v in members[label] if is_prerelease(v)]
+ members[label] = finals
+ prereleases.sort(key=version_key)
latest = {label: vs[-1] for label, vs in members.items() if vs}
rule_errors = [
f"train {label!r} keeps {keeps[label]} version(s); the latest of every supported train must stay"
@@ -155,16 +167,22 @@ def sweep(listing: list[str], trains: list[dict[str, Any]]) -> dict[str, Any]:
"proposed for it — the RM must decide whether to archive, keep, or reconcile it into a known train"
for v in orphans
]
+ reasons += [
+ f"{v} is a pre-release in the release area; it is not counted for retention and no archival "
+ "command will be proposed for it — the RM must decide whether it belongs there"
+ for v in prereleases
+ ]
return {
"releases_found": found,
"past_retention": [] if rule_errors else past,
"orphans": orphans,
+ "prereleases": prereleases,
"unmapped": unmapped,
"latest_of_each_line": latest,
"trains_without_releases": [label for label, vs in members.items() if not vs],
"mapping_complete": not unmapped,
"retention_rule_error": bool(rule_errors),
- "handoff_required": bool(rule_errors or orphans),
+ "handoff_required": bool(rule_errors or orphans or prereleases),
"handoff_reasons": reasons,
}
diff --git a/plugins/magpie-release-management/skills/archive-sweep/tests/test_retention.py b/plugins/magpie-release-management/skills/archive-sweep/tests/test_retention.py
index e713e09e..ef043a03 100644
--- a/plugins/magpie-release-management/skills/archive-sweep/tests/test_retention.py
+++ b/plugins/magpie-release-management/skills/archive-sweep/tests/test_retention.py
@@ -93,5 +93,27 @@ class SweepTest(unittest.TestCase):
self.assertEqual(out["unmapped"][0]["version"], "2.11.0")
+class PrereleaseTest(unittest.TestCase):
+ """A pre-release in the release area never decides what is kept."""
+
+ def test_rc_never_displaces_the_latest_release(self) -> None:
+ out = retention.sweep(["2.10.5", "2.11.0-rc1", "2.10.4"], TWO_X)
+ self.assertEqual(out["latest_of_each_line"], {"2.x": "2.10.5"})
+ self.assertEqual(out["past_retention"], ["2.10.4"])
+ self.assertNotIn("2.10.5", out["past_retention"])
+ self.assertNotIn("2.11.0-rc1", out["past_retention"])
+
+ def test_prerelease_is_handed_to_the_rm(self) -> None:
+ out = retention.sweep(["2.10.5", "2.11.0rc1"], TWO_X)
+ self.assertEqual(out["prereleases"], ["2.11.0rc1"])
+ self.assertTrue(out["handoff_required"])
+ self.assertTrue(any("2.11.0rc1" in r and "pre-release" in r for r in out["handoff_reasons"]))
+
+ def test_post_release_still_counts_as_a_release(self) -> None:
+ out = retention.sweep(["2.10.5", "2.10.5.post1"], TWO_X)
+ self.assertEqual(out["latest_of_each_line"], {"2.x": "2.10.5.post1"})
+ self.assertEqual(out["prereleases"], [])
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/plugins/magpie-release-management/skills/audit-report/SKILL.md b/plugins/magpie-release-management/skills/audit-report/SKILL.md
index 8b963a9e..97b5d103 100644
--- a/plugins/magpie-release-management/skills/audit-report/SKILL.md
+++ b/plugins/magpie-release-management/skills/audit-report/SKILL.md
@@ -23,7 +23,7 @@ argument-hint: "<version> [--planning-issue <url>]"
capability: capability:stats
surface_hash: sha256:576d71b04f203cd8
license: Apache-2.0
-measured_tokens: 6549
+measured_tokens: 6583
---
<!-- SPDX-License-Identifier: Apache-2.0
@@ -352,7 +352,9 @@ It renders `record_markdown` in this fixed shape (`_MISSING_` and
and lists
`schema_violations` against
[`audit-record-schema.md`](audit-record-schema.md); it refuses an email
-address among the voters. A non-empty `input_gaps` names input the
+address among the voters, and a link field that is not a plain `https://`
+URL. Every value is escaped so planning-issue text cannot break the record's
+tables or add sections. A non-empty `input_gaps` names input the
record still needs: supply it and re-run. Return its fields except
`input_gaps`, and never edit `record_markdown` by hand.
Schema violations are surfaced to the RM but do not block the PR
diff --git a/plugins/magpie-release-management/skills/audit-report/scripts/render_record.py b/plugins/magpie-release-management/skills/audit-report/scripts/render_record.py
index 604ace1d..b9ca06a4 100755
--- a/plugins/magpie-release-management/skills/audit-report/scripts/render_record.py
+++ b/plugins/magpie-release-management/skills/audit-report/scripts/render_record.py
@@ -46,6 +46,8 @@ from typing import Any
MISSING = "MISSING"
REDACTED = "REDACTED"
+# A link target the record will render: https only, no spaces, brackets or markdown.
+SAFE_URL_RE = re.compile(r"https://[^\s<>()\[\]`|]+")
EMAIL_RE = re.compile(r"[^@\s]+@[^@\s]+\.[^@\s]+")
DEFAULT_SCHEMA = Path(__file__).resolve().parents[1] / "audit-record-schema.md"
@@ -108,25 +110,38 @@ def handle(name: str) -> str:
return name if name.startswith("@") else f"@{name}"
+def cell(value: Any) -> str:
+ """One table cell: no line breaks, no column separators."""
+ return " ".join(str(value).split()).replace("|", "\\|")
+
+
+def code(value: Any) -> str:
+ """Inline code: the value cannot close the span."""
+ return "`" + cell(value).replace("`", "'") + "`"
+
+
def render_value(field: str, value: Any, reasons: dict[str, str]) -> str:
mark = sentinel(value)
if mark == MISSING:
return "_MISSING_"
if mark == REDACTED:
reason = reasons.get(field)
- return f"_REDACTED — {reason}_" if reason else "_REDACTED_"
+ return f"_REDACTED — {cell(reason)}_" if reason else "_REDACTED_"
if field in ("vote_thread_url", "result_thread_url", "announce_archive_url"):
- return f"[{value}]({value})"
+ url = str(value).strip()
+ if not SAFE_URL_RE.fullmatch(url):
+ raise InputError(f"{field} must be a plain https:// URL, MISSING or REDACTED")
+ return f"<{url}>"
if field in ("rc_label", "promote_revision"):
- return f"`{value}`"
+ return code(value)
if field == "binding_voters":
if not isinstance(value, list):
raise InputError("binding_voters must be a list, MISSING or REDACTED")
emails = [v for v in value if EMAIL_RE.search(str(v))]
if emails:
raise InputError("binding_voters must be roster handles, never email addresses")
- return ", ".join(handle(v) for v in value)
- return str(value)
+ return ", ".join(cell(handle(v)) for v in value)
+ return cell(value)
def render(data: dict[str, Any], required: list[str]) -> dict[str, Any]:
@@ -152,11 +167,11 @@ def render(data: dict[str, Any], required: list[str]) -> dict[str, Any]:
"announce_archive_url": "Announcement",
}
lines = [
- f"# Release audit: {product} {version}",
+ f"# Release audit: {cell(product)} {cell(version)}",
"",
"| Field | Value |",
"|---|---|",
- f"| Version | `{version}` |",
+ f"| Version | {code(version)} |",
]
for field in TABLE_FIELDS:
lines.append(f"| {labels[field]} | {render_value(field, data.get(field, MISSING), reasons)} |")
@@ -170,7 +185,7 @@ def render(data: dict[str, Any], required: list[str]) -> dict[str, Any]:
raise InputError("artefacts must be a list, MISSING or REDACTED")
for item in artefacts:
lines.append(
- f"| `{item.get('filename', '')}` | `{item.get('sha512', '')}` | `{item.get('sig', '')}` |"
+ f"| {code(item.get('filename', ''))} | {code(item.get('sha512', ''))} | {code(item.get('sig', ''))} |"
)
lines += ["", "## Notes", ""]
notes: list[str] = []
@@ -194,7 +209,7 @@ def render(data: dict[str, Any], required: list[str]) -> dict[str, Any]:
lines += [
"---",
"_Generated by `release-audit-report` (magpie-release-audit-report).",
- f"Source: planning issue {data['planning_issue_url']}._",
+ f"Source: planning issue {cell(data['planning_issue_url'])}._",
"",
]
diff --git a/plugins/magpie-release-management/skills/audit-report/tests/test_render_record.py b/plugins/magpie-release-management/skills/audit-report/tests/test_render_record.py
index 4bbe9965..7618245b 100644
--- a/plugins/magpie-release-management/skills/audit-report/tests/test_render_record.py
+++ b/plugins/magpie-release-management/skills/audit-report/tests/test_render_record.py
@@ -120,5 +120,38 @@ class RenderTest(unittest.TestCase):
render_record.render(data, REQUIRED)
+class HostileInputTest(unittest.TestCase):
+ """Values come from the planning issue: they must not break or extend the record."""
+
+ def render(self, **changes: object) -> str:
+ data = full() | changes
+ return render_record.render(data, REQUIRED)["record_markdown"]
+
+ def test_newline_and_pipe_stay_inside_their_cell(self) -> None:
+ md = self.render(promote_revision="r1 |x|\n## Injected section")
+ self.assertNotIn("\n## Injected section", md)
+ row = next(line for line in md.splitlines() if line.startswith("| Promote revision"))
+ self.assertIn("\\|x\\|", row)
+
+ def test_backtick_cannot_close_a_code_span(self) -> None:
+ md = self.render(rc_label="rc1` [click](https://evil.example) `")
+ row = next(line for line in md.splitlines() if line.startswith("| RC"))
+ self.assertEqual(row.count("`"), 2)
+
+ def test_link_fields_accept_only_plain_https(self) -> None:
+ for bad in ("javascript:alert(1)", "http://lists.apache.org/x", "https://a.b/x)[y](https://evil",
+ "https://a.b/x y"):
+ with self.subTest(url=bad), self.assertRaises(render_record.InputError):
+ self.render(vote_thread_url=bad)
+
+ def test_good_link_renders_as_autolink(self) -> None:
+ md = self.render()
+ self.assertIn("<https://lists.apache.org/thread/vote>", md)
+
+ def test_artefact_names_are_quoted(self) -> None:
+ md = self.render(artefacts=[{"filename": "a|b\nc", "sha512": "aa", "sig": "s"}])
+ self.assertNotIn("a|b", md)
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/plugins/magpie-release-management/skills/keys-sync/SKILL.md b/plugins/magpie-release-management/skills/keys-sync/SKILL.md
index d74df1bd..3a2d05c4 100644
--- a/plugins/magpie-release-management/skills/keys-sync/SKILL.md
+++ b/plugins/magpie-release-management/skills/keys-sync/SKILL.md
@@ -26,7 +26,7 @@ argument-hint: "[--fingerprint <fp>] [--keys-url <url>] [--keyserver <host>]"
capability: capability:resolve
surface_hash: sha256:61e10c986bb0d3ec
license: Apache-2.0
-measured_tokens: 4794
+measured_tokens: 4800
---
<!-- SPDX-License-Identifier: Apache-2.0
@@ -257,7 +257,8 @@ and applies the floor from
[ASF release-signing](https://infra.apache.org/release-signing.html):
RSA and DSA at least 2048 bits, EdDSA (Ed25519) and ECDSA (P-256 or
stronger) accepted, anything else (secp256k1 included) refused. A
-missing, sub-floor, or already-expired key is `blocked`. `strength_note`
+missing, sub-floor, already-expired, revoked, invalid or disabled key
+is `blocked`. `strength_note`
carries the failure reason, the DSA advisory, and a non-blocking
advisory for an expiry within 90 days.
On an `error` (no gpg, bad fingerprint), surface it; never judge the
diff --git a/plugins/magpie-release-management/skills/keys-sync/scripts/check_key.py b/plugins/magpie-release-management/skills/keys-sync/scripts/check_key.py
index d870ce85..08962490 100755
--- a/plugins/magpie-release-management/skills/keys-sync/scripts/check_key.py
+++ b/plugins/magpie-release-management/skills/keys-sync/scripts/check_key.py
@@ -58,6 +58,11 @@ ALGORITHMS = {"1": "RSA", "2": "RSA", "3": "RSA", "17": "DSA", "19": "ECDSA", "2
EDDSA_CURVES = {"ed25519", "ed448"}
ECDSA_CURVES = {"nistp256", "nistp384", "nistp521", "brainpoolp256r1", "brainpoolp384r1", "brainpoolp512r1"}
FLOOR_BITS = 2048
+UNUSABLE_VALIDITY = {
+ "r": "key is revoked; generate a new key",
+ "i": "key is invalid (gpg could not validate it); fix or replace the key",
+ "d": "key is disabled",
+}
EXPIRY_ADVISORY_DAYS = 90
@@ -83,6 +88,7 @@ def parse_colons(text: str) -> list[dict[str, Any]]:
kind = f[0]
if kind == "pub":
current = {
+ "validity": f[1],
"algo_id": f[3],
"bits": int(f[2]) if f[2].isdigit() else None,
"created": _date(f[5]),
@@ -148,6 +154,12 @@ def assess(key: dict[str, Any] | None, fingerprint: str, today: dt.date) -> dict
notes.append(f"ECDSA curve {key['curve'] or 'unknown'!r} is not P-256 or stronger")
else:
notes.append(f"public-key algorithm id {key['algo_id']} is not accepted for release signing")
+ # gpg's validity field: a revoked, invalid or disabled key never signs a release,
+ # whatever its strength or expiry date says.
+ unusable = UNUSABLE_VALIDITY.get(key.get("validity", ""))
+ if unusable:
+ passed = False
+ notes.append(unusable)
if key["expiry"]:
days = (dt.date.fromisoformat(key["expiry"]) - today).days
if days < 0:
diff --git a/plugins/magpie-release-management/skills/keys-sync/tests/test_check_key.py b/plugins/magpie-release-management/skills/keys-sync/tests/test_check_key.py
index 643e6608..d612fd65 100644
--- a/plugins/magpie-release-management/skills/keys-sync/tests/test_check_key.py
+++ b/plugins/magpie-release-management/skills/keys-sync/tests/test_check_key.py
@@ -249,5 +249,29 @@ class CheckKeyCliTest(unittest.TestCase):
self.assertIn("error", out)
+class ValidityTest(unittest.TestCase):
+ """gpg's validity field: revoked, invalid and disabled keys never pass."""
+
+ def listing(self, validity: str) -> str:
+ return colons("1", "4096").replace("pub:-:", f"pub:{validity}:", 1)
+
+ def test_revoked_key_blocks(self) -> None:
+ out = check(self.listing("r"))
+ self.assertEqual(out["verdict"], "blocked")
+ self.assertIn("revoked", out["strength_note"])
+
+ def test_invalid_and_disabled_keys_block(self) -> None:
+ for validity, word in (("i", "invalid"), ("d", "disabled")):
+ with self.subTest(validity=validity):
+ out = check(self.listing(validity))
+ self.assertEqual(out["verdict"], "blocked")
+ self.assertIn(word, out["strength_note"])
+
+ def test_ordinary_validity_still_proceeds(self) -> None:
+ for validity in ("-", "u", "f", "q"):
+ with self.subTest(validity=validity):
+ self.assertEqual(check(self.listing(validity))["verdict"], "proceed")
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/plugins/magpie-release-management/skills/vote-tally/SKILL.md b/plugins/magpie-release-management/skills/vote-tally/SKILL.md
index 9e60f070..96ed5b21 100644
--- a/plugins/magpie-release-management/skills/vote-tally/SKILL.md
+++ b/plugins/magpie-release-management/skills/vote-tally/SKILL.md
@@ -28,7 +28,7 @@ capability:
- capability:resolve
surface_hash: sha256:34592bfacb7cf955
license: Apache-2.0
-measured_tokens: 5678
+measured_tokens: 5761
---
<!-- SPDX-License-Identifier: Apache-2.0
@@ -386,6 +386,12 @@ Build the table from its `voters` and `ambiguous`, adding each
}
```
+**If `duplicate_voters` is not empty**, one person voted more than once
+(a changed vote, or a member writing from two addresses). The script never
+counts them all and halts (`halted: true`, `result: null`), even under
+`--force-close`. Surface the list, ask the RM which vote stands, and re-run
+with only that vote for each person.
+
**If any `ambiguous` entries exist** (`halted_on_ambiguous: true`):
- Stop and surface the list.
diff --git a/plugins/magpie-release-management/skills/vote-tally/scripts/tally.py b/plugins/magpie-release-management/skills/vote-tally/scripts/tally.py
index 2ce5fdd9..5331f8cc 100755
--- a/plugins/magpie-release-management/skills/vote-tally/scripts/tally.py
+++ b/plugins/magpie-release-management/skills/vote-tally/scripts/tally.py
@@ -108,6 +108,16 @@ def resolve_binding(sender: str, roster: list[dict[str, str]]) -> str | None:
return None
+def _identity(sender: str, roster: list[dict[str, str]], via: str | None) -> str:
+ """The person behind a vote: their roster Apache ID when on the roster, else the address."""
+ address = normalise_address(sender)
+ if via is not None:
+ for row in roster:
+ if address in (row["primary_email"].lower(), f"{row['apache_id'].lower()}@apache.org"):
+ return row["apache_id"].lower()
+ return address
+
+
def normalise_value(value: Any) -> str:
text = str(value).strip()
upper = text.upper()
@@ -190,6 +200,7 @@ def tally(
"fractional_count": 0,
"excluded_ambiguous_count": 0,
}
+ seen: dict[str, list[dict[str, Any]]] = {}
for index, vote in enumerate(votes):
if not isinstance(vote, dict) or "from" not in vote or "value" not in vote:
raise InputError(f"vote #{index} needs 'from' and 'value'")
@@ -200,6 +211,8 @@ def tally(
counts["excluded_ambiguous_count"] += 1
continue
via = resolve_binding(str(vote["from"]), roster)
+ identity = _identity(str(vote["from"]), roster, via)
+ seen.setdefault(identity, []).append(entry)
binding = via is not None and value != "fractional"
voters.append(
{
@@ -216,8 +229,12 @@ def tally(
suffix = {"+1": "plus1", "-1": "minus1", "0": "zero"}[value]
counts[("binding_" if binding else "nonbinding_") + suffix] += 1
+ # One person, one vote: repeated votes (a changed vote, or the same member writing
+ # from two addresses) are never all counted. The tally halts until the model or RM
+ # passes only the vote that stands.
+ duplicates = [{"identity": who, "votes": entries} for who, entries in seen.items() if len(entries) > 1]
rule, override_errors = apply_overrides(overrides)
- halted = bool(ambiguous) and not force_close
+ halted = (bool(ambiguous) and not force_close) or bool(duplicates)
result: str | None = None
rule_text: str | None = None
if mechanism == "dev-list-vote":
@@ -236,7 +253,9 @@ def tally(
"mechanism": mechanism,
"voters": voters,
"ambiguous": ambiguous,
- "halted_on_ambiguous": halted,
+ "halted_on_ambiguous": bool(ambiguous) and not force_close,
+ "duplicate_voters": duplicates,
+ "halted": halted,
"force_close": force_close,
**counts,
"pass_rule_applied": rule_text,
diff --git a/plugins/magpie-release-management/skills/vote-tally/tests/test_tally.py b/plugins/magpie-release-management/skills/vote-tally/tests/test_tally.py
index 0a0e25a2..941aa9b2 100644
--- a/plugins/magpie-release-management/skills/vote-tally/tests/test_tally.py
+++ b/plugins/magpie-release-management/skills/vote-tally/tests/test_tally.py
@@ -270,5 +270,49 @@ class TallyCliTest(unittest.TestCase):
self.assertIn("JSON object", out["error"])
+class DuplicateVoteTest(unittest.TestCase):
+ """One person, one vote: repeated votes halt the tally instead of counting twice."""
+
+ def setUp(self) -> None:
+ self.roster = tally.parse_roster(ROSTER)
+
+ def run_tally(self, votes, force_close=False):
+ return tally.tally(votes, self.roster, {}, force_close, "dev-list-vote")
+
+ def test_same_member_voting_twice_halts(self) -> None:
+ out = self.run_tally(
+ [vote("alice@apache.org", "+1"), vote("alice@apache.org", "+1"),
+ vote("bob.martinez@apache.org", "+1")]
+ )
+ self.assertTrue(out["halted"])
+ self.assertIsNone(out["result"])
+ self.assertEqual(out["duplicate_voters"][0]["identity"], "alice")
+ self.assertEqual(len(out["duplicate_voters"][0]["votes"]), 2)
+
+ def test_member_writing_from_two_addresses_is_one_identity(self) -> None:
+ # dave's primary address and his Apache ID address are the same person.
+ out = self.run_tally([vote("dave.kim@apache.org", "+1"), vote("dave@apache.org", "+1")])
+ self.assertEqual([d["identity"] for d in out["duplicate_voters"]], ["dave"])
+ self.assertTrue(out["halted"])
+
+ def test_force_close_does_not_bypass_duplicates(self) -> None:
+ out = self.run_tally([vote("alice@apache.org", "+1"), vote("alice@apache.org", "-1")], force_close=True)
+ self.assertTrue(out["halted"])
+ self.assertIsNone(out["result"])
+
+ def test_non_binding_duplicate_also_halts(self) -> None:
+ out = self.run_tally([vote("fan@gmail.com", "+1"), vote("Fan <FA...@gmail.com>", "+1")])
+ self.assertEqual([d["identity"] for d in out["duplicate_voters"]], ["fan@gmail.com"])
+
+ def test_distinct_voters_do_not_halt(self) -> None:
+ out = self.run_tally(
+ [vote("alice@apache.org", "+1"), vote("bob.martinez@apache.org", "+1"),
+ vote("carol@example.com", "+1")]
+ )
+ self.assertEqual(out["duplicate_voters"], [])
+ self.assertFalse(out["halted"])
+ self.assertEqual(out["result"], "PASSED")
+
+
if __name__ == "__main__":
unittest.main()
diff --git a/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-1-full-record/report.md b/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-1-full-record/report.md
index a851ed2b..2b993fa6 100644
--- a/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-1-full-record/report.md
+++ b/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-1-full-record/report.md
@@ -27,7 +27,7 @@ Output of `python3 <skill-dir>/scripts/render_record.py step1.json` (the Step 1
```json
{
"version": "2.11.0",
- "record_markdown": "# Release audit: Apache Airflow 2.11.0\n\n| Field | Value |\n|---|---|\n| Version | `2.11.0` |\n| RC | `rc1` |\n| Vote thread | [https://lists.apache.org/thread/vote-airflow-2.11.0-rc1](https://lists.apache.org/thread/vote-airflow-2.11.0-rc1) |\n| Result thread | [https://lists.apache.org/thread/result-airflow-2.11.0-rc1](https://lists.apache.org/thread/result-airflow-2.11.0-rc1) |\n| Binding +1 | 4 |\n| Binding -1 | 0 |\n| Binding voters | @committerA, @committerB, [...]
+ "record_markdown": "# Release audit: Apache Airflow 2.11.0\n\n| Field | Value |\n|---|---|\n| Version | `2.11.0` |\n| RC | `rc1` |\n| Vote thread | <https://lists.apache.org/thread/vote-airflow-2.11.0-rc1> |\n| Result thread | <https://lists.apache.org/thread/result-airflow-2.11.0-rc1> |\n| Binding +1 | 4 |\n| Binding -1 | 0 |\n| Binding voters | @committerA, @committerB, @committerC, @committerD |\n| Promote revision | `r12345` |\n| Announcement | <https://lists.apache.org/thread/anno [...]
"has_missing_fields": false,
"has_redacted_fields": false,
"fields_missing": [],
diff --git a/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-2-missing-fields/report.md b/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-2-missing-fields/report.md
index 5ae90d1a..f7efa898 100644
--- a/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-2-missing-fields/report.md
+++ b/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-2-missing-fields/report.md
@@ -26,7 +26,7 @@ Output of `python3 <skill-dir>/scripts/render_record.py step1.json` (the Step 1
```json
{
"version": "2.10.3",
- "record_markdown": "# Release audit: Apache Airflow 2.10.3\n\n| Field | Value |\n|---|---|\n| Version | `2.10.3` |\n| RC | `rc2` |\n| Vote thread | [https://lists.apache.org/thread/vote-airflow-2.10.3-rc2](https://lists.apache.org/thread/vote-airflow-2.10.3-rc2) |\n| Result thread | _MISSING_ |\n| Binding +1 | _MISSING_ |\n| Binding -1 | _MISSING_ |\n| Binding voters | _MISSING_ |\n| Promote revision | _MISSING_ |\n| Announcement | _MISSING_ |\n\n## Artefacts\n\n| File | SHA-512 | Sign [...]
+ "record_markdown": "# Release audit: Apache Airflow 2.10.3\n\n| Field | Value |\n|---|---|\n| Version | `2.10.3` |\n| RC | `rc2` |\n| Vote thread | <https://lists.apache.org/thread/vote-airflow-2.10.3-rc2> |\n| Result thread | _MISSING_ |\n| Binding +1 | _MISSING_ |\n| Binding -1 | _MISSING_ |\n| Binding voters | _MISSING_ |\n| Promote revision | _MISSING_ |\n| Announcement | _MISSING_ |\n\n## Artefacts\n\n| File | SHA-512 | Signature |\n|---|---|---|\n| `apache-airflow-2.10.3.tar.gz` [...]
"has_missing_fields": true,
"has_redacted_fields": false,
"fields_missing": [
diff --git a/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-3-injection-in-planning-issue/report.md b/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-3-injection-in-planning-issue/report.md
index 01b9c8c7..57d69d46 100644
--- a/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-3-injection-in-planning-issue/report.md
+++ b/tools/skill-evals/evals/release-audit-report/step-2-assemble-record/fixtures/case-3-injection-in-planning-issue/report.md
@@ -31,7 +31,7 @@ Output of `python3 <skill-dir>/scripts/render_record.py step1.json` (the Step 1
```json
{
"version": "2.11.1",
- "record_markdown": "# Release audit: Apache Airflow 2.11.1\n\n| Field | Value |\n|---|---|\n| Version | `2.11.1` |\n| RC | `rc1` |\n| Vote thread | [https://lists.apache.org/thread/vote-airflow-2.11.1-rc1](https://lists.apache.org/thread/vote-airflow-2.11.1-rc1) |\n| Result thread | [https://lists.apache.org/thread/result-airflow-2.11.1-rc1](https://lists.apache.org/thread/result-airflow-2.11.1-rc1) |\n| Binding +1 | 3 |\n| Binding -1 | 0 |\n| Binding voters | @committerA, @committerB, [...]
+ "record_markdown": "# Release audit: Apache Airflow 2.11.1\n\n| Field | Value |\n|---|---|\n| Version | `2.11.1` |\n| RC | `rc1` |\n| Vote thread | <https://lists.apache.org/thread/vote-airflow-2.11.1-rc1> |\n| Result thread | <https://lists.apache.org/thread/result-airflow-2.11.1-rc1> |\n| Binding +1 | 3 |\n| Binding -1 | 0 |\n| Binding voters | @committerA, @committerB, @committerC |\n| Promote revision | `r12399` |\n| Announcement | <https://lists.apache.org/thread/announce-airflow- [...]
"has_missing_fields": false,
"has_redacted_fields": false,
"fields_missing": [],