Skip to content

Score tests on the impact path and prefer generated OpenAPI clients - #5

Merged
cursor[bot] merged 3 commits into
mainfrom
cursor/review-accuracy-ccb4
Aug 14, 2026
Merged

Score tests on the impact path and prefer generated OpenAPI clients#5
cursor[bot] merged 3 commits into
mainfrom
cursor/review-accuracy-ccb4

Conversation

@Modsofthenation

@Modsofthenation Modsofthenation commented Aug 14, 2026

Copy link
Copy Markdown
Owner

Why

Merge confidence, N+1, OpenAPI stitching, and Django boot were a little too eager: off-path tests could cover a sink, CharField accesses looked like relations, string fetch competed with generated clients, weak churn notes could knock HIGH down to MEDIUM, and django.setup() mutated the reviewer process.

What changed

  • Confidence counts TESTED_BY only when both ends sit on the impact subgraph (including two-hop producers on that path).
  • Schema-aware N+1: drop known non-relation fields (CharField, etc.), keep unknown names at medium, raise to high when the schema says relation. Findings stay on extra — no new walkable edges. Residuals use the same filter.
  • django.setup() runs in a subprocess so it is not process-global. Failures and malformed payloads still surface as django.setup() skipped: ….
  • Generated OpenAPI clients stitch at high confidence. Client nodes are keyed by file+URL so generated/invoices.ts is not overwritten by api.ts. String URL matches stay dashed; if a generated client already covers the same template they are marked superseded_by_generated (~0.4).
  • INDEX_REVISION is part of the sidecar digest so identity changes force an incremental rebuild.
  • Evolution only flips HIGH→MEDIUM for serious notes (hotspot, silo, cross-context, temporal coupling), not a 2-commit complexity blip.
  • Residuals name serializer/Zod overlap fields and superseded string stitches.

Tests

Unit coverage for impact-only tests, schema-aware N+1 (findings + residuals), boot JSON framing/malformed payload, generated vs inferred client stitch, and file-scoped generated clients. Vertical slice still expects InvoicePage (not MePage), suggested_reviewers == ['billing-team'], celery + dramatiq, confidence medium/low.

Adversarial review

  • 3f5467e: generated and handwritten clients shared one node id (client:{url}).
  • ab99fa0: CharField N+1 still leaked into residuals; extractor identity did not invalidate the index; boot JSON KeyError could crash the parent.
Open in Web Open in Cursor 

Summary by CodeRabbit

  • Improvements

    • Improved detection and confidence scoring for relationship-based N+1 query findings.
    • Django project analysis now runs more reliably with isolated bootstrapping and clearer error reporting.
    • Prevented collisions between API clients from different files.
    • Automatically refreshes stale indexes when analysis logic changes.
    • Improved generated API client detection and route stitching, including supersession details.
    • Refined review confidence and residual reporting for impacted code.
  • Tests

    • Expanded coverage for Django bootstrapping, relationship analysis, confidence scoring, indexing, and generated API clients.

…, prefer generated clients.

Confidence only counts TESTED_BY edges on the impact subgraph. N+1 drops CharField
accesses and keeps unknown names at medium. django.setup() runs in a subprocess.
String URL stitches stay inferred when a generated OpenAPI client already covers
the same template. Weak evolution notes no longer flip HIGH to MEDIUM.

Co-authored-by: Damon  <Modsofthenation@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Aug 14, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6ceddfe8-80ba-41e2-b846-31d31f1fa55f

📥 Commits

Reviewing files that changed from the base of the PR and between a5f4a75 and ab99fa0.

📒 Files selected for processing (12)
  • src/loadpath/architecture/rules.py
  • src/loadpath/extractors/django_boot.py
  • src/loadpath/extractors/react.py
  • src/loadpath/index.py
  • src/loadpath/review/confidence.py
  • src/loadpath/review/engine.py
  • src/loadpath/stitch/openapi.py
  • tests/e2e/test_brokers_and_django.py
  • tests/unit/test_architecture_rules.py
  • tests/unit/test_confidence.py
  • tests/unit/test_index_and_stitch.py
  • tests/unit/test_react_extractors.py

📝 Walkthrough

Walkthrough

The PR isolates Django boot execution, improves graph identity and index invalidation, makes N+1 analysis relationship-aware, scopes confidence testing to impacted graphs, and distinguishes generated OpenAPI clients during stitching.

Changes

Graph extraction and review updates

Layer / File(s) Summary
Isolated Django boot
src/loadpath/extractors/django_boot.py, tests/e2e/test_brokers_and_django.py
Django boot runs in a subprocess by default. Marked JSON payloads are parsed and malformed or failed boots produce residual errors.
Graph identity and index invalidation
src/loadpath/extractors/react.py, src/loadpath/index.py, tests/unit/test_react_extractors.py
React client identifiers include source files. Generated and inferred metadata is recorded. Index digests include INDEX_REVISION.
Relationship-aware review analysis
src/loadpath/architecture/rules.py, src/loadpath/review/confidence.py, src/loadpath/review/engine.py, tests/unit/test_architecture_rules.py, tests/unit/test_confidence.py
N+1 findings resolve relationship fields. Confidence and residual collection use normalized, impact-scoped data and serious evolution notes.
Generated-client stitching
src/loadpath/stitch/openapi.py, tests/unit/test_index_and_stitch.py
Generated-client detection is centralized. Stitching records generated coverage, confidence, and superseded inferred edges.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant DjangoBoot
  participant BootSubprocess
  participant PayloadParser
  participant ExtractedGraph
  DjangoBoot->>BootSubprocess: execute isolated Django boot
  BootSubprocess->>PayloadParser: emit marked JSON payload
  PayloadParser->>ExtractedGraph: reconstruct nodes and edges
  PayloadParser-->>DjangoBoot: return graph or residual error
Loading

Possibly related PRs

Suggested reviewers: cursoragent

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch cursor/review-accuracy-ccb4

Comment @coderabbitai help to get the list of available commands.

cursoragent and others added 2 commits August 14, 2026 23:42
Client nodes were keyed only on the URL template, so generated/invoices.ts
and billing/api.ts collapsed into one node and the high-confidence stitch
never appeared.

Co-authored-by: Damon  <Modsofthenation@users.noreply.github.com>
…ayload.

CharField N+1 hits were still copied into review residuals after the rule
dropped them. Client node-id changes now bump INDEX_REVISION so incremental
graphs rebuild. Malformed django.setup() JSON becomes a skip residual.

Co-authored-by: Damon  <Modsofthenation@users.noreply.github.com>
@Modsofthenation
Modsofthenation marked this pull request as ready for review August 14, 2026 23:47
@cursor
cursor Bot merged commit 596f4e2 into main Aug 14, 2026
2 checks passed
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.

2 participants