Skip to content

Report which hosted patch pins changed - #2307

Open
Martin Torp (mtorp) wants to merge 3 commits into
mainfrom
codex/report-hosted-pin-changes
Open

Martin Torp (mtorp) wants to merge 3 commits into
mainfrom
codex/report-hosted-pin-changes

Conversation

@mtorp

Copy link
Copy Markdown

Hosted scans report an applied event for every confirmed patch, including a patch that was already in place. When two packages share a lockfile, the file list alone cannot tell a caller which pin changed.

Hosted scan and get now include details.pinChanged on each confirmed patch's JSON event. The CLI compares local dependency records for the package and patch UUID. It reports true for a new or updated pin, false for an unchanged pin, and null when the records cannot establish the result. A dry run reports the planned change. This adds no network requests.

The scan integration suite covers adding a second patch to a shared npm lockfile, previewing that change, rerunning with both pins already in place, and repairing one pin's integrity without changing its UUID.

Compare local pin records before and after the hosted rewrite so JSON
consumers can tell which patch changed in a shared lockfile. Report an
unknown result when the available records cannot establish the change.

Assisted-by: Codex:GPT-6
Keep the two variants of FinalDiscovery so existing Rust callers can
still match on both. Give the CLI a separate way to read pins found on
servers named by a grant. Keep the public discovery field empty when
the grant adds a server.

Assisted-by: Codex:GPT-6
Reuse the existing check for whether the pin check's discovery matches
the written disk, which also skips the report after a vlt store heal.
Set pinChanged where the confirmed events are built, check that scan's
discovery is still current once per run, and skip collecting created
paths when no report will read them.

Assisted-by: Claude Code:claude-opus-5-5
@cursor

cursor Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

PR Summary

Medium Risk
Changes hosted rewrite discovery attribution and JSON event shape; behavior is additive but consumers and dry-run/JSON paths depend on the new comparison logic.

Overview
Hosted JSON envelopes now expose details.pinChanged on each confirmed hosted pin (applied or dry-run verified), so callers can tell whether this run actually added or updated a pin versus leaving it unchanged. Values are true / false when before/after lockfile discovery can attribute the pin, and null when attribution fails (e.g. unreadable lockfiles); if nothing was rewritten, all confirmed pins report false.

The CLI adds a pin_changes pass that snapshots discovery before rewrite (reusing scan’s prior discovery when safe, or widening origins for foreign grant hosts), then compares hosted refs after write—even on --dry-run when JSON is enabled—via discovery_after_writes. The core hosted engine now keeps grant_origin_discovery separate from final_discovery and exposes pin_discovery(), so post-rewrite comparison still works when grants come from non-configured patch servers.

CLI_CONTRACT and integration tests (including shared npm lockfiles: second pin, idempotent re-run, integrity repair) document and assert the new field.

Reviewed by Cursor Bugbot for commit 19870c4. Configure here.

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want fixes drafted automatically? Bugbot Autofix can create code changes for findings. A team admin can enable Autofix in the Cursor dashboard.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 19870c4. Configure here.

.push(pin);
}
pins
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shadowed pins skip change detection

Medium Severity

refs_by_patch only reads discovery.refs, but confirmation treats discovery.shadowed as attributed hosted pins as well. A confirmed pin withheld from refs because an unpatched copy sits beside it never appears in the before/after maps, so pinChanged is null instead of true or false even though the lock records are available.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 19870c4. Configure here.

Written::Landed { created: &created },
vlt_stale.healed_store.as_ref(),
);
pin_changes::compare(before_pins.as_deref(), after, &confirmed)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After-snapshot filters drop pin results

Medium Severity

The JSON path reuses discovery_after_writes with Written::Landed and the vlt-heal store, and it has no fresh-discovery fallback. When that helper discards the overlay (a vlt heal ran, or a newly created file is not an invisible config), after is None and every confirmed event gets pinChanged: null, including dry runs that should report the planned change.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 19870c4. Configure here.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant