fix: date audits from the merge that landed them in audit_priority

audit_priority.py dated a section's audit from its sweep commit, so the `feat: add` commits made right after the sweep counted as changes since that audit and the just-audited section ranked first again.

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Vinta Chen
2026-10-14 23:15:09 +08:00
co-authored by Claude
parent eb06a31d3c
commit c3a4b18db6
@@ -2,8 +2,9 @@
A section's last audit is the newest of: a commit whose subject starts with
`audit: sweep`, `prune: sweep`, or `style: audit` and names the section or its
Thematic Group, and its line under docs/audit-logs.md "Last Audited". Sections
whose entries changed since then come first, most changes first; the rest
Thematic Group, and its line under docs/audit-logs.md "Last Audited". A commit
on a merged branch dates from that merge. Sections whose entries changed since
then come first, most changes first; the rest
follow by oldest audit, never-audited first.
"""
@@ -62,9 +63,13 @@ def main() -> None:
if section not in last or timestamp > last[section][0]:
last[section] = (timestamp, date, rev)
# Branch commit -> the merge that landed it, so an audit's follow-up `feat: add` commits count as audited.
landed = {commit: merge for merge in git("rev-list", "--first-parent", "--merges", f"{REFORM}..HEAD").split() for commit in git("rev-list", f"{merge}^1..{merge}").split()}
unmatched = []
for line in git("log", "--format=%H%x09%ct%x09%cs%x09%s", f"{REFORM}..HEAD").splitlines():
rev, timestamp, date, subject = line.split("\t", 3)
rev = landed.get(rev, rev)
if match := AUDIT_SUBJECT_RE.match(subject):
sections = resolve(match.group(1), names)
for section in sections: