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

refactor: Removes the deprecated redirect endpoint #26377

Merged

Conversation

michael-s-molina
Copy link
Member

@michael-s-molina michael-s-molina commented Dec 28, 2023

SUMMARY

As part of the 4.0 approved initiatives, this PR removes the deprecated Redirect API that supported short URLs (/r) and the url metadata table used to store them that was used before the permalink feature. Users lost the ability to generate R links ~1.5 years ago which seems sufficient time to remove the endpoint. It looks like we forgot to officially deprecate the endpoint in config.py when working on 3.0 but #19078 has the following message in UPDATING.md which is more relevant from a communication standpoint as opposed to the # deprecated comment in config.py:

  • 19078: Creation of old shorturl links has been deprecated in favor of a new permalink feature that solves the long url problem (old shorturls will still work, though!). By default, new permalinks use UUID4 as the key. However, to use serial ids similar to the old shorturls, add the following to your superset_config.py: PERMALINK_KEY_TYPE = "id".

TESTING INSTRUCTIONS

CI should be sufficient for merging this PR. We'll do a complete testing of 4.0 after all approved proposals are merged.

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

@michael-s-molina michael-s-molina added risk:breaking-change Issues or PRs that will introduce breaking changes hold! On hold v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch labels Dec 28, 2023
@michael-s-molina michael-s-molina changed the title refactor: Removes deprecated redirect endpoint refactor: Removes the deprecated redirect endpoint Dec 28, 2023
Copy link

codecov bot commented Dec 28, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d9a3c3e) 69.57% compared to head (8e73687) 69.56%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #26377      +/-   ##
==========================================
- Coverage   69.57%   69.56%   -0.01%     
==========================================
  Files        1893     1892       -1     
  Lines       74220    74162      -58     
  Branches     8263     8263              
==========================================
- Hits        51635    51592      -43     
+ Misses      20504    20489      -15     
  Partials     2081     2081              
Flag Coverage Δ
hive 53.78% <100.00%> (+<0.01%) ⬆️
javascript 56.84% <ø> (ø)
mysql 78.23% <100.00%> (+0.03%) ⬆️
postgres 78.33% <100.00%> (+<0.01%) ⬆️
presto 53.73% <100.00%> (+<0.01%) ⬆️
python 83.21% <100.00%> (+0.01%) ⬆️
sqlite 77.91% <100.00%> (+<0.01%) ⬆️
unit 56.35% <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 Sentry.
📢 Have feedback on the report? Share it here.

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.

@michael-s-molina although the redirect endpoint is deprecated and the functionality for creating /r links no longer exists, I wonder if we should try to preserve these URLs (for some period) by:

  1. Migrate the records from the url to the key_value table where the resource column is redirect and the value column is a JSON key/value pair mapping url.id to url.url. These records could have an expiration of 1–2 years given the somewhat transient nature of URLs.
  2. Keep the /r link endpoint which—albeit inefficiently—scans the key_value table (by leveraging JSON SQL UDFs) where the resource column is redirect and the value column contains the /r ID as they key.
  3. Remove the deprecated RESTful HTTP endpoints in a far future version.

Alternatively, if code bloat is less of a concern, we could maybe punt this PR (as is) until v6.0 (or later) given the increased likelihood that the legacy redirects would be unused.

Note both options suffer from the same achilles heel in the sense that there’s no guarantee that an institution upgrade cadence will reflect that of the release cycle, hence users may feel short changed when the redirects no longer exist.

@@ -112,6 +112,7 @@ def test_delete_tags_command(self):
TaggedObject.object_id == example_dashboard.id,
Tag.type == TagType.custom,
)
.order_by(Tag.name)
Copy link
Member

Choose a reason for hiding this comment

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

What does this change have to do with the redirect logic?

Copy link
Member Author

Choose a reason for hiding this comment

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

Nothing. It was something I caught while running the tests. It's a flaky test given that order is not guaranteed.

@michael-s-molina
Copy link
Member Author

@michael-s-molina although the redirect endpoint is deprecated and the functionality for creating /r links no longer exists, I wonder if we should try to preserve these URLs (for some period) by:

  1. Migrate the records from the url to the key_value table where the resource column is redirect and the value column is a JSON key/value pair mapping url.id to url.url. These records could have an expiration of 1–2 years given the somewhat transient nature of URLs.
  2. Keep the /r link endpoint which—albeit inefficiently—scans the key_value table (by leveraging JSON UDFs) where the resource column is redirect and the value column contains the /r ID as they key.

Alternatively, if code bloat is less of a concern, we could maybe punt this PR (as is) until v6.0 (or later) given the increased likelihood that the legacy redirects would be unused.

If we're going to keep the /r endpoint for some period, I think is easier to keep the values in the url table, avoid the migrations, and punt this proposal to 5.0.

@michael-s-molina michael-s-molina marked this pull request as ready for review January 5, 2024 18:52
@michael-s-molina michael-s-molina requested a review from a team as a code owner January 5, 2024 18:52
@eschutho
Copy link
Member

eschutho commented Jan 8, 2024

I don't have a strong opinion on whether to keep the urls, but I did notice that it doesn't look like the endpoint was ever marked as deprecated. Not a blocker but something to keep in mind for future.

@michael-s-molina
Copy link
Member Author

I don't have a strong opinion on whether to keep the urls, but I did notice that it doesn't look like the endpoint was ever marked as deprecated. Not a blocker but something to keep in mind for future.

@eschutho I updated the PR description with more context. Let me know if that's sufficient to resolve your concern.

@yousoph
Copy link
Member

yousoph commented Jan 10, 2024

@michael-s-molina do you have examples handy of what a full short chart URL and what a short dashboard URL looked like before?

Thanks!

Nevermind, found it :) Didn't realize it was just /r/id

@michael-s-molina michael-s-molina removed the hold! On hold label Jan 16, 2024
@michael-s-molina michael-s-molina force-pushed the remove-old-redirect-endpoint branch from d7a8417 to 4fb63fc Compare January 19, 2024 13:15


def upgrade():
module.downgrade()
Copy link
Member

Choose a reason for hiding this comment

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

interesting approach

@michael-s-molina michael-s-molina merged commit a84d86f into apache:master Jan 19, 2024
33 checks passed
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
@mistercrunch mistercrunch added the 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels label Apr 17, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 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/L v4.0 Label added by the release manager to track PRs to be included in the 4.0 branch 🚢 4.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants