Commit Graph

148 Commits

Author SHA1 Message Date
Jamie Pine
388b4dde28 cargo fmt 2026-01-24 16:14:21 -08:00
Jamie Pine
26a730c0f2 add sd sync partners CLI 2026-01-24 11:09:09 -08:00
Jamie Pine
eb1de30d26 remove pairing expiration 2026-01-24 11:06:02 -08:00
Jamie Pine
37d19adb08 chore(sync): remove legacy last_sync_at column and related functionality
- Removed the last_sync_at field from the device model and related structures, as it is now superseded by per-peer watermark tracking in sync.db.
- Updated various components, including device registration, sync setup, and messaging protocols, to eliminate references to last_sync_at.
- Introduced a migration to drop the obsolete last_sync_at column from the devices table.
- Adjusted tests and helper functions to reflect the removal of last_sync_at, ensuring they align with the new sync architecture.
2026-01-22 19:37:43 -08:00
Jamie Pine
5673bd0eb4 feat(device): enhance device registration with comprehensive hardware specifications
- Added new fields for device OS, hardware model, CPU details, memory, and storage specifications to the device registration process.
- Updated the LibraryManager to handle the new device attributes during device creation and updates.
- Modified the sync setup action to include full device information when registering devices with remote peers.
- Enhanced the messaging protocol to support the transmission of detailed hardware specs during device registration.
- Introduced a new test for transitive sync backfill to validate the complete sync process across multiple devices.
2026-01-22 18:02:07 -08:00
Jamie Pine
966b7fea7a feat(sync): transition device sync to shared resources
- Updated device versioning to use the `updated_at` timestamp for conflict resolution.
- Refactored sync methods to support shared changes with HLC-based conflict resolution.
- Implemented automatic device discovery via shared sync, allowing devices to propagate changes to all members in the library.
- Added migration to transition existing devices to shared sync.
- Enhanced documentation to reflect changes in device ownership and sync methods.
2026-01-22 15:52:42 -08:00
Jamie Pine
1d11e121dc feat(pairing): enhance proxy pairing functionality and add tests
- Introduced new event types for proxy pairing confirmation and vouching readiness in the event summarization.
- Implemented a reload mechanism for protocol configurations to support dynamic updates during runtime.
- Enhanced the PairingProtocolHandler to manage joiner pairing handshakes and improve session handling.
- Added comprehensive unit tests for proxy pairing, covering session creation, state transitions, and vouching logic.
- Updated configuration structures to include default proxy pairing settings for better integration.
2026-01-22 14:55:58 -08:00
Cursor Agent
2f7a88a625 refactor useNormalizedQuery to accept query name
Co-authored-by: ijamespine <ijamespine@me.com>
2026-01-22 07:00:52 +00:00
Jamie Pine
1b04b3b431 feat(sync): implement batch event emission for applied UUIDs during backfill
This commit enhances the BackfillManager by collecting successfully applied UUIDs during the backfill process and emitting batch resource events for UI reactivity. It also updates the protocol handler to emit resource events for insert and update changes, ensuring that the UI reflects the latest state. Additionally, a new test is added to verify that volume ResourceChanged events are emitted correctly during synchronization, improving the overall synchronization experience.
2026-01-20 14:55:31 -08:00
Jamie Pine
b9bfa5463c feat(sync): enhance foreign key handling and mime type synchronization
This commit introduces improvements to the synchronization process by adding foreign key conversion to UUIDs for cross-device compatibility. It also implements batch syncing of mime types before content identities to ensure proper dependency resolution. Additionally, the content identity model is updated to include mime type and kind ID handling, enhancing data integrity during sync operations. Debugging information is added to track registered models and their sync types, improving traceability in the sync process.
2026-01-20 14:00:27 -08:00
Jamie Pine
564928060b feat(indexing): improve ephemeral indexing with batch processing and event emission control
This commit enhances the ephemeral indexing process by introducing batch processing for entries, which reduces lock contention and improves performance. It also adds a new parameter to control event emissions based on the indexing context (volume indexing vs. directory browsing). Additionally, the progress reporting mechanism is updated to reflect actual file counts, ensuring more accurate completion metrics during indexing operations. These changes optimize the overall efficiency and user experience of the indexing system.
2026-01-15 07:52:41 -08:00
Jamie Pine
6177fc480e feat(CopyJobDetails): enhance file transfer UI with auto-scrolling and metadata refetching
This commit improves the `CopyJobDetails` component by adding an auto-scroll feature that centers the currently copying file in the transfer queue. Additionally, it implements a mechanism to refetch copy metadata when the completed file count changes, ensuring that the displayed information is always up-to-date. The UI is further refined with updated icons and styles for better user experience during file operations.
2026-01-12 02:50:11 -08:00
Jamie Pine
df10b6cf72 feat(JobManager): enhance job details display with speed tracking and UI improvements
This commit introduces a new `CopyJobDetails` component to display detailed information about file copy jobs, including transfer speed, estimated time of arrival (ETA), and a speed graph. The `JobCard` and `JobList` components are updated to support this new functionality, allowing users to view historical speed data for ongoing jobs. Additionally, the `useJobs` hook is enhanced to manage speed history, ensuring a smooth user experience during file operations. These changes improve the overall visibility and feedback for users managing file transfers.
2026-01-11 05:30:21 -08:00
Jamie Pine
2802917d07 feat(copy): enhance file copy operations with metadata tracking and conflict resolution
This commit introduces several improvements to the file copy functionality, including the addition of metadata for rich UI display during copy operations. It implements detailed tracking of file counts and total bytes, enhancing user feedback during the process. Additionally, a new mechanism for checking and resolving file conflicts has been added, allowing for better handling of existing files at the destination. The changes also include the introduction of a `CopyJobMetadata` structure to facilitate querying of copy job details, improving the overall robustness and user experience of file operations.
2026-01-11 04:39:04 -08:00
Jamie Pine
5b74e94953 refactor(location): enforce volume detection for location entries
This commit updates the LocationManager to ensure that all locations have a resolved volume before creation. It simplifies volume ID handling by removing lazy resolution and directly returning errors when volumes are not found. Additionally, it modifies related functions to reflect these changes, enhancing the robustness of volume management in the application.
2026-01-11 00:00:56 -08:00
Jamie Pine
715645ed23 refactor(dependencies): update Cargo.toml and Cargo.lock for sd-tauri-core and related modules
This commit updates the dependencies in the Cargo.toml files for both sd-tauri-core and src-tauri, removing the deprecated sd-core dependency and adding the dirs crate for platform-specific directory handling. Additionally, it modifies the implementation of data directory resolution in sd-tauri-core to support different operating systems. The Cargo.lock file is also updated to reflect these changes.
2026-01-10 21:55:08 -08:00
Jamie Pine
61219569c4 Enhance CONTRIBUTING.md with media processing features guidance
This commit updates the CONTRIBUTING.md file to provide clearer instructions on building the project with media processing features. It introduces convenient cargo aliases for building with `ffmpeg` and `heif` features enabled, and emphasizes the importance of these features for development. Additionally, it includes notes on the implications of building without these features and how to resolve related issues. The changes aim to improve the onboarding experience for new contributors.
2026-01-09 17:59:22 -08:00
Jamie Pine
6d61477885 Refactor: Replace Explorer component with Shell in App and main entry points
This commit updates the application structure by replacing the Explorer component with the new Shell component in both the Tauri and web applications. The Shell component serves as the main entry point, enhancing the overall architecture and layout management. Additionally, the interface documentation has been updated to reflect this change, ensuring clarity in the component hierarchy.
2026-01-07 15:58:10 -08:00
Jamie Pine
b4385aa3f3 Enhance test cleanup by adding core shutdown logic
This commit adds core shutdown logic to multiple test scenarios in the `file_copy_pull_test.rs` and `volume_tracking_test.rs` files. The shutdown ensures that file descriptors are released after test completion, improving resource management and preventing potential leaks. This change enhances the reliability of the tests by ensuring a clean state after execution.
2026-01-07 12:47:38 -08:00
Jamie Pine
d1db406cda Update VSCode settings, modify Cargo.toml features, and enhance tag handling in the interface
This commit updates the VSCode settings to include new configurations for newline handling and formatting. In the Cargo.toml file for the server, the default features have been cleared to streamline dependencies. Additionally, the TagsGroup and TagSelector components have been modified to handle both TagSearchResult and raw Tag objects, improving tag extraction and selection logic. These changes enhance the overall development experience and ensure better tag management in the application.
2026-01-05 21:24:29 -08:00
Jamie Pine
4f97267c37 Enhance LibraryLock management by adding explicit release method
This commit introduces a `release` method to the `LibraryLock` struct, allowing for explicit lock release during library shutdown. The `_lock` field in the `Library` struct is now wrapped in a `Mutex<Option<LibraryLock>>` to facilitate this change. Additionally, the shutdown process has been updated to ensure the lock is released properly, even with lingering references. The library test has been adjusted to reflect a change from "thumbnails" to "sidecars" in the expected directory structure.
2026-01-04 22:06:34 -08:00
Jamie Pine
70842c6743 Fix library test (database.db → library.db) 2026-01-04 21:36:14 -08:00
Cursor Agent
3487c90f1c Merge branch 'main' into windows-build
Resolved conflict in core/src/infra/sync/hlc.rs by adopting the main branch's
improved test implementation that properly uses FakeTimeSource for deterministic
time control in tests.
2026-01-03 21:53:34 +00:00
Jamie Pine
322db65663 feat(logo): replace ASCII logo with a dynamic purple orb rendering
- Removed the static ASCII logo and implemented a new function to calculate brightness on a sphere, allowing for a dynamic rendering of the Spacedrive logo as a purple orb using ANSI colors and Unicode half-blocks.
- Enhanced the `print_logo_colored` function to utilize the new brightness calculation and color gradient, improving visual representation.
- Updated related documentation to reflect the changes in logo rendering.
2025-12-31 16:46:58 -08:00
Jamie Pine
6b8f178788 refactor(tests): enhance debug output formatting in indexing tests
- Updated debug print statements in the indexing test to use consistent formatting with multi-line syntax for improved readability.
- Rearranged test suite definitions in `test_core.rs` for better organization and clarity, including renaming test cases for consistency.
- Added new test cases to cover additional functionalities, ensuring comprehensive test coverage.

These changes aim to improve the clarity of debug information and the overall structure of the test suite.
2025-12-31 16:46:50 -08:00
Jamie Pine
d9f0a4de5e fix(tests): improve Windows test stability and directory handling
- Reduced sleep duration after shutdown to 500ms to expedite test execution while still allowing time for SQLite file locks to release.
- Enhanced uniqueness of temporary directory names on Windows by incorporating a timestamp alongside a counter, preventing conflicts with leftover files from previous runs.
- Implemented retry logic for cleaning up leftover directories on Windows, improving robustness against file lock issues during test execution.

These changes aim to enhance the reliability and performance of tests in a Windows environment.
2025-12-31 13:44:25 -08:00
Jamie Pine
edf22c56d9 feat(indexing): enhance DatabaseAdapter and ChangeDetector to support device_id
- Added device_id parameter to DatabaseAdapter and DatabaseAdapterForJob for improved context handling.
- Updated ChangeDetector to utilize device_id when creating persistence instances, ensuring accurate indexing behavior.
- Refactored related tests to verify correct parent-child relationships and prevent duplicate entries during folder moves.
2025-12-31 12:54:58 -08:00
Jamie Pine
32e7fe9ca1 fix(tests): enhance Windows compatibility and test stability
- Normalize file paths to use forward slashes in Git pattern matching for better compatibility across platforms.
- Introduce a random suffix to temporary directory names in tests on Windows to avoid file lock contention during parallel execution.
- Add a delay after shutdown in tests to ensure SQLite file locks are released properly on Windows.

These changes aim to improve the reliability and consistency of tests in a Windows environment.
2025-12-31 12:45:22 -08:00
Brendan Allan
48b986652c hlc time source 2025-12-31 14:37:11 +08:00
Jamie Pine
9f404225a6 Merge branch 'windows-build' of https://github.com/spacedriveapp/spacedrive into windows-build 2025-12-30 22:12:01 -08:00
Jamie Pine
710062b869 fix(windows): improve test stability and Windows API usage
- Fix flaky HLC test by handling timing variations between sequential calls
- Move GENERIC_READ import to correct module in Windows file operations
- Add debug logging to change detection test for troubleshooting

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2025-12-30 22:11:27 -08:00
Jamie Pine
ff25fab772 refactor(tests): enhance fixture generation and update test suite structure
- Updated the fixture generation process to write to a temporary directory by default, improving test isolation and following best practices.
- Added instructions for regenerating source fixtures when needed, enhancing developer experience.
- Refactored the test suite structure to utilize a more flexible argument handling mechanism, allowing for easier addition of new tests.
- Removed deprecated test configurations and streamlined the test suite definitions for clarity and maintainability.
2025-12-30 22:06:53 -08:00
Jamie Pine
d255ef185e refactor(tests): implement TestDataDir and SnapshotManager for improved test data handling
- Introduced TestDataDir for managing test data directories with automatic cleanup and optional snapshot support, ensuring all test data is created in the system temp directory.
- Added SnapshotManager to facilitate capturing snapshots of test state for post-mortem debugging, with platform-specific storage locations.
- Updated various integration tests to utilize the new TestDataDir structure, enhancing consistency and determinism in test execution.
- Revised documentation to reflect new conventions for test data management and snapshot usage.
2025-12-30 15:50:07 -08:00
Jamie Pine
2881117e00 feat(tests): update testing paths for deterministic integration tests
- Modified test data paths in various integration tests to use the Spacedrive source code instead of user directories, ensuring consistent and deterministic test results across environments.
- Updated comments and documentation to reflect the new testing approach and clarify the purpose of using project source code for testing.
- Enhanced the GitHub Actions workflow to skip Rust toolchain setup on macOS self-hosted runners, assuming Rust is pre-installed.
2025-12-30 13:05:19 -08:00
Jamie Pine
eb8d83df6e fix: improve readability of environment variable retrieval in indexing harness
Refactored the environment variable retrieval logic for Windows to enhance clarity by adding additional line breaks. This change maintains the existing functionality while making the code easier to read and understand.
2025-12-30 12:08:53 -08:00
Jamie Pine
fee527536c Merge branch 'main' into windows-build 2025-12-30 12:08:41 -08:00
Jamie Pine
a292cc31cc fix: resolve async/await issues in file transfer path validation
- Changed get_all_allowed_paths() to async to properly await library manager operations
- Changed is_path_allowed() to async and fixed RwLock held across await points
- Changed validate_path_access() to async for consistency
- Replaced blocking_read() and block_on() with proper async/await
- Clone RwLock data before await to ensure future is Send
- Updated all call sites to use .await
- Improved error logging with structured tracing

