Skip to content

fix(lading): surface user-config parsing failures as Error variants#1902

Draft
goxberry wants to merge 1 commit into
goxberry/expect-cleanup-lading-bins-drop-quarantinesfrom
goxberry/expect-fixme-user-config
Draft

fix(lading): surface user-config parsing failures as Error variants#1902
goxberry wants to merge 1 commit into
goxberry/expect-cleanup-lading-bins-drop-quarantinesfrom
goxberry/expect-fixme-user-config

Conversation

@goxberry
Copy link
Copy Markdown
Contributor

@goxberry goxberry commented May 23, 2026

Summary

First PR in a three-part follow-up to the lading-crate expect_used
cleanup stack (#1896#1901). Each of the 10 sites annotated with
#[expect(clippy::expect_used, reason = "FIXME: …")] in that stack
gets converted into a proper Error variant in one of three PRs,
grouped by failure mode.

This PR addresses the 5 user-supplied config sites — fields read out
of YAML at startup, where a malformed value should surface as a typed
error from the generator constructor rather than abort the process.

File Site Conversion
generator/tcp.rs Tcp::new addr lookup Add AddrParse { addr, source } + EmptyAddrResolution(String); ?
generator/udp.rs Udp::new addr lookup Same two variants on udp::Error; ?
generator/tcp_rr.rs TcpRr::spin addr Add InvalidAddr(#[from] AddrParseError); ?
generator/grpc.rs Grpc::new URI + path Add InvalidTargetUri { uri, reason } covering both Uri parse and missing path; ?
bin/payloadtool.rs check_generator zero cache anyhow::bail! (bin uses anyhow)

The fn-level #[expect(clippy::expect_used)] attribute is removed
from each of the five functions; no other .expect() calls remain in
their bodies.

Test plan

  • ./ci/validate passes
  • grep -n 'FIXME' lading/src/generator/{tcp,udp,tcp_rr,grpc}.rs lading/src/bin/payloadtool.rs is empty
  • cargo build --workspace --all-targets --all-features

🤖 Generated with Claude Code

Convert five FIXME .expect() sites that panicked on malformed user-supplied
YAML config into proper Error-variant propagation:

- tcp.rs::Tcp::new: AddrParse + EmptyAddrResolution for to_socket_addrs
- udp.rs::Udp::new: AddrParse + EmptyAddrResolution for to_socket_addrs
- tcp_rr.rs::TcpRr::spin: InvalidAddr wrapping std::net::AddrParseError
- grpc.rs::Grpc::new: InvalidTargetUri covering both URI parse and missing
  path-and-query
- payloadtool.rs::check_generator: anyhow!() on zero
  maximum_prebuild_cache_size_bytes (eight identical sites)

All five functions already returned Result. After conversion the fn-level
#[expect(clippy::expect_used, reason = "FIXME: ...")] attributes are dropped
since no .expect() calls remain in these functions.

Co-Authored-By: Claude Opus 4.7 <[email protected]>
Copy link
Copy Markdown
Contributor Author

goxberry commented May 23, 2026

Warning

This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
Learn more

This stack of pull requests is managed by Graphite. Learn more about stacking.

@datadog-prod-us1-6
Copy link
Copy Markdown

Pipelines

Fix all issues with BitsAI

⚠️ Warnings

🚦 1 Pipeline job failed

Changelog Check | changelog-check   View in Datadog   GitHub Actions

🛟 This job is unlikely to succeed on retry. Please review your pipeline configuration. No changes to CHANGELOG.md detected. Add 'no-changelog' label if this is intentional.

Useful? React with 👍 / 👎

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 2203e15 | Docs | Datadog PR Page | Give us feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant