Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: remove deprecated apis and ENABLE_BROAD_ACTIVITY_ACCESS #24400

Merged
merged 9 commits into from
Jun 15, 2023

Conversation

dpgaspar
Copy link
Member

@dpgaspar dpgaspar commented Jun 14, 2023

SUMMARY

Removes old deprecated APIs:

  • /superset/recent_activity/...
  • /superset/fave_dashboards_by_username/...
  • /superset/fave_dashboards/...
  • /superset/created_dashboards/...
  • /superset/user_slices/...
  • /superset/created_slices/...
  • /superset/fave_slices/...
  • /superset/favstar/...

This PR also removes ENABLE_BROAD_ACTIVITY_ACCESS feature flag (was disabled by default), since by removing the above mentioned deprecated API's only one final API ( /api/v1/log/recent_activity/ ) was using it.
Also removes changed_by_url and created_by_url REST API response fields from datasets, dashboards and charts, since these fields function was to provide a link to other user's profiles.

Effort on removing deprecated APIs from /superset: #24332

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • 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

@dpgaspar dpgaspar changed the title chore: remove deprecated apis on superset chore: remove deprecated apis on superset Jun 14, 2023
@codecov
Copy link

codecov bot commented Jun 14, 2023

Codecov Report

Merging #24400 (a12e019) into master (19a9400) will decrease coverage by 0.05%.
The diff coverage is 91.48%.

❗ Current head a12e019 differs from pull request most recent head 63ea2bd. Consider uploading reports for the commit 63ea2bd to get more accurate results

@@            Coverage Diff             @@
##           master   #24400      +/-   ##
==========================================
- Coverage   68.95%   68.91%   -0.05%     
==========================================
  Files        1903     1904       +1     
  Lines       74070    73913     -157     
  Branches     8110     8118       +8     
==========================================
- Hits        51077    50939     -138     
+ Misses      20881    20864      -17     
+ Partials     2112     2110       -2     
Flag Coverage Δ
hive 53.92% <68.75%> (+0.05%) ⬆️
javascript 55.65% <87.09%> (+0.02%) ⬆️
mysql 79.20% <100.00%> (-0.06%) ⬇️
postgres 79.29% <100.00%> (-0.05%) ⬇️
presto 53.85% <68.75%> (+0.05%) ⬆️
python 83.28% <100.00%> (-0.04%) ⬇️
sqlite 77.79% <100.00%> (-0.05%) ⬇️
unit 54.62% <68.75%> (+0.06%) ⬆️

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

Impacted Files Coverage Δ
...ackages/superset-ui-core/src/utils/featureFlags.ts 100.00% <ø> (ø)
...acy-preset-chart-deckgl/src/components/Tooltip.tsx 0.00% <0.00%> (ø)
...lugins/plugin-chart-table/src/utils/formatValue.ts 66.66% <0.00%> (-3.93%) ⬇️
superset-frontend/src/SqlLab/fixtures.ts 100.00% <ø> (ø)
...c/components/Chart/DrillDetail/DrillDetailPane.tsx 75.32% <ø> (ø)
...-frontend/src/components/TableCollection/index.tsx 100.00% <ø> (ø)
...mponents/DataTablesPane/components/SamplesPane.tsx 97.67% <ø> (ø)
...ataTablesPane/components/SingleQueryResultPane.tsx 85.71% <ø> (ø)
superset-frontend/src/pages/DatasetList/index.tsx 57.76% <ø> (ø)
...rset-frontend/src/profile/components/Favorites.tsx 80.00% <ø> (ø)
... and 22 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@eschutho eschutho added the risk:breaking-change Issues or PRs that will introduce breaking changes label Jun 14, 2023
@dpgaspar dpgaspar changed the title chore: remove deprecated apis on superset chore: remove deprecated apis and ENABLE_BROAD_ACTIVITY_ACCESS Jun 14, 2023
Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the cleanup. I left a couple of comments, but otherwise LGTM.

superset/views/core.py Outdated Show resolved Hide resolved
payload = {
"user": bootstrap_user_data(user, include_perms=True),
"user": bootstrap_user_data(g.user, include_perms=True),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dpgaspar what happens if the user is a guest user? Is g.user guaranteed to exist and be non-None.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point, it should be AnonymousUser from flask-login or GuestUser, but added some safe guard, and we're returning 404 now

superset/views/log/api.py Outdated Show resolved Hide resolved
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment on lines -1366 to +1080
@expose("/profile/<username>/")
def profile(self, username: str) -> FlaskResponse:
@expose("/profile/")
def profile(self) -> FlaskResponse:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

if error_obj := self.get_user_activity_access_error(user_id):
return error_obj

user = g.user if hasattr(g, "user") and g.user else None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this snippet or a variation of it appears in LOTS of places. We should replace all of these with a single util to DRY this up and add tests for all expected cases. I can do it if needed (I think this PR is big enough already, so it should not be obfuscated with more chores).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

totally agree! would be great also to make anonymous users and guest user's more clear to check, use and test

Copy link
Member

@john-bodley john-bodley Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@villebro having a get_user method here—which get_user_id and get_username would call—would be useful. I did a pass previously in #20492 which ensured facets of this was normalized.

Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

if error_obj := self.get_user_activity_access_error(user_id):
return error_obj

user = g.user if hasattr(g, "user") and g.user else None
Copy link
Member

@john-bodley john-bodley Jun 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@villebro having a get_user method here—which get_user_id and get_username would call—would be useful. I did a pass previously in #20492 which ensured facets of this was normalized.

@dpgaspar dpgaspar merged commit 23bb1c4 into apache:master Jun 15, 2023
31 checks passed
@dpgaspar dpgaspar deleted the chore/remove-deprecated-apis-11 branch June 15, 2023 21:11
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.0.0 labels Mar 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels risk:breaking-change Issues or PRs that will introduce breaking changes size/XL 🚢 3.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants