Skip to content

Commit b3d2b53

Browse files
etrclaude
andcommitted
TASK-045: housekeeping — mark Done + persist validation review notes
Action items in TASK-045.md ticked off and Status flipped to Done (matched by the TASK-045 row in tasks/_index.md). Multi-agent validation loop on 4dd7217 returned 8/8 approve after one fix iteration (housekeeper request-changes → fixed); the 4 major + 30 minor unworked findings are persisted to specs/unworked_review_issues/2026-05-21_173303_task-045.md for follow-up sweeps. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 4dd7217 commit b3d2b53

3 files changed

Lines changed: 156 additions & 11 deletions

File tree

specs/tasks/M5-routing-lifecycle/TASK-045.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@
88
Land the public types and per-phase storage for the lifecycle hook bus without firing any hooks yet. After this task the API surface compiles and a hook can be registered + removed, but no phase actually fires; subsequent tasks (TASK-046 .. TASK-051) wire individual phases.
99

1010
**Action Items:**
11-
- [ ] New public header `src/httpserver/hook_phase.hpp`: define `enum class hook_phase` with the eleven phases plus `count_` sentinel (per §4.10).
12-
- [ ] New public header `src/httpserver/hook_action.hpp`: `class hook_action` with `pass()`, `respond_with(http_response)`, `is_pass() const noexcept`, `http_response&& take_response() &&`. Implementation over `std::optional<http_response>`.
13-
- [ ] New public header `src/httpserver/hook_handle.hpp`: move-only RAII type holding a non-owning reference into the per-phase storage. Destructor calls `remove()` unless previously `detach()`-ed.
14-
- [ ] New public header `src/httpserver/hook_context.hpp`: phase-specific context structs (`accept_ctx`, `request_received_ctx`, `body_chunk_ctx`, `route_resolved_ctx`, `before_handler_ctx`, `handler_exception_ctx`, `after_handler_ctx`, `response_sent_ctx`, `request_completed_ctx`, `connection_open_ctx`, `connection_close_ctx`, `peer_address`). All libhttpserver-defined; never expose MHD types (PRD-HDR-REQ-001).
15-
- [ ] `webserver_impl` private state in `src/httpserver/detail/webserver_impl.hpp`: one `std::vector<std::function<...>>` per phase + `std::array<std::atomic<bool>, hook_phase::count_> any_hooks_` + a single `std::shared_mutex hook_table_mutex_` covering all phase vectors.
16-
- [ ] `webserver::add_hook(hook_phase, ...)` — eleven overloads, one per phase. Each acquires `hook_table_mutex_` (unique_lock), pushes the callable, sets `any_hooks_[phase] = true` (memory_order_release), returns a `hook_handle` carrying back-references for removal.
17-
- [ ] `hook_handle::remove()` re-takes the `hook_table_mutex_` (unique_lock), erases the entry, clears `any_hooks_[phase]` if the vector is now empty (memory_order_release). Idempotent.
18-
- [ ] Add `hook_phase.hpp`, `hook_action.hpp`, `hook_handle.hpp`, `hook_context.hpp` to the umbrella include in `src/httpserver.hpp` and to install rules in `src/httpserver/Makefile.am`.
19-
- [ ] Extend the public-header hygiene CI test (TASK-007) to cover the four new headers — they must carry the `_HTTPSERVER_HPP_INSIDE_` / `HTTPSERVER_COMPILATION` guard pair.
11+
- [x] New public header `src/httpserver/hook_phase.hpp`: define `enum class hook_phase` with the eleven phases plus `count_` sentinel (per §4.10).
12+
- [x] New public header `src/httpserver/hook_action.hpp`: `class hook_action` with `pass()`, `respond_with(http_response)`, `is_pass() const noexcept`, `http_response&& take_response() &&`. Implementation over `std::optional<http_response>`.
13+
- [x] New public header `src/httpserver/hook_handle.hpp`: move-only RAII type holding a non-owning reference into the per-phase storage. Destructor calls `remove()` unless previously `detach()`-ed.
14+
- [x] New public header `src/httpserver/hook_context.hpp`: phase-specific context structs (`accept_ctx`, `request_received_ctx`, `body_chunk_ctx`, `route_resolved_ctx`, `before_handler_ctx`, `handler_exception_ctx`, `after_handler_ctx`, `response_sent_ctx`, `request_completed_ctx`, `connection_open_ctx`, `connection_close_ctx`, `peer_address`). All libhttpserver-defined; never expose MHD types (PRD-HDR-REQ-001).
15+
- [x] `webserver_impl` private state in `src/httpserver/detail/webserver_impl.hpp`: one `std::vector<std::function<...>>` per phase + `std::array<std::atomic<bool>, hook_phase::count_> any_hooks_` + a single `std::shared_mutex hook_table_mutex_` covering all phase vectors.
16+
- [x] `webserver::add_hook(hook_phase, ...)` — eleven overloads, one per phase. Each acquires `hook_table_mutex_` (unique_lock), pushes the callable, sets `any_hooks_[phase] = true` (memory_order_release), returns a `hook_handle` carrying back-references for removal.
17+
- [x] `hook_handle::remove()` re-takes the `hook_table_mutex_` (unique_lock), erases the entry, clears `any_hooks_[phase]` if the vector is now empty (memory_order_release). Idempotent.
18+
- [x] Add `hook_phase.hpp`, `hook_action.hpp`, `hook_handle.hpp`, `hook_context.hpp` to the umbrella include in `src/httpserver.hpp` and to install rules in `src/httpserver/Makefile.am`.
19+
- [x] Extend the public-header hygiene CI test (TASK-007) to cover the four new headers — they must carry the `_HTTPSERVER_HPP_INSIDE_` / `HTTPSERVER_COMPILATION` guard pair.
2020

2121
**Dependencies:**
2222
- Blocked by: TASK-014 (webserver_impl), TASK-009 (http_response by value).
@@ -36,4 +36,4 @@ Land the public types and per-phase storage for the lifecycle hook bus without f
3636
**Related Requirements:** PRD-HOOK-REQ-001, PRD-HOOK-REQ-002, PRD-HOOK-REQ-007, PRD-HOOK-REQ-008
3737
**Related Decisions:** DR-012, §4.10, §5.6
3838

39-
**Status:** Not Started
39+
**Status:** Done

specs/tasks/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ Nominally: **13 sequential tasks**, each S–XL. Most other tasks parallelize of
127127
| TASK-034 | Build-flag-independent public API + `webserver::features()` | M5 | Done | TASK-003, TASK-019, TASK-033 |
128128
| TASK-035 | Smart-pointer `register_ws_resource` overloads | M5 | Done | TASK-014, TASK-034 |
129129
| TASK-036 | Handler return-by-value dispatch cutover | M5 | Done | TASK-022, TASK-025, TASK-027, TASK-031 |
130-
| TASK-045 | Hook bus skeleton (`hook_phase`, `hook_action`, `hook_handle`, `webserver::add_hook`) | M5 | Not Started | TASK-009, TASK-014 |
130+
| TASK-045 | Hook bus skeleton (`hook_phase`, `hook_action`, `hook_handle`, `webserver::add_hook`) | M5 | Done | TASK-009, TASK-014 |
131131
| TASK-046 | Fire `connection_opened` / `connection_closed` / `accept_decision` | M5 | Not Started | TASK-045 |
132132
| TASK-047 | Fire `request_received` and `body_chunk` (pre-handler short-circuit) | M5 | Not Started | TASK-045 |
133133
| TASK-048 | Fire `route_resolved` and `before_handler`; wire 404/405/auth aliases | M5 | Not Started | TASK-045, TASK-027, TASK-031 |

0 commit comments

Comments
 (0)