Skip to content

refactor(docs): drop mirrored help-page close; align convert_console_blocks_in_docs error channel - #2422

Merged
max-sixty merged 2 commits into
mainfrom
docs/static-output-for-gif-pages
Apr 26, 2026
Merged

max-sixty merged 2 commits into
mainfrom
docs/static-output-for-gif-pages

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

Summary

Three follow-ups from #2419 review.

  • Bare close everywhere. With inner snapshot wrappers gone from command pages (refactor(tests): consolidate three sync tests; drop dead inner snapshot wrappers #2419), no AUTO-GENERATED markers nest inside the help-page region anywhere in docs/content/*.md. The mirrored close (<!-- END AUTO-GENERATED from \wt cmd --help-page` -->) was the only remaining variant of the close form; collapsed to bare MARKER_CLOSE`.

    • src/help.rs::PageMode::emit_footer() no longer takes subcommand.
    • The help-page regex in readme_sync.rs matches via non-greedy .*? to bare MARKER_CLOSE, with a comment pointing at the new invariant test.
    • AUTO_GENERATED_MARKER_PATTERN strip regex built from the constants.

    Added test_no_nested_auto_generated_markers — walks docs/content/*.md and fails if any AUTO-GENERATED open ever appears inside an already-open region. This is the explicit invariant that bare-close pairing depends on; if a future change tries to re-introduce nesting (e.g., restore an inner snapshot wrapper around terminal shortcodes), the test catches it before the subtle "regex chops region at first inner close" failure mode lands.

  • Aligned error channel. convert_console_blocks_in_docs now returns (Vec<String>, Vec<String>) like its sibling sync steps, with per-file error capture for read_dir, dir entries, and read_to_string. The caller passes errors through the same tag() aggregation as everything else, so a transient I/O failure on one file no longer aborts the whole pipeline silently. Also fixes the matching clippy warning (is_some_and(|e| e == \"md\") → is_none_or(|e| e != \"md\")).

  • Docs alignment. docs/CLAUDE.md updated in two places where the prose still documented the mirrored close as the canonical form.

Visual check via curl across 12 dev-server pages confirmed no leakage of any prior marker form. Adversarial review (subagent /popper-style) caught the stale prose; otherwise no regressions found.

Net diff: +113/-49 (the growth is the new invariant test and explicit per-file error handling; structural simplification shows as -49).

Test plan

  • cargo test --test integration readme_sync — 12 sync tests pass (was 11; +1 for the new invariant test)
  • cargo test --test integration — full integration suite (1558 tests) pass
  • cargo test --test integration test_no_nested_auto_generated_markers — new guard test passes; manually verified it fires on synthetic nesting
  • Single-pass convergence verified: git checkout docs/ && cargo test --test integration test_docs_are_in_sync && git diff --stat produces an empty diff after the first run
  • Visual check via local Zola dev server: 12 docs pages (`/worktrunk/`, `/llm-commits/`, `/claude-code/`, `/tips-patterns/`, `/merge/`, `/step/`, `/remove/`, `/hook/`, `/list/`, `/switch/`, `/config/`, `/faq/`) — only HTML comments contain marker text, no rendered leakage
  • cargo clippy --all-targets --all-features — clean
  • cargo fmt --check — clean

🤖 Generated with Claude Code

…onsole_blocks_in_docs error channel

Three follow-ups from PR #2419 review.

- **Bare close everywhere.** With inner snapshot wrappers gone from command
  pages (PR #2419), no `AUTO-GENERATED` markers nest inside the help-page
  region anywhere in `docs/content/*.md`. The mirrored close
  (`<!-- END AUTO-GENERATED from `wt cmd --help-page` -->`) was the only
  remaining variant of the close form; collapsed to bare `MARKER_CLOSE`.
  - `src/help.rs::PageMode::emit_footer()` no longer takes `subcommand`.
  - The help-page regex in `readme_sync.rs` matches via non-greedy `.*?`
    to bare `MARKER_CLOSE`, with a comment pointing at the new invariant
    test.
  - `AUTO_GENERATED_MARKER_PATTERN` strip regex built from the constants.

  Added `test_no_nested_auto_generated_markers` — walks
  `docs/content/*.md` and fails if any `AUTO-GENERATED` open ever appears
  inside an already-open region. This is the explicit invariant that
  bare-close pairing depends on; if a future change tries to introduce
  nesting (or restore an inner snapshot wrapper), the test catches it
  before the subtle "regex chops region at first inner close" failure
  mode lands.

- **Aligned error channel.** `convert_console_blocks_in_docs` now returns
  `(Vec<String>, Vec<String>)` like its sibling sync steps, with per-file
  error capture for `read_dir`, dir entries, and `read_to_string`. The
  caller passes errors through the same `tag()` aggregation as everything
  else, so a transient I/O failure on one file no longer aborts the
  whole pipeline silently. Also fixes the matching clippy warning
  (`is_some_and(|e| e == "md")` → `is_none_or(|e| e != "md")`).

- **Docs alignment.** `docs/CLAUDE.md` updated in two places where the
  prose still documented the mirrored close as the canonical form.

Visual check via curl across 12 dev-server pages confirmed no leakage of
any prior marker form. Adversarial review (subagent /popper-style) caught
the stale prose; otherwise no regressions found.

Net diff: +113/-49 (the growth is the new invariant test and explicit
per-file error handling; structural simplification shows as -49).

Co-Authored-By: Claude <[email protected]>

@worktrunk-bot worktrunk-bot left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two stale docstrings still describe the mirrored close marker as the canonical form. The PR description notes the adversarial review caught the prose in docs/CLAUDE.md; these two slipped through.

  • tests/integration_tests/readme_sync.rs:1885-1886 — inline suggestion below.
  • src/docs.rs:34-37 (MARKER_CLOSE docstring): "The help-page emitter uses a mirrored variant (<!-- END AUTO-GENERATED from <id> -->) so two adjacent regions can be parsed without ambiguity; everything else uses this bare form." — no longer accurate; the help-page emitter now uses the bare form too. This line is outside the diff; happy to push a fix commit if you'd like.

Comment thread tests/integration_tests/readme_sync.rs Resolved
Caught by auto-reviewer on PR #2422.

- `tests/integration_tests/readme_sync.rs:1885` — `AUTO_GENERATED_MARKER_PATTERN`
  docstring described the close as "with or without the help-page mirrored
  suffix". The regex now uses bare `MARKER_CLOSE` only.
- `src/docs.rs:34` — `MARKER_CLOSE` docstring described the help-page mirrored
  variant as the canonical close. With the bare close used everywhere,
  point at `test_no_nested_auto_generated_markers` as the invariant guarding
  non-greedy pairing instead.

Co-Authored-By: Claude <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner Author

Both stale docstrings fixed in d490a6d:

  • readme_sync.rs:1885 — applied the suggested rewrite verbatim (the regex doesn't have a "with or without mirrored suffix" alternative anymore).
  • src/docs.rs:34 — MARKER_CLOSE docstring now points at test_no_nested_auto_generated_markers as the invariant that makes non-greedy pairing safe, instead of describing the (now-removed) mirrored variant.

This was written by Claude Code on behalf of @max-sixty

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Both edits look right — MARKER_CLOSE now describes the bare close + non-greedy pairing with the new invariant test as the safety net, and the AUTO_GENERATED_MARKER_PATTERN docstring matches what the regex actually does. Thanks for picking them up.

@max-sixty
max-sixty merged commit 4cbc8ca into main Apr 26, 2026
25 checks passed
@max-sixty
max-sixty deleted the docs/static-output-for-gif-pages branch April 26, 2026 09:18
max-sixty added a commit that referenced this pull request Apr 26, 2026
…s page-list (#2427)

Follow-up #1 from PR #2422 review: `sync_well_known_skills` and
`sync_llms_txt` panicked on every failure, while every other step in
`test_docs_are_in_sync` reports via `(Vec<String>, Vec<String>)`. They
now use the channel so a single sync run reports all problems together.

While in the file: dropped redundant `.exists()` prechecks before reads,
collapsed the `if exists() then read else String::new()` pattern for
`skill_file` to `unwrap_or_default()` (we write `expected` either way),
and shared `docs_content_page_names` from
`convert_console_blocks_in_docs` so the directory walk and
underscore-prefix filter live in one place.

Net diff is shorter than baseline (-3 lines). Leaf TOCTOU reads stay as
one-line panics — converting them to the channel was ceremony, not
improvement.

> _This was written by Claude Code on behalf of Maximilian_

Co-authored-by: Claude <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants