T-1ZRX-gitignore-plugin-pycache
Status: closed/done · Impact: low · Complexity: small
Auto-generated from a /sdlc:task-work post-mortem. Review and
promote to open/ready before picking up.
Running plugin test scripts (e.g.
python3 plugin/skills/pr-check/test_classify_pr.py) materializes
__pycache__/ directories alongside the source. The compiled
.pyc files embed the original source path inside the bytecode,
which trips path-grep ACs on a clean tree. The implementer of
T-G834-move-plugin-runtime-state-to-sdlc-dir had to clean
the caches and pass --binary-files=without-match to grep just to
get a meaningful AC-1 result. Closing this gap means plugin tests
stop polluting the working tree (or stop polluting it in a way
that confuses text-search ACs).
Two reasonable fixes, pick one
Section titled “Two reasonable fixes, pick one”- Repo-level gitignore: add
plugin/**/__pycache__/to the repo’s.gitignore. Cheapest, but only suppresses tracking — the.pycfiles still sit on disk and still get hit by grep unless--exclude-dir=__pycache__is passed. - Bytecode-free test runs: set
sys.dont_write_bytecode = True(orPYTHONDONTWRITEBYTECODE=1) in plugin test runners. Eliminates the__pycache__/materialization entirely, so grep never has anything to skip.
The post-mortem captures the exact symptom:
__pycache__directories underplugin/scripts/andplugin/skills/pr-check/got created when runningpython3 plugin/skills/pr-check/test_classify_pr.pyand the compiled bytecode’s embedded source path strings tripped AC-1 grep. Required cleanup +--binary-files=without-match. Suggests:plugin/**/__pycache__/should be explicitly gitignored at the plugin level, or test runners should setsys.dont_write_bytecode = True.
Today, neither the repo .gitignore nor any plugin test runner
addresses this. Running plugin tests cold leaves __pycache__/
under plugin/scripts/ and plugin/skills/<any>/ until manually
cleaned.
Proposed
Section titled “Proposed”The simpler fix first: every plugin test entry-point sets
sys.dont_write_bytecode = True at the top of if __name__ == "__main__": (or imports a small shared helper that does so). No
__pycache__/ directories are created during test runs, so
path-grep ACs see only source tree content.
Belt-and-braces: add plugin/**/__pycache__/ to the repo
.gitignore as well, so even an accidentally-bytecode-writing run
doesn’t leak into committed state.
Approach
Section titled “Approach”- Survey every plugin test file (
plugin/**/test_*.py,plugin/**/*test*.py,plugin/**/tests/run_evals.py) for anif __name__ == "__main__":entry-point. - At the top of each entry-point, add
import sys; sys.dont_write_bytecode = Truebefore any other plugin imports. - Add
plugin/**/__pycache__/to the repo.gitignoreunder the appropriate ignore-block header. - Spot-verify by deleting all existing
__pycache__/directories underplugin/, running the test suites, and confirming no new caches are produced.
Files to touch
Section titled “Files to touch”| Location | Kind | Change |
|---|---|---|
plugin/skills/pr-check/test_classify_pr.py | modify | add dont_write_bytecode. |
plugin/skills/task-work/test_dedup_search.py | modify | same. |
plugin/skills/task-work/test_start_task.py | modify | same. |
plugin/skills/task-work/test_check_ancestry.py | modify | same. |
plugin/skills/task-work/test_preflight_permissions.py | modify | same. |
plugin/scripts/test_schema_patterns.py | modify | same. |
plugin/skills/setup/tests/run_evals.py | modify | same. |
plugin/validators/tests/test_validate_sdlc_yaml.py | modify | same. |
| “ | modify | <migrated from v2 — no note recorded> |
.gitignore | modify | add plugin/**/__pycache__/ entry. |
Acceptance criteria
Section titled “Acceptance criteria”- AC-1: After deleting every
__pycache__/underplugin/and running every plugin test entry-point, no new__pycache__/directory exists anywhere underplugin/. - AC-2: A grep AC of the form
grep -rn -E '<pattern>' plugin/returns the same hit count whether or not a fresh test run has happened — i.e. bytecode pollution can no longer change the AC’s verdict.
Out of scope
Section titled “Out of scope”- Migrating plugin tests to pytest or to a proper test runner — the fix is a one-line guard at the entry-point.
Dependencies
Section titled “Dependencies”- none
Discovery context
Section titled “Discovery context”Spawned by /sdlc:task-work post-mortem of T-G834-move-plugin-runtime-state-to-sdlc-dir on 2026-05-22.
Dedup search (spawn-from-post-mortem)
Section titled “Dedup search (spawn-from-post-mortem)”Bullet: pycache directories under plugin/scripts/ and plugin/skills/pr-check/ got created when running python3 plugin/skills/pr-check/test_classify_pr.py and the compiled bytecode embedded source path strings tripped AC-1 grep. Required cleanup + —binary-files=without-match. Suggests: plugin/**/pycache/ should be explicitly gitignored at the plugin level, or test runners should set sys.dont_write_bytecode = True. Keywords searched: dont_write_bytecode, test_classify_pr, without-match, binary-files, directories, explicitly, gitignored, pycache__ Excluded: 2026-05-22-move-plugin-runtime-state-to-sdlc-dir Top candidates (score / status / headline):
- 6 / closed/done / 2026-05-19-add-epic-entity-task-depends-on-dependencies — Add epic entity + task depends_on dependencies
- 4 / closed/done / 2026-05-20-task-work-sub-agent-verdict-contract-clarity — Tighten task-work sub-agent verdict contract so ensure-ready’s READY marker isn’t mistaken for task-work’s final verdict
- 3 / closed/done / 2026-05-19-task-work-emit-completion-marker — task-work emits a final completion marker to signal end-of-flow
- 3 / closed/done / 2026-05-20-orchestrator-categorized-in-flight-limits — Replace orchestrator parallelism cap with categorized in-flight limits configurable in sdlc.yaml
- 3 / closed/done / 2026-05-21-project-local-skill-extension-mechanism — Project-local skill extension / shadowing mechanism Decision: SPAWNED