Skip to content

fix: config validation for elasticsearch, loki, file_out (#718, #530)#795

Merged
strawgate merged 3 commits into
masterfrom
fix/config-validation-718-530
Apr 3, 2026
Merged

fix: config validation for elasticsearch, loki, file_out (#718, #530)#795
strawgate merged 3 commits into
masterfrom
fix/config-validation-718-530

Conversation

@strawgate
Copy link
Copy Markdown
Owner

Summary

After this change:

Output type Validation Runtime
elasticsearch Accepts (requires endpoint) Works via build_sink_factory()
loki Accepts (requires endpoint) Works via build_sink_factory()
file_out Rejects ("not yet implemented") N/A
parquet Rejects ("not yet implemented") N/A

Test plan

  • cargo test -p logfwd-config — 34 tests passing
  • cargo check --all-targets — clean
  • validation_unimplemented_output_type covers file_out and parquet
  • all_output_types confirms elasticsearch and loki are accepted

Closes #718, closes #530

🤖 Generated with Claude Code

strawgate and others added 2 commits April 2, 2026 23:10
Both types are fully implemented via build_sink_factory() but were
incorrectly rejected at validation time as "not yet implemented".
Elasticsearch and Loki now validate like other endpoint-based outputs.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
FileOut has no sink implementation but was accepted by validation,
causing a runtime crash. Now rejected at config load like Parquet.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 3, 2026

Walkthrough

Validation in crates/logfwd-config was changed: FileOut is now treated as a not-yet-implemented/early-rejection case (addressing #530) rather than being validated for path; Elasticsearch and Loki are removed from the unreachable/placeholder set and now require an endpoint (and URL validation) like Otlp and Http; the Parquet arm remains a not-yet-implemented placeholder. Unit tests were adjusted to reflect these new rejection categories and required fields.

Possibly related PRs


Caution

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

  • Ignore

❌ Failed checks (1 error, 3 warnings, 1 inconclusive)

Check name Status Explanation Resolution
High-Quality Rust Practices ❌ Error Code contains unreachable dead code: FileOut case rejected in first match (lines 494-499) but still present in second match (lines 527-533). Documentation mismatch in allocation_scaling.rs: line 51 comment says '30s' but line 54 uses Duration::from_secs(60). Remove unreachable OutputType::FileOut match arm from lines 527-533 in logfwd-config/src/lib.rs. Update line 51 comment in allocation_scaling.rs to '60s safety timeout'.
Out of Scope Changes check ⚠️ Warning One out-of-scope change detected: allocation_scaling.rs timeout increased from 30 to 60 seconds, unrelated to config validation objectives of #718 and #530. Remove the allocation_scaling.rs timeout change (30→60 secs) as it's unrelated to config validation. Submit as separate PR if needed.
Documentation Thoroughly Updated ⚠️ Warning CONFIG_REFERENCE.md documentation is inaccurate: elasticsearch and loki marked as stub/nonfunctional but PR now accepts them with endpoint; file_out marked partial but now rejected at validation. Update CONFIG_REFERENCE.md to reflect elasticsearch/loki as accepted with required endpoint and file_out as not yet implemented; add PHASES.md entries for #718/#530; document design rationale in DESIGN.md.
Maintainer Fitness ⚠️ Warning PR contains unresolved review comment: timeout documentation on line 51 states '30s safety timeout' while code on line 54 uses Duration::from_secs(60), creating code-comment misalignment. Change line 51 comment from '30s safety timeout' to '60s safety timeout' to match the 60-second Duration value in the code.
Linked Issues check ❓ Inconclusive Config validation changes align with #718 and #530 objectives: elasticsearch/loki now accepted with endpoint requirement, file_out rejected as not-yet-implemented. However, tests for elasticsearch/loki endpoint validation are missing. Add test cases validating that elasticsearch and loki require endpoint and proper URL scheme, ensuring the critical endpoint requirement is tested as documented in PR comments.
✅ Passed checks (2 passed)
Check name Status Explanation
Formal Verification Coverage ✅ Passed Formal verification coverage check not applicable; changes limited to configuration validation logic and test timeout constant, with no new public functions, lifecycle modifications, or SIMD/async pipeline code.
Crate Boundary And Dependency Integrity ✅ Passed PR introduces no new crates or external dependencies; only modifies validation logic in logfwd-config and updates test timeout. Crate boundaries and dependency direction remain intact.

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

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
crates/logfwd-config/src/lib.rs (3)

982-995: 🧹 Nitpick | 🔵 Trivial

Add explicit failing cases for missing endpoint on the new outputs.

This loop only proves the happy path. If a future edit drops elasticsearch or loki from the endpoint-required arm, these cases still stay green. Please add direct negative tests that both types fail without endpoint.

🧪 Suggested regression test
+    #[test]
+    fn validation_endpoint_required_for_elasticsearch_and_loki() {
+        for otype in ["elasticsearch", "loki"] {
+            let yaml = format!(
+                "input:\n  type: file\n  path: /tmp/x.log\noutput:\n  type: {otype}\n"
+            );
+            let msg = Config::load_str(&yaml).unwrap_err().to_string();
+            assert!(
+                msg.contains("endpoint"),
+                "expected missing endpoint error for '{otype}': {msg}"
+            );
+        }
+    }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/logfwd-config/src/lib.rs` around lines 982 - 995, The test
all_output_types() only checks successful parsing when endpoints are present;
add explicit negative tests that verify Config::load_str fails for the new
outputs when the endpoint is missing by calling Config::load_str on YAMLs for
"elasticsearch" and "loki" without an endpoint and asserting an error (e.g.,
using unwrap_err or assert!(matches!(...))). Update or add assertions near the
all_output_types() test to include these two failing cases so regressions
removing endpoint validation for elasticsearch or loki are caught.

523-542: 🛠️ Refactor suggestion | 🟠 Major

Delete the stale FileOut arm from the second match.

FileOut is now rejected above as unimplemented, but Line 523 still treats it as a valid output that only needs path. Keeping both paths in the same function leaves conflicting behavior and makes it easy to regress back into the runtime crash this PR is fixing.

♻️ Suggested cleanup
-                    OutputType::FileOut => {
-                        if output.path.is_none() {
-                            return Err(ConfigError::Validation(format!(
-                                "pipeline '{name}' output '{label}': {} output requires 'path'",
-                                output_type_name(&output.output_type),
-                            )));
-                        }
-                    }
                     OutputType::Stdout | OutputType::Null => {}
                     OutputType::TcpOut | OutputType::UdpOut => {
                         if output.endpoint.is_none() {
                             return Err(ConfigError::Validation(format!(
                                 "pipeline '{name}' output '{label}': {} output requires 'endpoint'",
                                 output_type_name(&output.output_type),
                             )));
                         }
                     }
-                    // FileOut and Parquet are already rejected above.
-                    OutputType::FileOut | OutputType::Parquet => {
+                    // Parquet is already rejected above.
+                    OutputType::Parquet => {
                         unreachable!("placeholder types are rejected before this match")
                     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/logfwd-config/src/lib.rs` around lines 523 - 542, The second match
still contains an OutputType::FileOut arm that conflicts with the earlier
rejection of FileOut; remove the stale OutputType::FileOut alternative from that
match so only Parquet (or the intended placeholder types) are handled by the
unreachable! arm. Ensure the logic that checks output.path and output.endpoint
remains in the first match branches (the existing OutputType::FileOut and
OutputType::TcpOut/OutputType::UdpOut arms) and keep the unreachable! arm only
for OutputType::Parquet (and any real placeholders), leaving output_type_name,
ConfigError::Validation, output.path and output.endpoint checks unchanged.

500-514: ⚠️ Potential issue | 🟡 Minor

Tighten endpoint validation before reusing it for elasticsearch/loki.

validate_endpoint_url() only checks the scheme prefix and whether anything remains after it, so malformed values like http:///bulk or http://:9200 still pass this branch. That lets the newly accepted outputs clear config validation and fail later during sink construction instead of at load time.

🛠️ Suggested fix
 fn validate_endpoint_url(endpoint: &str) -> Result<(), String> {
     // Defer validation for values that still contain unexpanded env var placeholders.
     if endpoint.contains("${") {
         return Ok(());
     }
     let rest = if let Some(r) = endpoint.strip_prefix("https://") {
         r
     } else if let Some(r) = endpoint.strip_prefix("http://") {
         r
     } else {
         return Err(format!(
             "endpoint '{endpoint}' has no recognised scheme; expected 'http://' or 'https://'"
         ));
     };
-    if rest.is_empty() {
+    let authority = rest.split(['/', '?', '#']).next().unwrap_or_default();
+    if authority.is_empty() || authority.starts_with(':') {
         return Err(format!(
             "endpoint '{endpoint}' has no host after the scheme"
         ));
     }
     Ok(())
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/logfwd-config/src/lib.rs` around lines 500 - 514, The endpoint
validation for outputs of type OutputType::Elasticsearch and OutputType::Loki
(and other URL-based outputs) is too permissive because validate_endpoint_url()
only checks the scheme prefix; update the validation in the match arm handling
output.output_type (and reuse of validate_endpoint_url) to fully parse the
endpoint (e.g., via a proper URL parser) and ensure a valid authority/host (and
optional port) and that there are no empty authority components (reject values
like "http:///bulk" or "http://:9200"), and if parsing/host checks fail return
the same ConfigError::Validation with the existing formatted message so
validation fails at load time instead of later during sink construction.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@crates/logfwd-config/src/lib.rs`:
- Around line 982-995: The test all_output_types() only checks successful
parsing when endpoints are present; add explicit negative tests that verify
Config::load_str fails for the new outputs when the endpoint is missing by
calling Config::load_str on YAMLs for "elasticsearch" and "loki" without an
endpoint and asserting an error (e.g., using unwrap_err or
assert!(matches!(...))). Update or add assertions near the all_output_types()
test to include these two failing cases so regressions removing endpoint
validation for elasticsearch or loki are caught.
- Around line 523-542: The second match still contains an OutputType::FileOut
arm that conflicts with the earlier rejection of FileOut; remove the stale
OutputType::FileOut alternative from that match so only Parquet (or the intended
placeholder types) are handled by the unreachable! arm. Ensure the logic that
checks output.path and output.endpoint remains in the first match branches (the
existing OutputType::FileOut and OutputType::TcpOut/OutputType::UdpOut arms) and
keep the unreachable! arm only for OutputType::Parquet (and any real
placeholders), leaving output_type_name, ConfigError::Validation, output.path
and output.endpoint checks unchanged.
- Around line 500-514: The endpoint validation for outputs of type
OutputType::Elasticsearch and OutputType::Loki (and other URL-based outputs) is
too permissive because validate_endpoint_url() only checks the scheme prefix;
update the validation in the match arm handling output.output_type (and reuse of
validate_endpoint_url) to fully parse the endpoint (e.g., via a proper URL
parser) and ensure a valid authority/host (and optional port) and that there are
no empty authority components (reject values like "http:///bulk" or
"http://:9200"), and if parsing/host checks fail return the same
ConfigError::Validation with the existing formatted message so validation fails
at load time instead of later during sink construction.

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: 529e5cc7-7553-466f-a68e-f9f3c9029b07

📥 Commits

Reviewing files that changed from the base of the PR and between 429fac8 and d2161fe.

📒 Files selected for processing (1)
  • crates/logfwd-config/src/lib.rs

@strawgate
Copy link
Copy Markdown
Owner Author

@coderabbitai can you please fully review this change?

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 3, 2026

Tip

For best results, initiate chat on the files or code changes.

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read the full changed file
cat crates/logfwd-config/src/lib.rs

echo "---GIT DIFF---"
git diff HEAD~1 HEAD -- crates/logfwd-config/src/lib.rs

Length of output: 47812


@strawgate — here's a full review of PR #795.


Overall Assessment

The logic intent is correct: FileOut is properly moved to the rejected-at-validation-time group, and Elasticsearch/Loki now pass validation with endpoint enforcement. However, there are two issues worth addressing.


🔴 Bug: Dead/duplicate FileOut arm in the second match

After the first match early-returns for FileOut, the second match still contains a separate, reachable (by the compiler's analysis) arm for FileOut:

// First match — returns early for FileOut:
match output.output_type {
    OutputType::FileOut | OutputType::Parquet => { return Err(...); }
    _ => {}
}

// Second match — FileOut appears TWICE:
match output.output_type {
    OutputType::Otlp | ... => { ... }
    OutputType::FileOut => {          // ← leftover arm from before the PR
        if output.path.is_none() { ... }
    }
    ...
    // FileOut and Parquet are already rejected above.
    OutputType::FileOut | OutputType::Parquet => { // ← FileOut here too
        unreachable!(...)
    }
}

Because FileOut appears as two separate arms in the same match expression, Rust will emit an unreachable_patterns warning for the unreachable!() arm's FileOut. The leftover OutputType::FileOut => { path check } arm from before the PR should be removed — it is dead code now that the first match returns early.

Fix:

// Remove this entire arm from the second match:
-                    OutputType::FileOut => {
-                        if output.path.is_none() {
-                            return Err(ConfigError::Validation(format!(
-                                "pipeline '{name}' output '{label}': {} output requires 'path'",
-                                output_type_name(&output.output_type),
-                            )));
-                        }
-                    }

🟡 Missing endpoint-validation tests for elasticsearch and loki

validation_missing_output_endpoint and validation_endpoint_missing_scheme only cover otlp/http. Now that elasticsearch and loki are subject to the same endpoint enforcement, they should be tested explicitly:

#[test]
fn validation_elasticsearch_loki_require_endpoint() {
    for otype in ["elasticsearch", "loki"] {
        let yaml = format!(
            "input:\n  type: file\n  path: /tmp/x.log\noutput:\n  type: {otype}\n"
        );
        let err = Config::load_str(&yaml).unwrap_err();
        let msg = err.to_string();
        assert!(
            msg.contains("endpoint"),
            "expected 'endpoint' in error for '{otype}': {msg}"
        );
    }
}

#[test]
fn validation_elasticsearch_loki_reject_scheme_less_endpoint() {
    for otype in ["elasticsearch", "loki"] {
        let yaml = format!(
            "input:\n  type: file\n  path: /tmp/x.log\noutput:\n  type: {otype}\n  endpoint: collector:9200\n"
        );
        let err = Config::load_str(&yaml).unwrap_err();
        let msg = err.to_string();
        assert!(
            msg.contains("scheme"),
            "expected 'scheme' in error for '{otype}': {msg}"
        );
    }
}

ℹ️ Pre-existing gap (out of scope, but worth noting)

all_output_types still doesn't cover tcp_out or udp_out. Not introduced by this PR, but now that the test is being updated it'd be a natural time to add them.


Summary table:

# Severity Issue
1 🔴 Bug Duplicate FileOut arm in second matchunreachable_patterns warning; dead path check
2 🟡 Missing tests No coverage for elasticsearch/loki missing/invalid endpoint
3 ℹ️ Pre-existing tcp_out/udp_out absent from all_output_types

🧠 Learnings used
Learnt from: CR
Repo: strawgate/memagent PR: 0
File: coderabbit-custom-pre-merge-checks-unique-id-file-non-traceable-F7F2B60C-1728-4C9A-8889-4F2235E186CA.txt:0-0
Timestamp: 2026-04-03T03:35:42.884Z
Learning: Applies to logfwd-io/src/**/*.rs : New async pipeline code must have proptest coverage for: arbitrary event ordering; acks out of order; drain while in-flight

FileOut was matched twice — once for validation (new code) and once
in the old catch-all. Remove the duplicate that caused the
unreachable_pattern clippy error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
crates/logfwd-config/src/lib.rs (1)

500-545: 🛠️ Refactor suggestion | 🟠 Major

Remove dead FileOut/Parquet arms from the second match.

Because Line 491 returns early for FileOut/Parquet, the OutputType::FileOut arm (Line 526) and OutputType::Parquet arm (Line 543) in the later match are unreachable by control flow and now misleading.

Suggested patch
                 match output.output_type {
                     OutputType::Otlp
                     | OutputType::Http
                     | OutputType::Elasticsearch
                     | OutputType::Loki => {
                         if output.endpoint.is_none() {
                             return Err(ConfigError::Validation(format!(
                                 "pipeline '{name}' output '{label}': {} output requires 'endpoint'",
                                 output_type_name(&output.output_type),
                             )));
                         }
                         if let Some(ep) = &output.endpoint
                             && let Err(msg) = validate_endpoint_url(ep)
                         {
                             return Err(ConfigError::Validation(format!(
                                 "pipeline '{name}' output '{label}': {msg}",
                             )));
                         }
                         if output.output_type == OutputType::Otlp
                             && output.compression.as_deref() == Some("gzip")
                         {
                             return Err(ConfigError::Validation(format!(
                                 "pipeline '{name}' output '{label}': otlp output does not support 'gzip' compression yet"
                             )));
                         }
                     }
-                    OutputType::FileOut => {
-                        if output.path.is_none() {
-                            return Err(ConfigError::Validation(format!(
-                                "pipeline '{name}' output '{label}': {} output requires 'path'",
-                                output_type_name(&output.output_type),
-                            )));
-                        }
-                    }
                     OutputType::Stdout | OutputType::Null => {}
                     OutputType::TcpOut | OutputType::UdpOut => {
                         if output.endpoint.is_none() {
                             return Err(ConfigError::Validation(format!(
                                 "pipeline '{name}' output '{label}': {} output requires 'endpoint'",
                                 output_type_name(&output.output_type),
                             )));
                         }
                     }
-                    OutputType::Parquet => {
-                        // Parquet output not yet implemented
-                    }
                 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/logfwd-config/src/lib.rs` around lines 500 - 545, The second match on
output.output_type contains dead/unreachable arms for OutputType::FileOut and
OutputType::Parquet; remove those two arms (the OutputType::FileOut and
OutputType::Parquet match branches) from the match so the control flow no longer
contains misleading unreachable cases, and if necessary replace them with a
catch-all arm (e.g. _ => {}) to keep the match exhaustive; update the match that
inspects output.output_type (the one handling
Otlp/Http/Elasticsearch/Loki/Stdout/Null/TcpOut/UdpOut) accordingly so behavior
and validation for other variants (including endpoint/path checks and the otlp
gzip check) remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/logfwd-config/src/lib.rs`:
- Around line 991-992: Add negative-path tests for the "elasticsearch" and
"loki" output types similar to the existing otlp/http checks: in the tests
module where all_output_types exists, add tests that invoke the same
validation/parsing used by all_output_types to assert errors when the endpoint
is missing and when the endpoint has no scheme (e.g., "http://x" vs "x" vs
empty). Name the tests clearly (e.g., elasticsearch_missing_endpoint,
elasticsearch_scheme_missing, loki_missing_endpoint, loki_scheme_missing) and
assert that the validator returns an error for those cases so regressions are
caught.

In `@crates/logfwd/tests/allocation_scaling.rs`:
- Around line 51-54: Update the inline timeout comment to reflect the actual
deadline used: change the comment that currently says "after 30s safety timeout"
to state "after 60s safety timeout" so it matches the Deadline computed in the
std::thread::spawn block (the variable deadline using Duration::from_secs(60)).

---

Outside diff comments:
In `@crates/logfwd-config/src/lib.rs`:
- Around line 500-545: The second match on output.output_type contains
dead/unreachable arms for OutputType::FileOut and OutputType::Parquet; remove
those two arms (the OutputType::FileOut and OutputType::Parquet match branches)
from the match so the control flow no longer contains misleading unreachable
cases, and if necessary replace them with a catch-all arm (e.g. _ => {}) to keep
the match exhaustive; update the match that inspects output.output_type (the one
handling Otlp/Http/Elasticsearch/Loki/Stdout/Null/TcpOut/UdpOut) accordingly so
behavior and validation for other variants (including endpoint/path checks and
the otlp gzip check) remain unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

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

Review profile: ASSERTIVE

Plan: Pro

Run ID: 07ee4e5d-5f28-4d99-abab-827169a37e95

📥 Commits

Reviewing files that changed from the base of the PR and between d2161fe and f5a85a5.

📒 Files selected for processing (2)
  • crates/logfwd-config/src/lib.rs
  • crates/logfwd/tests/allocation_scaling.rs

Comment on lines +991 to +992
("elasticsearch", "endpoint: http://x"),
("loki", "endpoint: http://x"),
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick | 🔵 Trivial

Add missing negative endpoint/scheme tests for elasticsearch and loki.

You added positive-path coverage for these types in all_output_types, but there is still no explicit regression test that they fail on missing endpoint or scheme-less endpoint (like existing otlp/http checks).

Suggested patch
     #[test]
     fn validation_missing_output_endpoint() {
-        let yaml = r"
-input:
-  type: file
-  path: /var/log/test.log
-output:
-  type: otlp
-";
-        let err = Config::load_str(yaml).unwrap_err();
-        let msg = err.to_string();
-        assert!(
-            msg.contains("endpoint"),
-            "expected 'endpoint' in error: {msg}"
-        );
+        for otype in ["otlp", "http", "elasticsearch", "loki"] {
+            let yaml = format!(
+                "input:\n  type: file\n  path: /var/log/test.log\noutput:\n  type: {otype}\n"
+            );
+            let err = Config::load_str(&yaml).unwrap_err();
+            let msg = err.to_string();
+            assert!(
+                msg.contains("endpoint"),
+                "expected 'endpoint' in error for '{otype}': {msg}"
+            );
+        }
     }
@@
     #[test]
     fn validation_endpoint_missing_scheme() {
         // Scheme-less endpoints must be rejected for both otlp and http outputs.
-        for otype in ["otlp", "http"] {
+        for otype in ["otlp", "http", "elasticsearch", "loki"] {
             let yaml = format!(
                 "input:\n  type: file\n  path: /tmp/x.log\noutput:\n  type: {otype}\n  endpoint: collector:4317\n"
             );
@@
     #[test]
     fn validation_endpoint_valid_schemes() {
         // Both http:// and https:// must be accepted for otlp and http outputs.
         for (otype, scheme) in [
             ("otlp", "http://"),
             ("otlp", "https://"),
             ("http", "http://"),
             ("http", "https://"),
+            ("elasticsearch", "http://"),
+            ("elasticsearch", "https://"),
+            ("loki", "http://"),
+            ("loki", "https://"),
         ] {
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/logfwd-config/src/lib.rs` around lines 991 - 992, Add negative-path
tests for the "elasticsearch" and "loki" output types similar to the existing
otlp/http checks: in the tests module where all_output_types exists, add tests
that invoke the same validation/parsing used by all_output_types to assert
errors when the endpoint is missing and when the endpoint has no scheme (e.g.,
"http://x" vs "x" vs empty). Name the tests clearly (e.g.,
elasticsearch_missing_endpoint, elasticsearch_scheme_missing,
loki_missing_endpoint, loki_scheme_missing) and assert that the validator
returns an error for those cases so regressions are caught.

Comment on lines 51 to +54
// Cancel as soon as all expected rows are processed, or after 30s safety timeout.
// This makes the test data-driven, not time-driven.
std::thread::spawn(move || {
let deadline = std::time::Instant::now() + Duration::from_secs(30);
let deadline = std::time::Instant::now() + Duration::from_secs(60);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor

Update the timeout comment to match the new value.

Line 54 uses a 60s deadline, but Line 51 still says 30s. Please keep the comment aligned with behavior to avoid test-debug confusion.

Suggested patch
-    // Cancel as soon as all expected rows are processed, or after 30s safety timeout.
+    // Cancel as soon as all expected rows are processed, or after 60s safety timeout.
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
// Cancel as soon as all expected rows are processed, or after 30s safety timeout.
// This makes the test data-driven, not time-driven.
std::thread::spawn(move || {
let deadline = std::time::Instant::now() + Duration::from_secs(30);
let deadline = std::time::Instant::now() + Duration::from_secs(60);
// Cancel as soon as all expected rows are processed, or after 60s safety timeout.
// This makes the test data-driven, not time-driven.
std::thread::spawn(move || {
let deadline = std::time::Instant::now() + Duration::from_secs(60);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@crates/logfwd/tests/allocation_scaling.rs` around lines 51 - 54, Update the
inline timeout comment to reflect the actual deadline used: change the comment
that currently says "after 30s safety timeout" to state "after 60s safety
timeout" so it matches the Deadline computed in the std::thread::spawn block
(the variable deadline using Duration::from_secs(60)).

@strawgate strawgate merged commit e282864 into master Apr 3, 2026
9 checks passed
@strawgate strawgate deleted the fix/config-validation-718-530 branch April 3, 2026 05:14
strawgate added a commit that referenced this pull request Apr 3, 2026
- Skip 3 commits already merged via #795 and #808
- Fix unnecessary qualification in elasticsearch.rs
- Allow clippy::too_many_arguments on bench utility function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
strawgate added a commit that referenced this pull request Apr 3, 2026
- Skip 3 commits already merged via #795 and #808
- Fix unnecessary qualification in elasticsearch.rs
- Allow clippy::too_many_arguments on bench utility function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
strawgate added a commit that referenced this pull request Apr 3, 2026
- Skip 3 commits already merged via #795 and #808
- Fix unnecessary qualification in elasticsearch.rs
- Allow clippy::too_many_arguments on bench utility function

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
strawgate added a commit that referenced this pull request Apr 3, 2026
- Skip 3 commits already merged via #795 and #808
- Fix unnecessary qualification in elasticsearch.rs
- Allow clippy::too_many_arguments on bench utility function

Co-Authored-By: Claude Opus 4.6 (1M context) <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

1 participant