Skip to content

Fixes 36831: Hex components as charts, run history and app views - #36836

Merged
ulixius9 merged 5 commits into
mainfrom
ulixius9/hex-assets-ingestion-fix
Nov 3, 2026
Merged

ulixius9 merged 5 commits into
mainfrom
ulixius9/hex-assets-ingestion-fix

Conversation

@ulixius9

@ulixius9 ulixius9 commented Nov 2, 2026

Copy link
Copy Markdown
Member

Describe your changes:

Fixes #36831

The Hex connector ingested projects as dashboards but nothing about Hex Components, runs or app views, which DataHub's Hex source does. This PR ingests Components imported by a project as Charts on its dashboard, sets each dashboard's life cycle, turns app views into dashboard usage, and — behind a new opt-in includeCustomProperties option — adds app view counts and the last run's status, duration and refresh time as dashboard custom properties. It also fixes the Hex models' snake_case aliases, which silently dropped every camelCase field Hex returns (lastPublishedAt, analytics), so every published project linked to the editor-only notebook instead of the app; and makes Hex honour includeOwners, which it ignored.

Type of change:

  • New feature

High-level design:

Components → Charts. get_projects lists with includeComponents=true; components are split off by type. The components a project imports come from COMPONENT_IMPORT cells in the project export (also nested in collapsible sections). The export is now fetched once per project and shared by the chart, data model and lineage stages (single-slot cache in HexApiClient). A transient export failure keeps the dashboard's existing charts rather than unlinking and deleting them; a token that can't export sees no components. Charts get name = component id, link, owner, chartType=Other, lifeCycle, and honour chartFilterPattern.

Life cycle. Dashboards and charts get created (createdAt), updated (analytics.publishedResultsUpdatedAt) and accessed (analytics.lastViewedAt) from the listing — no extra Hex calls; the server only moves them forward.

Usage. OpenMetadata keeps a count per day and a usage PUT adds to it; Hex reports only rolling totals. Today's count is max(0, lastSevenDays − the six previous stored days) minus what today already holds, so OpenMetadata's weekly count equals Hex's and a same-day re-run sends nothing (ADR:2026-11-02-hex-daily-usage-follows-its-seven-day-app-views). Adds OMetaDashboardMixin.get_dashboard_usage (GET /v1/usage/dashboard/{id}). The Looker/Tableau "total − latest daily" pattern was not copied: it subtracts a daily figure from a cumulative one.

