Skip to content

fix(indexes): show managed-database indexes in unscoped indexes list#170

Merged
eddietejeda merged 2 commits into
mainfrom
fix/indexes-list-unscoped-managed-db
Jun 19, 2026
Merged

fix(indexes): show managed-database indexes in unscoped indexes list#170
eddietejeda merged 2 commits into
mainfrom
fix/indexes-list-unscoped-managed-db

Conversation

@eddietejeda

@eddietejeda eddietejeda commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Whole-workspace hotdata indexes list (no --connection-id) returned "No indexes found" for indexes on managed databases, even though indexes list --connection-id <db-conn> showed them. Fixes #168.

Root cause (corrected)

The unscoped scan enumerates tables via a workspace-wide information_schema call, then fetches each table's indexes. 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 finds zero tables and reports nothing.

This corrects the root-cause analysis in the issue. The unscoped information_schema enumeration does not return managed-DB rows under __db_* labels — so the gap is discovery, not label resolution. Verified empirically (see issue comment).

Fix

Discover managed databases separately in the unscoped branch:

  1. databases list → the managed DBs.
  2. Resolve each default_connection_id via databases get (parallel; the list summary omits the connection id).
  3. Scan each connection scoped — exactly like the --connection-id path.
  4. Union with the regular-connection enumeration. The two sets are disjoint (a managed DB's connection is never returned by connections list), so no double-counting.

collect_connection_wide is restructured around a ScanTarget { conn_id, table } so every table is fetched against the correct connection id whether scoped or unscoped. The --connection-id path is unchanged.

Verification

Against production (workspace AgentRyan):

  • Before: hotdata indexes listNo indexes found.
  • After: lists all 4 managed-DB indexes (across airbnb, SF Airbnb Listings, and dbidrj69…).
  • 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.
  • Existing scoped-label test (…uses_supplied_id_for_db_scoped_label) still passes.

Full suite green (208), cargo fmt / clippy clean (no new warnings).

Refs #161, #164.

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.
@github-actions

Copy link
Copy Markdown

Automated review unavailable (Claude step failed). Please review manually.

@codecov

codecov Bot commented Jun 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@eddietejeda eddietejeda merged commit 01b72da into main Jun 19, 2026
14 checks passed
@eddietejeda eddietejeda deleted the fix/indexes-list-unscoped-managed-db branch June 19, 2026 23:41
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.

indexes list (unscoped) misses managed-database indexes

1 participant