Page MenuHomeSoftware Heritage

WIP - Deprecate most of the /browse/origin/.* URLs
AbandonedPublicDraft

Authored by jayeshv on Oct 7 2021, 10:45 AM.

Details

Reviewers
None
Group Reviewers
Reviewers
Maniphest Tasks
T3608: Deprecate most of the /browse/origin/.* URLs
Summary

Many URLs defined in the origin view (urlconf) are redundant.
This fix redirects them to the corresponding object type URLs.
eg: /origin/directory will be redirected to /directory/<sha1>

Related to T3608

Test Plan
  • Test the following URLs

/browse/origin/directory/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/directory/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/directory/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/directory/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/directory/
/browse/origin/content/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/content/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/content/(?P<path>.+)/
/browse/origin/(?P<origin_url>.+)/content/
/browse/origin/log/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/log/
/browse/origin/(?P<origin_url>.+)/log/
/browse/origin/branches/", view_name="browse-origin-branches
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/branches/
/browse/origin/(?P<origin_url>.+)/branches/
/browse/origin/releases/
/browse/origin/(?P<origin_url>.+)/visit/(?P<timestamp>.+)/releases/
/browse/origin/(?P<origin_url>.+)/releases/

Diff Detail

Repository
rDWAPPS Web applications
Branch
T3608
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 24281
Build 37899: Phabricator diff pipeline on jenkinsJenkins console · Jenkins
Build 37898: arc lint + arc unit

Unit TestsFailed

TimeTest
71 msJenkins > "before each" hook for "should display correct file name"::Tests / Cypress tests / Run cypress tests / Test File Rendering "before each" hook for "should display correct file name"
CypressError: `cy.visit()` failed trying to load: http://localhost:5004/browse/origin/content/?origin_url=https://github.com/memononen/libtess2&path=Source/tess.h
238 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_directory_snapshot_not_found
client = <django.test.client.Client object at 0x7f66157a9dd8> mocker = <pytest_mock.plugin.MockerFixture object at 0x7f66157a9e80>
1,159 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_origin_content_directory_empty_snapshot[content]
client = <django.test.client.Client object at 0x7f66248d2b38> staff_user = <User: admin> archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f66248d24a8>
741 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_origin_content_directory_empty_snapshot[directory]
client = <django.test.client.Client object at 0x7f6622e6add8> staff_user = <User: admin> archive_data = <swh.web.tests.conftest._ArchiveData object at 0x7f6622e6aef0>
219 msJenkins > .tox.py3.lib.python3.7.site-packages.swh.web.tests.browse.views.test_origin::Tests / Python tests / test_browse_origin_content_no_visit
client = <django.test.client.Client object at 0x7f6615e65470> mocker = <pytest_mock.plugin.MockerFixture object at 0x7f6615e65518>
View Full Test Results (34 Failed · 572 Passed · 5 Skipped)

Event Timeline

Build has FAILED

Patch application report for D6430 (id=23358)

Rebasing onto cc60a4a5c8...

Current branch diff-target is up to date.
Changes applied before test
commit d68fdbd2a79967d2be79d16b91cea315dff34d58
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Oct 7 10:35:41 2021 +0200

    Deprecate most of the /browse/origin/.* URLs
    
    Many URLs defined in the origin view (urlconf) are redundant.
    This fix redirects them to the corresponding object type URLs.
    eg: /origin/directory will be redirected to /directory/<sha1>
    
    Related to T3608

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1145/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1145/console

Harbormaster returned this revision to the author for changes because remote builds failed.Oct 7 2021, 11:07 AM
Harbormaster failed remote builds in B24274: Diff 23358!

Please proceed one view at at a time by diff to ease reviews, start with content, then directory, ...

swh/web/browse/views/origin.py
16–21

That code is not needed, views exception handling is done at a global level by a django middleware. Every caught NotFoundExc will return a 404.

Build has FAILED

Patch application report for D6430 (id=23366)

Rebasing onto 0da4e46ae3...

First, rewinding head to replay your work on top of it...
Applying: Deprecate most of the /browse/origin/.* URLs
Applying: more re-factoring
Changes applied before test
commit 473930b796906e1a419655fd357ffb8e1f65c8b8
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Oct 7 11:51:10 2021 +0200

    more re-factoring

commit e3b15af0705f966b442b2cd68c0241a95f92bc11
Author: Jayesh Velayudhan <jayesh@softwareheritage.org>
Date:   Thu Oct 7 10:35:41 2021 +0200

    Deprecate most of the /browse/origin/.* URLs
    
    Many URLs defined in the origin view (urlconf) are redundant.
    This fix redirects them to the corresponding object type URLs.
    eg: /origin/directory will be redirected to /directory/<sha1>
    
    Related to T3608

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1146/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1146/console

Harbormaster returned this revision to the author for changes because remote builds failed.Oct 7 2021, 12:13 PM

Please proceed one view at at a time by diff to ease reviews, start with content, then directory, ...