Skip to content

Add reversible reorganization previews - #48

Merged
mzagozda merged 1 commit into
mainfrom
add-reversible-reorganization-previews
Oct 3, 2026
Merged

mzagozda merged 1 commit into
mainfrom
add-reversible-reorganization-previews

Conversation

@mzagozda

@mzagozda mzagozda commented Oct 3, 2026

Copy link
Copy Markdown
Contributor

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

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
Copilot AI balanced review requested due to automatic review settings October 3, 2026 19:41
@mzagozda
mzagozda merged commit f9a892b into main Oct 3, 2026
13 checks passed
@mzagozda
mzagozda deleted the add-reversible-reorganization-previews branch October 3, 2026 19:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 High severity · 11 Medium severity

Open (16)
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 thread src/operation_steps.cpp
Comment on lines +146 to +147
if (path[0] != L'\\' && !(path[0] != 0 && path[1] == L':'))
return FALSE;
Comment thread src/operation_steps.cpp
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 thread src/operation_steps.cpp
Comment on lines +301 to +302
if (IsDrivePath(source) && IsDrivePath(target))
return (source[0] & ~0x20) == (target[0] & ~0x20);
Comment thread src/operations_core.cpp
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);
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.

2 participants