Skip to content

Revert pull request #1437 #1441

Merged
AlexisMora merged 1 commit into
mainfrom
chore/add-back-reverted-tasks
Jul 8, 2026
Merged

Revert pull request #1437 #1441
AlexisMora merged 1 commit into
mainfrom
chore/add-back-reverted-tasks

Conversation

@AlexisMora

@AlexisMora AlexisMora commented Jul 8, 2026

Copy link
Copy Markdown
Contributor

This pr reverts #1437 so we add back #1433 and #1430

Summary by CodeRabbit

  • New Features

    • Improved context-menu support across Windows versions, including better installation and removal behavior.
    • Added support for the legacy Windows 10 shell context-menu flow alongside newer Windows handling.
  • Bug Fixes

    • Context-menu setup now continues past non-critical registration issues instead of stopping the installer.
    • Backup file comparison now recognizes changes based on file timestamps, not just file size, reducing missed updates.

…nd-preserve-token-scheduler"

This reverts commit dff3ab7, reversing
changes made to c89ab7d.
@github-actions

github-actions Bot commented Jul 8, 2026

Copy link
Copy Markdown

This PR changes 617 lines.

If it contains multiple concerns, consider splitting it. Large PRs are fine when the changes are mechanical, intentionally grouped, or belong together as part of the same feature.

Please make sure the PR description gives reviewers enough context about what matters most to review.

@AlexisMora AlexisMora changed the title Revert "Merge pull request #1437 Revert pull request #1437 Jul 8, 2026
@coderabbitai

coderabbitai Bot commented Jul 8, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This PR overhauls Windows context-menu registration/unregistration for both Windows 10 (legacy shell, registry-based) and Windows 11 (MSIX sparse package), updates native COM shell extension code and build settings, softens installer failure handling, and adds timestamp-based file modification detection to backup diff logic with corresponding tests.

Changes

Windows Context Menu Extension

Layer / File(s) Summary
Installer failure handling and build settings
assets/context-menu-installer.nsh, packages/context-menu/InternxtContextMenu.vcxproj, packages/context-menu/InternxtContextMenuHost.vcxproj
Installer logs context-menu registration failures instead of aborting; both projects set RuntimeLibrary to MultiThreaded for Release|x64.
Registration script (Windows 10/11)
packages/context-menu/register-context-menu-extension.ps1
Adds logging, build-number detection, native PowerShell relaunch, registry-based Windows 10 registration, and MSIX-based Windows 11 registration with certificate trust handling, wrapped in a trap-guarded main flow.
Unregistration script
packages/context-menu/unregister-context-menu-extension.ps1
Adds relaunch detection, a registry-tree removal helper, and Windows 10 context-menu unregistration invoked before existing Appx/certificate cleanup.
Native shell extension (legacy context menu)
packages/context-menu/src/context_menu.cpp
Adds cached icon bitmap, refactors provider/sync-root detection with Win32 APIs, and implements IShellExtInit/IContextMenu on InternxtPublicLinkShareCommand for Windows 10 legacy shell support.

Backup File Diff Timestamp Comparison

Layer / File(s) Summary
Timestamp-based modified classification
src/apps/backups/diff/calculate-files-diff.ts, src/apps/backups/diff/calculate-files-diff.test.ts, src/apps/backups/backups.test.ts
Adds isLocalFileNewer helper and updates modified-file classification to consider modification time in addition to size; tests and fixtures updated with real/mocked timestamps.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Installer
  participant RegisterScript as register-context-menu-extension.ps1
  participant Registry
  participant AppxPackage

  Installer->>RegisterScript: run script
  RegisterScript->>RegisterScript: Get-WindowsBuild
  alt relaunch needed
    RegisterScript->>RegisterScript: Invoke-NativePowerShellRegistration
  end
  alt Windows 10 build
    RegisterScript->>Registry: Register-Windows10ContextMenuExtension
  else Windows 11 build
    RegisterScript->>AppxPackage: Register-Windows11ContextMenuExtension
  end
  RegisterScript->>RegisterScript: Write-RegistrationLog
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title correctly identifies the PR as a revert of pull request #1437, which matches the stated objective.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch chore/add-back-reverted-tasks

Warning

Tools execution failed with the following error:

