← Back to Pull requests

Match the Lighthouse markers as whole lines #4273

Closed
unknown closed this pull request without merging on Oct 01, 2026 12:51 UTC
View on GitHub
unknown unknown commented on Sep 24, 2026 22:44 UTC
Author

Fixes #4272.

The Lighthouse markers were matched with strings.Contains on every line, so a Corefile whose own comments name #lighthouse-start, or one that lost its end marker to a hand edit, was cut from that line to the end of the file and the new section prepended to what was left. A marker now has to be the first token on its own line, apart from indentation, so a longer word beginning with the same text is not one. The reproducer is in the issue.

When they are not one ordered pair the end of the section is unknown, so removeLighthouseSection returns an error and nothing is written: util.MustUpdate calls the mutate function first. Clusterset DNS then stays unconfigured until the Corefile is repaired by hand, with the error on the reconcile. I preferred that to rewriting a file I cannot delimit. The alternative is to log and skip the Corefile without failing the reconcile.

Removal also round-trips the rest of the file exactly now. The old loop appended a newline on every update.

removeLighthouseSection has a Ginkgo internal test next to the one for findCoreDNSListeningPort. The controller spec seeds kube-system/coredns with a section whose end marker is missing and asserts that the reconcile fails and the Corefile is unchanged. With the old scan back behind the same signature, 9 of the 10 new specs fail, including the comment case and the controller one; the spec for a Corefile with no section passes either way.

<!-- This is an auto-generated comment: release notes by coderabbit.ai -->

Summary by CodeRabbit

Bug Fixes
Lighthouse configuration updates now remove generated sections only when their start and end markers are correctly paired.
Marker-like text in other lines is preserved, including when it appears within a longer word. Indented markers are recognized.
Missing, unmatched, or nested markers prevent updates, leaving the existing Corefile unchanged.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Diff: 250 lines (+187 / -63) across 3 files Reviewer: thc1006 Review duration: 9486m
All Vouch review confidence checks passed
Residual risk 0.15 = Change Risk (0.39) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.39 · 250 lines diff across 3 files
0.39
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.331
Shallow Review Depth shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #4273"
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: 39.0% (MEDIUM) · Higher = larger blast radius
39.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: 15.4% · Safe to merge
15.4%