Custom properties. With includeCustomProperties (new, default false — definitions are global to the Dashboard type), dashboards get appViewsLast7Days, appViewsAllTime (integer), and for published projects lastRunStatus (string), lastRunElapsedSeconds (integer), lastRefreshed (timestamp, end of the last COMPLETED run) from GET /projects/{id}/runs (one call, a second only when the latest run didn't complete). A bot PUT keeps the stored extension unless overrideMetadata, so these are set by a new dashboard topology stage, yield_dashboard_extension, that runs after the dashboard is saved and yields a PatchRequest (override_metadata=True) replacing only the connector's keys — user properties are kept, nothing is removed, and an unknown value is omitted rather than cleared (ADR:2026-11-02-run-changing-dashboard-custom-properties-are-patched-after-the-dashboard). Definitions are registered once per run; a name already defined with another type is left alone. Alternatives rejected: run status in lifeCycle only (no status/duration), a new dashboard.json field (schema + UI + migration for one connector).

Backward compatibility.

  • No migration: includeCustomProperties is an additive optional field defaulting to false.
  • Published projects' sourceUrl changes from /hex/ to /app/ on the next run (the alias fix makes fix(hex): build dashboard source URLs that resolve in the Hex UI #36335 take effect).
  • New charts appear under Hex dashboards.
  • Hex now honours includeOwners (default false, like every other dashboard connector): new Hex dashboards/charts get no owner unless the pipeline enables it; owners already set are kept (a bot PUT without owners never removes them).

Tests:

Use cases covered

  • A component imported by a project (also inside a collapsible section) becomes a chart linked from the dashboard; filtered and unlisted components are skipped; a repeat import is one chart
  • A failed export, or a failed project-listing page that leaves a component out, keeps the dashboard's existing charts linked and not deleted; a token that can't export sees no components
  • Hex's camelCase payload is read (lastPublishedAt, analytics), and published projects link to /app/
  • Usage: first run, same-day re-run (nothing sent), a rise on the same day, the next day, a drop (nothing sent)
  • Custom properties: latest run errored → status/duration from it, lastRefreshed from the last completed run; user properties kept; a property of another type left alone; unpublished projects get views without a runs call; nothing without the flag
  • Owners: the user or team with the Hex owner's email; none, and no lookup, when includeOwners is off

Unit tests

  • I added unit tests for the new/changed logic.
  • Added ingestion/tests/unit/topology/dashboard/test_hex_components_runs_usage.py (20 tests: the real Hex client and source against fakes of the Hex API, shaped from its OpenAPI spec, and of the OpenMetadata server; the custom-property patch goes through the real build_patch). Updated test_hex.py, test_hex_client.py; added test_get_dashboard_usage to tests/integration/ometa/test_ometa_dashboard_api.py (pins the usage window and the additive usage PUT the arithmetic relies on).
  • Every unit test importing a changed module (32 files): python -m pytest -n 8 <files> --cov=… → 740 passed.
  • Coverage on changed classes: hex/metadata.py 91%, hex/client.py 91%, hex/models.py 100%, dashboard_service.py 77% (only the new no-op stage added there).
  • Mutation checks: removing the patch's override_metadata=True, the same-day subtraction, the includeOwners guard, or the unlisted-component fallback each fails a test.

Backend integration tests

  • Not applicable (no backend API changes). The schema change (dashboardServiceMetadataPipeline.json) selects the tests below.

Local Java test run: PASSED

  • Commit: 7ec67cc9e4ff (base origin/main)
  • Finished: 2026-11-02 10:11 UTC · 20.2 min
Step Scope Classes Tests Failed Skipped Min Result
unit openmetadata-service (1 class) 1 11 0 0 1.8 passed
integration mysql-elasticsearch · parallel 25 1419 0 96 7.6 passed
integration mysql-elasticsearch · isolated 1 131 0 0 10.8 passed

Ingestion integration tests

  • I ran the integration tests covering my changed files locally, against a local server: tests/integration/ometa/test_ometa_dashboard_api.py + tests/integration/tableau/test_backfill.py → 12 passed. There is no tests/integration/hex/.
  • Files added/updated: tests/integration/ometa/test_ometa_dashboard_api.py

Playwright (UI) tests

  • Not applicable (no UI changes; only the pipeline-option doc in locales/en-US/Dashboard/workflows/metadata.md).

Manual testing performed

Local stack (docker compose -f docker/development/docker-compose.yml up -d --no-build mysql elasticsearch execute-migrate-all openmetadata-server) and a real Hex workspace (2 published demo projects, no components):

  1. Ran Hex ingestion twice with includeUsage, includeCustomProperties, includeOwners: 0 errors, 0 warnings. Both dashboards got lifeCycle, /app/ links, and appViewsLast7Days/appViewsAllTime/lastRunStatus/lastRunElapsedSeconds/lastRefreshed matching Hex's runs API (e.g. COMPLETED, 29 s). Registered types: integer/integer/string/integer/timestamp.
  2. Between runs set a user property team=finance and lastRunStatus=STALE by hand: run 2 restored COMPLETED and kept team.
  3. Opened both apps in Hex: allTime 0→1/2 immediately and appViewsAllTime followed on the next run (lastSevenDays/lastViewedAt update later on Hex's side).
  4. Usage against the real server with overridden lastSevenDays 10→10→12 (day 1), 15→5 (day 2): stored 10, nothing, +2; then 3 (weekly 15); then nothing.
  5. Created a local user with the Hex owner's email: with includeOwners: true both dashboards got it as owner.
  6. Checked the UI: the custom properties show on the dashboard's Custom Properties tab and right panel; usage shows as the existing weekly percentile.

Not verified live: components as charts (this Hex workspace has none — covered by unit tests).

UI screen recording:

Not applicable — ingestion connector change; the UI is unchanged and only displays the new values through existing custom-property and usage views.

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: I updated the migration scripts or explained why it is not needed. (Additive optional pipeline option with a default; no stored data changes.)

  • For a UI feature or feature task: as part of PR creation, I ran the PR build in Docker with sample data and embedded a verified GitHub-hosted recording plus build/health evidence above (or explained why this requirement is 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 7ec67cc9e4f with a fresh-context reviewer. Fixed the one 🔴 (a failed project-listing page unlinked and soft-deleted the charts of components it left out) with a test; added the two 🟡 tests (close() percentiles, the usage-window integration test). Second pass: no 🔴. Pre-existing and not widened here: a failed listing page can still soft-delete the dashboards it leaves out.

  • Decision check: adds docs/decisions/2026-11-02-run-changing-dashboard-custom-properties-are-patched-after-the-dashboard.md and docs/decisions/2026-11-02-hex-daily-usage-follows-its-seven-day-app-views.md.

  • The issue properly describes why the new feature is needed, what's the goal, and how we are building it.

  • I have updated the documentation.

  • I have added tests around the new logic.

🤖 Generated with Claude Code

Bring the Hex connector to parity with DataHub's Hex source:

- Components imported by a project become Charts on its dashboard (read
  from the project export, shared with the data model and lineage
  stages). A failed export keeps the dashboard's existing charts.
- Dashboards and charts get a lifeCycle: created, updated (published
  results refreshed) and accessed (last viewed).
- App views become dashboard usage, derived so OpenMetadata's weekly
  count equals Hex's seven-day views.
- Behind a new dashboard pipeline option, includeCustomProperties
  (default false), dashboards get appViewsLast7Days, appViewsAllTime,
  lastRunStatus, lastRunElapsedSeconds and lastRefreshed. They are
  patched in by a new dashboard topology stage after the dashboard is
  saved, since a bot PUT keeps the stored extension.

Also fix the Hex models' snake_case aliases, which dropped every
camelCase field Hex returns (lastPublishedAt, analytics), so published
projects linked to the editor instead of the app; and honour
includeOwners, which the Hex connector ignored.
A component the project imports but the project listing lacks (a failed
listing page returns the items read so far) was skipped, so its chart was
unlinked from the dashboard and soft-deleted. It now keeps the chart the
dashboard already has, linked and marked as seen.

Also test close() computing usage percentiles only with includeUsage, and
pin the usage window and additive PUT that the Hex usage arithmetic relies
on in an ometa integration test.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 10:13
@ulixius9
ulixius9 requested a review from a team as a code owner November 2, 2026 10:13
@ulixius9
ulixius9 requested a review from stout-yeoman November 2, 2026 10:13
@ulixius9

ulixius9 commented Nov 2, 2026

Copy link
Copy Markdown
Member Author

Local Java test run: PASSED — details

  • Commit: 7ec67cc9e4ff (base origin/main)
  • The summary is in the PR description.

Tests run locally

  • unit · openmetadata-service (1 class): CreateIngestionPipelineImplTest (11 passed)
  • integration · mysql-elasticsearch · parallel: BaseEntityIT$ListEntityHistoryByTimestampPaginationTest (90 passed, 11 skipped), ConfigResourceIT (30 passed, 2 skipped), DatabaseSmokeIT (2 passed), GlossaryTermResourceIT (128 passed, 1 skipped), IngestionPipelineAgentTypeIT (18 passed, 2 skipped), IngestionPipelineLogStreamIT (22 passed), IngestionPipelineLogStreamingResourceIT (39 passed), IngestionPipelineOwnerInheritanceIT (48 passed, 7 skipped), IngestionPipelineProgressStreamIT (7 passed), IngestionPipelineResourceIT (298 passed, 19 skipped), IngestionPipelineSortIT (1 passed), K8sEnvVarSerializationIT (3 passed), K8sOMJobOperatorIT (13 passed, 8 skipped), K8sPipelineEnvVarIT (6 passed), OrphanIngestionPipelineCleanupIT (10 passed), PipelineStatusAuthorizationIT (21 passed, 1 skipped), RunIngestionPipelineForEntityIT (96 passed, 12 skipped), SeedDataPresenceIT (3 passed), TableResourceIT (1 passed), TestConnectionDefinitionResourceIT (14 passed), UserResourceIT (159 passed, 3 skipped), WorkflowRedeploySignalIT (2 passed), WorkflowResourceIT (8 passed, 1 skipped), WorkflowSignalDeliveryIT (4 passed), WorkflowTaskAssigneesIT (4 passed), WorkflowTriggerPermissionsIT (52 passed, 6 skipped)
  • integration · mysql-elasticsearch · isolated: WorkflowDefinitionResourceIT (131 passed)

Per-class counts come from the test reports, which can credit a test to the wrong class when classes run concurrently, and keep only the last run of a nested class that several test classes inherit. The summary's step totals are Maven's own counts.

Why these tests
  • area ingestion-pipelines ← openmetadata-spec/src/main/resources/json/schema/metadataIngestion/dashboardServiceMetadataPipeline.json
  • smoke ← code other than a test class changed
Commands
mvn -B package -pl openmetadata-service -am -Dspring-boot.repackage.skip=true -Dtest=CreateIngestionPipelineImplTest -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=parallel -Dit.test=ConfigResourceIT,DatabaseSmokeIT,GlossaryTermResourceIT,IngestionPipelineAgentTypeIT,IngestionPipelineLogStreamIT,IngestionPipelineLogStreamingResourceIT,IngestionPipelineOwnerInheritanceIT,IngestionPipelineProgressStreamIT,IngestionPipelineResourceIT,IngestionPipelineSortIT,K8sEnvVarSerializationIT,K8sOMJobOperatorIT,K8sPipelineEnvVarIT,OrphanIngestionPipelineCleanupIT,PipelineStatusAuthorizationIT,RunIngestionPipelineForEntityIT,SeedDataPresenceIT,TableResourceIT,TestConnectionDefinitionResourceIT,UserResourceIT,WorkflowRedeploySignalIT,WorkflowResourceIT,WorkflowSignalDeliveryIT,WorkflowTaskAssigneesIT,WorkflowTriggerPermissionsIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false
mvn -B verify -pl :openmetadata-integration-tests -am -Dspring-boot.repackage.skip=true -Pmysql-elasticsearch -DintegrationTests.lane=global-state -Dit.test=WorkflowDefinitionResourceIT -Dfailsafe.failIfNoSpecifiedTests=false -Dtest=NoUnitTestsInThisRun -Dsurefire.failIfNoSpecifiedTests=false

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Nov 2, 2026
@github-actions

github-actions Bot commented Nov 2, 2026

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.

@github-actions

github-actions Bot commented Nov 2, 2026

Copy link
Copy Markdown
Contributor

✅ Generated Sources Auto-Updated

The generated TypeScript types (src/generated/) and dereferenced JSON
schemas (src/jsons/, public/jsons/) have been automatically updated
based on JSON schema changes in this PR.

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.

🟡 Changes recommended

Export-permission and preservation-lookup failures can remove existing chart links and trigger chart soft-deletion, while zero-view runs leave usage totals stale.

3 open issues
What changed in this PR

Extends OpenMetadata’s Hex connector with component charts, lifecycle metadata, app-view usage, and optional run-history custom properties, addressing #36831.

Changes:

  • Ingests imported Hex Components as charts and shares project exports across chart, data-model, and lineage stages.
  • Adds usage reporting and opt-in custom properties through a post-save dashboard patch stage.
  • Corrects camelCase parsing for published-app links and analytics, honours includeOwners, and adds tests and decision records.
File Description
openmetadata-ui/​src/​main/​resources/​ui/​public/​locales/​en-US/​Dashboard/​workflows/​metadata.md Documents the custom-properties option.
openmetadata-spec/​src/​main/​resources/​json/​schema/​metadataIngestion/​dashboardServiceMetadataPipeline.json Adds default-off includeCustomProperties.
ingestion/​tests/​unit/​topology/​dashboard/​test_hex.py Removes the obsolete no-charts test.
ingestion/​tests/​unit/​topology/​dashboard/​test_hex_components_runs_usage.py Tests components, lifecycle, usage, owners, and custom properties.
ingestion/​tests/​unit/​topology/​dashboard/​test_hex_client.py Updates listing and camelCase parsing expectations.
ingestion/​tests/​integration/​ometa/​test_ometa_dashboard_api.py Tests usage windows and additive writes.
ingestion/​src/​metadata/​ingestion/​source/​dashboard/​hex/​models.py Corrects API field names and run models.
ingestion/​src/​metadata/​ingestion/​source/​dashboard/​hex/​metadata.py Implements charts, usage, lifecycle, and custom properties.
ingestion/​src/​metadata/​ingestion/​source/​dashboard/​hex/​client.py Adds component discovery, export caching, and latest-run retrieval.
ingestion/​src/​metadata/​ingestion/​source/​dashboard/​dashboard_service.py Adds the post-save extension stage.
ingestion/​src/​metadata/​ingestion/​ometa/​mixins/​dashboard_mixin.py Adds dashboard usage retrieval.
ingestion/​.basedpyright/​baseline.json Removes obsolete type-check baseline entries.
docs/​decisions/​2026-11-02-run-changing-dashboard-custom-properties-are-patched-after-the-dashboard.md Records custom-property update and preservation semantics.
docs/​decisions/​2026-11-02-hex-daily-usage-follows-its-seven-day-app-views.md Records the rolling-total usage calculation.

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 2, 2026 10:20

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. Try requesting a review at a lower effort level.

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Jest test Coverage

UI tests summary

Lines Statements Branches Functions
Coverage: 81%
80.97% (137064/169263) 67.88% (49184/72453) 70.93% (27686/39029)

Copilot AI balanced review requested due to automatic review settings November 2, 2026 12:14

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. Try requesting a review at a lower effort level.

The dashboard's usage summary is read from its latest usage row, so a
project whose views dropped to zero kept its old weekly count.
Copilot AI balanced review requested due to automatic review settings November 2, 2026 12:20

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. Try requesting a review at a lower effort level.

@gitar-bot

gitar-bot Bot commented Nov 2, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Hex ingestion now writes component charts, usage counts, and opt-in run/view properties; incorrect source data or arithmetic could misstate dashboards.

Adds Hex Components as dashboard Charts, run history and app view usage, with opt-in custom properties for app view counts and last run status, duration and refresh time. Also fixes the camelCase field aliases so published projects link to the app and honours includeOwners. 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

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@sonarqubecloud

sonarqubecloud Bot commented Nov 2, 2026

Copy link
Copy Markdown

@ulixius9
ulixius9 added this pull request to the merge queue Nov 2, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Nov 3, 2026
@github-actions

github-actions Bot commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

🚦 Removed from the merge queue — failed_checks (2026-11-03T00:18:07Z)

Blocked the queue: integration-tests-postgres-elasticsearch-redis

@ulixius9
ulixius9 added this pull request to the merge queue Nov 3, 2026
Merged via the queue into main with commit 202ac12 Nov 3, 2026
92 of 93 checks passed
@ulixius9
ulixius9 deleted the ulixius9/hex-assets-ingestion-fix branch November 3, 2026 08:14
ulixius9 added a commit that referenced this pull request Nov 3, 2026
…kport 2.0 #36836) (#36856)

* Hex: ingest components as charts, run history and app views

Bring the Hex connector to parity with DataHub's Hex source:

- Components imported by a project become Charts on its dashboard (read
  from the project export, shared with the data model and lineage
  stages). A failed export keeps the dashboard's existing charts.
- Dashboards and charts get a lifeCycle: created, updated (published
  results refreshed) and accessed (last viewed).
- App views become dashboard usage, derived so OpenMetadata's weekly
  count equals Hex's seven-day views.
- Behind a new dashboard pipeline option, includeCustomProperties
  (default false), dashboards get appViewsLast7Days, appViewsAllTime,
  lastRunStatus, lastRunElapsedSeconds and lastRefreshed. They are
  patched in by a new dashboard topology stage after the dashboard is
  saved, since a bot PUT keeps the stored extension.

Also fix the Hex models' snake_case aliases, which dropped every
camelCase field Hex returns (lastPublishedAt, analytics), so published
projects linked to the editor instead of the app; and honour
includeOwners, which the Hex connector ignored.

(cherry picked from commit 0405c39)

* Hex: keep the charts of components a failed listing page leaves out

A component the project imports but the project listing lacks (a failed
listing page returns the items read so far) was skipped, so its chart was
unlinked from the dashboard and soft-deleted. It now keeps the chart the
dashboard already has, linked and marked as seen.

Also test close() computing usage percentiles only with includeUsage, and
pin the usage window and additive PUT that the Hex usage arithmetic relies
on in an ometa integration test.

(cherry picked from commit 7ec67cc)

* Hex: write a zero usage row so app views that aged out stop showing

The dashboard's usage summary is read from its latest usage row, so a
project whose views dropped to zero kept its old weekly count.

(cherry picked from commit 0ca3439)

* Update generated TypeScript types and dereferenced schemas

* Hex: baseline the dashboard extension NodeStage call on 2.0

2.0's basedpyright baseline holds one reportCallIssue per existing NodeStage call in dashboard_service.py; main carries a spare, so the backport's extra stage was the only new error.

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
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 Components as charts, run history and app views

3 participants