# Resolve the database file itself; missing-target outranks same-source · pingdotgg/t3code

[View on GitCafe](https://git.cafe/pingdotgg/t3code/commit/b769bb64557bf14b7c514346591df529818c52bc)

Repository: [pingdotgg/t3code](https://git.cafe/pingdotgg/t3code)

Visibility: public

Requested revision: b769bb64557bf14b7c514346591df529818c52bc

Requested commit: b769bb64557bf14b7c514346591df529818c52bc

Commit: b769bb64557bf14b7c514346591df529818c52bc

Tree: 847f2107532e616d26376500bcbb71e95cfba5b4

Author: Theo Browne

Committer: Theo Browne

## Message

```
Resolve the database file itself; missing-target outranks same-source

Two Cursor findings on the previous guard fix:

- `canonicalDbPath` resolved only the directory and re-joined the
  filename, so a symlink at the *file* — `state.sqlite` itself linking
  into the shared home — passed the guard. Reproduced: the seed replaced
  the shared database through the link. Resolve the full path first (the
  file can be the link), falling back to directory-resolution only when
  the file does not exist yet, which is the one case a full resolution
  cannot handle and the one where the missing-target advice would create
  the database in the shared home.
- With --from and --to aliasing the same base and no database behind
  them, same-source fired before the existence check, hiding the
  actionable "start the dev server" guidance. The existence check now
  runs between the shared-home refusal (which must stay first — its
  advice is exactly wrong for the shared home) and same-source.

Verified seven ways: symlinked file refused with the shared rows
untouched, symlinked directory still refused, shared home with and
without a database refused as shared-home, aliased-empty reported as
missing-target, aliased-with-database as same-source, and a legitimate
seed unaffected.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

```

## Parents

- [aad1bdd49a43341ad124c784f44568a14ba41a9f](https://git.cafe/pingdotgg/t3code/commit/aad1bdd49a43341ad124c784f44568a14ba41a9f?format=markdown)

[Source at this commit](https://git.cafe/pingdotgg/t3code/tree/b769bb64557bf14b7c514346591df529818c52bc?format=markdown)
