Repository navigation
Add reversible reorganization previews - #48
Merged
Merged
Conversation
Add the Reorganize plug-in to preview, validate, save, and apply filesystem plans through the host's durable operation engine. Keep moves recoverable and surface conflicts before disk changes so users can review the proposed result and recover displaced items. Extend SDK 105 with step execution and lifecycle/path services, and include the plug-in, language resources, host integration, and plan tests in the solution. Document the workflow and record the separate Delivery Handoff requirements for future implementation. ^ Conflicts: ^ handoff-spec.md ^ src/plugins/shared/baseaddr_x64.txt ^ src/plugins/shared/baseaddr_x86.txt
Contributor
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Multiple correctness issues currently affect conflict handling, recovery paths, cross-volume directory moves, snapshot validation, and SDK callback semantics.
Review effort: Balanced
Findings: 5
Open (16)
Validate absolute drive and UNC paths · New Build legacy file IDs for identity verification · New Compare volume serials instead of drive letters · New Report failed current steps in both error modes · New Require a matching successful review before execution · New Forward per-step UserData through observer callbacks · New Report already-existed and cross-volume result flags · New Infer destination volume from proposed parent nodes · New Expand complete directory trees for cross-volume moves · New Preserve CSV quoting during record splitting · New Apply saved conflict resolutions before validation · New Use destination properties for validation · New Resolve placeholder recovery paths before applying steps · New Scope the rule to the plan root · New Rebuild snapshots atomically and fail analysis on capture errors · New Assert corrupted journals fail parsing · New
What changed in this PR
Adds the Reorganize plug-in for previewing, validating, persisting, and executing filesystem reorganization plans through SDK 105.
Changes:
- Adds planning, validation, compilation, recovery, reporting, and localized plug-in UI.
- Extends the host operation engine and SDK for asynchronous plan-step execution.
- Integrates projects, icons, documentation, and native regression tests.
| File | Description |
|---|---|
README.md |
Documents Reorganize. |
architecture.md |
Documents SDK 105 integration. |
design/icon-reference/fluent-color-essentials/svg/PluginReorganize.svg |
Adds icon reference. |
src/file operation: operation_steps.cpp |
Implements SDK step execution. |
src/operation_journal.cpp |
Names directory-time journal operations. |
src/operation_steps.h |
Declares step helpers. |
src/operations_core.cpp |
Executes and reports plan steps. |
src/plugins.h |
Adds host API implementations. |
src/plugins_loading.cpp |
Prevents unsafe plug-in unloading. |
src/plugins/reorganize/core/compiler.cpp |
Compiles filesystem plans. |
src/plugins/reorganize/core/compiler.h |
Declares plan compilation. |
src/plugins/reorganize/core/fsprobe.cpp |
Implements filesystem probes. |
src/plugins/reorganize/core/fsprobe.h |
Defines probe interfaces. |
src/plugins/reorganize/core/journal.cpp |
Implements recovery journals. |
src/plugins/reorganize/core/journal.h |
Defines journal structures. |
src/plugins/reorganize/core/json.cpp |
Implements bounded JSON handling. |
src/plugins/reorganize/core/json.h |
Defines JSON model. |
src/plugins/reorganize/core/mapping.cpp |
Parses CSV mappings. |
src/plugins/reorganize/core/mapping.h |
Defines mapping results. |
src/plugins/reorganize/core/overlay.cpp |
Builds proposed filesystem views. |
src/plugins/reorganize/core/overlay.h |
Defines overlay structures. |
src/plugins/reorganize/core/plan.cpp |
Implements plan editing/history. |
src/plugins/reorganize/core/plan.h |
Declares plan operations. |
src/plugins/reorganize/core/planio.cpp |
Loads and saves plans. |
src/plugins/reorganize/core/planio.h |
Declares plan persistence. |
src/plugins/reorganize/core/reconcile.cpp |
Reconciles interrupted execution. |
src/plugins/reorganize/core/reconcile.h |
Defines reconciliation results. |
src/plugins/reorganize/core/report.cpp |
Generates CSV/HTML reports. |
src/plugins/reorganize/core/report.h |
Defines report rows. |
src/plugins/reorganize/core/revert.cpp |
Builds recovery plans. |
src/plugins/reorganize/core/revert.h |
Declares recovery helpers. |
src/plugins/reorganize/core/rules.cpp |
Implements organization rules. |
src/plugins/reorganize/core/rules.h |
Declares rule processing. |
src/plugins/reorganize/core/scanners/scanner.cpp |
Scans path references. |
src/plugins/reorganize/core/scanners/scanner.h |
Defines reference scanners. |
src/plugins/reorganize/core/snapshot.cpp |
Captures filesystem state. |
src/plugins/reorganize/core/snapshot.h |
Defines snapshots. |
src/plugins/reorganize/core/types.h |
Defines the plan model. |
src/plugins/reorganize/core/util.cpp |
Implements shared utilities. |
src/plugins/reorganize/core/util.h |
Declares shared utilities. |
src/plugins/reorganize/core/validate.cpp |
Validates plans and conflicts. |
src/plugins/reorganize/core/validate.h |
Defines validation interfaces. |
src/plugins/reorganize/fs.cpp |
Implements the virtual plan filesystem. |
src/plugins/reorganize/help/introduction.htm |
Adds introductory help. |
src/plugins/reorganize/help/reorganize.hhp |
Configures compiled help. |
src/plugins/reorganize/lang/lang.rc |
Adds English dialogs. |
src/plugins/reorganize/lang/lang.rc2 |
Adds English strings. |
src/plugins/reorganize/lang/lang.rh |
Defines string IDs. |
src/plugins/reorganize/lang/pl/lang_pl.rc |
Adds Polish dialogs. |
src/plugins/reorganize/lang/pl/lang_pl.rc2 |
Adds Polish strings. |
src/plugins/reorganize/precomp.cpp |
Adds precompiled-header source. |
src/plugins/reorganize/precomp.h |
Adds plug-in common includes. |
src/plugins/reorganize/reorganize.cpp |
Implements plug-in commands and Apply. |
src/plugins/reorganize/reorganize.def |
Exports plug-in entry points. |
src/plugins/reorganize/reorganize.h |
Declares plug-in interfaces. |
src/plugins/reorganize/reorganize.rc |
Defines plug-in resources. |
src/plugins/reorganize/reorganize.rc2 |
Includes version resources. |
src/plugins/reorganize/reorganize.rh |
Defines command/resource IDs. |
src/plugins/reorganize/session.cpp |
Manages active plan state. |
src/plugins/reorganize/session.h |
Defines session state. |
src/plugins/reorganize/vcxproj/lang_pl_reorganize.vcxproj |
Builds Polish resources. |
src/plugins/reorganize/vcxproj/lang_reorganize.props |
Configures language builds. |
src/plugins/reorganize/vcxproj/lang_reorganize.vcxproj |
Builds English resources. |
src/plugins/reorganize/vcxproj/reorganize.props |
Configures plug-in compilation. |
src/plugins/reorganize/vcxproj/reorganize.vcxproj |
Builds the plug-in. |
src/plugins/reorganize/versinfo.rh2 |
Defines version metadata. |
src/plugins/shared/baseaddr_x64.txt |
Allocates x64 image addresses. |
src/plugins/shared/baseaddr_x86.txt |
Allocates x86 image addresses. |
src/plugins/shared/spl_gen.h |
Adds SDK 105 APIs and types. |
src/plugins/shared/spl_vers.h |
Advances the SDK version. |
src/res/toolbars/24/PluginReorganize.svg |
Adds 24px toolbar icon. |
src/res/toolbars/32/PluginReorganize.svg |
Adds 32px toolbar icon. |
src/res/toolbars/PluginReorganize.svg |
Adds 16px toolbar icon. |
src/svg.cpp |
Registers the plug-in icon. |
src/vcxproj/salamand.sln |
Adds plug-in projects. |
src/vcxproj/salamand.vcxproj |
Builds the host step adapter. |
src/vcxproj/salamand.vcxproj.filters |
Organizes the new host source. |
src/worker.cpp |
Initializes the step bridge. |
src/worker.h |
Extends operation metadata and flags. |
tests/NativeSafetyTests/NativeSafetyTests.cpp |
Runs Reorganize core tests. |
tests/NativeSafetyTests/NativeSafetyTests.vcxproj |
Links Reorganize core sources. |
tests/NativeSafetyTests/ReorganizeTests.h |
Adds plan safety regressions. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+146
to
+147
| if (path[0] != L'\\' && !(path[0] != 0 && path[1] == L':')) | ||
| return FALSE; |
Comment on lines
+238
to
+240
| DWORD serial = ok ? (DWORD)info.VolumeSerialNumber : basic.dwVolumeSerialNumber; | ||
| const BYTE* id = ok ? info.Identifier : NULL; | ||
| if (serial != op->ExpectedVolumeSerial || (id != NULL && memcmp(id, op->ExpectedFileId, 16) != 0)) |
Comment on lines
+301
to
+302
| if (IsDrivePath(source) && IsDrivePath(target)) | ||
| return (source[0] & ~0x20) == (target[0] & ~0x20); |
| if (!CaptureOperationFileIdentities(op, &identityError)) | ||
| { | ||
| TRACE_E("Unable to capture handle identity before file-operation item " << i << ": " << GetErrorText(identityError)); | ||
| if (planStep && !script->StepBridge->StopOnError()) |
| } | ||
| else | ||
| { | ||
| reorg::MarkReviewed(Session().Plan, compiled.Hash, (int)compiled.Steps.size()); |
Comment on lines
+168
to
+172
| if (node.Info.ReadOnlyVolume && node.Change != ChangeMovedWithFolder) | ||
| { | ||
| std::vector<std::wstring> paths; | ||
| paths.push_back(node.ProposedPath); | ||
| sink.Add(MakeIssue(L"DST-002", SevError, paths, L"The destination volume is read-only.")); |
Comment on lines
+196
to
+199
| if (!src.StorePlaceholder.empty()) | ||
| { | ||
| ShowError(parent, L"A recovery store path is still a placeholder."); | ||
| return; |
Comment on lines
+419
to
+420
| if (!Session().Plan.DestinationRoots.empty()) | ||
| rule.Match.ScopeRoot = Session().Plan.DestinationRoots[0].Path; |
Comment on lines
+109
to
+111
| reorg::CCancellation cancel; | ||
| Session().Snapshot.Capture(Session().Probe, roots, true, cancel); | ||
| Session().Overlay = reorg::BuildOverlay(Session().Snapshot, Session().Plan); |
| interior.replace(interior.find("crc="), 12, "crc=DEADBEEF"); | ||
| // The replaced checksum belongs to the first record only when it is not last. Append a valid tail. | ||
| interior += FormatJournalRecord("END-APPLY", std::vector<std::string>(1, "status=failed")); | ||
| ParseJournal(interior, journal); |
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.


Add the Reorganize plug-in to preview, validate, save, and apply filesystem plans through the host's durable operation engine. Keep moves recoverable and surface conflicts before disk changes so users can review the proposed result and recover displaced items.
Extend SDK 105 with step execution and lifecycle/path services, and include the plug-in, language resources, host integration, and plan tests in the solution. Document the workflow and record the separate Delivery Handoff requirements for future implementation.
^ Conflicts:
^ handoff-spec.md
^ src/plugins/shared/baseaddr_x64.txt
^ src/plugins/shared/baseaddr_x86.txt