Skip to content

Commit e448c35

Browse files
etrclaude
andcommitted
Merge TASK-061: mechanical cleanup sweep — unfinished prose, orphan comments, stale doc refs
Clear the low-risk mechanical leftovers flagged in specs/tasks/v2-branch-gap-audit.md "Proposed disposition" — five concrete fixes shipped as a single sweep: - Finished the truncated TASK-029 block comment in webserver_register.cpp with its missing closing clause ("…they are no longer reachable from the public API."). - Installed the full TASK-024 prologue (six lines, ending "…dangling resource pointer after the maps drop their refs.") immediately above webserver::unregister_impl_ — the function it actually describes — and removed the orphaned five-line head that was sitting above the unrelated block_ip in webserver_setup.cpp (split-artifact from the 7-way webserver.cpp split). - Removed the two orphan comment fragments at webserver.cpp:503-504. - Replaced the stale "Currently in XFAIL_TESTS" claim at test/Makefile.am:67-74 with a status-correct note (header_hygiene was removed when TASK-020 landed). - Dropped the stale "RELEASE_NOTES.md created by TASK-042, not yet present" case arm at scripts/check-readme.sh:273 — TASK-042 shipped. Vendored test/littletest.hpp left untouched per planning decision. Followed by housekeeping (action items + Status flipped to Done in the spec), validation-loop persistence of 7 unworked minor review findings, and a final spec sync that recorded the TASK-024 relocation action item + acceptance criteria that were captured during planning but never landed in the spec file. Verification (per 06ad399): make check 87/87 PASS, check-file-size PASS, check-readme.sh returns 0, all five pre-edit failing grep guards now report zero matches, each reflowed sentence fragment has exactly one canonical copy under src/. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2 parents d272e78 + 65fda97 commit e448c35

8 files changed

Lines changed: 54 additions & 21 deletions

File tree

scripts/check-readme.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,7 +270,6 @@ while IFS= read -r target; do
270270
case "$target" in
271271
http://*|https://*) continue ;; # absolute URLs — not checked
272272
\#*) continue ;; # in-page anchors — not checked
273-
RELEASE_NOTES.md) continue ;; # created by TASK-042, not yet present
274273
esac
275274
# Strip fragment identifiers (#section) before existence check to avoid
276275
# false failures when a link like [foo](examples/foo.cpp#line) is added.

specs/tasks/M7-v2-cleanup/TASK-061.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@
88
Clear the mechanical leftovers flagged in the audit's "Proposed disposition (next steps)" — short, low-risk edits that should land together so reviewers can scan one PR for stale prose drift.
99

