Skip to content

Fixes #35965: Ingest PowerBI report pages as charts of their report - #35970

Merged
harshsoni2024 merged 4 commits into
mainfrom
pbi_report_pages
Oct 23, 2026
Merged

harshsoni2024 merged 4 commits into
mainfrom
pbi_report_pages

Conversation

@harshsoni2024

@harshsoni2024 harshsoni2024 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Describe your changes:

Fixes #35965

PowerBI dashboards carried their tiles as charts, but reports (dashboardType: Report) had none. Each page of a report is now ingested as a chart under its report, and the report URL is built from the same pages response, so ingestion makes no extra API call.

Type of change:

  • New feature

Manual Testing

Before change

Screenshot 2026-10-22 at 6 33 03 PM Screenshot 2026-10-22 at 6 33 43 PM

After change

Screenshot 2026-10-22 at 6 31 32 PM Screenshot 2026-10-22 at 6 32 54 PM

High-level design:

  • One pages call per report. The topology yields every chart of a workspace before any dashboard, so both stages need the pages. _get_report_pages fetches them on first use and memoises the response in WorkspaceState, which releases it when the workspace exits (the scope-limited cache the connector memory standard allows, like cache_dataflow_export). _get_report_url becomes a pure builder that takes the page to open on; a report still opens on its first page.
  • Chart name {report_id}_{page.name}. Page names repeat across reports (the API example answers ReportSection and ReportSection1), so a bare name would collide in service.chartName. Grafana scopes its panels the same way ({uid}_{panelId}). Recorded in ADR:2026-10-22-powerbi-report-pages-are-charts-named-by-report-id-and-page-name.
  • One chart path for tiles and pages. _yield_chart (filter, request, record under the parent, progress, error) and _get_chart_fqns (the parent's charts list) replace a second copy of the tile loop. Only charts that were yielded are listed, because the server resolves every listed chart FQN and fails the dashboard on a missing one.
  • A failed pages read keeps the report's charts. fetch_report_pages answers [] only for a response with no pages, and None when the read fails (an error status, which REST.get turns into None because Power BI nests the error code under error; a transport error; an unreadable body). Both are logged at debug. For a failed read, the chart stage reads the report back from the server and keeps the charts it already lists, in the run's live set (so markDeletedCharts does not soft-delete them) and in the report's charts; otherwise a transient failure would delete the page charts and the next run restore them. When the server cannot list those charts either, the report's charts are unknown: the report is registered but not sent (a PUT replaces its chart links, null included), and PowerbiSource.mark_charts_as_deleted skips the stale-chart pass for the run, so a failed discovery never drives deletion. The step is not failed for a failed pages read: with the admin APIs the service principal often cannot open a workspace, so its reports' pages fail on every run. An answer with no pages lets the old page charts go.
  • chartFilterPattern applies to page display names; a page without a name is skipped with a warning; a report excluded by dashboardFilterPattern still makes no pages call.
  • Side fix: a tile with no title whose chart failed raised StackTraceError(name=None) from inside the error handler, which aborted the chart stage for the rest of the workspace. Errors are now named by the chart's display name.
  • Rollout: existing reports gain charts on the next run; charts of pages later removed in PowerBI are soft-deleted under markDeletedCharts, like tiles. No schema or migration change.
  • Not changed: the base yield_dashboard_chart_lineage stage draws Dashboard→Chart lineage edges only for the last dashboard yielded per workspace (context.dashboard is upserted), which already applies to tiles and now applies to pages too; the charts list itself is set for every report. In non-admin mode a failed tiles read (fetch_all_org_tiles) still empties a dashboard's tiles, as before this PR.

Tests:

Use cases covered

  • A report's pages become charts with the page display name and a URL that opens the page, and the report lists them.
  • The report URL opens on the first page and comes from the same, single pages call.
  • Two reports with a page named ReportSection get distinct charts.
  • chartFilterPattern drops a page from the charts while the report still opens on it.
  • A page without a name is skipped; a page or tile chart that fails is reported and left out of its parent's charts.
  • An API error status or a network error keeps the charts the report already has (live set and charts), with a page-less URL, after one call; a report not ingested before keeps nothing.
  • When the stored charts cannot be read either, the failure is reported, the report is not sent, the stale-chart pass deletes nothing, and the next report is still ingested.
  • A normal run's stale-chart pass gets exactly the charts ingested this run.
  • An answer with no pages leaves the report without charts, so its old page charts can be soft-deleted.
  • Paginated (RDL) reports use the rdlreports prefix for their pages and the report.
  • A report excluded by dashboardFilterPattern makes no pages call.
  • Dashboards (tiles) and reports (pages) in one workspace.

Unit tests

  • I added unit tests for the new/changed logic.
  • Added: ingestion/tests/unit/topology/dashboard/test_powerbi_report_pages.py, which runs the real producer, chart stage and dashboard stage with only the PowerBI REST GET mocked.
  • Updated: test_powerbi_client.py (fetch_report_pages tells no pages from a failed read, and its debug logs), test_powerbi_workspace_state.py (pages memo lifecycle, failed reads included), test_powerbi.py (test_get_report_url for the pure builder).
  • Ran every unit test that covers a changed file (changed tests plus every test importing a changed module), with PYTHONPATH=src:
    test_connection.py 39, test_powerbi_filter_query.py 10, test_powerbi_table_measures.py 13, test_dashboard_owned_connection.py 5, test_powerbi.py 59, test_powerbi_client.py 14, test_powerbi_metrics.py 22, test_powerbi_report_pages.py 17, test_powerbi_workspace_state.py 12, test_powerbi_resilience.py 17 — 208 passed, 0 failed.
  • Coverage (pytest-cov): every changed executable line is covered, 81/81 (metadata.py 58/58, client.py 6/6, workspace_state.py 17/17). File totals: workspace_state.py 100%, metadata.py 65%, client.py 45%; the rest is untouched auth, scan and lineage code.
  • Each guard was checked to fail when its code is swapped out in-process: the pages memo, the report-id scoping, the report's charts, chart registration for markDeletedCharts, keeping the stored charts on a failed read, telling a failed read from no pages, and, when the stored charts are unknown, not sending the report and skipping the stale-chart pass. test_failed_tile_without_a_title_is_reported_by_its_id fails on main's chart stage with the StackTraceError(name=None) ValidationError.

Backend integration tests

  • Not applicable (no backend API changes).

Ingestion integration tests

  • I ran the integration tests covering my changed files locally: tests/integration/powerbi/ — 1 passed. No integration test was added: the pages call is a per-report REST GET, covered at the REST boundary by the stage tests above.

Playwright (UI) tests

  • Not applicable (no UI changes).

Manual testing performed

Ran against a live Power BI tenant with useAdminApis: true, ingesting it into two new services: before_changes with main, after_changes with this branch.

  • A report whose pages call answers two pages (ReportSection "count of status by year", ReportSection6937772d99d42eb76e55 "sum of customers") now lists two charts, 3c8875f2-***_ReportSection and 3c8875f2-***_ReportSection6937772d99d42eb76e55, shown by those display names, each with a source URL that opens its page (.../reports/3c8875f2-***/ReportSection6937772d99d42eb76e55?experience=power-bi). On main it lists none. The report still opens on ReportSection, its first page.
  • Across the tenant, both services hold the same 44 reports and 33 dashboards. With this branch, 17 reports list 23 page charts; each page chart is scoped by its report id, listed by its report, and opens its own page. The 88 tile charts are identical to main's (name, display name, URL, chart type, dashboard), and so is every report URL.
  • The other 27 reports (18 in personal workspaces, 4 in the Admin monitoring workspace, a paginated report, and 4 others) got no pages on main either: their report URL has no page in both runs. They still have no charts.
  • Not run: re-running this branch over the service main ingested (the upgrade path), and excluding a page with chartFilterPattern to see its chart soft-deleted.

UI screen recording:

Not applicable — ingestion-only change; the existing Charts tab renders the new charts.

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. Not applicable: no schema change.

  • 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.
    Pass 1 on f10427e1836: 🔴 a failed pages read soft-deleted the report's page charts, and 🔴 the decision record was not committed; both fixed in 3f011e540a8, with tests. 🟡 a filter in _get_chart_fqns that could never drop a chart: removed. 🟡 Dashboard→Chart lineage reaching only the last dashboard per workspace: pre-existing (Fixes 5952: [Lineage] Draw Dashboard to Chart edges in the shared dashboard topology #34985), left out of scope (see "Not changed"). Pass 2 on 3f011e540a8: 🔴 when the stored charts could not be read either, the report was still sent with charts=[] and its charts soft-deleted; fixed in 6d1327b3ada, with tests (Greptile's P1 is the same finding). Pass 3 on 6d1327b3ada: no 🔴. Its one withheld nit, that the double-failure test dropped the dashboards so a continue→return regression passed, is fixed in ad871935579, a test-only change that the same mutant now fails.

  • Decision check: if this PR decides something the next contributor could undo — a schema field, REST path or format another component or repo must agree with, a new default or limit, an ordering that must hold, or a rule stated only in this description — it adds a record under docs/decisions/ (see its README.md). This description is gone from git log after the squash-merge.

  • 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. Not done: the connector docs live in the docs repository.

  • I have added tests around the new logic.

🤖 Generated with Claude Code

RetriggerView in GreptileConfidence Score: 5/5

The PR appears safe to merge; no new actionable issues were found.

Summary

PowerBI report pages become charts under their report. The connector reuses one pages response for charts and report URLs.

  • PowerBI reports now list each named page as a chart.
  • PowerBI ingestion keeps report charts when page reads fail.
  • PowerBI tile errors keep a name when a tile has no title.
  • The Ruff baseline drops one recorded entry.

Reviews (3) · Last reviewed commit: "test(powerbi): assert the next report is..." · Reviewed by Greptile

PowerBI dashboards carried their tiles as charts, but reports had none.
Each page of a report now becomes a chart under its PowerBIReport
dashboard, named `{report_id}_{page.name}`: page names such as
`ReportSection` repeat across reports, so the report id keeps chart
FQNs unique within the service.

The Get Pages In Group response is fetched once per report and memoised
in WorkspaceState for the workspace, so the chart stage and the report
url share one call. `_get_report_url` becomes a pure builder that takes
the page to open on, and tiles and pages share one chart helper.

`fetch_report_pages` now always returns a list (a null page list used
to come back as None) and logs at debug when the API returns no pages.
A failed Get Pages In Group read answered the same empty list as a
report without pages, so a transient error soft-deleted the report's
page charts under markDeletedCharts and emptied its chart list, only
for the next good run to restore them.

