|
| 1 | +--- |
| 2 | +name: ci-failure-debugging |
| 3 | +description: > |
| 4 | + Debug and fix failing CI validation checks for this Python project. |
| 5 | + Use when asked to fix CI failures, debug failing PR checks, fix pylint/mypy/black/cspell/pytest errors, |
| 6 | + or when a PR validation workflow fails. |
| 7 | +--- |
| 8 | + |
| 9 | +# CI Failure Debugging |
| 10 | + |
| 11 | +This project's PR validation runs the following checks on Python 3.10–3.14. To debug failures, identify which step failed and follow the corresponding section below. |
| 12 | + |
| 13 | +## Step 1: Identify the failing check |
| 14 | + |
| 15 | +The validation workflow runs these steps in order: |
| 16 | + |
| 17 | +1. **black** — code formatting |
| 18 | +2. **pylint** — static analysis |
| 19 | +3. **mypy** — type checking (strict mode) |
| 20 | +4. **cspell** — spell checking |
| 21 | +5. **pytest** — unit tests with coverage |
| 22 | +6. **pylint (samples/tests)** — lint samples and tests with relaxed rules |
| 23 | + |
| 24 | +## Step 2: Reproduce locally |
| 25 | + |
| 26 | +Set up the environment first: |
| 27 | + |
| 28 | +```bash |
| 29 | +python -m pip install -e ".[dev,test]" |
| 30 | +``` |
| 31 | + |
| 32 | +Then run the specific failing check: |
| 33 | + |
| 34 | +| Check | Command | Notes | |
| 35 | +|-------|---------|-------| |
| 36 | +| pylint | `pylint featuremanagement` | | |
| 37 | +| black | `black --check featuremanagement` | Use `black featuremanagement` to auto-fix | |
| 38 | +| mypy | `mypy featuremanagement` | Uses `strict = True` from `mypy.ini` | |
| 39 | +| cspell | `npx cspell "**"` | Config in `cspell.config.yaml`, custom words in `project-words.txt` | |
| 40 | +| pytest | `pytest tests --doctest-modules --cov-report=xml --cov-report=html` | | |
| 41 | +| pylint (samples) | `pylint --disable=missing-function-docstring,missing-class-docstring samples tests` | Requires `python -m pip install -r samples/requirements.txt` | |
| 42 | + |
| 43 | +## Step 3: Fix the issue |
| 44 | + |
| 45 | +### pylint failures |
| 46 | + |
| 47 | +- Run `pylint featuremanagement` and fix reported issues. |
| 48 | +- Do NOT add `# pylint: disable` comments unless absolutely necessary. |
| 49 | +- Do NOT add new imports or dependencies to fix warnings. |
| 50 | +- The project disables `duplicate-code` in `pyproject.toml`. |
| 51 | +- Max line length is 120. Min public methods is 1. Max branches is 20. Max returns is 7. |
| 52 | + |
| 53 | +### black failures |
| 54 | + |
| 55 | +- Run `black featuremanagement` to auto-format. Line length is 120 (configured in `pyproject.toml`). |
| 56 | +- If CI uses `black --check`, it means files need reformatting — run `black` locally to fix. |
| 57 | + |
| 58 | +### mypy failures |
| 59 | + |
| 60 | +- Run `mypy featuremanagement`. The project uses `strict = True` with Python 3.10 target. |
| 61 | +- All functions must have type annotations. |
| 62 | +- Use `Optional[X]` or `X | None` for nullable types. |
| 63 | +- Check `mypy.ini` for the full configuration. |
| 64 | + |
| 65 | +### cspell failures |
| 66 | + |
| 67 | +- Misspelled words: fix the typo in your code. |
| 68 | +- Legitimate technical terms: add the word to `project-words.txt` (one word per line, alphabetically sorted). |
| 69 | +- Do NOT modify `cspell.config.yaml` unless adding a new ignore path. |
| 70 | + |
| 71 | +### pytest failures |
| 72 | + |
| 73 | +- Run `pytest tests` to reproduce. |
| 74 | +- Sync tests: `tests/test_*.py` |
| 75 | +- Async tests: `tests/test_*_async.py` (use `pytest-asyncio`) |
| 76 | +- Time window filter tests: `tests/time_window_filter/` |
| 77 | +- Telemetry tests: `tests/test_send_telemetry_appinsights.py` |
| 78 | +- If adding new code, ensure both sync and async tests exist where applicable. |
| 79 | + |
| 80 | +### pylint (samples/tests) failures |
| 81 | + |
| 82 | +- This step runs with `--disable=missing-function-docstring,missing-class-docstring`. |
| 83 | +- Requires sample dependencies: `python -m pip install -r samples/requirements.txt`. |
| 84 | +- Fix any remaining pylint issues in `samples/` and `tests/` directories. |
0 commit comments