You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the deferred exit-code contract tests for the extracted github-agile scripts (#165). Their behavior was validated by hand each time a skill workflow ran end-to-end; these tests pin the documented exit codes so argument-handling, exit-code, or guarded-sequence drift can't slip through unnoticed.
What's here
tests/test_github_agile_scripts.py — 35 network-free tests, one TestCase per script, covering a success path plus every documented non-zero exit for all 8 scripts (make-workdir, post-issue-comment, sync-base-branch, list-open-milestones, list-sub-issues, label-create, label-audit, bump-and-tag).
Hyphenated scripts are loaded by path via importlib; subprocess.run is mocked in-process with ordered fake results; the CWD-dependent label-audit runs inside a temp dir. No network, no live gh/git.
Pins the subtle contracts too: label-create's warn-and-continue (a failed label still exits 0), sync-base-branch's dirty-tree (1) vs. git-failure (2) split, and list-open-milestones' open-only filtering.
skills/github-agile/scripts/bump-and-tag.py — docstring fix: the documented 4 bad arguments exit was unreachable (the script uses argparse with required=True, which exits 2 on bad args and never returns 4). Removed the phantom 4 and documented argparse's real behavior. No functional change; the bump-and-tag test pins the actual SystemExit code 2.
Test plan
make test → 163 tests, OK (128 existing + 35 new; the new file is auto-discovered by the test_*.py pattern, no Makefile change).
make check → passes (sync.py --validate, permissions, command-shape).
Scope: tests/test_github_agile_scripts.py (new) + bump-and-tag.py docstring fix. make test → 163 passing; make check green. No sensitive-area surfaces (test code + docstring) — sensitive-area gate not triggered. No correctness issues: the mocks feed ordered subprocess.run results and each test asserts the real returned exit code.
[NOTE]tests/test_github_agile_scripts.py — bump-and-tag.py's fallback path (tag missing after bump → create annotated git tag -a, exit 3 if that fails) isn't exercised; tests cover only the tag-present branch. The ticket asks for one test per documented exit code, and exit 3 is covered via the push-failure case, so this is complete as specced — noting the untested branch for a future hardening pass.
[NOTE]tests/test_github_agile_scripts.py:~95 — __import__("shutil").rmtree(...) in addCleanup would read cleaner as a top-level import shutil. Cosmetic.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the deferred exit-code contract tests for the extracted
github-agilescripts (#165). Their behavior was validated by hand each time a skill workflow ran end-to-end; these tests pin the documented exit codes so argument-handling, exit-code, or guarded-sequence drift can't slip through unnoticed.What's here
tests/test_github_agile_scripts.py— 35 network-free tests, oneTestCaseper script, covering a success path plus every documented non-zero exit for all 8 scripts (make-workdir,post-issue-comment,sync-base-branch,list-open-milestones,list-sub-issues,label-create,label-audit,bump-and-tag).importlib;subprocess.runis mocked in-process with ordered fake results; the CWD-dependentlabel-auditruns inside a temp dir. No network, no livegh/git.label-create's warn-and-continue (a failed label still exits 0),sync-base-branch's dirty-tree (1) vs. git-failure (2) split, andlist-open-milestones' open-only filtering.skills/github-agile/scripts/bump-and-tag.py— docstring fix: the documented4 bad argumentsexit was unreachable (the script usesargparsewithrequired=True, which exits 2 on bad args and never returns 4). Removed the phantom4and documented argparse's real behavior. No functional change; thebump-and-tagtest pins the actualSystemExitcode 2.Test plan
make test→ 163 tests, OK (128 existing + 35 new; the new file is auto-discovered by thetest_*.pypattern, no Makefile change).make check→ passes (sync.py --validate, permissions, command-shape).Closes #165