Skip to content

chore: remove backwards-compat test cruft#1702

Merged
strawgate merged 2 commits into
mainfrom
chore/remove-compat-test-cruft
Apr 8, 2026
Merged

chore: remove backwards-compat test cruft#1702
strawgate merged 2 commits into
mainfrom
chore/remove-compat-test-cruft

Conversation

@strawgate
Copy link
Copy Markdown
Owner

@strawgate strawgate commented Apr 8, 2026

Summary

  • Remove clap_rejects_unknown_old_top_level_flags test (documented old --config top-level flag)
  • Remove clap_rejects_removed_dump_config_alias test (documented removed dump-config subcommand)
  • Remove legacy_output_aliases_are_rejected test (documented removed file_out/tcp_out/udp_out output types)

Too early in the project for backwards-compat baggage. These tests only documented rejection of interfaces that never shipped publicly.

Closes #1599

Test plan

  • cargo test -p logfwd --bin logfwd -- cli_tests — 22 passed
  • cargo test -p logfwd-config --lib — 123 passed

🤖 Generated with Claude Code

Note

Remove backwards-compatibility tests for legacy CLI flags and config aliases

Deletes three tests that verified rejection of legacy/removed inputs: the legacy_output_aliases_are_rejected test in lib.rs and two CLI tests (clap_rejects_unknown_old_top_level_flags, clap_rejects_removed_dump_config_alias) in main.rs. These tests were backwards-compatibility cruft no longer needed.

Macroscope summarized f03d2a2.

Remove three tests that only existed to document rejection of old/removed
interfaces. Too early in the project for this kind of compat baggage:

- clap_rejects_unknown_old_top_level_flags (old --config top-level flag)
- clap_rejects_removed_dump_config_alias (removed dump-config subcommand)
- legacy_output_aliases_are_rejected (removed file_out/tcp_out/udp_out)

Closes #1599

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings April 8, 2026 22:55
@chatgpt-codex-connector
Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 8, 2026

Caution

Review failed

Pull request was closed or merged during review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: ASSERTIVE

Plan: Pro

Run ID: b4705b48-5bec-47b0-96ed-5521ea2eca92

📥 Commits

Reviewing files that changed from the base of the PR and between 5922389 and f03d2a2.

📒 Files selected for processing (2)
  • crates/logfwd-config/src/lib.rs
  • crates/logfwd/src/main.rs
💤 Files with no reviewable changes (2)
  • crates/logfwd-config/src/lib.rs
  • crates/logfwd/src/main.rs

Walkthrough

This PR removes test coverage without modifying production code. It eliminates the legacy_output_aliases_are_rejected test from the config crate, which validated that configuration loading rejects deprecated output type aliases (file_out, tcp_out, udp_out). It also removes two CLI parser tests from the main crate: clap_rejects_unknown_old_top_level_flags and clap_rejects_removed_dump_config_alias. All runtime logic and public APIs remain unchanged.

Possibly related PRs

🚥 Pre-merge checks | ✅ 5 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning PR removes backwards-compat test cruft but does not implement the core fix for issue #1599: detecting config sub-flags without --config to provide targeted error messages. Implement the fix described in #1599: detect --validate/--check/--dry-run when used without --config and emit targeted error guidance instead of 'unknown command' message.
Maintainer Fitness ⚠️ Warning PR claims to close #1599 (bug fix) but only removes tests; actual fix was in prior commit be14e35, creating misleading git history. Update PR description to clarify this is cleanup following #1539 refactoring, and explicitly reference that be14e35 fixed the underlying #1599 issue.
✅ Passed checks (5 passed)
Check name Status Explanation
Out of Scope Changes check ✅ Passed All changes are in-scope test removals directly related to deprecated interfaces mentioned in #1599, with no extraneous modifications.
High-Quality Rust Practices ✅ Passed PR contains only test removals with no new production code additions, so no High-Quality Rust Practices violations can occur.
Formal Verification Coverage ✅ Passed PR removes only test code without adding new public functions, modifying logfwd-core, or changing formal proofs.
Documentation Thoroughly Updated ✅ Passed PR removes three backwards-compatibility tests with no production code, config, architecture, or API changes.
Crate Boundary And Dependency Integrity ✅ Passed PR removes only test code (33 lines) with no modifications to Cargo.toml, dependencies, crate structure, or boundaries.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Removes backwards-compatibility tests that asserted rejection of CLI/config interfaces the project no longer wants to carry forward (and that reportedly never shipped publicly).

Changes:

  • Deleted CLI tests that documented/validated rejection of removed/legacy flags and subcommand aliases.
  • Deleted config parsing test that documented rejection of legacy output type aliases (file_out, tcp_out, udp_out).

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
crates/logfwd/src/main.rs Removes CLI parser tests for old top-level flags / removed subcommand alias rejection.
crates/logfwd-config/src/lib.rs Removes test covering rejection of legacy output type aliases.

Comment thread crates/logfwd/src/main.rs
Comment on lines 1295 to 1307
#[test]
fn clap_parses_validate_subcommand() {
let cli = Cli::try_parse_from(["logfwd", "validate", "--config", "foo.yaml"])
.expect("parser should accept validate subcommand");
match cli.command.expect("command") {
Commands::Validate { config } => assert_eq!(config.as_deref(), Some("foo.yaml")),
other => panic!("expected validate command, got {other:?}"),
}
}

#[test]
fn clap_rejects_unknown_old_top_level_flags() {
let err = Cli::try_parse_from(["logfwd", "--config", "foo.yaml"])
.expect_err("parser should reject old top-level flags");
assert_eq!(err.kind(), ErrorKind::UnknownArgument);
}

#[test]
fn clap_parses_effective_config_with_optional_config_flag() {
let with_path = Cli::try_parse_from(["logfwd", "effective-config", "--config", "foo.yaml"])
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

The PR description closes #1599 (misleading logfwd --validate error), but the code changes here only remove backwards-compat CLI tests and don’t appear to address that behavior. If #1599 is already fixed elsewhere, consider removing the closing keyword here (or update the PR/issue link to the relevant issue).

Copilot uses AI. Check for mistakes.
@macroscopeapp
Copy link
Copy Markdown

macroscopeapp Bot commented Apr 8, 2026

Approvability

Verdict: Approved

This PR only removes three test functions that verified rejection of legacy CLI options. No production code is changed, so there is no runtime impact. The unresolved comment concerns PR/issue linkage documentation, not code correctness.

You can customize Macroscope's approvability policy. Learn more.

@strawgate strawgate merged commit 0d59a4b into main Apr 8, 2026
17 of 18 checks passed
@strawgate strawgate deleted the chore/remove-compat-test-cruft branch April 8, 2026 23:00
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.

bug: logfwd --validate (without --config) gives misleading "unknown command: --validate" error

2 participants