Skip to content

Merge-hotspot advisor: detect files repeatedly hit by concurrent PRs and file modularize issues for the ci-maintainer #15428

Closed

Description

@clubanderson

Problem

The merge train already detects when concurrent PRs touch the same file (overlap check, conflict prediction, sibling rebases), but it only reacts — it never tells anyone that a particular file keeps being the collision point. We just fixed two such files by hand: pkg/dashboard/static/index.html (28k lines, now generated from static-src/**, #15300) and docs/api-reference.md (split into docs/api-reference/<area>.md, #15304). Both had been colliding for weeks before a human noticed.

Owner's ask: "since we can detect overlapping files in merges, can we also determine if it makes sense to split them up … if you get a high number of PRs touching the same file, maybe we could open an issue to modularize them? could this be a part of the prompt template for the ci maintainer?"

Proposal

A merge-hotspot advisor in the governor:

  1. Detect — over a rolling window (default 7 days) of merged + open PRs per repo, count distinct PRs per file, pairwise concurrent overlaps (PRs open at the same time touching the file) and rebase conflicts blamed on the file. Derived purely from data the hive already has (merge-train file lists, rebase follow-through) — no new GitHub polling.
  2. Score — overlaps weighted by file size, plus conflicts. Thresholds: ≥ 6 distinct PRs and ≥ 3 overlaps in the window.
  3. Classify, don't splinter — *.md/docs/lock/data files are reported but only get a "split by section" recommendation when large; generated files (// Code generated, static/index.html) point at their source. A split is only recommended when the file is ≥ 800 lines and the overlapping PRs touched ≥ 2 distinct top-level symbol groups (go/ast for Go, regex for JS/TS/py, ## headings for md).
  4. File one issue per hotspot through the writeback gate (paused repos honoured), labelled agent/ci-maintainer + kind/cleanup, deduped with <!-- hive:hotspot file=… -->, not re-filed for 30 days after close. Body: evidence table, colliding symbol groups, concrete split proposal (≤ 4 files, each ≥ 150 lines, no behaviour change, tests move with code).
  5. Expose GET /api/hotspots, hotspots in /api/status, hivectl governor hotspots, a tile in the governor view, and a "Merge Hotspots" section in the ci-maintainer lane prompt so the lane knows how to execute a split (mechanical, one PR, land when the file has no open PRs against it).

Config: governor.hotspot_enabled, hotspot_window_days, hotspot_min_prs, hotspot_min_overlaps, hotspot_min_lines, hotspot_refile_days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions