Skip to content

test: suite-wide hygiene sweep — hoist imports, trim comments, merge tests#71

Merged
hakula139 merged 3 commits intomainfrom
chore/test-suite-sweep
May 8, 2026
Merged

test: suite-wide hygiene sweep — hoist imports, trim comments, merge tests#71
hakula139 merged 3 commits intomainfrom
chore/test-suite-sweep

Conversation

@hakula139
Copy link
Copy Markdown
Owner

Summary

  • Cross-cutting test-suite hygiene sweep across 27 files. Net: +138 / -370, test count 1812 → 1786 (-26).
  • Four cleanup categories applied uniformly per CLAUDE.md test-suite + comment guidance: hoist shared use imports, drop rotting / restate-the-code comments, scenario-leading test names, and merge tiny redundant tests into table-style cases.
  • Cross-file naming consistency: bool_unset_and_empty_are_absent_or_empty_is_absent to match its string_* sibling; three noop variants (_is_noop, _is_silent_noop, _is_a_no_op) normalized to the dominant _is_a_noop.
  • Per-file line / region coverage unchanged — every merge preserves all previously-asserted branches; the one genuine deletion (list_finds_first_prompt_title_in_long_session) exercises the same flat byte-scan path as the retained list_finds_ai_title_buried_between_head_and_tail, no unique branch lost.

Verified by /pr-review-toolkit:review-pr all parallel — 4 review agents (code-reviewer, pr-test-analyzer, comment-analyzer, silent-failure-hunter); follow-up commit addresses every issue raised.

Changes

File Change
agent.rs Test name rename (_records_assistant_message_and_returns_records_and_completes).
client/anthropic/sse.rs Hoist 4 repeated use wiremock::matchers::{method, path}; blocks to test mod top.
config.rs, config/file.rs Drop two Regression: ... narrative doc comments; replace with one-line cross-reference.
session/actor.rs Trim multi-line WHY comments to one-liners leading with rationale.
session/handle.rs Drop change-narrating comments; rephrase one antithesis tic (SET (not just count) → positive form).
session/state.rs Merge 5 extract_user_text_* + 6 truncate_title_* + 5 parse_git_branch_* into 3 table-style tests. Trim verbose comments.
session/store.rs Merge format_size_* and consolidate. Drop the long-session FirstPrompt test (subsumed).
slash/diff.rs Merge truncate_* + format_size_* table-style. Trim comments.
slash/effort_slider.rs, picker.rs, theme.rs, init.rs, help.rs, matcher.rs Hoist test imports, trim comments, merge label / fixture tests. init.rs switches assert!(matches!(...)) to let-else + panic for stricter mismatch reporting.
slash/resume.rs Hoist 3 fn-local use ratatui::Terminal/TestBackend; merge unhandled_keys_* + ctrl_other_chars_* (both verify unrecognized keys are absorbed).
tui/app.rs, modal.rs, modal/list_picker.rs, theme.rs, theme/color.rs, components/{chat/blocks/assistant.rs, chat/blocks/tool/numbered_row.rs, input/popup.rs, welcome.rs} Hoist imports, trim comments, merge composite-helper / markdown-helper / hex-case theme tests. Two welcome.rs noop renames.
util/env.rs Merge string_unset_* + string_empty_* (and matching bool_*) into 2 consolidated _unset_or_empty_is_absent tests.

Test plan

  • cargo fmt --all --check
  • cargo clippy --all-targets -- -D warnings
  • cargo test --package oxide-code — 1786 pass
  • cargo llvm-cov per-file — coverage unchanged
  • pnpm spellcheck
  • pnpm lint
  • /pr-review-toolkit:review-pr all parallel — 4 review agents, all findings addressed

hakula139 added 3 commits May 9, 2026 00:40
…tests

Net change: 25 files, +131 / -354. Test count drops 1812 → 1786 (-26)
because redundant one-liner tests were folded into table-style cases;
no behavioral coverage lost (per-file line-coverage unchanged).

Four categories applied uniformly per CLAUDE.md test-suite guidance:

(1) Hoist shared `use` to top of test module.
    `use ratatui::Terminal; use ratatui::backend::TestBackend;` and
    `use wiremock::matchers::{method, path};` style imports were
    repeated in many test fns. Hoisted to the `mod tests` import
    block (std → external → internal, alphabetical within each).

(2) Trim or drop rotting / verbose comments.
    Deleted comments that narrate the change ("Regression: ...",
    "Updated to ...", references to past behavior). CLAUDE.md global:
    "That belongs in the commit message and rots in the source tree."
    Multi-line rationale comments trimmed to one or two lines, leading
    with the WHY. Comments explaining non-obvious invariants /
    workarounds / perf-or-security considerations kept as-is.

(3) Test names. Per CLAUDE.md ("Phrase the scenario side, not the
    mechanism"), shortened mechanism-leading names. Examples:
    `agent_turn_text_only_response_records_assistant_message_and_returns`
    → `agent_turn_text_only_response_records_and_completes`.

(4) Merge redundant tests. CLAUDE.md: "Prefer a concise suite with
    full coverage over many minimal tests. Merge tests that cover the
    same path." Tiny one-liner tests calling the same fn with
    different inputs collapsed into table-style tests with multiple
    asserts. Two tests with near-identical setup asserting different
    aspects of the same fn merged. Tests subsumed by a broader test
    dropped.

Verification: cargo fmt / clippy / test green; pnpm spellcheck / lint
green. Coverage on every modified file unchanged.
Two tiny normalisations spotted in a follow-up sweep:

- `bool_unset_and_empty_are_absent` → `bool_unset_or_empty_is_absent`
  to match the sibling `string_unset_or_empty_is_absent` (semantic OR
  on the input states; singular subject across both tests).
- Three noop variants → the dominant `_is_a_noop`:
  `modal_cancel_without_snapshot_is_noop` (missing article),
  `swap_theme_with_unknown_name_is_silent_noop` (missing article),
  and `paint_*_is_a_no_op` (split spelling) in welcome.rs. The 8+
  other call sites all spell it `_is_a_noop`.
Three issues surfaced by parallel review agents (code-reviewer,
pr-test-analyzer, comment-analyzer):

- slash/help.rs: drop the orphaned `///` on `Fake` struct (duplicated
  inline at the merged test) and the trait-stub asserts that crept
  into `display_label_combines_name_aliases_and_usage`. The stub
  asserts were chasing coverage rather than verifying behavior — the
  trait wiring is already exercised implicitly by the four
  display_label cases.
- session/handle.rs: rephrase the antithesis tic
  `path SET (not just count)` → `path set so the test fails even if
  every snapshot points at the same file`. Global CLAUDE.md flags the
  X-not-Y construction unless it rules out a misconception a reader
  would otherwise hold; here the positive form carries the same
  meaning.

silent-failure-hunter and pr-test-analyzer both confirmed the sweep
introduces no coverage regressions; the deleted
`list_finds_first_prompt_title_in_long_session` test exercised the
same flat-byte-scan path as the retained
`list_finds_ai_title_buried_between_head_and_tail`, with no unique
branch lost.
@hakula139 hakula139 added the enhancement New feature or request label May 8, 2026
@hakula139 hakula139 self-assigned this May 8, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented May 8, 2026

Codecov Report

❌ Patch coverage is 98.11321% with 1 line in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/oxide-code/src/slash/init.rs 83.33% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@hakula139 hakula139 added refactor Reorganize the code to be cleaner and easier readable and removed enhancement New feature or request labels May 8, 2026
@hakula139 hakula139 merged commit 68e8360 into main May 8, 2026
4 checks passed
@hakula139 hakula139 deleted the chore/test-suite-sweep branch May 8, 2026 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactor Reorganize the code to be cleaner and easier readable

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant