Skip to content

fix: document and categorize diagnostic files in state logs#1981

Merged
max-sixty merged 5 commits intomainfrom
state-logs-docs
Apr 7, 2026
Merged

fix: document and categorize diagnostic files in state logs#1981
max-sixty merged 5 commits intomainfrom
state-logs-docs

Conversation

@max-sixty
Copy link
Copy Markdown
Owner

verbose.log and diagnostic.md (created by -vv) were undocumented in the wt config state logs help text and FAQ. verbose.log was miscategorized as hook output in logs get, and diagnostic.md was invisible to both logs get and logs clear (not matched by is_wt_log_file).

Adds a DIAGNOSTIC section to all output paths (human table, JSON, logs get, state get logs), updates help text ("two kinds" → "three kinds"), and updates the FAQ file inventory.

Also extracts the three identical per-section render functions into a single render_log_section parameterized by heading and filter predicate — render_all_log_sections composes them and is called from all three display paths.

Fixes a test filter bug where \s*$ consumed trailing newlines, collapsing blank line separators between populated sections. Changed to [ \t]*$ to match only horizontal whitespace.

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

max-sixty and others added 3 commits April 7, 2026 09:46
`verbose.log` and `diagnostic.md` (created by `-vv`) were undocumented
in the state logs help text and FAQ. `verbose.log` was miscategorized
as hook output in `logs get`, and `diagnostic.md` was invisible to both
`logs get` and `logs clear`.

Add a DIAGNOSTIC section to all output paths (human, JSON, table),
update docs and FAQ inventory, and add tests for section separation
and clearing.

Co-Authored-By: Claude <noreply@anthropic.com>
# Conflicts:
#	tests/integration_tests/config_state.rs
…blank lines

Deduplicate the three log section render functions into a single generic
`render_log_section` parameterized by heading and filter predicate, called
from `render_all_log_sections`. All three output paths (logs get,
state get logs, state table) now share one code path.

Fix `\s*$` in the test size/age filter consuming trailing newlines,
which collapsed blank line separators between populated sections. Use
`[ \t]*$` to match only horizontal whitespace.

Co-Authored-By: Claude <noreply@anthropic.com>
Copy link
Copy Markdown
Collaborator

@worktrunk-bot worktrunk-bot left a comment

Choose a reason for hiding this comment

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

The JSON test snapshots (test_state_get_json_empty, test_state_get_json_comprehensive, test_state_get_json_with_logs) weren't updated to include the new "diagnostic" field. The code now emits "diagnostic": [...] in the JSON output, but the inline snapshots don't expect it — these tests will fail.

Fix: run cargo insta test --accept -- --test integration "test_state_get_json" and commit the updated snapshots.

Also — #1977 touches the exact same files with a subset of this work. One of them should be closed to avoid merge conflicts.

max-sixty and others added 2 commits April 7, 2026 11:02
Main converted the JSON state tests to inline snapshots, which now
need the `"diagnostic"` key added by this branch.

Co-Authored-By: Claude <noreply@anthropic.com>
@max-sixty max-sixty merged commit ed883d5 into main Apr 7, 2026
25 checks passed
@max-sixty max-sixty deleted the state-logs-docs branch April 7, 2026 20:03
max-sixty added a commit that referenced this pull request Apr 7, 2026
`\s*$` in Rust regex matches newlines, which can consume trailing `\n`
and collapse blank line separators in insta inline snapshots. Use
`[ \t]*$` to match only horizontal whitespace, consistent with the
same fix applied in config_state.rs (#1981).

Co-Authored-By: Claude <noreply@anthropic.com>
max-sixty added a commit that referenced this pull request Apr 7, 2026
Same fix as #1981 — `\s*$` in Rust regex matches newlines, so
`add_filter` patterns ending with `\s*$` can consume trailing `\n` and
collapse blank line separators in insta inline snapshots. Changed to `[
\t]*$` in the two remaining instances in `switch_picker.rs`.

> _This was written by Claude Code on behalf of @max-sixty_

Co-authored-by: Claude <noreply@anthropic.com>
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