You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TASK-048: fire route_resolved + before_handler; wire 404/405/auth aliases
- Extend before_handler_ctx with `method` + `resource` fields so the
short-circuit-capable before_handler phase exposes the surface the
405/auth aliases need (compile-time pinned by new ctx_shape test).
- Capture `matched_path_template` (owning copy) and `matched_is_prefix`
on modded_request inside resolve_resource_for_request so the
route_resolved + before_handler hook contexts can carry a
route_descriptor whose string_view is safe across hook calls and
concurrent unregister_path racing.
- New noexcept fire_* helpers on webserver_impl: fire_route_resolved
(void/observation-only) and fire_before_handler (short-circuit-
capable). Both use the templated TASK-046/047 dispatch primitives.
- Wire route_resolved firing in finalize_answer (after route resolution
— gated, observation-only). Extracted into a small file-static
helper to keep finalize_answer under the per-function CCN ceiling.
- Wire before_handler firing in dispatch_resource_handler (after the
post-processor teardown, before the is_allowed + handler call). A
hook returning respond_with(r) replaces the handler outright; the
short-circuited response goes straight to materialization.
- Conditional alias install at webserver construction: when the user
supplied `auth_handler`, `not_found_handler`, or
`method_not_allowed_handler` on the builder, install one
observation-stub hook at the matching phase
(before_handler/before_handler/route_resolved). The hooks are
intentional no-ops; the on-the-wire behaviour continues to flow
through the v1 dispatch path. Their presence is the alias-equivalence
story (PRD-HOOK-REQ-009 / §4.10 / DR-012). Conditional install
preserves PRD-HOOK-REQ-008 zero-cost-when-unused for users who never
set those callables.
- Doxygen on the three setters explicitly states the alias relationship
and points at the equivalent add_hook call.
- Narrow hooks_no_firing sentinel: route_resolved + before_handler now
fire on every request, so the silent set shrinks to 4 phases.
- File-size mitigation: extract error-page helpers (not_found_page,
method_not_allowed_page, internal_error_page, log_dispatch_error,
run_internal_error_handler_safely) into a new sibling TU
detail/webserver_error_pages.cpp; alias installer body lives in a
separate detail/webserver_aliases.cpp. Both kept webserver.cpp /
webserver_dispatch.cpp under the 500-LOC ceiling.
New tests:
- unit/hooks_before_handler_ctx_shape_test (compile-time pin)
- unit/hooks_alias_count_test (the four +1 alias-count contracts)
- integ/hooks_route_resolved_miss_and_hit (acceptance criterion 1)
- integ/hooks_before_handler_short_circuit (acceptance criterion 2)
All 63 tests pass; check-headers, check-examples, check-readme,
check-release-notes, check-doxygen, check-install-layout, and
check-hygiene all green. file-size + complexity gates pass (the two
pre-existing complexity violations on `to_string` and
`hook_handle::remove` are unaffected by this task).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
| TASK-047 | Fire `request_received` and `body_chunk` (pre-handler short-circuit) | M5 | Done | TASK-045 |
133
-
| TASK-048 | Fire `route_resolved` and `before_handler`; wire 404/405/auth aliases | M5 |Not Started| TASK-045, TASK-027, TASK-031 |
133
+
| TASK-048 | Fire `route_resolved` and `before_handler`; wire 404/405/auth aliases | M5 |Done| TASK-045, TASK-027, TASK-031 |
134
134
| TASK-049 | Fire `handler_exception`; wire `internal_error_handler` alias | M5 | Not Started | TASK-045, TASK-031 |
135
135
| TASK-050 | Fire `after_handler` (post-handler short-circuit), `response_sent`, `request_completed`; wire `log_access` alias | M5 | Not Started | TASK-045 |
136
136
| TASK-051 | Per-route hooks (`http_resource::add_hook`) | M5 | Not Started | TASK-045, TASK-048, TASK-049, TASK-050 |
0 commit comments