feat(cli): SARIF surface for .own flow diagnostics (check --format sarif)#165
Conversation
…rif) The C# extractor path emits SARIF via ownir.build_sarif; the .own flow diagnostics had no SARIF surface, so their structured Diagnostic.evidence (acquire->escape / move->use / leak acquire site) reached only the human `check` render, never GitHub code scanning. Add ownlang/diag_sarif.py: it maps each Diagnostic to a SARIF 2.1.0 result and projects its evidence through the shared ownlang.evidence builders (relatedLocations + ordered codeFlows) — the same vocabulary the OwnIR path speaks. Wire it to `check --format sarif` (human default). --format is relaxed from ownir-only to also accept human|sarif on check; github/msbuild stay ownir-only (they render a Finding, not a Diagnostic), and --severity/--verbosity stay ownir-only. Adds tests/test_diag_sarif.py (log shape, evidence->relatedLocations+codeFlows, empty-evidence carries neither, no empty artifactLocation.uri, severity->level) folded into run_tests.py, plus a docs/notes/sarif-export.md section. Realizes execution-surfaces ADR §3.1. No analyzer semantics change. Gate green: run_tests, ruff, mypy ownlang; no new type: ignore.
|
Warning Review limit reached
Next review available in: 10 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@coderabbitai review New surface —
Generated by Claude Code |
🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
gh pr view 165 --repo PhysShell/Own.NET --json title,body,files -q '.files[].path'
echo "---DIFF---"
gh pr diff 165 --repo PhysShell/Own.NETLength of output: 19336 🏁 Script executed: #!/bin/bash
set -euo pipefail
cd $(mktemp -d)
gh repo clone PhysShell/Own.NET . -- -q
git fetch origin pull/165/head:pr165 -q
git checkout pr165 -q
echo "---evidence.py---"
cat -n ownlang/evidence.py
echo "---diagnostics.py (relevant parts)---"
sed -n '1,80p' ownlang/diagnostics.py
echo "---search Evidence class---"
rg -n "class Evidence" -A 15 ownlang/diagnostics.py
echo "---search resource_kind---"
rg -n "resource_kind" ownlang/diagnostics.pyLength of output: 11660 🏁 Script executed: #!/bin/bash
set -euo pipefail
cd $(mktemp -d)
gh repo clone PhysShell/Own.NET . -- -q
git fetch origin pull/165/head:pr165 -q
git checkout pr165 -q
sed -n '1,60p' ownlang/__main__.py
echo "---main func full---"
sed -n '360,470p' ownlang/__main__.pyLength of output: 7617 🏁 Script executed: #!/bin/bash
set -euo pipefail
cd $(mktemp -d)
gh repo clone PhysShell/Own.NET . -- -q
git fetch origin pull/165/head:pr165 -q
git checkout pr165 -q
sed -n '80,110p' ownlang/__main__.py
rg -n "_FORMATS|_SEVERITIES|_VERBOSITY" ownlang/__main__.pyLength of output: 2103 This all checks out well — the implementation is solid. Confirmed:
One minor observation (not a blocker): Everything else — schema/version, driver/rules shape, per-result ✅ Action performedReview finished.
|
|
Codex Review: Didn't find any major issues. You're on a roll. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
Что и зачем
Продолжение execution-surfaces ADR (§3.1). Follow-up к #164: там evidence подключилась к flow-анализу, но доходила только до human-вывода
check. SARIF был лишь для C#/OwnIR-пути (ownir --format sarifнадownir.Finding), поэтому.own-диагностики попадали в GitHub code scanning без evidence.Добавляет
ownlang/diag_sarif.py: маппит каждыйDiagnosticв SARIF 2.1.0resultи проецирует егоevidenceчерез те же билдерыownlang.evidence(related_locations+ упорядоченныйcode_flow) — тот же словарьrelatedLocations/codeFlows, что и OwnIR-путь. Подключено кcheck --format sarif(human по умолчанию).github/msbuildостаются ownir-only (это per-finding рендерерыFinding, неDiagnostic);--severity/--verbosityтоже ownir-only. Семантику анализатора не меняли.Тип изменения
Как проверено
python tests/run_tests.py— зелёный (добавленtests/test_diag_sarif.py: log-shape, evidence→relatedLocations+codeFlows, empty-evidence без ключей, no-empty-artifactLocation.uri, severity→level; свёрнут в аггрегатор)ruff check .иmypy— чисто (incl. новый модуль), без новых# type: ignorecheck f.own --format sarif(OWN015/OWN001), exit-коды, отклонение--format github/--severityнаcheck,--format=equals-форма, dispatch остальных командСвязанные issue
Нет связанного issue. Follow-up к #164 (execution-surfaces ADR).
Чеклист
tests/test_diag_sarif.pydocs/notes/sarif-export.md(секция про.ownflow-diagnostic SARIF) + usage в__main__docstringfeat:)🤖 Generated with Claude Code
Generated by Claude Code