review_diff grades deleted pub members of a pub(crate) type as api_break_deleted (high) #573

Closed
opened 2026-11-12 02:34:20 +01:00 by buildagent · 0 comments
Member

Found by a worker during the v0.41.50 train (dogfood triage batch 17) and reproduced by the lead on the installed release, 0.41.49 (a7ce9603).

Reproduction (in this repository):

code-index query review_diff '{"base":"31b3c0b6","path_glob":"crates/mcp-server/src/arguments.rs","envelope":"minimal","response_format":"concise"}'

Actual: the fields min, max, clamp and the method schema are reported severity: "high", reason: "api_break_deleted". Every other deleted symbol of that file is low / internal_symbol_deleted.

Control: at 31b3c0b6 the container is crate-private:

pub(crate) struct IntegerPolicy {
    pub min: u64,
    pub max: u64,
    pub clamp: bool,
}
impl IntegerPolicy {
    pub fn schema(self) -> Value { … }
}

A pub member cannot be more visible than its containing type, so none of the four was reachable from outside the crate.

Expected: a deletion is graded by effective visibility: the minimum of the member's own visibility and that of its containing type (and, for a method, of the impl's self type). These four are internal_symbol_deleted.

Impact: an internal refactor produces high-severity public-API findings. An agent that follows review_diff severities spends its review on them, and a reader who learns that high can be a false alarm trusts the real ones less.

Scope note: the member's recorded visibility is correct as written in source (pub). The defect is in the grading, which reads the member's visibility alone. The same question applies to members of a private module's public items; that case is not measured here.

Found by a worker during the v0.41.50 train (dogfood triage batch 17) and reproduced by the lead on the installed release, 0.41.49 (a7ce9603). **Reproduction** (in this repository): ``` code-index query review_diff '{"base":"31b3c0b6","path_glob":"crates/mcp-server/src/arguments.rs","envelope":"minimal","response_format":"concise"}' ``` **Actual:** the fields `min`, `max`, `clamp` and the method `schema` are reported `severity: "high"`, `reason: "api_break_deleted"`. Every other deleted symbol of that file is `low` / `internal_symbol_deleted`. **Control:** at `31b3c0b6` the container is crate-private: ```rust pub(crate) struct IntegerPolicy { pub min: u64, pub max: u64, pub clamp: bool, } impl IntegerPolicy { pub fn schema(self) -> Value { … } } ``` A `pub` member cannot be more visible than its containing type, so none of the four was reachable from outside the crate. **Expected:** a deletion is graded by effective visibility: the minimum of the member's own visibility and that of its containing type (and, for a method, of the `impl`'s self type). These four are `internal_symbol_deleted`. **Impact:** an internal refactor produces high-severity public-API findings. An agent that follows `review_diff` severities spends its review on them, and a reader who learns that `high` can be a false alarm trusts the real ones less. **Scope note:** the member's recorded `visibility` is correct as written in source (`pub`). The defect is in the grading, which reads the member's visibility alone. The same question applies to members of a private module's public items; that case is not measured here.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
h-dv/code-index#573
No description provided.