← Back to Pull requests

Fix token mapping for rules whose spots share structure; fix swprintf size in replace_backrefs #6

Open
unknown opened this pull request with 174 lines diff across 2 files
View on GitHub
unknown unknown commented on Nov 26, 2026 13:02 UTC
Author

Two fixes in lattice-mapping.c, one commit each.

Clear temporary unifications before the first spot of a lattice mapping rule (fixes #3)

initialize_possible_map() and update_possible_map_add() leave their last successful match unified into the rule. apply_lattice_rule1() only called bump_generation() when have > 0, so the first candidate for the first spot was unified into a rule that still held another edge in another spot. For rules whose spots share structure this failed, and the failure cache then rejected that candidate for the rest of the rule's run. The bump is now unconditional.

Pass the remaining buffer size to swprintf in replace_backrefs (fixes #4)

The size argument stayed at 1023 while the write pointer advanced, so builds with _FORTIFY_SOURCE abort the first time a rule with a ${...} back-reference in its output applies.

Testing

  • A grammar with one rule matching two adjacent tokens with the same +FORM (see #3): before, a b b c gets the new token but b b c and ab b b c do not; after, every adjacent identical pair gets it.

  • Unfixed and fixed builds give the same parse results (-n 5) on test suites for the ERG (610 items), Zhong (850 items) and a Cantonese grammar (116 items), apart from edge numbering in one derivation.

  • Built on Ubuntu 24.04 x86-64 only.
  • 🤖 Generated with Claude Code

    Diff: 174 lines (+130 / -44) across 2 files Reviewer: arademaker Review duration: 5924m
    All Vouch review confidence checks passed
    Residual risk 0.31 = Change Risk (0.59) × (1 − Review Confidence (0.47)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.59 · 174 lines diff across 2 files
    0.59
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.02 · 1 substantive comment(s)
    0.02
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    46%
    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
    Shallow Review Depth shallow_review_depth
    0.344
    Diff Size diff_size
    0.309
    Sensitive Paths sensitive_paths
    0.059
    Real PR Conversation Timeline
    1 comments
    "Review active on #6"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 46.7% reviewed sensitive_module
    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: 58.5% (MEDIUM) · Higher = larger blast radius
    58.5%
    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: 46.7% · Lower = rushed or shallow review
    46.7%
    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: 31.2% · Safe to merge
    31.2%
    Repository