LearnNewsExamplesServices
Frontmatter
id16337
titleRemove the dead bare-number tolerance from getPullRequestDiff
stateClosed
labels
airefactoring
assigneesneo-kimi-iris
createdAtAug 2, 2026, 12:39 PM
updatedAtAug 2, 2026, 1:05 PM
githubUrlhttps://github.com/neomjs/neo/issues/16337
authorneo-kimi-iris
commentsCount0
parentIssuenull
subIssues[]
subIssuesCompleted0
subIssuesTotal0
contentTrust
projected
quarantined0
signals[]
blockedBy[]
blocking[]
closedAtAug 2, 2026, 1:05 PM

Remove the dead bare-number tolerance from getPullRequestDiff

Closed Backlog/active-chunk-11 airefactoring
neo-kimi-iris
neo-kimi-iris commented on Aug 2, 2026, 12:39 PM

Context

PR #16330 (merged 2026-08-02, #16250) added x-pass-as-object: true to github-workflow get_pull_request_diff, so the MCP dispatcher now hands the handler the validated argument object instead of a positional spread. During review coordination (@neo-opus-grace's relay, [A2A 2026-08-02T07:3xZ]) one dead-code consequence surfaced and was deliberately scoped OUT of that PR: the handler's bare-number tolerance has no remaining producer — it compensates for exactly the dispatch bug that was just fixed.

Live latest-open sweep (2026-08-02T11:3xZ): nearest neighbours are #16250 (the fix that creates this dead branch) and #16334 (the handler-signature census — deliberately disjoint; that ticket classifies handlers, this one removes one dead branch). No equivalent found.

The Problem

ai/services/github-workflow/PullRequestService.mjs getPullRequestDiff(options) begins:

const { pr_number, file, sha, files_only } = typeof options === 'number' || typeof options === 'string'
    ? { pr_number: parseInt(options, 10) }
    : (options || {});

The number|string arm re-wraps a bare 42 into {pr_number: 42}. Post-#16330, no caller can produce that shape:

  • The MCP dispatcher (ToolService.callTool, ai/mcp/ToolService.mjs:107-111) now passes the validated object (tool.passAsObject branch); the positional spread that produced bare values is gone for this operation.
  • @neo-opus-grace's consumer sweep (relayed, source-verified): every in-repo call site passes an object — seven specs plus sdk-manifest.md:75 documenting getPullRequestDiff({ pr_number }). The sole bare-number producer was the dispatcher's positional spread itself.

A tolerance whose only producer was the bug it compensated for is dead code that still looks load-bearing: it invites a future caller to rely on a shape the system no longer produces, and it makes the contract's true surface ({pr_number, file, sha, files_only} object) harder to read.

The Architectural Reality

  • The branch is two lines plus its destructure shape; the object arm is already the sole live path.
  • get_pull_request_diff's OpenAPI contract declares four parameters; post-annotation all four arrive as an object (dispatch-verified in #16330's Test Evidence).
  • This is an independent, single-purpose removal — explicitly decoupled from both #16250 (shipped) and #16334 (census of other handlers), per the review coordination that named it as wanting its own named decision.

The Fix

  1. Remove the number|string tolerance arm from getPullRequestDiff; the parameter becomes an options object (tolerating undefined → default empty object is fine to keep, since MCP validation already requires pr_number).
  2. Update the JSDoc @param {Object|number} to {Object}.
  3. Sweep specs for any bare-number invocation (expected zero per Grace's census; the seven spec call sites all pass objects) and adjust any that exist.

Acceptance Criteria

  • getPullRequestDiff contains no typeof options === 'number' || typeof options === 'string' re-wrap; the options-object path is the only path.
  • JSDoc names the object contract only.
  • Repo-wide grep for bare-number call sites returns none (positive control: the grep pattern finds the current tolerance arm pre-change).
  • Existing github-workflow and MCP-compliance specs stay green.

Out of Scope

  • Any other handler's tolerance branches (#16334 owns the census and its own dispositions).
  • Behavior changes for well-formed callers — this is dead-branch removal only; the object contract is unchanged.

Related

  • #16250 (the fix that made this branch dead)
  • PR #16330 (merged; its review coordination named this as a separate decision)
  • #16334 (the handler-signature census — disjoint scope)

Origin Session ID: session_2f4d15f0-d626-4f16-9491-620b8b0bc9c2

Retrieval Hint: query_raw_memories("getPullRequestDiff bare number tolerance dead code positional spread removal")

Authored by Iris (@neo-kimi-iris, Kimi K3, Kimi Code CLI) 🌈

tobiu referenced in commit 3a83abd - "chore(github): remove the dead bare-number tolerance from getPullRequestDiff (#16337) (#16339)" on Aug 2, 2026, 1:05 PM
tobiu closed this issue on Aug 2, 2026, 1:05 PM