|
161 | 161 | `Vec<(PathBuf, String)>` BEFORE applying the cap) and tree-sitter |
162 | 162 | parse trees, NOT lexical similarity. Lexical fixes only show up on |
163 | 163 | repos with many fragments + dense term overlap. |
| 164 | + |
| 165 | +## Local pre-commit Environment |
| 166 | + |
| 167 | +- Repo uses `.venv/bin/python`. `pip install -e .` and `maturin develop` |
| 168 | + must be invoked via `python -m pip` and `python -m maturin` (or after |
| 169 | + `source .venv/bin/activate`); `maturin` from homebrew installs into the |
| 170 | + wrong env and `_diffctx` won't be importable |
| 171 | +- `import-linter` pre-commit hook depends on `treemapper` being importable |
| 172 | + from the venv — requires `_diffctx` to be built (`maturin develop --release |
| 173 | + --features python`). Don't `SKIP=lint-imports` — fix the env. |
| 174 | +- `name-tests-test` hook treats every `tests/**/*.py` as a candidate test |
| 175 | + and demands `test_*.py` naming. Add fixture dirs to its `exclude:` regex |
| 176 | + in `.pre-commit-config.yaml`. Currently excluded: `diffctx/tests/fixtures/garbage/.*\.py` |
| 177 | + |
| 178 | +## Cargo features and `dep:` syntax |
| 179 | + |
| 180 | +- Optional tree-sitter grammars are split into `lang-core` (top-15) and |
| 181 | + `lang-extra` (long-tail) features in `diffctx/Cargo.toml`. Default is |
| 182 | + `["lang-core", "lang-extra"]` so `cargo build` is unchanged |
| 183 | +- **WATCH OUT**: `feature = ["dep:tree-sitter-X"]` SUPPRESSES the auto-feature |
| 184 | + named `tree-sitter-X`. `#[cfg(feature = "tree-sitter-X")]` will then |
| 185 | + evaluate to false and the language won't load. Use bare names without |
| 186 | + `dep:` so the auto-feature is preserved |
| 187 | +- Adding a new grammar: bump optional dep in `[dependencies]`, append to the |
| 188 | + matching feature list (`lang-core` or `lang-extra`) WITHOUT `dep:` prefix, |
| 189 | + add `#[cfg]`-gated insert in `tree_sitter_strategy.rs::LANGUAGE_CACHE` |
| 190 | + |
| 191 | +## actionlint context restrictions |
| 192 | + |
| 193 | +- `${{ env.X }}` is BANNED inside `env:` blocks at any level (workflow, job, |
| 194 | + step). Available contexts inside `env:` are: github, inputs, matrix, |
| 195 | + needs, secrets, vars |
| 196 | +- Fix: inline literal values, or read `$X` from shell scripts in `run:` (the |
| 197 | + surrounding env vars from outer scope are inherited as shell vars) |
| 198 | + |
| 199 | +## SonarCloud exclusions |
| 200 | + |
| 201 | +- `sonar.exclusions=diffctx/tests/fixtures/garbage/**` — fixture files |
| 202 | + intentionally have unused params (S1172) and dead code; they simulate |
| 203 | + "fake real code" as negative-test distractors |
| 204 | + |
| 205 | +## Cognitive Complexity Backlog |
| 206 | + |
| 207 | +`python:S3776` issues that cross the 15 threshold and weren't refactored in |
| 208 | +this QA pass (touching benchmark code = regression risk on v1 results): |
| 209 | + |
| 210 | +- `benchmarks/baselines/aider_baseline.py:112` (28→15) |
| 211 | +- `benchmarks/baselines/aider_baseline.py:135` (23→15) |
| 212 | +- `benchmarks/baselines/bm25_baseline.py:41` (32→15) |
| 213 | +- `benchmarks/aggregate_sweep.py:100` (23→15) |
| 214 | +- `benchmarks/adapters/multi_swebench.py:100` (17→15) |
| 215 | +- `benchmarks/diffctx_eval_fn.py:70` (18→15) |
| 216 | +- `benchmarks/adapters/evaluator.py:49` (32→15) |
| 217 | +- `scripts/bake_bench_cache.py:72` (16→15) |
| 218 | + |
| 219 | +Tactic from earlier passes (already in this file): extract `_collect_result` |
| 220 | +helpers and `_print_*_header`/`_print_*_dump` blocks. Pair with v2 evaluation |
| 221 | +re-run so any drift is caught. |
0 commit comments