Skip to content

Fixes 36357: Hex cells reading a broken cell keep their data model groups - #36541

Merged
Khairajani merged 1 commit into
mainfrom
ulixius9/hex-chained-broken-cell
Oct 31, 2026
Merged

Khairajani merged 1 commit into
mainfrom
ulixius9/hex-chained-broken-cell

Conversation

@ulixius9

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #36357

Follow-up to #36371, from Gitar's review of its 2.0 backport (#36388). A cell whose SQL stops parsing (a draft being edited) keeps its column group, but the cells reading its result did not:

  • Dataframe SQL over it inlined nothing and was dropped, along with the descriptions and tags users added to its group.
  • A warehouse cell on its connection searched the broken cell's name as a table, so its group came back with UNKNOWN columns and no lineage.

Now ChainedCells records a failed cell's result variable, using the same connection rules as chaining: same connection, or any for dataframe SQL. A cell that reads a failed cell fails too, and so on down the chain, so each one keeps its group from the existing data model. A successful cell that later reuses the name clears the failure. The ADR gets a v2 amendment stating the rule.

Type of change:

  • Bug fix

High-level design:

N/A — small change (3 code/test files plus the ADR amendment).

Tests:

Use cases covered

  • Upstream cell breaks: the dataframe SQL cell and the chained-on-chained cell reading it keep their groups unchanged from the previous run.
  • Upstream cell breaks: the same-connection cell reading it keeps its group with its typed columns, not UNKNOWN.
  • A failed cell on another connection doesn't fail a warehouse cell reading a bare name of the same spelling; a later cell redefining the name clears the failure.

Unit tests

  • Added test_cells_reading_a_broken_cell_keep_their_groups (dataframe SQL and same-connection variants, three-cell chain) and test_a_failed_cell_is_failed_only_for_the_cells_that_can_read_it in ingestion/tests/unit/topology/dashboard/test_hex_cell_lineage.py.
  • Both variants of the first test fail on main without the fix: the group is dropped (['c1']) for dataframe SQL, and the column is UNKNOWN for the same connection.
  • Mutation checks: removing the failure registration, the add reset, or the connection filter each makes a new test fail.
  • PYTHONPATH=src python -m pytest tests/unit/topology/dashboard/test_hex*.py tests/unit/source/dashboard/hex → 157 passed.
  • ruff check / ruff format --check clean; basedpyright on hex/ → 0 errors.

Backend integration tests

  • Not applicable (no backend changes).

Ingestion integration tests

  • Not applicable: the Hex connector has no tests/integration/ suite; every test importing the changed modules is listed above.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Not run against a live Hex workspace; the unit tests reproduce the export shapes (chained dataframe and warehouse SQL cells over a broken cell) end to end through the data model stage.

UI screen recording:

Not applicable — ingestion connector fix, no UI code.

Checklist:

  • I have read the CONTRIBUTING document.

  • My PR title is Fixes <issue-number>: <short explanation>

  • My PR is linked to a GitHub issue via Fixes #<issue-number> above.

  • I have commented on my code, particularly in hard-to-understand areas.

  • For JSON Schema changes: not applicable, no schema change.

  • For a UI feature or feature task: not applicable.

  • I have added tests (unit / integration / Playwright as applicable) and listed them above.

  • Self-review: I reviewed the final diff against REVIEW.md (the pr-checklist skill runs it) and fixed every 🔴 finding, or answered it on the line below.

    • Reviewed at 2209cc21a68: no 🔴. Fixed all three 🟡 in ea7e12238d1: a redefined name now clears its failure, a test covers the connection filter, and the warning names the failed cell being read.
  • Decision check: ADR:2026-10-27-hex-project-is-one-data-model-with-a-column-group-per-cell-id gets a v2 amendment for this rule.

  • I have added a test that covers the exact scenario we are fixing.

Backports: #36387 (2.1) and #36388 (2.0) carry this commit too.

🤖 Generated with Claude Code

A cell whose SQL fails keeps its existing group, but the cells reading its
result lost theirs: dataframe SQL over it was dropped and a warehouse cell
searched its name as a table, coming back with UNKNOWN columns. A cell reading
a failed cell now fails too, down the chain, so each keeps its group.
@ulixius9
ulixius9 requested a review from a team as a code owner October 29, 2026 10:50
@ulixius9
ulixius9 requested review from harshsoni2024 and a balanced review from Copilot October 29, 2026 10:50
@github-actions

Copy link
Copy Markdown
Contributor

❌ PR checklist incomplete

This PR cannot be merged until the following are addressed on its linked issue:

