You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "jesperct (via GitHub)" <gi...@apache.org> on 2026/06/08 18:00:42 UTC
[PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
jesperct opened a new pull request, #40865:
URL: https://github.com/apache/superset/pull/40865
### SUMMARY
When you convert a chart from **Big Number with Time Comparison** or **Table** (both offer the "Inherit range from time filter" and "Custom" time shifts) into a timeseries chart such as Line or Bar, the `inherit`/`custom` value was carried over into the new chart's **Time shift** control. The timeseries Advanced Analytics "Time shift" reuses the same `time_compare` form-data key but does not offer those options, and because the control is free-form the value was accepted and left as a stray tag the user had to delete by hand on every edit.
`StandardizedFormData.transform` preserves shared controls across viz-type switches. It now drops `inherit`/`custom` from `time_compare` when the target viz type's Time shift control does not list them as choices. Portable relative shifts (e.g. "1 year ago") are still carried over, and `inherit`/`custom` are preserved when switching between viz types that both support them (e.g. Table to Big Number).
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
After converting a Big Number (Time Comparison) chart with Time shift = "Inherit" into a Line chart:
| Before | After |
| :---: | :---: |
|  |  |
### TESTING INSTRUCTIONS
1. Create a **Big Number with Time Comparison** (or **Table**) chart.
2. In **Time Comparison**, set **Time shift** to **Inherit range from time filter**.
3. Switch the visualization type to **Line Chart** (or Bar).
4. Open **Advanced Analytics → Time Comparison**.
5. The **Time shift** field is empty; previously it showed a lingering `inherit` tag.
Unit tests in `standardizedFormData.test.ts` cover both stripping (target viz without inherit/custom) and preservation (target viz that supports them).
### ADDITIONAL INFORMATION
- [ ] Has associated issue:
- [ ] Required feature flags:
- [x] Changes UI
- [ ] Includes DB Migration (follow approval process in [SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] 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
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "jesperct (via GitHub)" <gi...@apache.org>.
jesperct commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3388812507
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +344,47 @@ describe('should collect control values and create SFD', () => {
]);
});
+ test('strips inherit/custom time shifts when target viz does not support them', () => {
+ // Table/Big Number period-over-period offer "inherit" and "custom" time
+ // shifts; the timeseries advanced-analytics target (target_viz) does not.
+ // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit', 'custom'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz', store);
+ // the free-form delta survives, the special markers are dropped
+ expect(formData.time_compare).toEqual(['1 year ago']);
+ });
+
+ test('preserves inherit/custom time shifts when target viz supports them', () => {
+ getChartControlPanelRegistry().registerValue('target_viz_inherit', {
+ controlPanelSections: [
+ sections.timeComparisonControls({}),
+ {
+ label: 'transform controls',
+ controlSetRows: publicControls
+ .filter(c => c !== 'dashboardId' && c !== 'time_compare')
+ .map(control => [control]),
+ },
+ ],
+ });
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz_inherit', store);
+ expect(formData.time_compare).toEqual(['1 year ago', 'inherit']);
+ });
Review Comment:
Good call. Added a test that converts a chart with `time_compare: ['inherit', 'custom']` to a viz without those choices and asserts the value comes out `null`, so the empty-result branch is locked in.
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.ts:
##########
@@ -156,6 +156,36 @@ export class StandardizedFormData {
return controls;
}
+ // Time shifts only meaningful for viz types whose "Time shift" control offers
+ // them (Big Number / Table period-over-period). Other viz types reuse the same
+ // `time_compare` key without these choices.
+ private static specialTimeShifts = ['inherit', 'custom'];
+
+ // Drop `time_compare` markers the target viz can't honor so they don't carry
+ // over as un-removable tags when switching chart types.
+ static dropUnsupportedTimeShifts(
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ controlsState: Record<string, any>,
+ ): void {
+ const control = controlsState?.time_compare;
+ if (!control || !Array.isArray(control.value)) {
+ return;
+ }
+ const supportedChoices = new Set(
+ ensureIsArray(control.choices).map(
+ (choice: [string, string]) => choice[0],
+ ),
+ );
+ const filtered = control.value.filter(
+ (shift: string) =>
+ !StandardizedFormData.specialTimeShifts.includes(shift) ||
+ supportedChoices.has(shift),
+ );
+ if (filtered.length !== control.value.length) {
+ control.value = filtered.length ? filtered : null;
+ }
+ }
Review Comment:
Switched the parameter to `Record<string, unknown>` and added runtime guards on the `value` and `choices` shapes, so it no longer leans on `any` or assumes the choices tuple type.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3382694186
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.ts:
##########
@@ -156,6 +156,36 @@ export class StandardizedFormData {
return controls;
}
+ // Time shifts only meaningful for viz types whose "Time shift" control offers
+ // them (Big Number / Table period-over-period). Other viz types reuse the same
+ // `time_compare` key without these choices.
+ private static specialTimeShifts = ['inherit', 'custom'];
+
+ // Drop `time_compare` markers the target viz can't honor so they don't carry
+ // over as un-removable tags when switching chart types.
+ static dropUnsupportedTimeShifts(
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
+ controlsState: Record<string, any>,
+ ): void {
+ const control = controlsState?.time_compare;
+ if (!control || !Array.isArray(control.value)) {
+ return;
+ }
+ const supportedChoices = new Set(
+ ensureIsArray(control.choices).map(
+ (choice: [string, string]) => choice[0],
+ ),
+ );
+ const filtered = control.value.filter(
+ (shift: string) =>
+ !StandardizedFormData.specialTimeShifts.includes(shift) ||
+ supportedChoices.has(shift),
+ );
+ if (filtered.length !== control.value.length) {
+ control.value = filtered.length ? filtered : null;
+ }
+ }
Review Comment:
`dropUnsupportedTimeShifts` introduces a new `any`-typed controls state parameter and then assumes `time_compare.choices` is a tuple array of `[string, string]`. You can keep this logic but make it type-safe with `unknown` + runtime guards so future control-state shape changes won’t silently bypass filtering (and to avoid expanding `any` usage in this file).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3431742332
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +356,52 @@ describe('should collect control values and create SFD', () => {
]);
});
+ test('strips inherit/custom time shifts when target viz does not support them', () => {
+ // Table/Big Number period-over-period offer "inherit" and "custom" time
+ // shifts; the timeseries advanced-analytics target (target_viz) does not.
+ // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit', 'custom'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz', store);
+ // the free-form delta survives, the special markers are dropped
+ expect(formData.time_compare).toEqual(['1 year ago']);
+ });
Review Comment:
**🟡 Consider:** These tests pass `time_compare` as an array, but Table/Big Number store it as a scalar string and rely on the scalar→array coercion in `getControlState` before this strip runs. Can we add a case seeding `time_compare: 'inherit'` (scalar) so that path is covered too?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe merged PR #40865:
URL: https://github.com/apache/superset/pull/40865
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #40865:
URL: https://github.com/apache/superset/pull/40865#issuecomment-4652091726
## [Codecov](https://app.codecov.io/gh/apache/superset/pull/40865?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 64.14%. Comparing base ([`7c7ab88`](https://app.codecov.io/gh/apache/superset/commit/7c7ab88a602b1b896aaaa6a0a5a43e0d8d51062e?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`ceb4018`](https://app.codecov.io/gh/apache/superset/commit/ceb4018bf5783957762e17eba323b7a416eaac4d?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 11 commits behind head on master.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## master #40865 +/- ##
=======================================
Coverage 64.14% 64.14%
=======================================
Files 2652 2652
Lines 143488 143501 +13
Branches 33110 33115 +5
=======================================
+ Hits 92042 92052 +10
- Misses 49837 49840 +3
Partials 1609 1609
```
| [Flag](https://app.codecov.io/gh/apache/superset/pull/40865/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
|---|---|---|
| [javascript](https://app.codecov.io/gh/apache/superset/pull/40865/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `67.87% <100.00%> (+<0.01%)` | :arrow_up: |
Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
</details>
[:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/superset/pull/40865?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
- :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40865:
URL: https://github.com/apache/superset/pull/40865#issuecomment-4662404827
<!-- Bito Reply -->
To make `dropUnsupportedTimeShifts` type-safe and avoid `any`, you can replace the `any` type with `unknown` and use a type guard to verify the structure of `control.choices`. This ensures that `choice` is indeed a tuple of `[string, string]` before accessing `choice[0]`.
```typescript
static dropUnsupportedTimeShifts(controlsState: Record<string, unknown>): void {
const control = controlsState?.time_compare as { value?: unknown[]; choices?: unknown } | undefined;
if (!control || !Array.isArray(control.value) || !Array.isArray(control.choices)) {
return;
}
const supportedChoices = new Set(
control.choices
.filter((c): c is [string, string] => Array.isArray(c) && typeof c[0] === 'string')
.map((choice) => choice[0]),
);
// ... rest of the filtering logic
}
```
**superset-frontend/src/explore/controlUtils/standardizedFormData.ts**
```
static dropUnsupportedTimeShifts(controlsState: Record<string, unknown>): void {
const control = controlsState?.time_compare as { value?: unknown[]; choices?: unknown } | undefined;
if (!control || !Array.isArray(control.value) || !Array.isArray(control.choices)) {
return;
}
const supportedChoices = new Set(
control.choices
.filter((c): c is [string, string] => Array.isArray(c) && typeof c[0] === 'string')
.map((choice) => choice[0]),
);
// ... rest of the filtering logic
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3431742332
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +356,52 @@ describe('should collect control values and create SFD', () => {
]);
});
+ test('strips inherit/custom time shifts when target viz does not support them', () => {
+ // Table/Big Number period-over-period offer "inherit" and "custom" time
+ // shifts; the timeseries advanced-analytics target (target_viz) does not.
+ // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit', 'custom'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz', store);
+ // the free-form delta survives, the special markers are dropped
+ expect(formData.time_compare).toEqual(['1 year ago']);
+ });
Review Comment:
These tests pass `time_compare` as an array, but Table/Big Number store it as a scalar string and rely on the scalar→array coercion in `getControlState` before this strip runs. Can we add a case seeding `time_compare: 'inherit'` (scalar) so that path is covered too?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "jesperct (via GitHub)" <gi...@apache.org>.
jesperct commented on PR #40865:
URL: https://github.com/apache/superset/pull/40865#issuecomment-4729925360
@sadpandajoe This one's been addressed since your last pass (a38122a) and CI is green. Could you take another look when you have a moment?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40865:
URL: https://github.com/apache/superset/pull/40865#issuecomment-4651894820
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3382725308
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +344,47 @@ describe('should collect control values and create SFD', () => {
]);
});
+ test('strips inherit/custom time shifts when target viz does not support them', () => {
+ // Table/Big Number period-over-period offer "inherit" and "custom" time
+ // shifts; the timeseries advanced-analytics target (target_viz) does not.
+ // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit', 'custom'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz', store);
+ // the free-form delta survives, the special markers are dropped
+ expect(formData.time_compare).toEqual(['1 year ago']);
+ });
+
+ test('preserves inherit/custom time shifts when target viz supports them', () => {
+ getChartControlPanelRegistry().registerValue('target_viz_inherit', {
+ controlPanelSections: [
+ sections.timeComparisonControls({}),
+ {
+ label: 'transform controls',
+ controlSetRows: publicControls
+ .filter(c => c !== 'dashboardId' && c !== 'time_compare')
+ .map(control => [control]),
+ },
+ ],
+ });
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz_inherit', store);
+ expect(formData.time_compare).toEqual(['1 year ago', 'inherit']);
+ });
Review Comment:
**🟢 Nit:** The new tests only exercise the "some values survive" branch of `filtered.length ? filtered : null`. Could we add a case where every value is special (e.g. `time_compare: ['inherit']` → expect `null`) so the empty-result path is locked in, along with the `time_compare: null` serialization that flows out of `getFormDataFromControls`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3431742332
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +356,52 @@ describe('should collect control values and create SFD', () => {
]);
});
+ test('strips inherit/custom time shifts when target viz does not support them', () => {
+ // Table/Big Number period-over-period offer "inherit" and "custom" time
+ // shifts; the timeseries advanced-analytics target (target_viz) does not.
+ // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit', 'custom'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz', store);
+ // the free-form delta survives, the special markers are dropped
+ expect(formData.time_compare).toEqual(['1 year ago']);
+ });
Review Comment:
These tests pass `time_compare` as an array, but Table/Big Number store it as a scalar string and rely on the scalar→array coercion in `getControlState` before this strip runs. Can we add a case seeding `time_compare: 'inherit'` (scalar) so that path is covered too?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40865:
URL: https://github.com/apache/superset/pull/40865#issuecomment-4743959656
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "jesperct (via GitHub)" <gi...@apache.org>.
jesperct commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3436015478
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +356,52 @@ describe('should collect control values and create SFD', () => {
]);
});
+ test('strips inherit/custom time shifts when target viz does not support them', () => {
+ // Table/Big Number period-over-period offer "inherit" and "custom" time
+ // shifts; the timeseries advanced-analytics target (target_viz) does not.
+ // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit', 'custom'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz', store);
+ // the free-form delta survives, the special markers are dropped
+ expect(formData.time_compare).toEqual(['1 year ago']);
+ });
Review Comment:
Good call, added in 59f70ee. It seeds a scalar `time_compare: 'inherit'` and asserts it serializes to null on the target viz, so the coercion path through `getControlsState` is covered now.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #40865:
URL: https://github.com/apache/superset/pull/40865#issuecomment-4651950910
### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
| Name | Link |
|:-:|------------------------|
|<span aria-hidden="true">🔨</span> Latest commit | ceb4018bf5783957762e17eba323b7a416eaac4d |
|<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/6a27034a26e9a20008ad9a48 |
|<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-40865--superset-docs-preview.netlify.app](https://deploy-preview-40865--superset-docs-preview.netlify.app) |
|<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br /><br /><br />_Use your smartphone camera to open QR code link._</details> |
|<span aria-hidden="true">🤖</span> Make changes | [Run an agent on this branch](https://app.netlify.com/projects/superset-docs-preview/agent-runs#DctRDsIgDADQu_TbRoLL3LyBx6ijkyYOGmgW0ezu4-_9vD9oyZsaPAAu8CqUlti9yvdqsjHWKKuhpMhFDJVLlWoVc8JdfmhNGZdI6c19B9ZPbs_Q_0j-7m4D-ZFn8s65icJMwwTHCQ) |
---
<!-- [superset-docs-preview Preview](https://deploy-preview-40865--superset-docs-preview.netlify.app) -->
_To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "sadpandajoe (via GitHub)" <gi...@apache.org>.
sadpandajoe commented on code in PR #40865:
URL: https://github.com/apache/superset/pull/40865#discussion_r3382725308
##########
superset-frontend/src/explore/controlUtils/standardizedFormData.test.ts:
##########
@@ -344,6 +344,47 @@ describe('should collect control values and create SFD', () => {
]);
});
+ test('strips inherit/custom time shifts when target viz does not support them', () => {
+ // Table/Big Number period-over-period offer "inherit" and "custom" time
+ // shifts; the timeseries advanced-analytics target (target_viz) does not.
+ // Carrying them over leaves un-removable tags on the new chart (SC-99170).
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit', 'custom'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz', store);
+ // the free-form delta survives, the special markers are dropped
+ expect(formData.time_compare).toEqual(['1 year ago']);
+ });
+
+ test('preserves inherit/custom time shifts when target viz supports them', () => {
+ getChartControlPanelRegistry().registerValue('target_viz_inherit', {
+ controlPanelSections: [
+ sections.timeComparisonControls({}),
+ {
+ label: 'transform controls',
+ controlSetRows: publicControls
+ .filter(c => c !== 'dashboardId' && c !== 'time_compare')
+ .map(control => [control]),
+ },
+ ],
+ });
+ const store = {
+ ...sourceMockStore,
+ form_data: {
+ ...sourceMockFormData,
+ time_compare: ['1 year ago', 'inherit'],
+ },
+ };
+ const sfd = new StandardizedFormData(store.form_data);
+ const { formData } = sfd.transform('target_viz_inherit', store);
+ expect(formData.time_compare).toEqual(['1 year ago', 'inherit']);
+ });
Review Comment:
The new tests only exercise the "some values survive" branch of `filtered.length ? filtered : null`. Could we add a case where every value is special (e.g. `time_compare: ['inherit']` → expect `null`) so the empty-result path is locked in, along with the `time_compare: null` serialization that flows out of `getFormDataFromControls`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org
Re: [PR] fix(explore): drop inherit/custom time shifts when switching to a viz that can't honor them [superset]
Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #40865:
URL: https://github.com/apache/superset/pull/40865#issuecomment-4672367010
AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
<details>
<summary>
Bito Usage Guide
</summary>
**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 <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
**Configuration**
This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
**Documentation & Help**
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
- <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org