Skip to content

feat(filters): add cmake output filter#267

Merged
Koukyosyumei merged 1 commit into
h5i-dev:mainfrom
zerone0x:fix/issue-207-cmake-filter
Jul 8, 2026
Merged

feat(filters): add cmake output filter#267
Koukyosyumei merged 1 commit into
h5i-dev:mainfrom
zerone0x:fix/issue-207-cmake-filter

Conversation

@zerone0x

@zerone0x zerone0x commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #207

Adds a declarative built-in output filter for cmake configure/build output, preserving warnings, errors, and final configure/generate status while dropping routine probe chatter.

Changes

  • Add assets/filters/cmake.toml with a ^cmake\b matcher
  • Strip common -- Detecting / -- Found / compiler probe lines and blanks
  • Add inline golden tests for success, error, warning, and empty output

Test Plan

  • python3 semantic check of the inline golden cases: pass
  • H5I_SKIP_WEB_BUILD=1 cargo test builtin_golden_tests_pass -- --nocapture (blocked in this environment: linker cc is not installed)

Fixes h5i-dev#207

Co-Authored-By: Hermes Agent <noreply@nousresearch.com>

@Koukyosyumei Koukyosyumei 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.

Summary

Adds a single new declarative filter asset, assets/filters/cmake.toml, matching ^cmake\b. It strips CMake configure probe chatter while preserving warnings, errors, and the final configure/generate/build-files status, plus four inline golden tests. It's a clean, additive, self-contained change that follows the established pattern in src/filter_rules.rs.

What's good

  • Correct engine usage. All fields used (description, match_command, strip_ansi, strip_lines_matching, truncate_lines_at, max_lines, on_empty) are valid under FilterDef, which is #[serde(deny_unknown_fields)] (src/filter_rules.rs:66), so the file parses and builtin_rules_all_parse stays green.
  • Golden tests pass. I traced all four cases through apply_filter (src/filter_rules.rs:248) and reproduced the engine (.lines() drops the trailing newline, ^\s*$ strips blanks, empty result → on_empty). All four PASS: success keeps final status, error/warning blocks are preserved, empty run collapses to cmake: clean. Good coverage of the meaningful states.
  • Preserves the important negatives. -- Could NOT find … and CMake Deprecation/Warning lines do not match any strip pattern, so real signal is retained — exactly right.
  • Conventions match siblings. Structure mirrors make.toml/gcc.toml; the em-dash in description is consistent with gcc.toml's description, and on_empty mirrors make: ok. No manual registration needed (RustEmbed auto-includes assets/filters/*.toml), and there's no match_command overlap with any other rule, so routing stays unambiguous.

Minor notes (non-blocking)

  • Redundant strip patterns. Patterns 3 and 4 are largely subsumed by pattern 2:

    • ^-- (Detecting|Check for working|Detecting .* done) — real CMake Detecting … lines always have a trailing space, already caught by pattern 2's Detecting , and Check for working is caught by pattern 2's Check(ing)? .
    • ^-- (C|CXX|CUDA|ASM) compiler identification is — real output is -- The C compiler identification is …, already caught by pattern 2's The .

    They work as harmless belt-and-suspenders (they'd catch hypothetical output lacking the The /space prefix), but consider trimming to keep the rule tight. Not required.

  • -- Found <pkg> is stripped. This drops successful-find lines like -- Found OpenSSL: … (found version …). That's a reasonable probe-chatter tradeoff since warnings/errors are kept, but worth being aware it also removes the version-confirmation some users scan for.

  • Build-phase interaction. Since routing is first-match-per-command, cmake --build . is claimed by this rule, so compiler errors emitted during the build pass through without the gcc rule's include-chain stripping. Acceptable given the one-rule-per-command model; just noting the scope.

  • Test plan. The author notes cargo test builtin_golden_tests_pass was blocked locally (no cc). I confirmed the four cases pass via a faithful simulation of the engine, but CI should be the source of truth here.

Verdict

No blocking issues. Correct, well-tested, convention-consistent additive change. The regex-redundancy trim is optional polish and can be done in a follow-up or ignored.

@Koukyosyumei Koukyosyumei merged commit b668435 into h5i-dev:main Jul 8, 2026
5 checks passed
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.

Add an output filter for cmake

2 participants