Commit 950a7f8
fix(mapper): reject redundant namespace prefix in to= and controller= (#2794)
* fix(mapper): reject redundant namespace prefix in to= and controller=
Inside `.namespace("foo")` (or equivalent `.scope()` / `.package()`),
writing `to="foo/dashboard##index"` instead of `to="dashboard##index"`
silently produced a `foo.foo/dashboard` controller path that downstream
got flattened to a `Foodashboard`-style class lookup with an opaque
`Wheels.ViewNotFound` error — leaving users to chase the symptom rather
than the route definition.
`$match()` now detects when the parsed controller starts with the scope's
package converted to slash form and throws `Wheels.MapperArgumentInvalid`
at registration time. The error names the namespace and the offending
value and points at the correct shorter form.
Fixes #2791
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
* fix(mapper): address Reviewer A/B consensus findings (round 1)
- Snapshot `local.fromTo` / `local.originalTo` before the `to=` parse
block so the error detail can distinguish `to=` vs direct `controller=`
callers (Reviewer A nit).
- Add `Len(arguments.package) > 0` to the guard's outer condition so an
empty package does not yield `prefix = "/"` and spuriously reject
controllers whose path starts with a slash (Reviewer A response,
Reviewer B round-1 missed-issue).
- Collapse multi-line block comments above the guard in `matching.cfc`
and above the new `it()` group in `MatchingSpec.cfc` to one-liners
to comply with CLAUDE.md style (both reviewers).
- Add a spec asserting `$match()` with `package = ""` and a controller
starting with `/` is not falsely rejected.
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
* fix(mapper): address Reviewer A/B consensus findings (round 2)
- vendor/wheels/mapper/matching.cfc:328 — change local.hh = "##" to
local.hh = "####" so the error-suggestion detail renders as
to="dashboard##index" (source-correct CFML), not to="dashboard#index"
(Reviewer A finding, Reviewer B verified).
- vendor/wheels/tests/specs/mapper/MatchingSpec.cfc:241–242 — collapse
the 2-line comment inside the "Allows controllers..." spec body to a
single line per CLAUDE.md "one short line max" rule (both reviewers).
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
---------
Signed-off-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Signed-off-by: Peter Amiri <peter@alurium.com>
Co-authored-by: claude[bot] <41898282+claude[bot]@users.noreply.github.com>
Co-authored-by: Peter Amiri <peter@alurium.com>1 parent 343ae6f commit 950a7f8
3 files changed
Lines changed: 102 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | 27 | | |
27 | 28 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
303 | 303 | | |
304 | 304 | | |
305 | 305 | | |
| 306 | + | |
| 307 | + | |
306 | 308 | | |
| 309 | + | |
| 310 | + | |
307 | 311 | | |
308 | 312 | | |
309 | 313 | | |
310 | 314 | | |
311 | 315 | | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
312 | 342 | | |
313 | 343 | | |
314 | 344 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
197 | 197 | | |
198 | 198 | | |
199 | 199 | | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
200 | 271 | | |
201 | 272 | | |
202 | 273 | | |
| |||
0 commit comments