Expand unit test coverage across all scripts
Merged
TO
2mo ago+764+764+012345678901234567890123456789-1-1-0123456789
Summary
- Fills in
main()/argparse paths and error branches forpackage_plugin.py(60% -> 98%),gen_spec.py(56% -> 99%),format_json.py(68% -> 97%) - Extends
check_repo_consistency.py,release_transaction.py,validate_manifest.pytest coverage - Wires
coverage.pyinto therepo-safety.ymlvalidatejob — informational only, reports to the job summary, no--fail-undergate
Test plan
-
python3 -m unittest discover -s scripts -p "test_*.py" -v— 111 tests, all green -
python3 -m compileall -q scripts— clean
Summary by cubic
Expands unit test coverage across all scripts and prevents package_plugin.py from overwriting an existing archive. CI now runs tests under pinned coverage and appends a coverage report to the job summary.
-
Tests
- Exercise main()/argparse and error paths for
package_plugin.py,gen_spec.py,format_json.py,check_repo_consistency.py,release_transaction.py, andvalidate_manifest.py. - Add edge-case checks: README/manifest mismatches and malformed lines; JSON primitive formatting and multi-file exit codes; packaged-asset parsing, hash verification, and missing assets; release tag_name mismatches, upload guards, finalize checks, and fail-fast when
GITHUB_OUTPUTis unset; manifest target selection and exclusions; Windows zip contents and deterministic archives. - Restore ADR‑0001 fork identity and commit-snapshot validation; split active-list validation into empty vs non-list cases to cover both branches.
- Exercise main()/argparse and error paths for
-
Operational notes
- Packaging behavior change: previously overwrote existing archives; now exits with status 1 if the output file exists. If you rely on overwriting, delete the old file first.
- CI installs pinned
coverage==7.15.4, runs tests withcoverage run, and writescoverage report -mto$GITHUB_STEP_SUMMARY(informational only). Adds.coverageand/.claude/worktreesto.gitignore.