Failed to run tools: 13 INTERNAL: Received RST_STREAM with code 2 (Internal server error)


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
src/apps/backups/diff/calculate-files-diff.test.ts (1)

35-90: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add tests for isLocalFileNewer fallback branches.

The two new tests cover the main paths (local newer, timestamps equal), but the fallback branches in isLocalFileNewer are untested:

  • remote.modificationTime missing, falls back to remote.updatedAt
  • Both modificationTime and updatedAt missing → returns true
  • Invalid/unparseable remoteTime string → Number.isNaN path
  • Missing local.stats.mtime → would crash (see related NPE concern)

Adding these cases would protect against regressions if the fallback logic changes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/apps/backups/diff/calculate-files-diff.test.ts` around lines 35 - 90, The
new tests in calculateFilesDiff only cover the primary timestamp comparisons, so
add coverage for the fallback logic in isLocalFileNewer. Include cases where
remote.modificationTime is missing and remote.updatedAt is used, where both
remote timestamps are missing and the function returns true, and where the
remote time string is invalid so the Number.isNaN path is exercised. Also add a
guard-rail test for missing local.stats.mtime to document the expected failure
mode or prevent an unexpected crash.
packages/context-menu/src/context_menu.cpp (1)

170-201: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

Optional: global bitmap cache is not thread-safe.

ContextMenuBitmap is a process-global lazily initialized from GetContextMenuBitmap(). Under the Apartment threading model, concurrent STA threads could both observe a null cache and each create a bitmap, leaking one HBITMAP. A one-time init (InitOnceExecuteOnce) or interlocked compare-exchange would remove the race. Low priority given the small window and single-leak impact.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/context-menu/src/context_menu.cpp` around lines 170 - 201, The lazy
global cache in GetContextMenuBitmap is not thread-safe, so multiple
Apartment/STA threads can race on ContextMenuBitmap and create duplicate
HBITMAPs. Update the one-time initialization in GetContextMenuBitmap to use a
thread-safe guard such as InitOnceExecuteOnce or an interlocked compare-exchange
around the bitmap creation and assignment, ensuring only one bitmap is created
and cached.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@packages/context-menu/src/context_menu.cpp`:
- Around line 170-201: The lazy global cache in GetContextMenuBitmap is not
thread-safe, so multiple Apartment/STA threads can race on ContextMenuBitmap and
create duplicate HBITMAPs. Update the one-time initialization in
GetContextMenuBitmap to use a thread-safe guard such as InitOnceExecuteOnce or
an interlocked compare-exchange around the bitmap creation and assignment,
ensuring only one bitmap is created and cached.

In `@src/apps/backups/diff/calculate-files-diff.test.ts`:
- Around line 35-90: The new tests in calculateFilesDiff only cover the primary
timestamp comparisons, so add coverage for the fallback logic in
isLocalFileNewer. Include cases where remote.modificationTime is missing and
remote.updatedAt is used, where both remote timestamps are missing and the
function returns true, and where the remote time string is invalid so the
Number.isNaN path is exercised. Also add a guard-rail test for missing
local.stats.mtime to document the expected failure mode or prevent an unexpected
crash.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 58d519af-275e-46d1-a9d5-a6a5e36e6362

📥 Commits

Reviewing files that changed from the base of the PR and between 96d0533 and 10159c1.

📒 Files selected for processing (9)
  • assets/context-menu-installer.nsh
  • packages/context-menu/InternxtContextMenu.vcxproj
  • packages/context-menu/InternxtContextMenuHost.vcxproj
  • packages/context-menu/register-context-menu-extension.ps1
  • packages/context-menu/src/context_menu.cpp
  • packages/context-menu/unregister-context-menu-extension.ps1
  • src/apps/backups/backups.test.ts
  • src/apps/backups/diff/calculate-files-diff.test.ts
  • src/apps/backups/diff/calculate-files-diff.ts

@sonarqubecloud

sonarqubecloud Bot commented Jul 8, 2026

Copy link
Copy Markdown

@AlexisMora AlexisMora merged commit ecda67e into main Jul 8, 2026
7 of 8 checks passed
@AlexisMora AlexisMora deleted the chore/add-back-reverted-tasks branch July 8, 2026 13:15
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