Skip to content

Use syncSuccessful variable for logging sync outcomes - #8

Merged
mrdevrobot merged 3 commits into
feature/snapshotsfrom
copilot/sub-pr-5-another-one
Jan 26, 2026
Merged

Use syncSuccessful variable for logging sync outcomes#8
mrdevrobot merged 3 commits into
feature/snapshotsfrom
copilot/sub-pr-5-another-one

Conversation

Copilot AI commented Jan 26, 2026

Copy link
Copy Markdown
Contributor

Description

The syncSuccessful variable in SyncOrchestrator.cs was assigned in multiple code paths but never read, triggering a dead code warning. This variable tracks sync completion state across three critical paths: normal sync, snapshot recovery, and emergency database recovery.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Changes Made

Added sync outcome logging in finally block:

  • Uses syncSuccessful to log successful sync completion at Information level
  • Provides consolidated visibility into sync operations without duplicating error logging (failures already logged in catch blocks)
  • Variable correctly tracks success across all three sync paths: normal sync (line 314), snapshot sync recovery (line 326), and emergency corruption recovery (line 350)
finally
{
    if (shouldRemoveClient && client != null)
    {
        if (_clients.TryRemove(peer.NodeId, out var removedClient))
        {
            try { removedClient.Dispose(); } catch { /* Ignore disposal errors */ }
        }
    }

    // Log successful sync outcome (failures are already logged in catch blocks)
    if (syncSuccessful)
    {
        _logger.LogInformation("Sync with {NodeId} completed successfully.", peer.NodeId);
    }
}

How Has This Been Tested?

  • All sync-related unit tests pass (VectorClockSyncTests)
  • Build succeeds with no new warnings
  • CodeQL security scan passes with no alerts

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits January 26, 2026 19:24
Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Co-authored-by: mrdevrobot <12503462+mrdevrobot@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feedback implementation for variable usage in snapshot persistence Use syncSuccessful variable for logging sync outcomes Jan 26, 2026
Copilot AI requested a review from mrdevrobot January 26, 2026 19:28
@mrdevrobot
mrdevrobot marked this pull request as ready for review January 26, 2026 19:35
@mrdevrobot
mrdevrobot merged commit 1f26c06 into feature/snapshots Jan 26, 2026
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