The fields live on the linked issue in the Shipping project (open the issue → right sidebar → Projects). After you set them, re-run this check (or push a commit) — issue/project changes do not re-trigger it automatically.

Maintainers can bypass this check by adding the skip-pr-checks label.

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 29, 2026
ulixius9 added a commit that referenced this pull request Oct 29, 2026
2.0 now has docs/decisions/, so the record #36371 added on main (with its v2
amendment from #36541) comes along instead of leaving the ADR citation in
hex/metadata.py dangling.
@gitar-bot

gitar-bot Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Tracking failed Hex SQL cells makes dependents retain prior column groups instead of rebuilding; stale schemas or lineage could persist while parsing is broken.

Hex cells that read a broken cell now keep their data model groups, covering dataframe SQL and same-connection warehouse cells, including chained cells downstream. Failure tracking clears when a later cell redefines the name. No issues found.

Verification

Rules No rules evaluated

Functional validation Not enabled

Set up

Auto-approval Not enabled

Set up

For more verification details, comment gitar display:verbose.

Options

Display: compact → Showing compact verification results.

Comment with these commands to change the behavior for this request:

Compact
gitar display:verbose         

Was this helpful? React with 👍 / 👎 | Powered by Gitar — free for open source

@sonarqubecloud

Copy link
Copy Markdown

ulixius9 added a commit that referenced this pull request Oct 29, 2026
…(2.0) (#36388)

* Fixes 36357: Hex data models and column-level lineage from project SQL cells (2.0)

Backport of #36371 to 2.0, squashed from 33b47d3, 16ad476,
22d96d4, 6af0b43, 791ff4a, c42a857, cacf30b,
c5d461c, 61debe6, 05f7d5c and d996669.

Adapted to 2.0:
- es_search_from_fqn has no raise_on_error here and returns None for a
  failed search, so the Hex source runs the FQN search itself and treats
  a search that didn't answer as an error, not as "no such table".
- The project's tag handling (tag_utils) is kept as it is on 2.0.
- The decision record is not added: 2.0 has no docs/decisions. The code
  cites ADR:2026-10-27-hex-project-is-one-data-model-with-a-column-group-per-cell-id on main.

* Hex: keep models without data connections, keep broken cells' groups

- Data connections the token can't read raise HexAccessDeniedError and
  are asked for once per run. Without them an existing data model is left
  as it is instead of being rebuilt without dialects and connection
  defaults; only a project without one gets one.
- A cell whose SQL fails to parse keeps its column group from the
  existing data model, with what users curated on it.
- A column name is parsed out of the lineage leaf rather than split on
  dots, so a quoted "customer.id" is one name.
- A column passed straight through keeps its table column's array
  element type, display type and nested fields.

(cherry picked from commit a6b8920)

* Hex (2.0): a failed read of a table the search found keeps the data model

The 2.0 FQN search reads each table it finds; an error there now counts
as a failed search, so the project's existing data model is kept rather
than rebuilt without that cell.

* Hex: keep a kept data model linked, copy only the type of passed-through columns

- A data model kept because its existing groups couldn't be read stays linked
  to the dashboard: the data model stage records what it kept and the dashboard
  stage links it, instead of only when the cells couldn't be read.
- A passed-through struct's fields copy only the table column's type, not its
  description, tags, constraint or profile.

(cherry picked from commit c02d176)

* Hex: a data model without a dashboard URL is still ingested; HexDataModel in the generated types

Matches the resolution on main (#36371) of the data model sourceUrl against
the workspace-scoped Hex URLs, which return None when the workspace id can't
be read. The generated TypeScript enum value is the one #36371 generated on
main; the type-generation workflow fails on 2.0 so it never added it here.

* Hex: cells reading a broken cell keep their data model groups

A cell whose SQL fails keeps its existing group, but the cells reading its
result lost theirs: dataframe SQL over it was dropped and a warehouse cell
searched its name as a table, coming back with UNKNOWN columns. A cell reading
a failed cell now fails too, down the chain, so each keeps its group.

(cherry picked from commit ea7e122)

* Hex: add the data model decision record the code cites

2.0 now has docs/decisions/, so the record #36371 added on main (with its v2
amendment from #36541) comes along instead of leaving the ADR citation in
hex/metadata.py dangling.
@Khairajani
Khairajani added this pull request to the merge queue Oct 30, 2026
Merged via the queue into main with commit c45a05f Oct 31, 2026
67 of 68 checks passed
@Khairajani
Khairajani deleted the ulixius9/hex-chained-broken-cell branch October 31, 2026 12:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Ingestion safe to test Add this label to run secure Github workflows on PRs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hex connector: ingest data models and column-level lineage from project SQL cells

3 participants