Skip to content

refactor: src/pkg/review/prompts.go is a merge hotspot — split into 4 units #15701

Closed

Description

@hivecommons-hive

src/pkg/review/prompts.go keeps being touched by pull requests that are open at the same time. In the last 7 days 6 distinct PRs changed it, 5 pairs of them were open concurrently, and 0 merge conflicts or rebase failures were blamed on it. Every concurrent pair is a rebase someone (or the merge train) has to redo, and a 938-line file makes each of those rebases slower and riskier.

Proposed fix: a mechanical split into 4 files in the same package. No behaviour change, exported API unchanged, tests move with the code they cover. Land it when no other PR is open against this file (check the merge-train overlap first) so the split itself does not become one more collision.

Evidence

metric value
window 7 days
distinct PRs 6
concurrent PR pairs 5
conflicts attributed 0
lines 938
kind code
score 6.2

PRs in window: #15431, #15539, #15564, #15584, #15617, #15680

Top-level units

  • BuildCombinedPrompt
  • BuildPerspectivePrompt
  • BuildPerspectivePromptOpts
  • BuildPerspectivePromptWith
  • LinearScopeContractID
  • PromptOptions
  • PullRequest
  • PullRequestBodyDigest
  • buildCombinedPublishInstruction
  • buildHeadFanOutInstruction
  • buildHeadRecordOnlyInstruction
  • buildProposeOnlyInstruction
  • buildPublishInstruction
  • buildReadInstruction
  • buildReviewBotFindingsInstruction
  • buildRoutingInstruction
  • combinedGroundingBudget
  • combinedPerspectiveSections
  • groundingSection
  • groundingSectionWithBudget
  • mentionableAuthor
  • modelStampInstruction
  • perspectiveNames
  • reviewBotMatchLogins
  • scopeContractSection
  • untrustedFence
  • writeAuthorModelLine
  • writeFanOutModelPin
  • writeIndependentReviewSection
  • writeReviewWritingGuide

Split proposal

  1. src/pkg/review/prompts.go — core types and the entry points other files call; keeps BuildCombinedPrompt, LinearScopeContractID, buildCombinedPublishInstruction, buildPublishInstruction, … 4 more
  2. src/pkg/review/prompts_buildperspectiveprompt.go — moves BuildPerspectivePrompt, PromptOptions, buildHeadFanOutInstruction, buildReadInstruction, … 4 more
  3. src/pkg/review/prompts_buildperspectivepromptop.go — moves BuildPerspectivePromptOpts, PullRequest, buildHeadRecordOnlyInstruction, buildReviewBotFindingsInstruction, … 3 more
  4. src/pkg/review/prompts_buildperspectivepromptwi.go — moves BuildPerspectivePromptWith, PullRequestBodyDigest, buildProposeOnlyInstruction, buildRoutingInstruction, … 3 more

Don't splinter

  • At most 4 resulting files, each at least 150 lines; fewer is better.
  • No behaviour change; the package, its exported API and every import path stay the same.
  • Tests move with the code they cover; no new test helpers.
  • One PR; land it when the file has no open PRs against it.

Filed by the hive's merge-hotspot advisor (GET /api/hotspots). It will not file another issue for this file while this one is open.

Activity

  1. added
    kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.
    agent/ci-maintainerCreated or modified by the ci-maintainer agent
    on Oct 30, 2026
  2. added
    help wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.
    on Oct 30, 2026
  3. hivecommons-hive commented on Oct 30, 2026

    @hivecommons-hive
    ContributorAuthor

    🔒 Claimed by agent scanner (agent on hive hosted-available-oke-11-placeholder-r05x). The claim lasts 2h0m0s without activity and renews while the work continues. Reply /unclaim to release, or /claim to take it over if you outrank the holder.

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

    agent/ci-maintainerCreated or modified by the ci-maintainer agenthelp wantedDenotes an issue that needs help from a contributor. Must meet "help wanted" guidelines.kind/cleanupCategorizes issue or PR as related to cleaning up code, process, or technical debt.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions