fix(indexes): show managed-database indexes in unscoped indexes list#170
Merged
Conversation
Whole-workspace `hotdata indexes list` (no `--connection-id`) returned "No indexes found" for indexes on managed databases, even though the connection-scoped path showed them. The unscoped scan enumerates tables via a workspace-wide `information_schema` call and fetches each table's indexes. But that enumeration returns only regular-connection tables — managed-database catalogs never appear there, and `connections list` hides their connections. In a managed-only workspace the scan therefore finds zero tables and reports nothing. Discover managed databases separately: `databases list` -> resolve each `default_connection_id` via `databases get` (in parallel) -> scan each connection scoped, exactly like the `--connection-id` path. Union the result with the regular-connection enumeration; the two sets are disjoint (a managed DB's connection is never returned by `connections list`), so there is no double-counting. Note: this corrects the root-cause analysis in #168. The unscoped `information_schema` enumeration does not return managed-DB rows under `__db_*` labels at all — so the gap was discovery, not label resolution. Verified against production (workspace AgentRyan): unscoped `indexes list` now surfaces all managed-DB indexes; the `--connection-id` path is unchanged. Refs #161, #164. Closes #168.
|
Automated review unavailable (Claude step failed). Please review manually. |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Reviewed. The ScanTarget refactor cleanly separates the display label from the real connection id used per-table call, and the managed-DB discovery path correctly handles the list→get race (404 skip) with error handling consistent with the rest of the scan. Tests cover both managed-only and union shapes. LGTM.
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.
Summary
Whole-workspace
hotdata indexes list(no--connection-id) returned "No indexes found" for indexes on managed databases, even thoughindexes list --connection-id <db-conn>showed them. Fixes #168.Root cause (corrected)
The unscoped scan enumerates tables via a workspace-wide
information_schemacall, then fetches each table's indexes. That enumeration returns only regular-connection tables — managed-database catalogs never appear there, andconnections listhides their connections. In a managed-only workspace the scan finds zero tables and reports nothing.Fix
Discover managed databases separately in the unscoped branch:
databases list→ the managed DBs.default_connection_idviadatabases get(parallel; the list summary omits the connection id).--connection-idpath.connections list), so no double-counting.collect_connection_wideis restructured around aScanTarget { conn_id, table }so every table is fetched against the correct connection id whether scoped or unscoped. The--connection-idpath is unchanged.Verification
Against production (workspace AgentRyan):
hotdata indexes list→No indexes found.airbnb,SF Airbnb Listings, anddbidrj69…).indexes list --connection-id <conn>unchanged (regression-checked).Tests
collect_connection_wide_unscoped_discovers_managed_db_indexes— managed-only workspace (the production shape).collect_connection_wide_unscoped_unions_regular_and_managed— regular + managed union, disjoint, each index once.…uses_supplied_id_for_db_scoped_label) still passes.Full suite green (208),
cargo fmt/clippyclean (no new warnings).Refs #161, #164.