Skip to content

Commit b0d5eec

Browse files
committed
fix(ci,bench): cross-compile abi3, Windows fcntl import, QA.md notes
- diffctx/Cargo.toml: enable pyo3 abi3-py310 — arm64 cross-compile no longer needs a target python interpreter (was blocking bench-image build at maturin --interpreter python3 lookup) - benchmarks/common.py: defer fcntl import into _bare_repo_lock so Windows test matrix can import patch_files without ModuleNotFoundError - QA.md: document panic=abort/cargo-test interaction, abi3 cross-compile, SonarCloud Bearer auth, recurring rule patterns
1 parent 3ba78bc commit b0d5eec

3 files changed

Lines changed: 43 additions & 2 deletions

File tree

QA.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,34 @@
8888
- Public `api/issues/search?projectKeys=nikolay-e_TreeMapper&statuses=OPEN`
8989
works without auth for OPEN issues. Token only needed for hotspot
9090
state changes / false-positive transitions.
91+
- Token lives in macOS Keychain under service `sonarqube-token` (40 chars).
92+
Auth via `Authorization: Bearer <token>` (NOT basic auth). Use
93+
`--data-urlencode key=value` for hotspot/issue mutations.
94+
- Quality gate ERROR conditions for treemapper after a paper-heavy push are
95+
usually `new_reliability_rating>1` (driven by S3516 BLOCKER bugs) and
96+
`new_security_hotspots_reviewed<100%`. Hotspots are bulk-resolvable in
97+
one loop over `/api/hotspots/search?status=TO_REVIEW` — set Safe with
98+
per-rule comments (S1313 instance-id false positive, S2245 seeded PRNG,
99+
docker S6471 internal image, S7637 tag-pin policy). Hotspots resolved
100+
this way DO clear the gate condition immediately on next refresh.
101+
102+
## SonarCloud Recurring Patterns (paper/benchmark commits)
103+
104+
- `python:S3516` BLOCKER on entry-points and orchestrators: appears when a
105+
function has multiple `return X` statements all of the same name (e.g.
106+
`return results`) — refactor into single tail-return by extracting
107+
per-branch helpers, NOT by collapsing branches.
108+
- `python:S5799` MAJOR (implicit string concat / missing comma): black
109+
often line-splits long f-strings into adjacent literals (`"..." "..."`).
110+
Merge into one literal — keep flake8 / ruff aligned with this rule by
111+
not relying on implicit concat for readability.
112+
- `python:S1244` MAJOR (float `==`): use `pytest.approx`, not `math.isclose`,
113+
because the codebase already imports pytest in every test module.
114+
- `python:S1186` CRITICAL (empty methods): for duck-typed stubs (e.g.
115+
Aider IO interface) add a one-line docstring describing the no-op —
116+
`pass` alone is flagged.
117+
- `python:S1192` CRITICAL (literal duplication ≥3): extract module-private
118+
`_TWO_COL_DIVIDER` style constant; keep adjacent to imports.
91119

92120
## CI Build of Rust Extension
93121

@@ -100,6 +128,15 @@
100128
fail at the build step before any test runs.
101129
- Cache cargo per-(os, python-version) — same cargo target dir compiled with
102130
different Python ABIs collides if the key doesn't include python-version.
131+
- `panic = "abort"` in `[profile.release]` is INCOMPATIBLE with
132+
`cargo test --release` — the test harness force-uses unwind, dependencies
133+
get abort, link fails. Keep abort for production safety but split CI:
134+
`cargo test --lib` (dev profile, harness happy) +
135+
`cargo build --release` + `cargo test --release --test yaml_cases`
136+
(integration tests with `harness = false` work in release).
137+
- Bench Dockerfile that copies `diffctx/Cargo.toml` MUST also copy
138+
`diffctx/tests/` whenever Cargo.toml declares any `[[test]]` entry —
139+
manifest parser validates path before any build step.
103140

104141
## YAML Case Runner (cargo integration test)
105142

benchmarks/common.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import contextlib
4-
import fcntl
54
import json
65
import os
76
import re
@@ -176,6 +175,11 @@ def _git_dir_for_repo(repo_dir: Path) -> Path:
176175

177176
@contextlib.contextmanager
178177
def _bare_repo_lock(cache_dir: Path):
178+
# `fcntl` is POSIX-only; benchmark runners are not supported on Windows,
179+
# but tests that import this module's pure helpers (e.g. `patch_files`)
180+
# must still be importable on win32. Keep the import inside the lock fn.
181+
import fcntl
182+
179183
lock_path = cache_dir / ".bench-worktree.lock"
180184
fd = os.open(str(lock_path), os.O_CREAT | os.O_RDWR, 0o644)
181185
try:

diffctx/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ rustc-hash = "2"
7676
similar = "2"
7777
glob = "0.3"
7878
smallvec = "1"
79-
pyo3 = { version = "0.24", features = ["extension-module"], optional = true }
79+
pyo3 = { version = "0.24", features = ["extension-module", "abi3-py310"], optional = true }
8080

8181
[dev-dependencies]
8282
tempfile = "3"

0 commit comments

Comments
 (0)