feat: read the dispatch table through nova_routing_trie - #71
Open
Taure wants to merge 1 commit into
Open
Conversation
Nova has replaced routing_tree with an in-tree, opaque nova_routing_trie (novaframework/nova#350), so the four tasks that walked routing_tree's records no longer have records to walk. rebar3 nova routes, audit, openapi and doctor would all crash against a current Nova. rebar3_nova_dispatch is now the only module that talks to the routing table. It uses nova_routing_trie:routes/1, the supported introspection API, and hands the tasks a flat list of {Path, Method, Payload}. That also drops a fair amount of duplicated tree-walking: the three collectors had each grown their own near-identical node recursion and segment formatting. Behaviour notes: - Paths arrive already rendered, so :id bindings are rewritten to {id} for the OpenAPI-shaped reports rather than reconstructed from node flags. - A trailing [...] has no OpenAPI equivalent and is dropped from those paths. - rebar3 nova routes prints a flat, sorted listing with the handler and any host scoping. The old output was a box-drawing tree over routing_tree's node structure, which the new table does not expose and which said nothing about which handler served a route. - Status-code routes are excluded from audit and openapi, as before, and shown by routes as (status NNN). rebar3_nova_dispatch_SUITE builds a real dispatch table with nova_router and checks each task can read it, including the websocket, static and status-code shapes the old walkers special-cased. routing_tree is dropped from the applications list and the dialyzer PLT.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Companion to novaframework/nova#405, which replaces
routing_treewith an in-tree, opaquenova_routing_trie.rebar3 nova routes,audit,openapianddoctorall-include_lib("routing_tree/include/routing_tree.hrl")and destructure#host_tree{},#routing_tree{},#node{}and#node_comp{}. Those records no longer exist, so all four crash against a current Nova.rebar3_nova_dispatchis now the only module that talks to the routing table. It usesnova_routing_trie:routes/1— the supported introspection API, since the trie is opaque — and hands the tasks a flat list of{Path, Method, Payload}. That also removes a fair amount of duplication: the three collectors had each grown their own near-identical node recursion and segment formatting.Behaviour notes:
:idis rewritten to{id}for the OpenAPI-shaped reports rather than reconstructed from node flags.[...]has no OpenAPI equivalent and is dropped from those paths.rebar3 nova routesprints a flat, sorted listing with the handler and any host scoping. The old output was a box-drawing tree overrouting_tree's node structure, which the new table does not expose and which said nothing about which handler served a route.auditandopenapi, as before, androutesshows them as(status NNN).rebar3_nova_dispatch_SUITEbuilds a real dispatch table withnova_routerand checks each task can read it, including the websocket, static and status-code shapes the old walkers special-cased. Verified locally with_checkoutspointing at the Nova branch: 37/37 CT, xref clean, erlfmt clean.This cannot merge until Nova releases with
nova_routing_trie—{deps, [nova, fs]}is unpinned, so CI here still resolves the current hex Nova and will fail until then.