fix(scan): stop the false [UPDATE] nag for equal-or-older batch-ranked patches - #162
Open
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Open
fix(scan): stop the false [UPDATE] nag for equal-or-older batch-ranked patches#162Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Mikola Lysenko (mikolalysenko) wants to merge 1 commit into
Conversation
`detect_updates` flagged an `[UPDATE]` (and a JSON `updates[]` entry) whenever the top-ranked batch candidate differed from the recorded patch. Batch responses omit `publishedAt`, so `cmp_batch_infos` collapses to the arbitrary uuid tiebreak and can crown an equal-or-older sibling as the "top" candidate — perpetually nagging a vendored project with a patch no newer than the one already committed. Now, when the applied patch is still among the offered patches, only surface an update if the candidate genuinely supersedes it on a meaningful axis (severity, merge coverage, or a real strictly-greater publish date). Missing dates parse to `None` and are never treated as newer, so an equal-or-older patch is never surfaced. Recency parsing stays on the existing RFC-2822-aware `api::date` helper. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Mikola Lysenko (mikolalysenko)
enabled auto-merge (squash)
August 12, 2026 23:41
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
After vendoring a patch, re-running
scan --mode vendoredperpetually reports an[UPDATE]/updates[]entry pointing at a patch that is the SAME or OLDER than the one already vendored — a permanent false nag (confirmed in prod on pip + poetry legs for urllib3).detect_updates(crates/socket-patch-cli/src/commands/scan/discovery.rs:248, pre-fix) flagged an update whenever the top-ranked batch candidate's UUID differed from the recorded one. The candidate is chosen byapi::ranking::cmp_batch_infos, but batch endpoint responses omitpublishedAt(seeranking.rs:176andrank_batch_infoatranking.rs:143, which parse an absent date to epoch0). With severity and merge-coverage tied and the date meaningless, ranking falls through to the arbitrary UUID tiebreak — so an equal-or-older sibling patch can be crowned "top candidate" and flagged as a newer update.Fix
In
detect_updates(crates/socket-patch-cli/src/commands/scan/discovery.rs):discovery.rs:249).candidate_supersedes(discovery.rs:~271) requires a strictly-better MEANINGFUL axis: worse severity, greater merge coverage, or a real, strictly-greaterpublishedAt. A missing date parses toNone(via the existing RFC-2822api::date::parse_timestamp_secs) and is never treated as newer, so an equal-or-older patch is never surfaced.Note: a strictly-newer sibling can only out-rank the applied patch when the batch actually supplies dates; with dates absent the newest is the applied one and apply (the richer by-package shape) keeps it, so
detect_updatesand apply stay consistent. Missed (not false) updates only until the endpoint emitspublishedAt.Test
crates/socket-patch-cli/src/commands/scan/discovery.rs— hermetic unit tests alongside the existingdetect_updatestests:detect_updates_no_nag_when_applied_patch_still_offered_and_batch_omits_dates— core regression: applieduuid-bre-listed with siblinguuid-a(sorts first), no dates → NO update. Verified RED before / GREEN after (temporarily disabling the guard makes it panic with "an equal-or-older sibling with no real date must not be an update").detect_updates_still_flags_a_higher_severity_candidate_offered_alongside_applied— over-suppression guard: a CRITICAL sibling still flags.detect_updates_flags_a_genuinely_newer_candidate_when_batch_supplies_dates— over-suppression guard: a strictly-newer sibling (real dates) still flags.cargo test -p socket-patch-cli --lib discovery::→ 23 passed, 0 failed.cargo build -p socket-patch-cliandcargo clippy -p socket-patch-cliclean. All pre-existingdetect_updatestests unchanged and green.Scope
Single-file change to
scan/discovery.rs. No API/type changes; reuses publicapi::ranking::{severity_order, merged_coverage}andapi::date::parse_timestamp_secs. Kills sweep findingsfalse-update-nag-older-uuid,false-update-flag-batch-ranking; touches K11. No cross-dependencies with the other parallel bug fixes.🤖 Generated with Claude Code
Note
Low Risk
Scan update detection only; no API or manifest schema changes; guarded by focused unit tests.
Overview
detect_updatesno longer treats every batch top-ranked candidate with a different UUID as an update. When the manifest’s applied patch is still in the batch response, an update is reported only if that candidate genuinely supersedes the applied patch viacandidate_supersedes: strictly worse severity, broader merge coverage, or a real, strictly greaterpublishedAt(missing dates do not count).This stops perpetual
[UPDATE]/updates[]noise when batch responses omit dates andcmp_batch_infospicks a sibling on UUID tiebreak alone. If the recorded patch is no longer offered, behavior is unchanged—a different available UUID still flags an update.Unit tests cover the no-nag regression, higher-severity updates, and genuinely newer siblings when dates are present.
Reviewed by Cursor Bugbot for commit 221d5d2. Configure here.