Repository navigation
Fix #40: --version flag; Fix #2: JUnit XML output - #81
Conversation
- app/__init__.py: single __version__ = "1.1.0" source of truth - cli.py: --version prints "kaaval 1.1.0", exits before subcommand check - main.py: FastAPI app version + /health endpoint now read __version__ instead of two separate hardcoded "1.0.0" strings (the stale hardcode kaaval#40 called out) - cli.py: --output junit emits JUnit XML via _finding_rows (the same normalized-row helper SARIF already uses) so GitLab CI / Jenkins render findings in their native test-report panes; a clean scan emits one passing testcase instead of an empty suite Verified locally (python3.11 venv, real deps installed, not assumed): - `python -m app.cli --version` -> "kaaval 1.1.0", exit 0 - `--output junit` against hack/dev/rbac-fixtures.yaml -> 20 real findings as 20 <failure> testcases, well-formed (parsed back with xml.etree.ElementTree) - `--output junit` against a clean manifest -> 1 passing testcase, tests="1" failures="0" Co-Authored-By: Claude <[email protected]> Signed-off-by: KK Nkama <[email protected]>
|
Merged the lesson from #45 straight into the next one, @rrskris 🙏 #40 and #2 are both done — this PR.
Same discipline as last time — I didn't just say it works. I had a second, independent model (Codex) check it from scratch, with no access to my reasoning, just the branch. It reproduced everything itself and landed on the same result — and along the way it caught something I'd missed: One thing before you review: I noticed #2 is still assigned to @Garifallos from a couple weeks back, with no PR from them yet. I don't want to step on that — happy to have this PR stand as reference/backup if they're still working on it, or happy for it to just land if they've moved on. Your call, whichever's kinder to everyone's time. |
rrskris
left a comment
There was a problem hiding this comment.
Verified locally, not just read: kaaval --version → kaaval 1.1.0 exit 0; --output junit against hack/dev/rbac-fixtures.yaml → 20 findings as well-formed <failure> testcases (parsed back with ElementTree); clean manifest → tests="1" failures="0" single passing case — the empty-suite-looks-broken guard is a thoughtful touch. Single-sourcing the version and catching the stale 1.0.0 in both main.py spots was exactly what #40 wanted. Full suite green at 62.59% coverage.
One gap, and it's on the house: no shape tests for the new emitter — SARIF and PolicyReport each have one, and JUnit deserves the same lock. Merging now and pushing the two tests (junit shape + --version) as a follow-up credited to this PR, so the next change to _finding_rows can't silently break your output. Two solid issues closed in one PR — thanks @donkk11. 🎉
Follow-up to #81 as promised in review: locks the JUnit emitter's shape (testsuite counts, classname prefix, failure message/body, clean-scan single passing case) and the single-sourced --version output, matching the coverage SARIF and PolicyReport already have. Credits @donkk11 in the changelog. Signed-off-by: Vamshi Krishna Santhapuri <[email protected]>
The architecture diagram still labelled SARIF as "(#1, in review)" and JUnit XML as "(#2)", and the CI-integration roadmap paragraph listed both plus the scan-diff endpoint as planned. All three have shipped (#10/#56, #81, #82). Also fixes two stale references found while verifying the above: - the `--output` flag table omitted `sarif` and `junit`, though the CLI has accepted both for several releases (`app/cli.py` choices) - `docs/api.md` did not document `GET /rbac/scan/diff` at all Prometheus /metrics (#3) and the Helm chart (#8) remain the open roadmap items, so they stay under "planned next". Signed-off-by: Vamshi Krishna Santhapuri <[email protected]>
Summary
kaaval --versionnow prints a real version, sourced from one place (app/__init__.py's__version__). Also fixes the stale hardcoded"1.0.0"inmain.py(FastAPI app +/healthendpoint) the issue called out — both now read the same constant.--output junitemits JUnit XML, built on the same_finding_rowsnormalizer SARIF already uses. A clean scan emits one passing<testcase>rather than an empty suite (avoids the report looking broken in CI).Verified (not assumed)
Ran locally against a real python3.11 venv with the actual dependencies installed:
python -m app.cli --version→kaaval 1.1.0, exit 0--output junitagainsthack/dev/rbac-fixtures.yaml→ 20 real findings as 20<failure>testcases; parsed back withxml.etree.ElementTreeto confirm well-formed XML--output junitagainst a clean manifest → 1 passing testcase,tests="1" failures="0"Test plan
🤖 Generated with Claude Code