Skip to content

feat(dart): Dart & Flutter TOML filters (hardened from upstream PR #2456) - #1

Merged
felipematheus merged 2 commits into
developfrom
feat/flutter-dart-filters
Jul 21, 2026
Merged

felipematheus merged 2 commits into
developfrom
feat/flutter-dart-filters

Conversation

@felipematheus

Copy link
Copy Markdown
Owner

Summary

Adds Flutter/Dart support as nine TOML-only filters, based on upstream rtk-ai/rtk#2456 by @vivekkartha, hardened per review findings. Upstream #669 and #2457 were evaluated and used only as sources of format knowledge ([E] failure markers, hyphen-format analyzer output) — both have correctness blockers.

Filters

Filter Behavior
dart-analyze / flutter-analyze errors/warnings + summary only; both hyphen and bullet formats; stderr merged
dart-test / flutter-test failures only: [E] lines → FAIL prefix, all passing progress stripped; short-circuit on all-pass
dart-pub-get / flutter-pub-get strip download noise, keep summary/warnings
dart-build-runner builder summaries + warnings + SEVERE failures only
flutter-build errors, wasm findings, build result only
dart-format short-circuit on (0 changed); changed files kept

Divergences from upstream rtk-ai#2456 (deliberate)

  1. No discover/rules.rs entries. Upstream's rule rewrote dart run build_runner … → rtk dart build_runner …, and rtk's fallback then executes the invalid native command dart build_runner …. This fork's TOML-only rewrite path (same as jj/jq/just) prefixes the full original command, so dart run build_runner build → rtk dart run build_runner build. Covered by rewrite-equivalence tests.
  2. Failures-only test output. Upstream kept every passing line when a suite failed and head-capped at 80 lines, so a late failure could be truncated away. Here, replace rules mark [E] failure lines and the summary before the progress-line strip runs — the cumulative -N counter on post-failure passing lines is deliberately not treated as a failure signal (the feat(flutter): add Flutter command filters rtk-ai/rtk#669 bug).
  3. Analyzer robustness. Accepts info -, info •, and indented diagnostics; filter_stderr = true on analyze/test/build/build_runner so stderr diagnostics don't bypass filtering.
  4. flutter run and non-build_runner dart run stay passthrough (interactive/streaming — must not go through the non-streaming TOML pipeline). Test-covered.
  5. Adds dart format (CI usage: --output=none --set-exit-if-changed).

Testing

  • cargo fmt --all && cargo clippy --all-targets && cargo test --all → 2454 passed, 0 failed
  • 23 inline TOML fixture tests across the nine filters, including the late-failure regression case and a SEVERE build_runner failure
  • 9 rewrite-equivalence tests in registry.rs
  • Verified with built binary: rtk rewrite 'dart run build_runner build --delete-conflicting-outputs' preserves run; flutter run exits 1 (passthrough)

🤖 Generated with Claude Code

https://claude.ai/code/session_01HkGFWjLXkKYwLJerVWwFjf

felipematheus and others added 2 commits July 7, 2026 19:57
… PR rtk-ai#2456)

Nine TOML-only filters: dart analyze/test/pub/format/build_runner,
flutter analyze/test/pub/build. Based on rtk-ai#2456 by @vivekkartha,
with the review blockers fixed:

- No discover/rules.rs entries: rely on the TOML-only rewrite path
  (like jj/jq/just), which prefixes the full original command. This
  fixes the upstream blocker where 'dart run build_runner' was
  rewritten to the invalid native command 'dart build_runner'.
- Test filters are failures-only: [E] compact-reporter lines are
  rewritten to a FAIL prefix via replace rules, then all remaining
  progress lines are stripped, so a late failure can never be buried
  under passing output or a head-truncation cap.
- Analyzers accept both hyphen and bullet diagnostic formats, with
  leading indentation, and merge stderr (filter_stderr = true) so
  diagnostics emitted there don't bypass the filter.
- build_runner gains a SEVERE generation-failure fixture; flutter
  build's plugin-list strip is tightened to bare identifiers.
- dart format filter added (short-circuits on '(0 changed)').
- Rewrite-equivalence tests for every command, incl. passthrough for
  'flutter run' and non-build_runner 'dart run'.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HkGFWjLXkKYwLJerVWwFjf
…, tail-truncate builds

Driven by real Claude Code history from the investapp project:
- 'flutter pub run build_runner build' (23 uses) was the dominant
  build_runner form — extend match to (dart|flutter) [pub] run.
- 'flutter test --reporter json' (2 uses) is machine output; skip the
  hook rewrite (same rationale as the gh --json guard).
- flutter-build / dart-build-runner now tail-truncate: compile errors
  and SEVERE blocks come at the end of the run.

Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01HkGFWjLXkKYwLJerVWwFjf
@felipematheus
felipematheus marked this pull request as ready for review July 21, 2026 22:49
@felipematheus
felipematheus merged commit 005f91a into develop Jul 21, 2026
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.

1 participant