Skip to content

Conversation

MarceloRobert
Copy link
Collaborator

Since the commit hash was a parameter that could be or not be sent in order to get the endpoint data, it was turned into an optional query parameter instead of being a separate endpoint.

In the frontend, the routes for /checkout/$treeName/$branch/$hash and /c/$treeName/$branch/$hash still exists in order to keep backwards compatibility. IF someone tries to access the url for a tree such as soc arm/fixes, they can avoid parameter conflict by encoding the /, for example http://localhost:5173/checkout/soc/arm%2Ffixes/0c952efa0d7cf5258879406077df33d23cb06d5e.

In the backend, the branch was altered to a path type, and the parameters are now returned by the endpoint if it doesn't encounter a tree in order to be clearer on how the variables were parsed.

Changes

  • Renamed treeLatest (view) to treeLatestView
  • Unified treeLatest and treeLatestHash
  • Updated types, documentation, integration tests, schema, example request and frontend api call

How to test

Access the /tree/tree_name/branch endpoint with different arguments for commit_hash. Also check the frontend routes for /tree/$treeName/$branch, /checkout/$treeName/$branch, /checkout/$treeName/$branch/$hash, /c/treeName/$branch, and /c/$treeName/$branch/$hash

Closes #1476

@MarceloRobert MarceloRobert self-assigned this Sep 17, 2025
Makes it more consistent with other views
Turns the commit_hash to an optional query parameter, allowing the endpoints to be combined. Updated types, documentation, integration tests, and frontend api call.

Closes #1476
},
False,
),
],
)
def test_tree_latest(tree_name, git_branch, query, has_error_body):
Copy link
Collaborator

Choose a reason for hiding this comment

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

omg I'll need to refactor my PR 😢

Comment on lines +60 to +63
if request.GET.get("origin") is None:
tree_not_found_error_message += (
f" {ClientStrings.TREE_LATEST_DEFAULT_ORIGIN} {DEFAULT_ORIGIN}"
)
Copy link
Collaborator

Choose a reason for hiding this comment

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

nice catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Unify treeLatest and treeLatestHash endpoints
2 participants