This fixes compilation errors where futures were not Send due to
RwLockReadGuard being held across await points, and prevents potential
deadlocks from blocking operations in async contexts.

Fixes the file_transfer_test which now passes successfully.
2025-12-30 10:50:30 -08:00
Jamie Pine
0402fb05d1 feat(windows): implement NTFS File ID tracking for stable file identity
Implements Windows File ID support in the indexer to enable stable file
identification across renames on Windows NTFS filesystems. This brings
Windows to feature parity with Unix/Linux/macOS for change detection
and UUID persistence.

**Problem:**
Previously, Windows files didn't have stable identifiers across renames
because get_inode() returned None. This meant:
- Renamed files were treated as delete + create
- UUIDs were not preserved across renames
- Tags, metadata, and relationships were lost
- Files had to be re-indexed and re-hashed unnecessarily

**Solution:**
Uses Windows NTFS File IDs (64-bit file index) via GetFileInformationByHandle
API as the equivalent of Unix inodes for stable file identification.

**Changes:**
- Added windows-sys dependency for Win32 File System API access
- Implemented get_inode() for Windows using GetFileInformationByHandle
- Combines nFileIndexHigh and nFileIndexLow into 64-bit identifier
- Gracefully handles FAT32/exFAT (returns None) and permission errors
- Updated all call sites to pass both path and metadata parameters
- Updated test harness to verify Windows File ID tracking

