-
Notifications
You must be signed in to change notification settings - Fork 0
Tracking: one agent-mode patch engine for apply and rollback #771
Copy link
Copy link
Open
0 / 10 of 1 issue completedOpen
0 / 10 of 1 issue completed
Copy link
Labels
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)Filed by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead codeStructural change: duplicated code or logic, missing abstraction, layering, dead code
Description
Activity
Metadata
Metadata
Assignees
Labels
agent:triagedarch-auditFiled by a scheduled architecture audit routine (see the architecture review discussion)Filed by a scheduled architecture audit routine (see the architecture review discussion)priority:p3refactorStructural change: duplicated code or logic, missing abstraction, layering, dead codeStructural change: duplicated code or logic, missing abstraction, layering, dead code
[agent] Filed by the scheduled architecture audit routine (CLI and core). Register: discussion #560 register.
Kind: tracking. Source: review 7.4 and 7.6 #4; register C24.
Problem
Verified on main @
045d7ec. Agent-mode apply (patch/apply.rs, 3,665 lines) and rollback (patch/rollback.rs, 2,585 lines) implement one transformation in two directions, written twice:VerifyStatus/VerifyResultVerifyRollbackStatus/VerifyRollbackResultMissingBlobverify_file_patchverify_file_rollback==in both (#707)apply_package_patchrollback_package_patchfold_copy_resultfold_copy_resultdispatch_fixupdispatch_rollback_fixupSymptoms
already_patched/applied: 0when it actually patched an unpatched pnpm peer-variant copy (the store-copy pass's writes are never reported) #756: apply (and, per its comment, rollback) reportalready_patched/already_originalafter writing an unpatched store copy, because each fold drops the copy's per-file records.Target design
One engine in
patch/engine.rs, parameterized byDirection { Apply { sources, policy }, Rollback { blobs } }:FileVerify { file, status, message, current_hash, expected_hash, target_hash }with oneFileStatus(Ready,AlreadyDone,HashMismatch,NotFound,MissingSource);PackageOutcomewithfiles_changed(today'sfiles_patchedandfiles_rolled_back);apply_package_patch/rollback_package_patchstay as thin public wrappers, so the CLI does not change.Checklist (ordered; each one is a PR)
already_patched/applied: 0when it actually patched an unpatched pnpm peer-variant copy (the store-copy pass's writes are never reported) #756).FileVerify,FileStatus) behind type aliases; mechanical, no behavior change.dispatch_fixup/dispatch_rollback_fixupbehind oneDirectionmatch).apply_package_patch_at/rollback_package_patch_atinto the engine and delete the old aliases.Acceptance criteria
patch/rollback.rsholds only the rollback-specific source logic (before-blob probe, new-file delete).apply,rollback,removeandrepairintegration tests stay green throughout.Dependencies
PatchSources::mem_blobsdelete) and Agent-mode apply and rollback reject a manifest hash in uppercase hex that blob download accepts as valid #707 (C41); with open PRs Fix agent mode patching linked first-party source (#626) #634 and Full Gradle support in agent, hosted and vendored modes #646, which touchpatch/apply.rs; and with whichever fix lands for Agent-mode apply reportsalready_patched/applied: 0when it actually patched an unpatched pnpm peer-variant copy (the store-copy pass's writes are never reported) #756.