Skip to content

Log configuration errors instead of silently discarding them#504

Merged
ChristianPavilonis merged 1 commit intomainfrom
fix/silent-configuration-errors
Mar 16, 2026
Merged

Log configuration errors instead of silently discarding them#504
ChristianPavilonis merged 1 commit intomainfrom
fix/silent-configuration-errors

Conversation

@ChristianPavilonis
Copy link
Collaborator

@ChristianPavilonis ChristianPavilonis commented Mar 13, 2026

Summary

  • Fix five sites where configuration and backend-setup errors were silently converted to None via .ok(), making broken configs appear as "not configured" with no operator feedback.
  • Prebid and NextJS build() functions now use match to log deserialization failures at log::error! level before returning None.
  • AdServer Mock, APS, and Prebid backend_name() methods now use .inspect_err() to log URL parsing errors before converting to Option.

Changes

File Change
crates/common/src/integrations/prebid.rs build(): replaced .ok().flatten()? with match + log::error!; backend_name(): added .inspect_err() before .ok()
crates/common/src/integrations/nextjs/mod.rs build(): replaced .ok().flatten()? with match + log::error!
crates/common/src/integrations/adserver_mock.rs backend_name(): added .inspect_err() before .ok()
crates/common/src/integrations/aps.rs backend_name(): added .inspect_err() before .ok()

Closes

Closes #408

Test plan

  • cargo test --workspace
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • JS tests: cd crates/js/lib && npx vitest run
  • JS format: cd crates/js/lib && npm run format
  • Docs format: cd docs && npm run format
  • WASM build: cargo build --bin trusted-server-fastly --release --target wasm32-wasip1
  • Manual testing via fastly compute serve

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses log macros (not println!)
  • New code has tests
  • No secrets or credentials committed

Copy link
Collaborator

@prk-Jr prk-Jr left a comment

Choose a reason for hiding this comment

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

Summary

This change fixes the five targeted silent .ok() conversions and materially improves operator visibility for config parse / backend resolution failures. I didn't find any blocking correctness issues, but I am leaving one cross-cutting follow-up about when provider endpoint validation runs.

Non-blocking

🤔 thinking

  • Lazy backend validation still defers invalid endpoint detection to live traffic: backend_name() is only queried from the auction loop, so invalid endpoints are still invisible at startup and will emit one error per auction request instead of a single registration-time failure. Consider validating BackendConfig::from_url(...) during provider registration and skipping registration on failure. (crates/common/src/integrations/adserver_mock.rs:372, crates/common/src/integrations/aps.rs:520, crates/common/src/integrations/prebid.rs:954, crates/common/src/auction/orchestrator.rs:238)

CI Status

  • Analyze (actions): PASS
  • Analyze (javascript-typescript): PASS
  • Analyze (rust): PASS
  • CodeQL: PASS
  • cargo fmt: PASS
  • cargo test: PASS
  • format-docs: PASS
  • format-typescript: PASS
  • vitest: PASS

Copy link
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

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

👍 Looks good

…and backend setup

Configuration errors from integration_config() were converted to None via
.ok(), making broken configs appear as 'not configured' with no operator
feedback. Similarly, BackendConfig::from_url() errors in backend_name() were
silently swallowed.

Add log::error! calls at five sites: Prebid and NextJS build() functions now
use match to log config deserialization failures, and adserver_mock, APS, and
Prebid backend_name() methods now use inspect_err to log URL parsing errors
before converting to Option.
@ChristianPavilonis ChristianPavilonis force-pushed the fix/silent-configuration-errors branch from a74cc40 to fb95002 Compare March 16, 2026 16:36
@ChristianPavilonis ChristianPavilonis merged commit 4fbaaa5 into main Mar 16, 2026
10 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.

Configuration errors silently disable integrations

3 participants