← Back to Pull requests

add tests for parse_parametrize #219

Closed
unknown closed this pull request without merging on Nov 16, 2026 18:59 UTC
View on GitHub
unknown unknown commented on Nov 15, 2026 10:27 UTC
Author

I think I found a bug in the parametrize logic 🤯🤯

I wrote two test cases where we should get a ValueError, because the keys are not equal. Here is the code:

expected_keys: set[str] = set(sorted(params[0].keys()))
for idx, param in enumerate(params):
    param_keys = set(sorted(param.keys()))
    if expected_keys.intersection(param_keys) != expected_keys:

We check that the other params have the same keys, but we do not check if they have extra keys. My test cases cover this. I recently refactored the logic in this function. Before, it looked like this:

parsed_params: List[Mapping[str, Any]] = []
known_params: Optional[Set[str]] = None
for idx, param in enumerate(params):
    param_keys = set(sorted(param.keys()))
    if not known_params:
        known_params = param_keys
    elif known_params.intersection(param_keys) != known_params:
        raise ValueError(
            "All parametrized entries must have same keys."
            f'First entry is {", ".join(known_params)} but {", ".join(param_keys)} '
            "was spotted at {idx} position",
        )

The logic is the same! Please check this. Maybe I am wrong, but I am ready to fix this bug:

pytest_mypy_plugins/tests/test_logic.py:30: Failed
========================================================================================== short test summary info ==========================================================================================
FAILED pytest_mypy_plugins/tests/test_logic.py::test_parametrized_with_wrong_keys[params0] - Failed: DID NOT RAISE ValueError
FAILED pytest_mypy_plugins/tests/test_logic.py::test_parametrized_with_wrong_keys[params1] - Failed: DID NOT RAISE ValueError

Diff: 228 lines (+171 / -57) across 2 files Reviewer: sobolevn Review duration: 1952m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.37) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.37 · 228 lines diff across 2 files
0.37
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%
60%
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.325
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #219"
general weight: 0.35
Reviewers
Assignees
Unassigned
Labels
risk: low confidence: 60.5% 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: 37.0% (MEDIUM) · Higher = larger blast radius
37.0%
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: 60.5% · Lower = rushed or shallow review
60.5%
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: 14.6% · Safe to merge
14.6%