1010
**Action Items:**
11-
- [ ] Finish the truncated comment at `src/detail/webserver_register.cpp:344-349`. The TASK-029 block comment ends mid-sentence (`"…keeps working at the daemon level, but"` then closing brace). Either complete the sentence with the original intent (reconstruct from git history or surrounding code) or rewrite the comment to stand on its own.
12-
- [ ] Remove the two orphan comment fragments at `src/webserver.cpp:503-504` (leftover from removed logic).
13-
- [ ] Update the stale `XFAIL_TESTS` comment block at `test/Makefile.am:67-74` to reflect that `header_hygiene` was removed when TASK-020 landed (cross-referenced at lines 532-535 in the same file).
14-
- [ ] Drop the stale `RELEASE_NOTES.md) continue ;; # created by TASK-042, not yet present` line at `scripts/check-readme.sh:273` — TASK-042 has shipped.
11+
- [x] Finish the truncated comment at `src/detail/webserver_register.cpp:344-349`. The TASK-029 block comment ends mid-sentence (`"…keeps working at the daemon level, but"` then closing brace). Either complete the sentence with the original intent (reconstruct from git history or surrounding code) or rewrite the comment to stand on its own.
12+
- [x] Remove the two orphan comment fragments at `src/webserver.cpp:503-504` (leftover from removed logic).
13+
- [x] Move the orphaned/truncated TASK-024 comment head from `src/detail/webserver_setup.cpp:441-445` (currently sits above the unrelated `block_ip`) to its correct home as a prologue above `webserver::unregister_impl_` in `src/detail/webserver_register.cpp:247`, restoring the full original sentence ending `"…dangling resource pointer after the maps drop their refs."` reconstructed from commit `ec82d90`. (Same split-artifact class as the items above; surfaced during TASK-061 planning, in scope per planning decision.)
14+
- [x] Update the stale `XFAIL_TESTS` comment block at `test/Makefile.am:67-74` to reflect that `header_hygiene` was removed when TASK-020 landed (cross-referenced at lines 532-535 in the same file).
15+
- [x] Drop the stale `RELEASE_NOTES.md) continue ;; # created by TASK-042, not yet present` line at `scripts/check-readme.sh:273` — TASK-042 has shipped.
1516
- [ ] Remove the decade-old `//TODO: personalized messages` at `test/littletest.hpp:21` only if we have a fork policy that lets us; otherwise leave (it's vendored).
1617

1718
**Dependencies:**
@@ -21,6 +22,8 @@ Clear the mechanical leftovers flagged in the audit's "Proposed disposition (nex
2122
**Acceptance Criteria:**
2223
- `git diff master..HEAD -- src/detail/webserver_register.cpp` shows a complete, well-formed comment.
2324
- `src/webserver.cpp:503-504` no longer contains orphan comment fragments.
25+
- `src/detail/webserver_setup.cpp:441-445` no longer carries the TASK-024 comment head above `block_ip`.
26+
- `src/detail/webserver_register.cpp` shows the full TASK-024 prologue (ending `"…dangling resource pointer after the maps drop their refs."`) immediately above `webserver::unregister_impl_`.
2427
- `test/Makefile.am:67-74` no longer claims `header_hygiene` is in `XFAIL_TESTS`.
2528
- `scripts/check-readme.sh:273` no longer carries the "created by TASK-042, not yet present" line.
2629
- `make check` still green.
@@ -30,4 +33,4 @@ Clear the mechanical leftovers flagged in the audit's "Proposed disposition (nex
3033
**Related Requirements:** PRD §2 code quality NFR
3134
**Related Decisions:** None new
3235

33-
**Status:** Backlog
36+
**Status:** Done

specs/tasks/M7-v2-cleanup/_index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ TASK-093).
2525
| ID | Name | Audit grade | Estimate | Status |
2626
|---|---|---|---|---|
2727
| TASK-060 | Scope or remove file-scoped `-Warray-bounds` suppressions | HIGH | S | Done |
28-
| TASK-061 | Mechanical cleanup sweep — unfinished prose, orphan comments, stale doc refs | HIGH | S | Backlog |
28+
| TASK-061 | Mechanical cleanup sweep — unfinished prose, orphan comments, stale doc refs | HIGH | S | Done |
2929
| TASK-062 | RFC-7616-compliant Digest auth response factory | HIGH | L | Backlog |
3030
| TASK-063 | Honor or remove `http_response::pipe` `size_hint` parameter | HIGH | S | Backlog |
3131
| TASK-064 | Structured cookie type | HIGH | M | Backlog |
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Unworked Review Issues
2+
3+
**Run:** 2026-06-04 16:09:35
4+
**Task:** TASK-061
5+
**Total:** 7 (0 critical, 0 major, 7 minor)
6+
7+
## Minor
8+
9+
1. [ ] **code-quality-reviewer** | `src/detail/webserver_register.cpp:247` | readability
10+
The TASK-024 comment added above unregister_impl_ uses the past-tense TASK tag prefix ('TASK-024:') as a rationale anchor, which is the established project convention, but the comment text itself is already present at line 272 (the original position inside the function body as a doc block). The two comment blocks are not duplicates — the new one is a function-level doc header while the existing one was a trailing inline remark — but a reader seeing both in quick succession may find the repetition slightly noisy.
11+
*Recommendation:* Consider consolidating: keep the function-level doc header that was added (lines 247-252) and remove or abbreviate the inline reference at the original position if it now says the same thing. This is purely cosmetic and does not block approval.
12+
13+
2. [ ] **code-quality-reviewer** | `src/detail/webserver_register.cpp:350` | readability
14+
The TASK-029 block comment (lines 350-355) is now complete and grammatically sound, but it appears between the closing brace of unregister_resource() (line 348) and the closing namespace brace (line 357), giving the impression it is a file-level orphan rather than documentation for a preceding function or for the namespace itself. Its placement is not wrong but could mislead a reader scanning top-level structure.
15+
*Recommendation:* Move the TASK-029 comment immediately above the first function it documents (block_ip at the next line after the namespace comment, or the unregister_resource group), or leave as-is and add a one-line header like '// IP-control API history:' to signal it is intentional prose. This is cosmetic only.
16+
17+
3. [ ] **code-quality-reviewer** | `src/detail/webserver_register.cpp:355` | readability
18+
The TASK-029 block comment (lines 350-357) that was completed by appending 'they are no longer reachable from the public API.' now has a blank line between the completed sentence and the closing namespace brace. This matches the pattern in the rest of the file, but the comment sits after the last function in the file with no following declaration to anchor it, making it slightly orphaned-looking even in its repaired form. The content is correct and complete.
19+
*Recommendation:* Acceptable as-is. If a future cleanup pass targets this file, moving the TASK-029 historical note immediately above block_ip / unblock_ip (the functions it describes) would improve locality. Not required for this task.
20+
21+
4. [ ] **code-quality-reviewer** | `test/Makefile.am:73` | readability
22+
The updated comment says 'See lines ~532-535 below for the historical XFAIL_TESTS note.' The tilde (~) and approximate line numbers will drift as the file grows. The target note is already self-contained (lines 533-536 say what happened), so the cross-reference adds maintenance burden without proportionate value.
23+
*Recommendation:* Either remove the forward-reference sentence entirely (both the comment at line 66-75 and the one at 533-536 are now self-sufficient) or replace the approximate line reference with a searchable token such as 'see the XFAIL_TESTS historical note near the TESTS= assignment below' to avoid stale numbers.
24+
25+
5. [ ] **code-simplifier** | `src/detail/webserver_register.cpp:247` | code-structure
26+
The moved comment block for unregister_impl_ (lines 247-252) now correctly precedes the function, but it still references 'TASK-024' inline, which is a task-tracker token rather than an intent-explaining label. The rest of the codebase uses the same convention consistently, so this is a minor style note rather than a real issue.
27+
*Recommendation:* No action required; the TASK-NNN prefix is the project-wide convention and is consistent with every other block comment in these files.
28+
29+
6. [ ] **code-simplifier** | `test/Makefile.am:74` | code-structure
30+
The updated comment says 'See lines ~532-535 below for the historical XFAIL_TESTS note' but the approximate line reference (~532-535) will drift as the file changes, making it unreliable as guidance.
31+
*Recommendation:* Either drop the cross-reference entirely (the comment stands on its own without it) or replace the line-number hint with a more stable search anchor such as 'See the XFAIL_TESTS block further below' so the reference stays valid as lines shift.
32+
33+
7. [ ] **housekeeper** | `specs/tasks/M7-v2-cleanup/TASK-061.md:15` | documentation-stale
34+
Action item 5 ('Remove the decade-old //TODO: personalized messages at test/littletest.hpp:21 only if we have a fork policy that lets us; otherwise leave (it's vendored)') remains unchecked, which is correct per the task text — but no explicit decision was recorded about the fork policy outcome.
35+
*Recommendation:* This is acceptable as-is since the task itself says 'only if we have a fork policy that lets us; otherwise leave'. The open checkbox correctly documents the deferred decision. No change required.

