Repository navigation
Fix Go patch delivery, audits, and reinstalls - #1698
Mikola Lysenko (mikolalysenko) wants to merge 10 commits into
Conversation
Verify the native vendor tree selected by Go before attesting patches. Account for workspaces, GOFLAGS, selected packages, embedded assets, and dependency-only fixes. Forward consumer synchronization warnings through nested agent get operations. Preserve upstream checksum lines with local patch artifacts and restore them on rollback after tidy. Refuse checksum conflicts without removing an active replacement or its copy, including orphan reconciliation. Replace empty production Go canaries with pgx/v5 execution proofs for hosted, vendored, and agent delivery, fresh caches, cold agent failure and recovery, and rollback. Add real Go regressions for native drift and the lifecycle failures reproduced by the smoke repository. Assisted-by: Codex:GPT-6
Reuse verified project-local agent copies after clearing the Go module cache. Refuse corrupted copies without an upstream rebuild source. Exercise get, scan, dependency maintenance, repeated native vendoring, and workspace synchronization with the patched pgx decoder. Assisted-by: Codex:gpt-6-astra
|
Burn-down agent: draft CI is green on Question for a human: once depscan#28901 is deployed and the pgx Generated by Claude Code |
Pull request was converted to draft
Resolve conflicts with main's advisory-warning refactor (#1722) and the global Go tool tests (#1717). apply.rs keeps main's advisory_warning_codes loop (it covers ownership_not_restored too) and drops main's nested_skip_warnings, because this branch already reports those skips through run_warnings. e2e_golang_build.rs keeps both sides' new tests. Co-Authored-By: Claude <noreply@anthropic.com>
|
Burn-down agent: merged
Draft hold and Generated by Claude Code |
Apply the 15 verified findings from /code-review max on #1698, including porting Go's path.Match into go_native_vendor.rs so core drops the glob dep. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…fix/go-patch-delivery-e2e # Conflicts: # crates/socket-patch-cli/src/commands/apply.rs
…-e2e # Conflicts: # crates/socket-patch-cli/tests/e2e_golang_build.rs # crates/socket-patch-cli/tests/e2e_vendor_golang_build.rs # crates/socket-patch-core/src/vendor/go_consumer_sync.rs
|
Burn-down agent: adding Generated by Claude Code |
|
Burn-down agent: marking this On Question: can someone regenerate/publish the pgx/v5@v5.7.0 patch as a hosted Go module in production? If that won't happen soon, should the strict hosted pgx canary stay out of this PR so the rest can land? Once it's published, re-running Generated by Claude Code |
Resolve conflicts with main's go.work replace hosting (#1763, #1764, #1765). ensure_replace_entry now validates and backs up go.sum before writing the replace into main's replace host (go.work or go.mod), and drop_replace_entry restores the saved go.sum lines before removing the replace from go.work and go.mod. The cleanup fallback uses the same go.work-aware removal now that edit_go_mod is gone. The workspace e2e test keeps this branch's reinstall steps on main's tail(&Tail{..}) shape. Co-Authored-By: Claude <noreply@anthropic.com>
|
Burn-down agent: merged
Generated by Claude Code |
save() unioned live go.sum lines with an existing .upstream-go.sum, so a different h1 for the same module and version was kept beside the old one, and a rollback after go mod tidy wrote both back. Refuse the conflict at save time, and refuse a backup that already holds conflicting lines at restore time. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- apply --check: skip the native vendor check for a module whose modules.txt drift the audit already reports, so one cause gives one drift (matches go_sync_warnings). - drop_replace_entry: plan the go.sum restore, remove the directive, and only then write go.sum, so a failed go.mod/go.work edit leaves both unchanged. - Native vendor: treat a file with two //go:build lines or an unparseable expression as omitted, as imports.ShouldBuild does. - reconcile: report a failed drop of a version-less directive under a PURL built from its copy path, not the bare module path. - Only probe selection when replace_refusal did not already refuse. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Production pgx/v5 hosted module is live after the patch was regenerated: Generated by Claude Code |
|
bugbot run Generated by Claude Code |
1 similar comment
|
bugbot run Generated by Claude Code |
reuse_go_redirect reported an intact agent copy as already patched from redirect_in_sync alone, so a go.work workspace whose root go.mod mirror of the replace had gone missing stayed unrepaired after the module cache was deleted, and a GOWORK=off build kept linking the unpatched module. apply_go_redirect's hot path already wrote the mirror back. Share that repair between both paths, skipping it on a dry run. Co-Authored-By: Claude <noreply@anthropic.com>
|
bugbot run Generated by Claude Code |
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit de070ed. Configure here.
|
Burn-down agent: labeled Ready for review at
Generated by Claude Code |
Final review brief:
|
The pgx/v5 smoke test exposed local Go patches that could be attested while Go built vulnerable bytes from native
vendor/, a missing warning in agentget, and rollback that stopped building aftergo mod tidyremoved upstream checksums. Reapplying an intact agent patch after deleting the module cache also failed withpackage_not_installed. The production Go canaries passed without proving delivery.Changes
apply --check/vendor --check. Cover workspace markers, quoted and double-hyphen GOFLAGS, unused replacements, package selection, ignored files, embedded assets, and dependency-only patches.github.com/jackc/pgx/v5@v5.7.0patchd8941a4c-4bcd-4756-b0aa-239ec9c81b0f: require a delivery event and reject the malformed decoder input without a panic. Exercise get/scan, fresh caches, cache removal, same-versiongo get,go mod download/tidy/verify, consumer tests, repeated native vendoring, offline rollback after tidy, and explicit cold-cache agent failure followed by recovery. Hosted/vendored workspace tests also exercisego work syncandgo work vendorwhen supported.The cold-cache false
appliedresult from the older smoke-test revision was already fixed on current main; this PR adds a live regression guard for the corrected failure behavior.Validation
5c4066702(32 settled checks). Heavy draft-gated jobs were validated locally. Two high-effort Codex CLI reviews were run; confirmed findings were fixed and given regression coverage.Review findings not fixed
/code-review maxverified 15 findings; all are fixed in 6341c0c (core no longer depends onglob:go_native_vendor.rsports Go'spath.Match). These verified findings are deferred to follow-ups:.upstream-go.sumlines are not forgotten after a vendored/hosted takeover or a hand-deleted directive.h1:prefix.CLI_CONTRACT.mdstill says a Go revert never touches go.sum.GOFLAGS/GOENV.-modcacherw.ensure_replace_entryerrors drop the go.mod path.A later
/code-review highfound 10 more (unverified). Fixed in 4eec336 and 67abc02: conflicting checksums merged into the backup, duplicateapply --checkdrift for one modules.txt cause, go.sum written before a failed directive edit, files with two or malformed//go:buildlines treated as vendored, a bare module path reported as a PURL, and an eager selection probe. Deferred as efficiency/cleanup follow-ups:verify_native_vendor(_tree)re-resolves GOFLAGS, modules.txt and replace entries per purl.forgetsequence is duplicated across four call sites.savereads and conflict-checks the go-patches backup twice.Kept on purpose: a machine-wide
GOFLAGS=-mod=moddisables the native-vendor check, as this PR's own test expects.Rollout dependency
Companion backend PR: https://github.com/SocketDev/depscan/pull/28901
Met 2026-10-29. The backend fix is deployed (depscan
deploy/prod/2026-10-26T19-24-34Z), and the pgx patch was regenerated in production.patch.socket.dev/gopatch/d8941a4c-…/v5@v5.7.0-socketpatch.1now resolves, and the strict hosted canarygolang_hosted_pgx_deliverypasses inhosted-e2eon67abc02cc. Rebuilding Go patches that already published a hosted module is handled separately in SocketDev/depscan#29337.Existing checkouts created by older CLI releases without a checksum backup may still need
go mod download <module>@<version>after rollback; newly patched checkouts restore their saved checksums offline.Note
High Risk
Changes attestation and audit gates for Go (VEX, CI check) and mutates go.mod/go.sum rollback semantics; mistakes could block valid builds or attest unpatched vendor trees.
Overview
Go patching and verification now treat native
vendor/as part of the truth:apply --check,vendor --check, andvexcan fail withgo_vendor_content_mismatchwhen the tree a default build compiles does not carry the patch, even if the.socketreplace copy is fine. Apply also emits consolidated consumer-sync + native-vendor warnings viago_sync_warnings, andapply --checkskips duplicate drift whenmodules.txtalready explains the same module.Agent/local Go workflow changes: stale go-patches redirects are reconciled before the apply loop; orphans that cannot be dropped (e.g. go.sum conflicts with saved upstream checksums) are kept and surface as failed apply results while other patches still run.
reuse_go_redirectreuses a committed copy after GOMODCACHE loss when hashes and wiring match..upstream-go.sumbeside local copies backs up upstream checksum lines for offline rollback aftergo mod tidy; conflicting pins refuse rollback/reconcile without tearing down active replaces. Nested scan/get no longer duplicates warnings already on the envelope when recording apply outcomes.Production and fixture E2E coverage replaces empty Go canaries with a real pgx/v5 delivery proof plus broad tests for native-vendor drift, workspace vendoring, checksum-conflict orphans, and cold-cache agent behavior.
Reviewed by Cursor Bugbot for commit de070ed. Configure here.
Generated by Claude Code