Skip to content

fix(permalink): accept null entries in activeTabs for v5-imported dashboards#40969

Open
Abdulrehman-PIAIC80387 wants to merge 1 commit into
apache:masterfrom
Abdulrehman-PIAIC80387:fix/permalink-activetabs-allow-null-40934
Open

fix(permalink): accept null entries in activeTabs for v5-imported dashboards#40969
Abdulrehman-PIAIC80387 wants to merge 1 commit into
apache:masterfrom
Abdulrehman-PIAIC80387:fix/permalink-activetabs-allow-null-40934

Conversation

@Abdulrehman-PIAIC80387

Copy link
Copy Markdown
Contributor

SUMMARY

Fixes #40934.

`DashboardPermalinkStateSchema.activeTabs` is a Marshmallow `fields.List(fields.String(), allow_none=True)`. The list itself accepts `None`, but each element inside the list is a `fields.String()` without `allow_none`, so a list containing a `None` (e.g. `["TAB-abc", null, "TAB-xyz"]`) fails validation with:

```json
{ "message": "{'activeTabs': {N: ['Field may not be null.']}}" }
```

That is exactly the shape v5-exported dashboards persist when one or more tab levels has no active child. Importing such a dashboard into v6 and generating a permalink fails systematically.

This PR adds `allow_none=True` to the inner `fields.String` so `None` entries are accepted while the outer list and the per-entry string typing are otherwise preserved.

BEFORE / AFTER

Before After
`activeTabs: ["a", null, "b"]` Validation error Loaded as-is
`activeTabs: None` (whole list null) Loaded as None (unchanged) Loaded as None (unchanged)
`activeTabs: ["a", 42]` (non-string entry) Validation error Still rejected — defensive

TESTING INSTRUCTIONS

```bash
pytest tests/unit_tests/dashboards/schema_tests.py -v
```

Three new tests assert:

Test Behavior
`test_permalink_state_schema_accepts_null_in_active_tabs` The reported v5 import case is now accepted
`test_permalink_state_schema_still_accepts_null_active_tabs_list` The pre-existing `allow_none` on the outer list is unchanged
`test_permalink_state_schema_still_rejects_non_string_entries` The fix does not widen the type — non-string entries are still rejected

Manual verification:

  1. Import any v5 dashboard whose `activeTabs` includes a `null` (the issue contains a minimal repro export attached)
  2. Open the dashboard and click "Share → Copy permalink"
  3. Permalink is generated; previously it failed with the validation error above

ADDITIONAL INFORMATION

  • Has associated issue: Permalink ko (activeTabs, Field may not be null) #40934
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (please mention any potential downtime)
  • Migration is atomic, supports rollback & is backwards-compatible
  • Confirm DB migration upgrade and downgrade tested
  • Runtime introduces no new dependencies / changes existing dependencies
  • Introduces new feature or API
  • Removes existing feature or API

@bito-code-review

bito-code-review Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #69bced

Actionable Suggestions - 0
Additional Suggestions - 1
  • superset/dashboards/permalink/schemas.py - 1
    • OpenAPI spec stale after schema change · Line 33-33
      The schema change on line 33 allows `null` entries in `activeTabs`, but the generated OpenAPI spec (`docs/static/resources/openapi.json` line 3577-3578) still shows `items: {type: string}` without `nullable: true`. API consumers relying on the spec will not know `null` is valid. Run `python3 docs/scripts/fix-openapi-spec.py` to regenerate, or add explicit handling for `allow_none` on inner list fields.
Review Details
  • Files reviewed - 2 · Commit Range: f108195..f108195
    • superset/dashboards/permalink/schemas.py
    • tests/unit_tests/dashboards/schema_tests.py
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful
    • MyPy (Static Code Analysis) - ✔︎ Successful
    • Astral Ruff (Static Code Analysis) - ✔︎ Successful

Bito Usage Guide

Commands

Type the following command in the pull request comment and save the comment.

  • /review - Manually triggers a full AI review.

  • /pause - Pauses automatic reviews on this pull request.

  • /resume - Resumes automatic reviews.

  • /resolve - Marks all Bito-posted review comments as resolved.

  • /abort - Cancels all in-progress reviews.

Refer to the documentation for additional commands.

Configuration

This repository uses Superset You can customize the agent settings here or contact your Bito workspace admin at evan@preset.io.

Documentation & Help

AI Code Review powered by Bito Logo

@dosubot dosubot Bot added the dashboard Namespace | Anything related to the Dashboard label Jun 11, 2026
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 64.30%. Comparing base (2b18dc0) to head (f108195).

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40969      +/-   ##
==========================================
+ Coverage   64.23%   64.30%   +0.06%     
==========================================
  Files        2657     2657              
  Lines      144028   144028              
  Branches    33208    33208              
==========================================
+ Hits        92521    92612      +91     
+ Misses      49885    49794      -91     
  Partials     1622     1622              
Flag Coverage Δ
hive 39.45% <ø> (ø)
mysql 58.18% <ø> (ø)
postgres 58.25% <ø> (?)
presto 41.04% <ø> (ø)
python 59.72% <ø> (+0.13%) ⬆️
sqlite 57.87% <ø> (ø)
unit 100.00% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dashboard Namespace | Anything related to the Dashboard size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Permalink ko (activeTabs, Field may not be null)

1 participant