src/detail/webserver_register.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,12 @@ void webserver::register_resource(const std::string& resource,
244244
register_path(resource, std::move(res));
245245
}
246246

247+
// TASK-024: erase a single registration of the requested kind (family).
248+
// Each kind keeps a distinct http_endpoint key (the family flag is part
249+
// of the endpoint's identity), so we must build the key with the right
250+
// flag or the erase silently misses. Caches are invalidated under the
251+
// registered_resources lock to prevent any thread from reading a
252+
// dangling resource pointer after the maps drop their refs.
247253
void webserver::unregister_impl_(const string& resource, bool family) {
248254
detail::http_endpoint he(resource, family, true, regex_checking);
249255

@@ -346,5 +352,6 @@ void webserver::unregister_resource(const string& resource) {
346352
// collapsed to a single name pair operating on the deny list. The internal
347353
// allowances set and the allow-list branch in policy_callback remain in
348354
// place so default_policy(REJECT) keeps working at the daemon level, but
355+
// they are no longer reachable from the public API.
349356

350357
} // namespace httpserver

src/detail/webserver_setup.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -438,11 +438,6 @@ bool webserver::add_connection(int client_socket, const struct sockaddr* addr, u
438438
static_cast<socklen_t>(addrlen)) == MHD_YES;
439439
}
440440

441-
// TASK-024: erase a single registration of the requested kind (family).
442-
// Each kind keeps a distinct http_endpoint key (the family flag is part
443-
// of the endpoint's identity), so we must build the key with the right
444-
// flag or the erase silently misses. Caches are invalidated under the
445-
// registered_resources lock to prevent any thread from reading a
446441
void webserver::block_ip(std::string_view ip) {
447442
std::unique_lock bans_lock(impl_->bans_mutex);
448443
ip_representation t_ip{std::string{ip}};

src/webserver.cpp

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -499,11 +499,4 @@ hook_handle webserver::add_hook(hook_phase phase,
499499
impl_->hooks_connection_closed_, std::move(fn));
500500
}
501501

502-
503-
// dangling resource pointer after the maps drop their refs.
504-
// they are no longer reachable from the public API.
505-
506-
507-
508-
509502
} // namespace httpserver

test/Makefile.am

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ header_hygiene_iovec_SOURCES = unit/header_hygiene_iovec_test.cpp
7070
# passed so <httpserver.hpp> resolves.
7171
# - LDADD is overridden to empty: this is a pure-compile assertion, the
7272
# `int main(){}` body has no library dependencies.
73-
# Currently in XFAIL_TESTS (see below); flips to PASS when M5 lands and
74-
# the umbrella is free of backend-header leakage.
73+
# Now an unconditional PASS: TASK-020 landed and the <httpserver.hpp>
74+
# umbrella is free of backend-header leakage. See lines ~532-535 below
75+
# for the historical XFAIL_TESTS note.
7576
header_hygiene_SOURCES = unit/header_hygiene_test.cpp
7677
header_hygiene_CPPFLAGS = -I$(top_srcdir)/src $(CPPFLAGS)
7778
header_hygiene_LDADD =

0 commit comments

Comments
 (0)