← Back to Pull requests

feat(ingester): export a counter for submission files that fail preparation #2225

Closed
unknown closed this pull request without merging on Nov 11, 2026 13:53 UTC
View on GitHub
unknown unknown commented on Nov 07, 2026 23:00 UTC
Author

Files that fail JSON decoding or schema validation were only logged and moved to the failed directory, so Grafana could not show them. Add the kcidb_ingestion_failures counter, labelled with reason=json_decode, schema_validation or other.

Increment the counter only after a successful move to failed/. Failed moves leave the file in the spool without counting it again on each retry. Deferred files with log excerpt upload errors remain excluded.

Make origin extraction tolerate malformed submission structures so inputs such as [1] and {"checkouts":["a"]} reach failure handling instead of crashing the worker while logging the error.

Validation: all 61 tests in the ingester test file pass, along with Ruff lint and formatting checks. Regression tests exercise malformed data, successful moves, repeated failed moves, and deferred files.

To reproduce from backend/:

poetry run pytest kernelCI_app/tests/unitTests/commands/monitorSubmissions/kcidbng_ingester_test.py -o addopts='' -p no:rerunfailures -q
poetry run ruff check kernelCI_app/management/commands/helpers/kcidbng_ingester.py kernelCI_app/tests/unitTests/commands/monitorSubmissions/kcidbng_ingester_test.py
poetry run ruff format --check kernelCI_app/management/commands/helpers/kcidbng_ingester.py kernelCI_app/tests/unitTests/commands/monitorSubmissions/kcidbng_ingester_test.py

The test command runs serially with automatic reruns disabled and does not require a running database.

Closes #1505

Diff: 186 lines (+139 / -47) across 2 files Reviewer: nuclearcat Review duration: 5212m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.36) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.36 · 186 lines diff across 2 files
0.36
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
0.17
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
56%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size diff_size
0.313
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #2225"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 56.8% reviewed
Vouch Risk Breakdown
AI-powered review risk analysis
Change Risk
Change Risk · Model 1 (XGBoost)
Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
Score: 35.8% (MEDIUM) · Higher = larger blast radius
35.8%
Review Confidence
Review Confidence · Models 2 & 3
Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
Score: 56.8% · Lower = rushed or shallow review
56.8%
Residual Risk
Residual Risk · Core Equation
Residual = Change × (1 − Confidence)
Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
Score: 15.5% · Safe to merge
15.5%