**Benefits:**
- File renames now detected as moves (not delete + create)
- UUIDs preserved across renames within a volume
- Tags and metadata preserved across renames
- No re-indexing or re-hashing needed for renamed files

**Limitations:**
- Only works on NTFS (FAT32/exFAT fall back to path-only matching)
- File IDs are volume-specific (cross-volume copies get new UUIDs)

Addresses task CORE-015

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 (1M context) <noreply@anthropic.com>
2025-12-29 09:49:08 -08:00
Jamie Pine
5c1c8dea88 feat(core): implement bidirectional remote file copy (PULL support)
Extends the FileCopyJob to support PULL operations, enabling files to be
copied FROM remote devices TO the local device. Previously, only PUSH
operations worked (local -> remote).

Changes:
- Add PullRequest/PullResponse messages to FileTransferMessage enum
- Add TransferDirection enum to detect PUSH vs PULL operations
- Refactor RemoteTransferStrategy to detect direction automatically
- Implement execute_pull() for remote source -> local destination
- Add handle_pull_request() handler on the protocol side
- Add path validation for security (prevent directory traversal)
- Add integration test for PULL operations

The strategy automatically detects direction based on SdPath:
- Source is local + Destination is remote = PUSH (existing behavior)
- Source is remote + Destination is local = PULL (new behavior)

This enables users to drag files from remote device explorers to local
folders, which previously failed with 'Source must be local path' error.