fetch_report_pages now answers None when the read fails and [] only
for a response with no pages. WorkspaceState memoises a failed read as
well, and for such a report the chart stage keeps the charts the server
already lists under it in the run's live set and in the report.

Also records the page-chart naming in a decision record, adds tests for
the chart error path (on main an untitled tile that failed raised from
the error handler and aborted the chart stage), and drops a filter in
_get_chart_fqns that could never remove a chart.
Copilot AI balanced review requested due to automatic review settings October 22, 2026 12:27
@harshsoni2024
harshsoni2024 requested a review from a team as a code owner October 22, 2026 12:27

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 reached their quota limit.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

✅ PR checks passed

The linked issue has a description and all required Shipping project fields set. Thanks!

@github-actions github-actions Bot added Ingestion safe to test Add this label to run secure Github workflows on PRs labels Oct 22, 2026
When a report's pages could not be read and the server could not list
its stored charts either, the report was still sent with no charts and
its charts were left out of the run's live set, so the run emptied the
report and markDeletedCharts soft-deleted the charts; with pages that
fail every run, later runs then found nothing left to keep.

Such a report's charts are now unknown: the report is registered but
not sent, so the server keeps its chart links, and the stale-chart pass
is skipped for the run, since a failed discovery must not drive
deletion. The failure is still reported for the report.
Copilot AI balanced review requested due to automatic review settings October 22, 2026 12:35

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 reached their quota limit.

The double-failure test dropped the dashboards it ingested, so turning
the unknown-report `continue` into a `return` passed every test while
leaving every later report in the workspace unsent and unregistered.
Copilot AI balanced review requested due to automatic review settings October 22, 2026 12:53

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 reached their quota limit.

@gitar-bot

gitar-bot Bot commented Oct 22, 2026

Copy link
Copy Markdown
Code Review ✅ Approved

🟡 Medium risk · Ingesting PowerBI report pages as charts changes report metadata; mistaken page results could create incorrect charts or soft-delete existing ones.

Ingests each Power BI report page as a chart under its parent report, named by report ID and page name, with URLs that open the specific page. No open 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

@harshsoni2024
harshsoni2024 added this pull request to the merge queue Oct 23, 2026
Merged via the queue into main with commit 7ac4c14 Oct 23, 2026
86 of 91 checks passed
@harshsoni2024
harshsoni2024 deleted the pbi_report_pages branch October 23, 2026 05:31
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.

PowerBI: ingest report pages as charts of their report

3 participants