|
| 1 | +# Contributing |
| 2 | + |
| 3 | +Thanks for your interest in contributing. This is an active research |
| 4 | +codebase — we welcome bug reports, fixes, and small enhancements that |
| 5 | +fit the project's scope. For larger changes, please open an issue |
| 6 | +first to discuss design. |
| 7 | + |
| 8 | +## Scope |
| 9 | + |
| 10 | +The project is the supporting code for a 3-paper research cascade |
| 11 | +(EWRL 2026 → NeurIPS 2026 workshop → TMLR). Contributions that align |
| 12 | +with the cascade are most likely to be merged: |
| 13 | + |
| 14 | +- Bug fixes in any layer |
| 15 | +- Reproducibility improvements (deterministic seeding, environment hygiene) |
| 16 | +- Test coverage on under-tested code paths |
| 17 | +- Documentation accuracy fixes |
| 18 | +- New observation treatments, reward strategies, or callbacks that |
| 19 | + don't break the existing pre-registered protocol |
| 20 | +- Performance improvements that don't change behaviour |
| 21 | + |
| 22 | +Out of scope without prior discussion: |
| 23 | + |
| 24 | +- Changes that alter the pre-registered analysis plan |
| 25 | + ([`paper/analysis_plan.md`](paper/analysis_plan.md)) |
| 26 | +- Changes to the 18 pre-registered event flags |
| 27 | + ([`pokemon_red_ai/game/event_flags.py`](pokemon_red_ai/game/event_flags.py)) |
| 28 | +- New reward components that retroactively affect already-completed runs |
| 29 | + |
| 30 | +## Development setup |
| 31 | + |
| 32 | +```bash |
| 33 | +git clone https://github.com/amcheste/pokemon-red-ai.git |
| 34 | +cd pokemon-red-ai |
| 35 | +python3 -m venv venv && source venv/bin/activate |
| 36 | +pip install -e . |
| 37 | +pip install -r requirements.txt |
| 38 | +``` |
| 39 | + |
| 40 | +Run the test suite: |
| 41 | + |
| 42 | +```bash |
| 43 | +./venv/bin/python3 -m pytest # full suite (~17s) |
| 44 | +./venv/bin/python3 -m pytest tests/unit/ # unit only |
| 45 | +./venv/bin/python3 -m pytest -k comparison # specific module |
| 46 | +``` |
| 47 | + |
| 48 | +All 833 tests should pass on a clean checkout. PRs that drop coverage |
| 49 | +or break tests will not be merged. |
| 50 | + |
| 51 | +## Branch and PR conventions |
| 52 | + |
| 53 | +- **Never commit to `main` or `master`** — always work on a feature |
| 54 | + branch and open a pull request. |
| 55 | +- Branch names: `feature/<short-description>`, `fix/<short-description>`, |
| 56 | + `docs/<short-description>`, `chore/<short-description>`. |
| 57 | +- Open the PR against `main`. PRs are routed to `@amcheste` via |
| 58 | + `CODEOWNERS`; leave the assignee field unset. |
| 59 | +- Keep PRs focused — one logical change per PR. Big mixed-bag PRs |
| 60 | + that combine refactors, features, and docs are hard to review and |
| 61 | + often get split anyway. |
| 62 | +- Include a `Test plan` section in the PR body covering what you ran |
| 63 | + and what you didn't. |
| 64 | + |
| 65 | +## Commit style |
| 66 | + |
| 67 | +- Imperative subject line under 72 characters |
| 68 | + (`Add reward breakdowns to monitoring callback` rather than |
| 69 | + `added reward breakdowns to monitoring callback`). |
| 70 | +- Body explains *why*, not what — the diff explains what. Wrap the |
| 71 | + body at 72 characters. |
| 72 | +- One logical change per commit. |
| 73 | + |
| 74 | +## Code style |
| 75 | + |
| 76 | +- Python 3.10+ |
| 77 | +- Follow the existing module structure (see [`DEVELOPER_GUIDE.md`](DEVELOPER_GUIDE.md)) |
| 78 | +- Type hints on every public function (`Optional[str]`, `Dict[str, Any]`, etc.) |
| 79 | +- Docstrings on every public class and function. Args / Returns |
| 80 | + / Raises sections where applicable. |
| 81 | +- Tests for every behaviour change — both the happy path and the |
| 82 | + obvious failure modes |
| 83 | +- No emojis in code, comments, or documentation unless they're part of |
| 84 | + user-facing CLI output that's intended to be visually distinctive |
| 85 | + |
| 86 | +## Reporting bugs |
| 87 | + |
| 88 | +Use the issue templates under `.github/ISSUE_TEMPLATE/`. At minimum: |
| 89 | + |
| 90 | +- What you expected to happen |
| 91 | +- What actually happened |
| 92 | +- Steps to reproduce (smallest possible example) |
| 93 | +- Versions: Python, the project, key dependencies (PyBoy, SB3, |
| 94 | + Gymnasium, PyTorch) |
| 95 | + |
| 96 | +For training crashes, please include the relevant section of the |
| 97 | +training log and the W&B run URL if applicable. |
| 98 | + |
| 99 | +## Reproducibility expectations |
| 100 | + |
| 101 | +Because this is a research codebase, reproducibility is unusually |
| 102 | +important: |
| 103 | + |
| 104 | +- Use `scripts/seed_utils.py` for any RNG seeding in new code |
| 105 | +- Use `scripts/eval.py` for evaluation results (no ad-hoc eval loops |
| 106 | + in notebooks or scripts) |
| 107 | +- Log every significant training run to |
| 108 | + [`paper/compute_ledger.md`](paper/compute_ledger.md) |
| 109 | +- Don't commit secrets (W&B keys, Slack webhooks, ROM files) — the |
| 110 | + `.gitignore` covers the obvious cases but always sanity-check |
| 111 | + `git status` before pushing |
| 112 | + |
| 113 | +## License |
| 114 | + |
| 115 | +By contributing, you agree that your contributions will be licensed |
| 116 | +under the [MIT License](LICENSE), the same license as the rest of the |
| 117 | +project. |
0 commit comments