Conversation
…n in web and desktop
…e selection restore
- Add 8 unit tests covering: identical branches, add, modify, remove, rename, WORKDIR sentinel, invalid branch, and binary file detection - Add create_test_repo() helper using tempfile for isolated temp repos - Add tempfile dev-dependency to Cargo.toml - Fix pre-existing clippy warnings (contains, needless_return, useless_format) - Apply cargo fmt to git.rs and lib.rs
Add 9 tests covering: text file content verification, missing file (notFound), binary detection via null bytes, WORKDIR filesystem reads, WORKDIR missing file, non-UTF8 lossy conversion (git blob and workdir), bad ref error handling, and WORKDIR binary detection.
…es_with_oids, and resolve_ref Add 11 tests covering: - list_files: committed files, nested paths, empty tree, WORKDIR, gitignore - list_files_with_oids: valid OID strings, multiple files with unique OIDs - resolve_ref: valid branch, invalid ref error, HEAD resolution
Extract classify_path pure function and EventKind enum from the watcher callback for testability. Add 17 unit tests covering: node_modules filtering, .git/objects and .git/logs ignored, target/ directory ignored, regular source files emit workdir-changed, .git/refs and .git/HEAD emit refs-changed, edge cases (paths outside repo, .git internals).
Mock @tauri-apps/api/core invoke to verify all GitService interface methods call the correct Tauri commands with proper argument shapes. Covers loadRepo, listBranches, getDiff, readFile, listFiles, listFilesWithOids, resolveRef, dispose, error propagation, and instance reuse patterns (18 tests).
12 renderHook tests covering initial state, load success/error state transitions, refresh with preserved selection, reset, localStorage branch persistence, workdir-changed event handling with debounce, branch flipping, and edge cases like single-branch repos.
Expand useFileTree.test.ts from 3 to 22 tests covering tree building, status markers, binary detection, filtering, selection, large repo mode, race condition prevention, expand/collapse, and revealPath.
- 10 tests covering token count updates, binary file handling (both includeBinaryPaths modes), progress callback, cancellation/abort, empty selection, context lines effect, total summation, runtime binary detection, and null gitClient - Mock tiktoken with deterministic word-count tokenizer - Verify cancellation prevents stale state updates after unmount
25 tests covering createUnifiedDiffForPath and buildUnifiedDiffForStatus: - Modified/added/removed file diff generation - Unchanged file handling (identical content, empty string) - CRLF normalization producing stable diffs - Context lines control (0, 3, 999/full file) - Empty file and no-trailing-newline edge cases - Binary file inputs returning null - notFound file side handling
Expand workspaceStore.test.ts from 4 to 16 tests covering: - upsertWorkspace updates existing rather than creating duplicates - upsertWorkspace by path match prevents duplicates - removeWorkspace with non-existent ID is a no-op - removeWorkspace clears activeWorkspaceId for active workspace - getWorkspaceSelectionRestore is case-sensitive - MAX_PERSISTED_SELECTIONS (5000) limit enforcement - listWorkspaceItems sorted by lastOpenedAt descending - setActiveWorkspace/getWorkspaceById round-trips - corrupt localStorage data graceful degradation - session settings merge with defaults (missing keys filled) - findWorkspaceByPath matches exact paths only - save/load round-trip preserves all session data
Tests mapWithConcurrency: concurrency limit enforcement via in-flight tracking, result ordering preservation, error propagation, empty input, sequential processing (limit=1), limit exceeding array length, and AbortSignal cancellation. Tests createConcurrencyLimiter: concurrent execution limiting, result ordering, and error propagation.
- Test single invocation after burst of calls within delay - Test final call's arguments are used - Test timer reset on rapid calls - Test full delay expiration triggers function - Test returned function is callable multiple times independently - Test multiple arguments passed correctly - Uses vi.useFakeTimers for deterministic timing control
fix(desktop): strip trailing slashes from input paths in normalizeClipboardPath
Tests cover rendering with status icons, token-based sorting (high/low), name-based sorting (A-Z/Z-A), binary file indicators with disabled preview, remove/reveal/preview callbacks, empty state, recalculating indicator, and locale-formatted token counts. TokenCountsContext is properly mocked.
- 15 tests covering token breakdown display, progress bar width, over-limit warning styling, copy button disabled/enabled states, onCopy callback, flash messages (success/failure), zero limit hiding progress bar, comma-formatted token counts, and busy state
- Test tab rendering (Selected Files and Settings tabs) - Test badge display with file count and zero-count behavior - Test tab switching calls onTabChange with correct tab IDs - Test active tab styling via CSS class - Test children rendering in tab panel - Test tab switching preserves content (no remount)
- Test provider makes token counts available to children via useContext - Test counts update when selectedPaths change - Test busy flag reflects computation state - Test progress reports completed/total/percent correctly via onBatch - Test total is sum of all individual file counts - Test unmount during async counting causes no state-update warnings - Test progress percent edge cases (zero total, overflow) - Test useTokenCountsContext throws outside provider - Test props are passed correctly to useTokenCounts hook
Extract inline theme management logic from App.tsx into a reusable useTheme hook and add 10 tests covering: system default (light/dark), toggle behavior, localStorage persistence, system fallback, DOM data-theme attribute, corrupt localStorage handling, system preference change tracking, and cleanup on unmount.
Extract output-building logic from App.tsx into testable copyOutput.ts utility functions (generateFileTreeText, buildHeader, buildFileSection, buildCopyOutput). Add 26 tests covering header format, instructions section, file tree toggle, modify/add/remove diffs, binary handling, context lines, and end-to-end output structure.
- Test getModels returns array of ModelInfo objects from API - Verify required fields (id, name, context_length) on each model - Validate model IDs are unique and context_length values are positive - Test localStorage caching (fresh cache hit, stale cache refetch) - Test model selection persistence via gc.selectedModel key - Verify invalid saved model ID handled gracefully (defaults to 0) - Verify ModelInfo type compliance with optional fields
Add 13 integration-level tests verifying error propagation, auto-clear, dismiss, and recovery flows that mirror the App's error management pattern: - Unhandled promise rejection displays in banner (Error and non-Error) - Window.error event displays in banner (with/without error object) - Auto-clear on successful repo load - Multiple rapid errors show only latest - Repo load and diff compute errors propagate to banner - Dismiss clears error without reappearing - Full recovery flow: error → user action → success - Re-render and null transition behavior - Global listener cleanup on unmount
Add comprehensive integration tests covering the full workspace lifecycle in apps/desktop/src/__tests__/workspaceLifecycle.test.ts. Tests verify: save captures branches/selection, restore triggers diff, auto-detection by path, refresh preserves selection, delete clears store, missing branch fallback, debounced session auto-persist, and race condition handling when switching workspaces.
Cover logError with Error objects, strings, non-Error/non-string values, error code prefix formatting, and errorLog cap at 100 entries.
Expand DiffControlBar.test.tsx from 19 to 32 tests covering: - Delete button disabled/enabled based on workspace selection - Save button disabled when no workspace path - Unsaved workspace label variants (with/without path) - Workspace option display format (name - folderName) - Fallback text for unknown workspace IDs - Workspace selector title attribute - WORKDIR display in base branch selector - All controls enabled/disabled state comprehensively - Disabled prop overrides individual button conditions
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: adb55c2620
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| diffRequestIdRef.current += 1 | ||
| setDiffFiles([]) |
There was a problem hiding this comment.
Reset diff computing flag when canceling identical-branch requests
When baseBranch === compareBranch, this path bumps diffRequestIdRef and returns without clearing isComputing; if a previous diff was already in flight, its finally block is skipped by the requestId guard, so isComputing can remain stuck true indefinitely. In that state, downstream logic gated by isDiffComputing (for example workspace selection restore in App.tsx) never runs, and the UI can stay in a perpetual “computing” state after users switch branches quickly.
Useful? React with 👍 / 👎.
| if (activeSession.baseBranch && branches.includes(activeSession.baseBranch) && baseBranch !== activeSession.baseBranch) { | ||
| setBaseBranch(activeSession.baseBranch) | ||
| } | ||
| if ( | ||
| activeSession.compareBranch && |
There was a problem hiding this comment.
Use loaded repo branches when restoring workspace branch selection
This restore check runs immediately after await selectNewRepo(), but branches here is still the value captured from the prior render (typically the previous repo), so saved workspace branches that only exist in the newly opened repo may be rejected and never restored. The result is opening a saved workspace via folder picker on incorrect base/compare refs, which also causes follow-on selection restore mismatch warnings.
Useful? React with 👍 / 👎.
|
🎉 This PR is included in version 2.3.0 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
No description provided.