Skip to content

feat(db-list): default to remote DB, add --local override#3

Merged
aladac merged 1 commit into
masterfrom
feat/db-list-remote-default
May 20, 2026
Merged

feat(db-list): default to remote DB, add --local override#3
aladac merged 1 commit into
masterfrom
feat/db-list-remote-default

Conversation

@aladac
Copy link
Copy Markdown
Member

@aladac aladac commented May 20, 2026

Why

tsr db list defaulted to the local SQLite DB even when default_remote was configured in config.toml. On a setup where the generation host is remote (e.g. chi@fuji with default_remote = "runpod"), the table would show ghost entries — files whose recorded file_path is a Linux path that doesn't exist on the operator's machine — instead of what's actually loadable on the generation host.

What

Flip the default for db list:

Invocation Source
tsr db list remote (when default_remote set), else local
tsr db list --local force local SQLite DB
tsr db list -r <name> explicit remote (overrides default_remote)
tsr db list --local -r <name> local wins (silent)

Precedence: --local > -r > default_remote > local.

How

  • New remote_db_files() helper in tensors/remote.py calls the existing GET /api/db/files server route. Mirrors remote_models().
  • db_list() in tensors/cli.py gains -r/--remote and --local options, plus the resolution block at the top.
  • Table title flips between Local Files and Remote Files so source is unambiguous; remote source also prints the resolved URL above the table (matching the tsr models UX).
  • No server-side changes — the route already returns the same payload shape Database.list_local_files() produces locally.

Scope

Intentionally minimal — only db list. db search, db triggers, db stats stay local-default; can be flipped under the same pattern in a follow-up if the UX wins are similar.

Validation

  • uv run pytest tests/ -x → 374 passed
  • uv run ruff check tensors/cli.py tensors/remote.py → All checks passed
  • uv run mypy tensors/cli.py tensors/remote.py → no issues
  • Manual:
    • tsr db list against pod https://347pijnn1zn2pl-7777.proxy.runpod.net → returns the pod's 12 checkpoints + 8 LORAs + 1 VAE
    • tsr db list --local → returns the 9 stale local entries (which is precisely the bug being addressed)
    • tsr db list --json → remote JSON payload
    • tsr db list -t Checkpoint → filter applies to remote result
    • tsr db list --help → new flags and precedence documented

By default 'tsr db list' read from the LOCAL SQLite DB even when
default_remote was configured, which created a confusing UX where the
table never reflected the actual generation host. On a typical setup
(chi@fuji with default_remote='runpod') it would happily display ghost
entries pointing at /home/madcat/comfyui/models/... paths that don't
exist on macOS at all.

Flip the default:
  - 'tsr db list'           -> remote (when default_remote set), else local
  - 'tsr db list --local'   -> force local SQLite DB
  - 'tsr db list -r <name>' -> explicit remote (overrides default_remote)

Precedence: --local wins; else -r; else default_remote; else local.

Adds remote_db_files() helper in tensors/remote.py that calls the
existing GET /api/db/files server endpoint (no server-side changes
needed). Mirrors the pattern used by remote_models().

Scope kept minimal: only 'db list' for now. db search / triggers /
stats stay local-default; can flip later under the same pattern if
the UX wins are similar.
@aladac aladac merged commit 1f105d7 into master May 20, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants