Skip to content

Add non-destructive scan setting for unrecognized files#91

Merged
luandev merged 7 commits intomainfrom
copilot/fix-auto-file-move-issue
Jan 8, 2026
Merged

Add non-destructive scan setting for unrecognized files#91
luandev merged 7 commits intomainfrom
copilot/fix-auto-file-move-issue

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 8, 2026

Summary

  • Implements a non-destructive scan setting to prevent automatic file moves
  • Unrecognized files (not found in Crocdb) will no longer be automatically moved to a "Not Found" folder without explicit user consent
  • Added autoOrganizeUnrecognized setting (default: false) to Settings type
  • Modified scanner service to respect the setting and skip organizing unrecognized files when disabled
  • Updated job service to pass the setting from application configuration
  • Fixed test compatibility after merge with fuzzy matching PR (Improve ROM recognition with fuzzy matching and multi-strategy search #92)

Testing

  • ✅ All 131 unit tests pass
  • ✅ 4 new tests specifically for autoOrganizeUnrecognized behavior
    • Verifies non-destructive default (files NOT moved when false)
    • Verifies legacy behavior when enabled (files moved when true)
    • Verifies recognized files always organized regardless of setting
    • Verifies batch operations respect the setting
  • ✅ Updated all existing test calls to explicitly pass the parameter
  • ✅ Added fuzzy-matcher mock in scanner.test.ts for compatibility with merged fuzzy matching functionality
  • ✅ Updated scanner-enhanced.test.ts from merged PR to use correct autoOrganizeUnrecognized parameter
  • ✅ Linting issues in modified files fixed
  • ✅ Type checking passes
  • ✅ Code review clean (no issues)

Checklist

  • Added a semantic version comment to this PR using /semver: patch, /semver: minor, or /semver: major. (See template for examples)
  • Confirmed workflows and automation updates (if any) have appropriate permissions.
Original prompt

This section details on the original issue you should resolve

<issue_title>Files are moved automatically when not recognised</issue_title>
<issue_description>Unrecognised files are automatically moved to a "not found" folder. This is unexpected and destructive.

Expected:

  • Default to non-destructive scans
  • Toggle to disable file moves
  • Explicit confirmation before mutations</issue_description>

<agent_instructions>Implement this using a test-driven development (TDD) approach, with production-grade code quality.
</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits January 8, 2026 18:38
Co-authored-by: luandev <6452989+luandev@users.noreply.github.com>
Co-authored-by: luandev <6452989+luandev@users.noreply.github.com>
Copilot AI changed the title [WIP] Fix issue with unrecognised files being moved automatically Add non-destructive scan setting for unrecognized files Jan 8, 2026
Copilot AI requested a review from luandev January 8, 2026 18:42
@luandev luandev marked this pull request as ready for review January 8, 2026 18:48
Copilot AI review requested due to automatic review settings January 8, 2026 18:48
Copy link
Copy Markdown
Owner

@luandev luandev left a comment

Choose a reason for hiding this comment

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

fix linting issues

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR implements a non-destructive scan behavior by default, addressing issue #87 where unrecognized files were automatically moved to "Not Found" folders without user consent. The solution adds an autoOrganizeUnrecognized setting (default: false) that allows users to opt into the legacy behavior while keeping scans safe by default.

Key Changes:

  • Added autoOrganizeUnrecognized?: boolean setting with non-destructive default (false)
  • Modified scanner logic to skip moving unrecognized files when setting is disabled
  • Comprehensive test coverage with 4 new tests and 33 updated tests to explicitly pass the new parameter

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
packages/shared/src/types.ts Added autoOrganizeUnrecognized?: boolean field to Settings type with clear JSDoc documentation
packages/shared/src/constants.ts Set default value to false for non-destructive behavior
packages/shared/src/tests/constants.spec.ts Added test assertion for the new default setting
apps/server/src/services/scanner.ts Implemented skip logic for unrecognized files when setting is false; preserved legacy behavior when true
apps/server/src/services/scanner.test.ts Added 4 comprehensive tests for new behavior; updated 33 existing tests with explicit parameter
apps/server/src/services/jobs.ts Integrated setting into scan job workflow with proper null coalescing

…tion

Co-authored-by: luandev <6452989+luandev@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 8, 2026

fix linting issues

Fixed linting issues in modified files:

  • Removed unused type imports (UnorganizedItem, ReorganizeResult) from test file
  • Prefixed unused isRomHack function with underscore

Commit: a0912b5

Copilot AI requested a review from luandev January 8, 2026 18:52
@luandev
Copy link
Copy Markdown
Owner

luandev commented Jan 8, 2026

@copilot after merge, unit tests are failing now

…Unrecognized param

Co-authored-by: luandev <6452989+luandev@users.noreply.github.com>
Copy link
Copy Markdown
Contributor Author

Copilot AI commented Jan 8, 2026

@copilot after merge, unit tests are failing now

Fixed the failing tests after merge with PR #92 (fuzzy matching):

  1. Added fuzzy-matcher mock in scanner.test.ts to pass through results without filtering
  2. Updated scanner-enhanced.test.ts to pass autoOrganizeUnrecognized: true for test expecting "Not Found" folder behavior

All 131 tests now pass.

Commit: 368b56f

Copilot AI requested a review from luandev January 8, 2026 19:07
@luandev luandev merged commit 6b6fb71 into main Jan 8, 2026
9 checks passed
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.

Files are moved automatically when not recognised

3 participants