Closes FILE-005
2025-12-26 12:38:49 -08:00
Jamie Pine
f1547de0af Refactor file transfer protocol to skip encryption and decryption
- Updated `stream_file_data` to bypass encryption, as Iroh provides end-to-end encryption for connections.
- Adjusted `FileTransferProtocolHandler` to skip decryption, directly using the received encrypted data.
- Enhanced logging to reflect changes in data handling during file transfers.
- Added tests to ensure session keys are distinct and validate key swapping functionality.
- Improved error handling in `DevicePersistence` for corrupted session keys during device loading.
2025-12-25 22:33:21 -08:00
Jamie Pine
a313f2b9c8 Enhance file copy strategies and improve logging
- Updated documentation for copy strategies to clarify their use cases and selection logic.
- Improved logging in `DevicePersistence` to track loading of paired devices and handle expired session keys.
- Added detailed logging for session key retrieval in `FileTransferProtocolHandler`.
- Introduced a new test for file transfer with daemon restart to ensure session key persistence across restarts.
2025-12-25 15:46:36 -08:00
Jamie Pine
fd6a9122d6 Update submodule reference and enhance file copy job logging
- Updated macOS subproject reference to indicate a dirty state.
- Refactored `FileCopyJob` to improve logging for final destination calculations.
- Enhanced `stream_file_data` logging to include destination path in transfer requests.
- Added `find_containing` method to `EphemeralIndex` for substring search functionality.
- Improved logging in `ephemeral_search` to track search results and filtering.
- Replaced print statements with tracing logs in `FileTransferProtocolHandler` for better debugging.
2025-12-25 14:31:42 -08:00
Jamie Pine
bcaa1ff85c Implement directory preview and enhance file deletion testing
- Added `DirectoryPreview` component for rendering a grid view of subdirectories in the Quick Preview.
- Updated `ContentRenderer` to utilize `DirectoryPreview` for directory types.
- Introduced TypeScript integration test for verifying cache updates upon file deletions, ensuring accurate directory listing after deletions.
- Enhanced keyboard handling in Explorer to prevent shortcuts when input fields are focused.
2025-12-25 10:50:20 -08:00
Jamie Pine
6bb6cb6c9a Enhance IndexerJobConfig to support background execution
- Added `run_in_background` field to `IndexerJobConfig` to allow jobs to run without persisting to the database or updating the UI.
- Updated `should_persist` method in `IndexerJob` to account for background jobs.
- Modified `handle_new_directory` in `DatabaseAdapter` to create background indexer jobs.
- Ensured default value for `run_in_background` is set to false in various configurations.
- Introduced a new integration test for bulk file moves to validate cache updates and file handling.
2025-12-25 07:30:07 -08:00
Jamie Pine
caf5a242fd Implement TypeScript integration tests with Rust bridge
- Added a new test suite in `core/tests/typescript_bridge_test.rs` to facilitate end-to-end testing between Rust and TypeScript.
- Introduced `IndexingHarnessBuilder` enhancements to support a daemon RPC server for TypeScript tests.
- Created TypeScript test files for `useNormalizedQuery` to validate file move and folder rename operations.
- Configured Bun test environment with `bunfig.toml` and setup scripts for improved testing efficiency.
- Updated `TcpSocketTransport` to handle TCP connections for the TypeScript client, ensuring robust communication with the Rust backend.
- Enhanced logging and error handling for better visibility during test execution.
2025-12-25 06:45:17 -08:00
Jamie Pine
1998975818 feat: Implement library validation and reset mechanism
- Added a new function `validate_and_reset_library_if_needed` to check if the current library exists and reset the state if it doesn't.
- Integrated this validation process into the daemon connection initialization, ensuring the app state is consistent with the available libraries.
- Enhanced error handling and logging for better debugging during library validation.
- Introduced a new test suite for file move operations, covering various scenarios to ensure robust handling of file movements and state integrity.
2025-12-25 05:39:36 -08:00
Jamie Pine
7f4b757290 Add comprehensive integration tests for the tag system
- Introduced a new test suite for validating the tag workflow, including tag creation, application, and database persistence.
- Implemented event collection to verify resource events during tag operations.
- Added assertions to ensure correct tag associations with files and proper database entries.
- Enhanced logging for better traceability of test execution and outcomes.
2025-12-24 10:00:58 -08:00
Jamie Pine
9f5c7c5880 Enhance indexing and change detection mechanisms
- Refactored the `IndexPersistence` implementation to improve error handling and logging when querying directory paths.
- Updated the change detection logic to always load existing entries during reindexing, ensuring accurate detection of moves, modifications, and deletions.
- Introduced a new test suite for folder rename operations, covering both persistent and ephemeral indexing scenarios, validating UUID/inode preservation and parent-child relationship integrity.
- Enhanced the `IndexingHarnessBuilder` to allow disabling the filesystem watcher for specific tests, improving test flexibility.
- Added closure table integrity verification to ensure proper connections between renamed folders and their children, preventing data inconsistencies.
2025-12-24 08:04:33 -08:00
Jamie Pine
3555a11795 Add IndexMode::Stale variant for improved stale file detection
- Introduced a new `IndexMode::Stale` variant to enhance the indexing process by leveraging modified time (mtime) pruning.
- Updated `IndexerJobConfig` to utilize the new mode, allowing for more efficient directory exploration based on filesystem changes.
- Implemented logic in the discovery phase to skip directories with matching mtime, improving performance and reducing unnecessary indexing.
- Enhanced `IndexMode` with helper methods to check for mtime pruning and retrieve the inner indexing mode.
- Updated relevant functions and tests to support the new stale detection capabilities, ensuring robust handling of file indexing and statistics tracking.
- Refactored existing code to accommodate the new indexing strategy while maintaining backward compatibility with previous modes.
2025-12-24 00:49:20 -08:00
Jamie Pine
96c08fa3a1 Enhance file operations and introduce statistics listener service
- Updated the TODO list to clarify the quick preview reporting issue.
- Enhanced the Tauri app's menu to include custom clipboard operations (cut, copy, paste) with appropriate state management.
- Introduced a new `statistics_listener` service to manage per-library statistics recalculation based on resource changes, improving performance and responsiveness.
- Added configuration options for enabling/disabling the statistics listener in the application settings.
- Refactored event handling in the job manager to improve logging and status monitoring.
- Updated tests to include the new statistics listener functionality and ensure proper event collection during file operations.
2025-12-23 08:36:42 -08:00