Skip to content

feat(cli): construct-aware location validation (#433) - #575

Merged
dan-petty merged 4 commits into
release/v0.2.23from
feat/433-construct-aware-location-validation
Sep 25, 2026
Merged

dan-petty merged 4 commits into
release/v0.2.23from
feat/433-construct-aware-location-validation

Conversation

@dan-petty

Copy link
Copy Markdown
Owner

Summary

Resolves #433.

Implements construct-aware location validation in the review verification pipeline:

  1. Schema & Model Updates:
    • Added relocated_from field to Finding in devops_cli.ai.review_schema to record original location on relocation.
    • Updated _merge_two_findings to preserve relocated_from.
  2. Construct Validation Engine:
    • Implemented devops_cli.ai.review.construct_validator (AstConstruct, collect_ast_constructs, extract_finding_construct_candidates, validate_construct_location).
    • Extracts candidate constructs (symbols, calls, decorators, assignments, literals) cited in finding titles and descriptions.
    • Verifies whether the cited file span actually contains the construct in AST or line text.
    • On mismatch, attempts relocation by AST symbol search and text matching, updating Finding.location and recording Finding.relocated_from.
    • Invalidates the finding with status="INVALIDATED" only when the cited construct is absent from the file entirely.
  3. Pipeline Integration:
    • Integrated validate_construct_location into _deterministic_pre_verification immediately following code file boundary checks.
  4. Testing & Invariants:
    • Added comprehensive test suite in tests/test_construct_aware_location.py with structural tuple equality assertions.
    • Maintained cyclomatic complexity M <= 10 and depth <= 5 project-wide.

Verification

  • uv run devops ci: All 10 gates passed (100%).
  • tests/test_construct_aware_location.py: 12 passed.
  • tests/test_review_verification.py: 84 passed.
  • tests/test_review_pipeline.py: 28 passed.

@dan-petty dan-petty added this to the v0.2.23 milestone Sep 25, 2026
@dan-petty
dan-petty merged commit 743aac2 into release/v0.2.23 Sep 25, 2026
7 checks passed
@dan-petty
dan-petty deleted the feat/433-construct-aware-location-validation branch September 25, 2026 12:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant