Skip to content

refactor(tests): consolidate three sync tests; drop dead inner snapshot wrappers - #2419

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

max-sixty merged 1 commit into
mainfrom
docs/static-output-for-gif-pages

Conversation

@max-sixty

Copy link
Copy Markdown
Owner

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_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 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_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 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 any nested AUTO-GENERATED marker appears in the body. Comment in src/help.rs:emit_footer updated 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) and docs/CLAUDE.md (2 sites) so the documented cargo test invocations 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) pass
  • Single-pass convergence verified: git checkout docs/ README.md && 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: `/worktrunk/`, `/llm-commits/`, `/claude-code/`, `/tips-patterns/`, `/merge/`, `/step/`, `/remove/`, `/hook/`, `/list/` all render terminal blocks cleanly with no leaked marker strings
  • Adversarial review of the consolidation (subagent /popper-style): all 4 actionable findings (stale doc references, lost README count, missing stage tags, etc.) addressed
  • cargo clippy --all-targets --all-features — clean
  • cargo fmt --check — clean

🤖 Generated with Claude Code

…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]>
@max-sixty
max-sixty merged commit 66a5bec into main Apr 26, 2026
25 checks passed
@max-sixty
max-sixty deleted the docs/static-output-for-gif-pages branch April 26, 2026 02:20
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]>
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]>
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