feat(db-list): default to remote DB, add --local override#3
Merged
Conversation
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.
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.
Why
tsr db listdefaulted to the local SQLite DB even whendefault_remotewas configured inconfig.toml. On a setup where the generation host is remote (e.g.chi@fujiwithdefault_remote = "runpod"), the table would show ghost entries — files whose recordedfile_pathis 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:tsr db listdefault_remoteset), else localtsr db list --localtsr db list -r <name>default_remote)tsr db list --local -r <name>Precedence:
--local>-r>default_remote> local.How
remote_db_files()helper intensors/remote.pycalls the existingGET /api/db/filesserver route. Mirrorsremote_models().db_list()intensors/cli.pygains-r/--remoteand--localoptions, plus the resolution block at the top.Local FilesandRemote Filesso source is unambiguous; remote source also prints the resolved URL above the table (matching thetsr modelsUX).Database.list_local_files()produces locally.Scope
Intentionally minimal — only
db list.db search,db triggers,db statsstay 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 passeduv run ruff check tensors/cli.py tensors/remote.py→ All checks passeduv run mypy tensors/cli.py tensors/remote.py→ no issuestsr db listagainst podhttps://347pijnn1zn2pl-7777.proxy.runpod.net→ returns the pod's 12 checkpoints + 8 LORAs + 1 VAEtsr db list --local→ returns the 9 stale local entries (which is precisely the bug being addressed)tsr db list --json→ remote JSON payloadtsr db list -t Checkpoint→ filter applies to remote resulttsr db list --help→ new flags and precedence documented