Skip to content

fix(archived-list): use the semantic-layers-aware label for the dataset type - #43465

Merged
aminghadersohi merged 3 commits into
apache:masterfrom
mikebridge:sc-117448-archived-datasource-label
Aug 25, 2026
Merged

fix(archived-list): use the semantic-layers-aware label for the dataset type#43465
aminghadersohi merged 3 commits into
apache:masterfrom
mikebridge:sc-117448-archived-datasource-label

Conversation

@mikebridge

Copy link
Copy Markdown
Contributor

SUMMARY

On the Recently Archived (soft-delete recovery) view, the archived-object type was labeled "Dataset" — in the type-filter dropdown and the Type column — even on workspaces where the SEMANTIC_LAYERS feature flag renames the concept to "Datasource" everywhere else (the top nav reads "Datasources" while the archived row says "Dataset"). QA-reported cosmetic inconsistency (sc-117448).

Root cause: the view's TYPE_LABELS map was a module-level constant with dataset: t('Dataset') hardcoded, bypassing the app's flag-aware naming module. The map now holds label getters (Record<ArchivedType, () => string>) and the dataset entry delegates to the existing shared helper (datasetLabel from src/features/semanticLayers/label.ts), so the flag is read at render time and any future rename stays consistent automatically.

Only display text changes: the ArchivedType identifiers, filter values, and API requests are byte-identical under both flag states (asserted in the tests — selecting the renamed option still drives the dataset endpoints). With the flag off, every string renders exactly as before.

Docs: the Recently Archived page's Type-selector sentence now notes the flag-aware name.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before (from the ticket, flag ON — nav says "Datasources", archived type says "Dataset"): see sc-117448's screenshot. After: the same two spots read "Datasource"; with the flag off, "Dataset" (unchanged). Text-only change; RTL tests pin both states.

TESTING INSTRUCTIONS

  1. Enable SOFT_DELETE and SEMANTIC_LAYERS (top nav shows Datasources); archive a dataset.
  2. Settings → Recently Archived: the Type selector offers Datasource (with Chart/Dashboard) and the Type column reads Datasource; selecting it lists the archived datasets exactly as the "Dataset" option did.
  3. Disable SEMANTIC_LAYERS: both spots read Dataset, unchanged from before this PR.
  4. npm run test -- src/pages/ArchivedList — 23 tests including the two new flag-state tests (the flag-on assertion fails against the previous hardcoded map).

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags: SEMANTIC_LAYERS for the renamed label (SOFT_DELETE to reach the view); flag-off rendering unchanged
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

🤖 Authored with the assistance of Claude (AI), directed and reviewed by @mikebridge.

…et type

The Recently Archived view hardcoded "Dataset" in its type map, so the
type-filter option and the Type column ignored the SEMANTIC_LAYERS flag
that renames the concept to "Datasource" everywhere else in the app
(sc-117448, QA-reported).

The map now holds label getters and the dataset entry delegates to the
shared naming module (src/features/semanticLayers/label.ts), so the flag
is read at render time and a future rename stays consistent
automatically. Only display text changes: the ArchivedType identifiers,
filter values, and requests are identical under both flag states.

Docs: the Recently Archived page notes the flag-aware name.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@dosubot dosubot Bot added change:frontend Requires changing the frontend doc:user User / Superset documentation labels Aug 24, 2026
@bito-code-review

bito-code-review Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #65b0b6

Actionable Suggestions - 0
Review Details
  • Files reviewed - 3 · Commit Range: 5208775..5208775
    • docs/docs/using-superset/recently-archived.mdx
    • superset-frontend/src/pages/ArchivedList/ArchivedList.test.tsx
    • superset-frontend/src/pages/ArchivedList/index.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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

@github-actions github-actions Bot added the doc Namespace | Anything related to documentation label Aug 24, 2026
@netlify

netlify Bot commented Aug 24, 2026

Copy link
Copy Markdown

Deploy Preview for superset-docs-preview ready!

Name Link
🔨 Latest commit bf28feb
🔍 Latest deploy log https://app.netlify.com/projects/superset-docs-preview/deploys/6a8ccc2403154a0008cbc4f3
😎 Deploy Preview https://deploy-preview-43465--superset-docs-preview.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Comment thread superset-frontend/src/pages/ArchivedList/index.tsx
@bito-code-review

Copy link
Copy Markdown
Contributor

The review comment correctly identifies an issue: the useListViewResource hook expects a plural resource label for error messages, but the current implementation passes the singular datasetLabel(), which causes incorrect pluralization (e.g., "Datasourcess").

To resolve this, you should pass a dedicated plural label to the hook for error handling while continuing to use the singular label for UI display. You can update the ArchivedListBody component to accept or derive the appropriate plural form based on the current type.

Would you like me to fetch all other comments on this PR to validate and implement fixes for them as well?

superset-frontend/src/pages/ArchivedList/index.tsx

refreshData,
  } = useListViewResource<ArchivedItem>(
    config.resource,
    type === 'dataset' ? t('Datasets') : TYPE_LABELS[type](),
    addDangerToast,
    true,
    [],

Review-panel follow-ups: pin the Type column cell with a row-scoped
assertion (the previous check was satisfiable by the Select's own
rendered value), reset the flag mock in afterEach so a test that dies
mid-body cannot leak SEMANTIC_LAYERS into later tests, and compare
against FeatureFlag.SemanticLayers instead of a string literal.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 78.86%. Comparing base (8fa48d7) to head (c024fca).
⚠️ Report is 9 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #43465   +/-   ##
=======================================
  Coverage   78.85%   78.86%           
=======================================
  Files        2876     2876           
  Lines      164601   164603    +2     
  Branches    38015    38015           
=======================================
+ Hits       129799   129806    +7     
+ Misses      32355    32350    -5     
  Partials     2447     2447           
Flag Coverage Δ
javascript 74.21% <100.00%> (+<0.01%) ⬆️

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.

@bito-code-review

bito-code-review Bot commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

Code Review Agent Run #c525d3

Actionable Suggestions - 0
Review Details
  • Files reviewed - 1 · Commit Range: 5208775..c024fca
    • superset-frontend/src/pages/ArchivedList/ArchivedList.test.tsx
  • Files skipped - 0
  • Tools
    • Whispers (Secret Scanner) - ✔︎ Successful
    • Detect-secrets (Secret Scanner) - ✔︎ Successful

Bito Usage Guide

Commands

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

  • /review - Manually triggers an incremental AI Review.

  • /review full - 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

@aminghadersohi
aminghadersohi self-requested a review August 24, 2026 23:00

@aminghadersohi aminghadersohi 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.

Thanks for this, @mikebridge — this is a clean, well-reasoned fix. I reviewed the two substantive commits (5208775 fix, c024fca tests); the head bf28feb8 is just an "Update branch" merge. Verdict: looks ready for a committer's attention. Notes below, none blocking.

The core question: did every call site get converted?

Yes — all four, including the one the diff context hides. TYPE_LABELS is read in exactly four places, and every one now invokes the getter:

  • index.tsx:172useListViewResource singular label → TYPE_LABELS[type]()
  • index.tsx:253recoveredToast(...)TYPE_LABELS[type]()
  • index.tsx:312Cell: () => TYPE_LABELS[type]()
  • index.tsx:545 — the Type-filter dropdown options map → TYPE_LABELS[option]()

That fourth one (availableTypes.map) is the easy one to miss — a Record<…, () => string> read without () renders as nothing / [object Function] and TS won't always catch it once it flows into ReactNode. You caught it. No fifth read exists.

The other checks

  1. datasetLabel is a plain function, not a hook. src/features/semanticLayers/label.tsexport const datasetLabel = () => sl(t('Dataset'), t('Datasource')), where sl calls isFeatureEnabled('SEMANTIC_LAYERS') at call time. So it's safe inside the useMemo/column config (no rules-of-hooks violation) and it is not a module-load no-op. ✅

  2. Incidental i18n win — real, and worth calling out. The old map evaluated t('Chart')/t('Dashboard')/t('Dataset') at module scope, before the locale is initialized, so those three could render untranslated. Deferring all three to render time fixes that for chart and dashboard too, not just the dataset relabel. Nice bonus.

  3. No staleness risk on the hook label. TYPE_LABELS[type]() at :172 is evaluated at render time; SEMANTIC_LAYERS is a boot-time flag, so it cannot go stale within a session. Fine.

  4. Docs match the behavior. recently-archived.mdx now reads "Dataset (shown as Datasource when semantic layers are enabled)" — flag-aware, not hardcoded. ✅

Test adequacy (one LOW note)

The two new tests are genuinely good: they exercise both flag states, and each asserts both the dropdown option label (:545) and the Type-column cell (:312) — including the nice touch of scoping the cell assertion to the row (within(datasetRow)) so it can't accidentally match the Select's own rendered value. The afterEach flag-mock restore is the right defensive move for shared module state.

LOW — two of the four call sites aren't covered. The recoveredToast label (:253) and the useListViewResource error-label (:172) are only reachable via a restore-success toast and a fetch-error path, neither of which these tests drive. Both are correctly converted here, so there's no bug — but if a future edit dropped the () on either line, the suite would stay green. A one-line assertion on the restore toast text (there's already a restore test at :188) would close that gap. Not required for this PR.

CI (re-derived at review time via statusCheckRollup)

Your own suite is green on CI: PASS src/pages/ArchivedList/ArchivedList.test.tsx (19.3 s) on sharded-jest-tests (3). The one red leg on that shard is SqlEditor › enables the save dataset button when the latest query succeeded in SqlLab/.../SqlEditor.test.tsx — a file this PR doesn't touch; it's an unrelated/flaky failure, not yours. A re-run should clear it. Seven legs (cypress, playwright, docker, storybook) were still running when I looked.

(Locally I INSPECTED rather than RAN — superset-frontend/node_modules isn't present in this worktree — so the "passing" claim rests on the CI shard log above, not a local run.)

@aminghadersohi
aminghadersohi merged commit f83fb7c into apache:master Aug 25, 2026
75 of 76 checks passed
@bito-code-review

Copy link
Copy Markdown
Contributor

Bito Automatic Review Skipped – PR Already Merged

Bito scheduled an automatic review for this pull request, but the review was skipped because this PR was merged before the review could be run.
No action is needed if you didn't intend to review it. To get a review, you can type /review in a comment and save it

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

Labels

change:frontend Requires changing the frontend doc:user User / Superset documentation doc Namespace | Anything related to documentation size/M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants