Skip to content

docs(routing): document boot errors for overlapping constraints (core #127) - #24

Merged
chrnx-dev merged 1 commit into
mainfrom
docs/fprd-001b-constraint-ambiguity
Oct 14, 2026
Merged

chrnx-dev merged 1 commit into
mainfrom
docs/fprd-001b-constraint-ambiguity

Conversation

@chrnx-dev

Copy link
Copy Markdown
Contributor

Companion to core issue #127 (FPRD-001b, CARD-13). Core now fails createApp on two kinds of sibling routes. These pages say what the errors mean and what to do about them.

Changes

  • guides/routing.md: new section, "Overlapping constraints fail at boot".
    • Which routes are compared: same method, branching at the same segment under the same prefix.
    • Ambiguous: two constraints that share a segment. Includes the full error and its witness (both match '0' (GET /u/0)). Equivalent spellings (\d+ and [0-9]+) count. A later segment that tells the routes apart keeps them bootable.
    • Unreachable: a plain param beside a constraint that accepts every segment ([^]*). Explains why .* is not that: . does not match line terminators, so /algo/%0A still reaches the plain route.
    • The constrained fallback, T4: /u/:id(\d+) + /u/:slug still boots. /u/42 goes to :id and /u/bob goes to :slug.
    • WebSocket: WS routes are matched in declaration order, so a plain WS param declared before a constrained one now fails. @Stream is checked as both HTTP and WS.
    • Mesh: routes exported by different teapots are checked against each other. Local over remote is still an override, not an error.
  • guides/mesh.md: in "One teapot per route", a short paragraph links to the new section and shows the mesh form of the ambiguous error.

Checks

  • npm audit --audit-level=moderate: 0 vulnerabilities, and no open Dependabot alerts, checked before branching.
  • npm run build: 27 pages built. The new heading anchor #overlapping-constraints-fail-at-boot is present in the built HTML, and the mesh guide links to it.

The error messages quoted on these pages match the core implementation word for word. Only the declaration names (Users.byId and similar) are illustrative.

… #127)

Core now refuses to boot two kinds of sibling routes. In the first, two
constrained params accept a common segment, so only declaration order would
choose between them. In the second, a plain param sits next to a constraint
that accepts every segment, so the plain route can never be reached. The
routing guide gets a section on both errors, with their messages and the
witness they print. The section also covers:

- the constrained fallback (/u/:id(\d+) + /u/:slug), which still boots;
- why .* does not count as every segment;
- WebSocket's declaration-order precedence;
- mesh teapots.

The mesh guide links to it from "One teapot per route".

Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
@chrnx-dev
chrnx-dev merged commit 7a27327 into main Oct 14, 2026
1 check passed
@chrnx-dev
chrnx-dev deleted the docs/fprd-001b-constraint-ambiguity branch October 14, 2026 02:22
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