fix: detect .todos file vs directory conflict in onboarding#206
Merged
Conversation
When a .todos file (not directory) exists, sidecar's onboarding now: - Detects the conflict before attempting td init - Shows a clear error with remediation instructions - Reports the conflict in diagnostics Fixes #194
TestInitWithValidDatabase and TestDiagnosticsWithDatabase were failing because they checked for .todos/issues.db at the raw project path, but monitor.NewEmbeddedWithOptions follows .td-root which redirects to a different (unreachable) directory. Fix by resolving the database path via tdroot.ResolveDBPath before checking the precondition, and extract the shared logic into findProjectRootWithDB helper. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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
When a
.todosfile (not directory) exists in a project, sidecar's onboarding silently fails — the setup dialog stays open, reinitializing in a loop, and clicking "Skip" shows "td is not installed" even though it is.Root cause: An AI agent (or other tool) created a
.todosfile where sidecar expects a.todosdirectory for td's SQLite database.Fix
CheckTodosConflict()intdrootthat usesLstatto detect when.todosexists as a file or symlink-to-file instead of a directoryInit()now checks for the conflict before attempting monitor creationView()renders a clear error with remediation instructions (mv .todos .todos.bak && td init)Diagnostics()reports the conflict as an error stateperformSetup()validates before callingtd initinstead of silently failingTests
5 new tests covering: no .todos, directory exists, file exists, symlink, and full plugin integration.
Also fixes 2 pre-existing test failures in tdmonitor (
TestInitWithValidDatabase,TestDiagnosticsWithDatabase).Fixes #194