Skip to content

feat(explorer): mark failed history runs and split UNION scopes in column usage - #1542

Open
shu-chen-dot-ca wants to merge 1 commit into
TabularisDB:mainfrom
shu-chen-dot-ca:feat-1479-followup
Open

shu-chen-dot-ca wants to merge 1 commit into
TabularisDB:mainfrom
shu-chen-dot-ca:feat-1479-followup

Conversation

@shu-chen-dot-ca

@shu-chen-dot-ca shu-chen-dot-ca commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Follow-up to #1479, with the points @debba listed there as follow-ups (7, 3 and the component tests from 6, repeated in the approving review).

What changed

  • Failed history runs (utils/columnUsageCollector.ts, ColumnUsageModal): history evidence now keeps the entry's status and error. A failed run gets a "Failed run" tag in the panel, with its error message under the title. The copied summary only adds the tag, not the error text, since errors often quote values (duplicate key value (email)=(...)), the same reason the summary never has raw SQL. The confidence is unchanged: the SQL still says what it says about the column.
  • UNION / INTERSECT / EXCEPT / MINUS (utils/columnUsage.ts): computeScopes now starts a sibling query level after a set operator, with the same parent, so each side resolves unqualified columns against its own tables. SELECT customer_id FROM public.orders UNION SELECT customer_id FROM public.archive now gives one parsed match instead of two several-tables. Only the level's own frame splits (the statement or a (SELECT / (WITH parenthesis), so a set operator inside function arguments or other parentheses does not. Correlated references from either side still climb to the enclosing query.
    • FROM ((SELECT ...) UNION (SELECT ...)) d was read as a parenthesised join group, so d was never bound and d.customer_id came out as unresolved-qualifier. A parenthesis whose first inner query is followed by a set operator is now a derived table, like ((SELECT ...)) d.
  • New string columnUsage.failedRun in all 13 locales.

Tests

  • tests/components/modals/ColumnUsageModal.test.tsx (new): initial focus on Close, Stop between lookups (remaining sources cancelled, their lookups never called), an unexpected collector failure settling every source as failed and recovering on Search again, Open going to the referenced table in the key's schema, Open in editor without running the query, and the failed-run tag with its error on only the failed entry.
  • SidebarColumnItem.test.tsx: the column menu opens with Show Usage when canManage is false (without Modify/Delete), opens the panel for that column, table, schema and database, and has no menu on a view column.
  • columnUsage.test.ts: UNION, UNION ALL, INTERSECT, EXCEPT and Oracle MINUS, both orders of the sides, a join inside one side (still several-tables), a UNION inside a subquery and inside a derived table with and without parentheses per side, a correlated reference from the second side, and a parenthesised join group still read as one.
  • columnUsageCollector.test.ts: status and error on history evidence, and the summary tagging failed runs without the error text.
  • RotateCw was missing from the lucide-react mock in tests/setup.ts, which the modal test needed.

The new tests for the failed tag and UNION scopes fail on main (4 of them); the others cover behaviour that already worked.

Checks: pnpm run typecheck && pnpm run lint && pnpm run lint:theme && pnpm run format:check && pnpm run web:boundaries && pnpm run web:packaging && pnpm run web:docs && pnpm run web:manual-parity && pnpm run test:contrast && pnpm run build && pnpm exec vitest --config packages/web-ui/vitest.config.ts run --maxWorkers=2 pass: 578 files, 9458 tests.

Manual check with Tabularis Web (this branch's dist on a nightly binary) against SQLite, with a history holding a failed query and a UNION over orders and archive; screenshots of orders.customer_id below.

GitNexus: upstream impact of computeScopes reports HIGH because it reaches three clusters, but they are buildModel, analyseStatement and findColumnReferences in the same file, used only by the column usage collector. collectColumnUsage, formatColumnUsageSummary and ColumnUsageModal are LOW.

Screenshots

Before After
before after

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

@@ -462,6 +468,11 @@ export function isUsageComplete(result: ColumnUsageResult): boolean {
type Translate = (key: string, options?: Record<string, unknown>) => string;

/** The qualified name shown for the target, e.g. `public.orders.customer_id`. */

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.

SUGGESTION: Misplaced doc comment

isFailedRun was inserted between the JSDoc for formatUsageTarget and the function itself, so this comment now sits above isFailedRun and formatUsageTarget has none. Move isFailedRun (and its comment) above this line.

@kilo-code-bot

kilo-code-bot Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Code Review Summary

Status: 1 Issue Found | Recommendation: Merge after optional fix

Overview

Severity Count
CRITICAL 0
WARNING 0
SUGGESTION 1
Issue Details (click to expand)

SUGGESTION

File Line Issue
packages/web-ui/src/utils/columnUsageCollector.ts 470 isFailedRun was inserted between the formatUsageTarget JSDoc and its function, so the comment is now misplaced
Files Reviewed (21 files)
  • packages/web-ui/src/components/modals/ColumnUsageModal.tsx
  • packages/web-ui/src/utils/columnUsage.ts
  • packages/web-ui/src/utils/columnUsageCollector.ts - 1 issue
  • 13 locale files (failedRun string added)
  • 5 test and setup files

Fix these issues in Kilo Cloud


Reviewed by claude-sonnet-5.5 · Input: 260 · Output: 2.1K · Cached: 338K

Review guidance: REVIEW.md from base branch main

This branch has not been deployed

No deployments
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.

1 participant