[AAASM-5756] ✨ (scripts): Add --root override and a negative control to check_contact_metadata.py - #327
Conversation
AAASM-5756: threads a --root override through the pyproject.toml/ SECURITY.md sync check so a negative-control test can point it at a tmp_path fixture tree instead of the real repo checkout. Matches the --root precedent already established in check_claim_vocabulary.py. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MrqouPFk9KoAw4DJLrDUDv
…ils on a dropped region AAASM-5756 AC#4: proves scripts/check_contact_metadata.py --check goes red (exit 2) when the SECURITY.md generated region's sentinels are dropped, exit 2 for a duplicated pyproject.toml author email (the fail-closed exactly-one-match guard), and exit 1 for in-region value drift (legacy-domain swap, SLA day-count edit). Uses --root to point the script at a tmp_path fixture copy of the real consumer files. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MrqouPFk9KoAw4DJLrDUDv
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
|
LGTM — merging. Independent review (fresh agent, read-only) verified: `--root` fully redirects every path the script touches (pyproject.toml + SECURITY.md, no fallback to `file` when set); all 6 negative-control test cases construct genuine tmp_path fixtures and assert against the script's real exit-code control flow (traced line-by-line, not trusted); the AC#4 "region entirely removed → gate fails" case is unambiguous; the pyproject duplicate-author "fail-closed count guard" claim is real (verified the regex/count logic); no live-tree mutation; ruff/mypy clean; CI already green. Verdict: ship as-is. Merging via the AAASM-5858 owner-only admin-merge exception: verified fresh as org admin (`Chisanan232`); CI green, no conflicts, no unresolved defect, no REQUEST_CHANGES; the only blocker is same-identity REVIEW_REQUIRED. Merge method: Create a merge commit. |



Description
Adds a
--rootCLI override toscripts/check_contact_metadata.py(the script that syncsSECURITY.mdandpyproject.toml's author email against the pinned canonical org contact-metadata registry), and adds a negative-control test proving the gate fails closed when the generated region is dropped.This is 1 of 4 independent repo-scoped PRs for AAASM-5756 (parent cross-repo ticket). The other three land the equivalent slice in
agent-assembly,node-sdk, and.github. No cross-repo dependency — this PR is self-contained and mergeable on its own.--rootmatches the exact precedent already established byscripts/check_claim_vocabulary.py(parser.add_argument("--root", default=".", help="repository root")→root = Path(args.root).resolve()), adapted to this script's existing--check-only argparse shape (defaultNone, falling back to the existing_repo_root()when omitted so the default in-place-sync/check behavior is unchanged).REGISTRY_SOURCE/CANONICAL).Type of Change
Breaking Changes
Related Issues
Testing
test/unit/test_contact_metadata_negative_control.py, 6 cases, all usingtmp_pathfixture copies of the realSECURITY.md/pyproject.tomldriven through the script's ownmain()via--root.The negative control proves the AC#4 gate-failure property: the parent ticket requires that dropping the generated region unambiguously turns the gate red. Cases and their exit codes (read from the script's own
sys.exit/returnsites, not assumed):SECURITY.md/pyproject.toml)0BEGIN GENERATED: security_contactsentinel removed2ContactDriftError— region not found2.devdomain swapped into the block's email1--check1pyproject.tomlauthor email duplicated to 2 entries2The generated-region-removed → non-zero exit case is the one AC#4 requires to unambiguously exist; it's labeled in the test docstrings.
Verification (all run locally)
Checklist