refactor: consolidate duplicated shared logic - #780
Open
beruro wants to merge 9 commits into
Open
Conversation
This was referenced Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Several mature code paths independently reimplemented the same domain decisions, lifecycle shells, projections, provider commands, or search utilities. That duplicated ownership made fixes prone to drift and left three uncompiled imported-history modules as dead maintenance surface. The cleanup was initially split across #771–#779, which made one systematic reuse pass unnecessarily expensive to review and run through CI.
Solution
Consolidate the reuse cleanup into one PR while preserving nine focused commits so each boundary can still be reviewed or reverted independently:
Public imports, IPC/wire commands, persisted formats, provider-specific token maps, database SQL dialect behavior, and existing user-facing flows remain compatible. The two UI extractions include their required frontend UI audit reports and regression coverage.
This PR supersedes #771, #772, #773, #774, #775, #776, #777, #778, and #779.
Potential risks
The combined diff spans independent runtime areas, so a reviewer must consider more surface than in a narrowly scoped PR. The commit boundaries, focused regression tests, and unchanged public contracts limit coupling and allow individual rollback by reverting the relevant commit. OAuth behavior still depends on native WebView/browser integration, and database behavior still depends on real PostgreSQL/MySQL drivers; those live credential paths were not exercised locally. There are no migrations, destructive data changes, dependency updates, or persistence/wire-format changes.
Audit
Architecture review covered ownership, type boundaries, state transitions, Tauri/wire compatibility, error mapping, initialization parity, naming, dead code, and test topology. UI audit verdicts were 1 abstract / 3 keep-with-reason for Activity Groups and 2 abstract / 3 fix / 2 keep-with-reason for OAuth Session Setup.
Effects: the OAuth shell retains only external browser/WebView lifecycle synchronization. The completion timer is cleared, external close is idempotent, and duplicate retries are coalesced. No polling, worker, cache, stream, or retained background loop was added.
Verification
pnpm typecheck && pnpm lint— executed on the consolidated branch; passed.pnpm run test— executed on the consolidated branch; full Vitest suite passed.node scripts/tauri/prepare-sidecars.cjs --profile debug— passed and staged the local debug sidecar.cargo clippy --workspace --all-targets -- -D warnings— local Rust 1.91 stopped on the unchangedsrc-tauri/crates/orgtrack-core/src/sources/imported_history/window.rs:189collapsible_else_ifbaseline warning. This PR does not modify that file or line.verify:quick/verify:final; the full commands above were used instead.