strix/tests
seanturner83 a93d9d5de7 feat(report): SARIF 2.1.0 emitter for CI / code-scanning integration (#626)
* feat(report): SARIF 2.1.0 emitter for CI / code-scanning integration

Strix emits CSV + markdown + JSON but no SARIF, so findings can't feed
GitHub code-scanning, an ASPM, or any SARIF-consuming CI gate. Add a
stdlib-only emitter (strix/report/sarif.py) and always write findings.sarif
from ReportState._save_artifacts, beside the existing artifacts.

Design invariants (learned from running this in production):
- Stable partialFingerprints.primaryLocationLineHash per finding, so a
  re-scan that re-words a title doesn't churn code-scanning alert IDs.
- Class/category hashing so the same vuln class maps to a stable ruleId
  across scans rather than drifting.
- Findings with no code location anchor to SECURITY.md with a synthetic
  location marker instead of being silently dropped.
- Always emit (even with zero findings) so a clean re-scan overwrites a
  stale findings.sarif and code-scanning auto-resolves fixed alerts.
- tool.driver.version reports the strix package version.
- Fully isolated in its own try/except: a SARIF build error must never
  break the CSV/MD/run-record path.

Verified end-to-end on v1.0.4 against a SQLi/cmd-inj/weak-hash fixture:
3 findings -> valid SARIF 2.1.0, 3 results, real code locations, distinct
per-finding fingerprints.


* fix(report): complete SARIF code scanning metadata

---------
Co-authored-by: bearsyankees <bearsyankees@gmail.com>
2026-07-03 10:43:31 -04:00
..
__init__.py Add configurable token / cost usage limits (#576) 2026-06-22 11:17:08 -04:00
test_config_loader.py test: add unit tests for config loader (strix/config/loader.py) (#596) 2026-06-30 04:31:29 -07:00
test_cost_tracking.py fix: report cost for streamed OpenRouter calls (#634) 2026-07-03 00:10:28 -04:00
test_execution.py Add configurable token / cost usage limits (#576) 2026-06-22 11:17:08 -04:00
test_hooks.py Add configurable token / cost usage limits (#576) 2026-06-22 11:17:08 -04:00
test_inputs.py fix(core): collapse child agent initial input into a single user message (#589) 2026-06-29 06:51:47 -07:00
test_local_sources.py Support large target repos with with bind-mount option. (#577) 2026-06-22 12:41:42 -04:00
test_notes.py fix: avoid note ID collisions (#630) 2026-07-02 22:54:44 -04:00
test_runner_rate_limit.py fix: stop gracefully with resume hint on persistent RateLimitError (#261) (#593) 2026-06-29 07:31:54 -07:00
test_sarif.py feat(report): SARIF 2.1.0 emitter for CI / code-scanning integration (#626) 2026-07-03 10:43:31 -04:00
test_session_entries.py Support large target repos with with bind-mount option. (#577) 2026-06-22 12:41:42 -04:00
test_state_repo_context.py feat(report): SARIF 2.1.0 emitter for CI / code-scanning integration (#626) 2026-07-03 10:43:31 -04:00