← Back to Pull requests

Feat: Control where properties are inserted #81

Closed
unknown closed this pull request without merging on Oct 01, 2026 09:47 UTC
View on GitHub
unknown unknown commented on Sep 27, 2026 19:22 UTC
Author

Implements #68

The commits are structured:
1) feature addition, all tests pass unchanged
2) test additions exercising the new API
3) extracts the 'navigateToStartOfBlock' Method into Cursor, makes it public and adds tests.
4) fixes a regression introduced by 1) that went unnoticed due to missing tests.

I added package-private getters and setters to Cursor because I dislike creating useless copies with copy().
(Those were also helpful for writing tests)

The core change is that addNewKeyValue now accepts a Cursor as an insertion-point.
There are sanity checks so that properties are not inserted at illogical positions (see also testNavigateToStartOfBlock):

  • if the cursor points at a comment (preceeding whitespace, COMMENT token, EOL),

  • then it is moved to point at the preceeding whitespace (if any) of the first comment in the block.
  • if the cursor points at a property (preceeding whitespace, preceeding COMMENT tokens, KEY/SEPARATOR/VALUE, or trailing EOLs of COMMENT/KEY/SEPARATOR/VALUE),

  • then it is moved to point at the preceeding whitespace of the first comment (if any) or the key.

    So to insert directly after a property, the Cursor must be moved to point directly after the EOL of the VALUE.

    There are new utility methods to make this easier:

  • Cursor Properties.afterHeaderComment()

  • Cursor Properties.beforeFirstProperty()

  • Cursor Properties.afterLastProperty()

  • Cursor Properties.before(String key)

  • Cursor Properties.after(String key)
  • The default insertion-point is afterLastProperty. (for put(String key, String value) and putRaw(String rawKey, String rawValue))

    Diff: 206 lines (+154 / -52) across 2 files Reviewer: quintesse Review duration: 5184m
    All Vouch review confidence checks passed
    Residual risk 0.16 = Change Risk (0.41) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.41 · 206 lines diff across 2 files
    0.41
    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.319
    Shallow Review Depth shallow_review_depth
    0.289
    Ai Authored ai_authored
    0.050
    Real PR Conversation Timeline
    1 comments
    "Review active on #81"
    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: 41.4% (MEDIUM) · Higher = larger blast radius
    41.4%
    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: 16.3% · Safe to merge
    16.3%