Skip to content

feat: read the dispatch table through nova_routing_trie - #71

Open
Taure wants to merge 1 commit into
masterfrom
feat/routing-trie
Open

feat: read the dispatch table through nova_routing_trie#71
Taure wants to merge 1 commit into
masterfrom
feat/routing-trie

Conversation

@Taure

@Taure Taure commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Companion to novaframework/nova#405, which replaces routing_tree with an in-tree, opaque nova_routing_trie.

rebar3 nova routes, audit, openapi and doctor all -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_dispatch is now the only module that talks to the routing table. It uses nova_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:

  • Paths arrive already rendered, so :id is 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 stay out of audit and openapi, as before, and routes shows them 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. Verified locally with _checkouts pointing 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.

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.
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.

1 participant