Repository navigation
refactor(tests): consolidate three sync tests; drop dead inner snapshot wrappers - #2419
Merged
Merged
Conversation
…ne; drop dead inner snapshot wrappers Two follow-ups from PR #2418 review. - **Test brittleness fix.** Three previously-separate sync tests had data dependencies that nextest could interleave: `test_readme_examples_are_in_sync` reads docs/content/*.md, which `test_docs_quickstart_examples_are_in_sync` generates from snapshots. Under parallelism, README sync could see stale docs and produce content that required a second run to converge. Collapsed both into the existing `test_command_pages_and_skill_files_are_in_sync` pipeline, renamed to `test_docs_are_in_sync`. Steps run sequentially in dependency order; single pass converges from a clean working tree. Each step's errors and updated-file list are tagged with the pipeline stage (`[command pages]`, `[standalone docs]`, `[README]`, etc.) so failures point at the broken stage without needing to read the test source. README failure also reports `(N of M section(s) updated)`. - **Dead inner snapshot wrappers.** `expand_command_placeholders` wrapped each terminal shortcode in command pages with `<!--⚠️ AUTO-GENERATED from <snap> --> ... <!-- END AUTO-GENERATED -->` markers. Command pages regenerate wholesale from `--help-page` each sync, so the inner wrapper served no in-place-refresh purpose — it was dead weight that nested inside the outer help-page region's markers. Stripped from `expand_command_placeholders`'s HTML branch; net -32 lines across six command-page docs files. (The outer help-page region's mirrored close stays — it's load-bearing whenever there's any nested `AUTO-GENERATED` marker in the body. Comment in `src/help.rs:emit_footer` updated to explain the role.) Renamed the test in `CLAUDE.md` (4 sites) and `docs/CLAUDE.md` (2 sites) so the documented `cargo test` invocations resolve. Net diff: -54 lines. Co-Authored-By: Claude <[email protected]>
worktrunk-bot
approved these changes
Apr 26, 2026
7 tasks done
max-sixty
added a commit
that referenced
this pull request
Apr 26, 2026
…blocks_in_docs error channel (#2422) ## Summary Three follow-ups from #2419 review. - **Bare close everywhere.** With inner snapshot wrappers gone from command pages (#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 - [x] `cargo test --test integration readme_sync` — 12 sync tests pass (was 11; +1 for the new invariant test) - [x] `cargo test --test integration` — full integration suite (1558 tests) pass - [x] `cargo test --test integration test_no_nested_auto_generated_markers` — new guard test passes; manually verified it fires on synthetic nesting - [x] 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 - [x] 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 - [x] `cargo clippy --all-targets --all-features` — clean - [x] `cargo fmt --check` — clean 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude <[email protected]>
2 tasks done
max-sixty
pushed a commit
that referenced
this pull request
Apr 27, 2026
## Summary The header comment in `.gitattributes` referenced `test_command_pages_and_skill_files_are_in_sync`, but that test was renamed to `test_docs_are_in_sync` in #2419 when the three sync tests were consolidated. ## Test plan - [x] No code changes; comment-only fix - [x] `git grep` confirms no other stale references to the old test name Co-authored-by: worktrunk-bot <[email protected]> Co-authored-by: Claude Opus 4.7 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two follow-ups from #2418 review.
Test brittleness fix. Three previously-separate sync tests had data dependencies that nextest could interleave:
test_readme_examples_are_in_syncreadsdocs/content/*.md, whichtest_docs_quickstart_examples_are_in_syncgenerates from snapshots. Under parallelism, README sync could see stale docs and produce content that required a second run to converge. Collapsed both into the existingtest_command_pages_and_skill_files_are_in_syncpipeline, renamed totest_docs_are_in_sync. Steps run sequentially in dependency order; single pass converges from a clean working tree.Each step's errors and updated-file list are tagged with the pipeline stage (
[command pages],[standalone docs],[README], etc.) so a failure tells a developer which stage broke without reading the test source. README failure also now reports(N of M section(s) updated).Dead inner snapshot wrappers.
expand_command_placeholderswrapped each terminal shortcode in command pages with<!-- ⚠️ AUTO-GENERATED from <snap> --> ... <!-- END AUTO-GENERATED -->markers. Command pages regenerate wholesale from--help-pageeach sync, so the inner wrapper served no in-place-refresh purpose — it was dead weight nested inside the outer help-page region's markers. Stripped fromexpand_command_placeholders's HTML branch; net -32 lines across six command-page docs files.The outer help-page region's mirrored close stays — it's load-bearing whenever any nested
AUTO-GENERATEDmarker appears in the body. Comment insrc/help.rs:emit_footerupdated to explain the role. (My follow-up note that the mirrored close was redundant turned out to be a misanalysis — non-greedy.*?only safely pairs the open with the right close when there are no nested closes; once the inner snapshot wrappers were gone, the mirror became technically unnecessary, but keeping it survives any future reintroduction of nesting at no cost.)Renamed the test in
CLAUDE.md(4 sites) anddocs/CLAUDE.md(2 sites) so the documentedcargo testinvocations resolve.Net diff: −54 lines.
Test plan
cargo test --test integration readme_sync— 11 sync tests pass (was 13; minus the two collapsed)cargo test --test integration— full integration suite (1557 tests) passgit checkout docs/ README.md && cargo test --test integration test_docs_are_in_sync && git diff --statproduces an empty diff after the first runcargo clippy --all-targets --all-features— cleancargo fmt --check— clean🤖 Generated with Claude Code