Parent: #66.
Home's URLPath.parse percent-decodes into a shared thread-local buffer. FileSystemRouter.match returns route pathname and parameter slices into that buffer, so a later encoded match overwrites data retained by an earlier MatchedRoute. The same path flow also has an explicit leak TODO because the original path allocation is never owned by the returned route.
Bun's live implementation gives each decoded URLPath heap-stable storage, transfers that storage into the MatchedRoute, and keeps the ordinary input allocation there when no decode occurs.
Port an allocator-backed URLPath parse wrapper that rebases every derived slice into per-call storage. Move the final path backing into MatchedRoute and release it during finalization. Preserve transient URLPath.parse for existing synchronous router call sites.
Acceptance:
- Two consecutive percent-encoded matches retain independent pathname and parameter values.
- Plain paths and
%25values preserve their existing parse semantics. - No path allocation leaks on successful, unmatched, or parse-error paths.
- The unchanged filesystem-router test passes at its original deadline against a fresh runtime.