|
1 | 1 | --- |
2 | 2 | name: verify |
3 | | -description: Run style checks and tests on changed files to verify code quality before committing. |
| 3 | +description: Verify a NeMo Speech change or pull request before commit, push, or review by checking the complete diff, formatting, tests, documentation, and DCO sign-offs. Use when asked to verify changes, prepare a commit or PR, or review a PR's validation and coverage. |
4 | 4 | --- |
5 | 5 |
|
6 | | -Run verification on the current changes: |
| 6 | +Verify the current change proportionally to its risk. Do not report success for checks that were not run. |
| 7 | + |
| 8 | +1. **Establish the complete scope.** Inspect committed, staged, unstaged, and untracked changes: |
7 | 9 |
|
8 | | -1. **Find changed files**: |
9 | 10 | ```bash |
10 | | - git diff --name-only HEAD |
| 11 | + git status --short |
| 12 | + git diff --name-only origin/main...HEAD |
| 13 | + git diff --name-only |
| 14 | + git diff --cached --name-only |
11 | 15 | ``` |
12 | | - Also include any files you've been editing in this session. |
13 | 16 |
|
14 | | -2. **Style check** on each changed Python file or its parent directory: |
| 17 | + Replace `origin/main` if the PR targets another branch. Read the full diff and any applicable nested `AGENTS.md` or `CLAUDE.md` files. |
| 18 | + |
| 19 | +2. **Review tests and documentation.** Before running commands, determine whether the change is adequately covered: |
| 20 | + |
| 21 | + - Require a regression test for a bug fix and focused unit tests for new or changed behavior, including important edge cases. If no test is appropriate, require a concrete explanation. |
| 22 | + - Check whether changes to public APIs, configuration, CLI behavior, examples, or user workflows are reflected in the relevant documentation. If no documentation update is needed, record why. |
| 23 | + |
| 24 | +3. **Run repository checks.** For staged changes, run: |
| 25 | + |
| 26 | + ```bash |
| 27 | + pre-commit run |
| 28 | + ``` |
| 29 | + |
| 30 | + For committed branch changes, run `pre-commit run --from-ref origin/main --to-ref HEAD`. If pre-commit is unavailable, use `uvx pre-commit` for the same command. Review and stage hook fixes, then rerun until clean. Also run `git diff --check`. |
| 31 | + |
| 32 | +4. **Run the smallest relevant tests.** Prefer focused test files or test names while iterating, then expand to the affected collection when practical: |
| 33 | + |
| 34 | + - `nemo/collections/asr/` → `uv run pytest tests/collections/asr -m "not pleasefixme"` |
| 35 | + - `nemo/collections/tts/` → `uv run pytest tests/collections/tts -m "not pleasefixme"` |
| 36 | + - `nemo/collections/audio/` → `uv run pytest tests/collections/audio -m "not pleasefixme"` |
| 37 | + - `nemo/collections/speechlm2/` → `uv run pytest tests/collections/speechlm2 -m "not pleasefixme"` |
| 38 | + - `nemo/collections/common/` → `uv run pytest tests/collections/common -m "not pleasefixme"` |
| 39 | + - `nemo/core/` → `uv run pytest tests/core -m "not pleasefixme"` |
| 40 | + |
| 41 | + Add `--with_downloads` only for tests marked as requiring model downloads. Use `--cpu` when supported and a GPU is unavailable. If documentation changed, install its dependencies with `uv sync --locked --group docs` and build it with `uv run make -C docs html`. |
| 42 | + |
| 43 | +5. **Verify commit sign-offs.** Every commit in the PR must have a DCO `Signed-off-by` trailer: |
| 44 | + |
15 | 45 | ```bash |
16 | | - python setup.py style --scope <path> |
| 46 | + git log --format='%h %s%n%(trailers:key=Signed-off-by)' origin/main..HEAD |
17 | 47 | ``` |
18 | | - If issues are found, fix them with `--fix` and report what changed. |
19 | 48 |
|
20 | | -3. **Run relevant tests** based on which collection was modified: |
21 | | - - `nemo/collections/asr/` → `pytest tests/collections/asr --download -m "not pleasefixme" -v --timeout=300` |
22 | | - - `nemo/collections/tts/` → `pytest tests/collections/tts --download -m "not pleasefixme" -v --timeout=300` |
23 | | - - `nemo/collections/audio/` → `pytest tests/collections/audio --download -m "not pleasefixme" -v --timeout=300` |
24 | | - - `nemo/collections/speechlm2/` → `pytest tests/collections/speechlm2 -m "not pleasefixme" -v --timeout=300` |
25 | | - - `nemo/collections/common/` → `pytest tests/collections/common -m "not pleasefixme" -v --timeout=300` |
26 | | - - `nemo/core/` → `pytest tests/core -m "not pleasefixme" -v --timeout=300` |
| 49 | + Create commits with `git commit -s`. Add a missing trailer to your own latest commit with `git commit --amend --no-edit -s`; do not rewrite other contributors' commits without authorization. |
27 | 50 |
|
28 | | -4. **Report results**: summarize passes and failures. For failures, show relevant error output and suggest fixes. |
| 51 | +6. **Report results.** Summarize the reviewed diff, test-coverage and documentation conclusions, exact commands and outcomes, commit sign-off status, and any skipped checks with reasons. For failures, include the relevant error and a concrete next step. |
0 commit comments