Skip to content

Test configured relay purpose end to end - #2037

Open
DanGould wants to merge 1 commit into
payjoin:masterfrom
DanGould:2026-generic-purpose-test
Open

DanGould wants to merge 1 commit into
payjoin:masterfrom
DanGould:2026-generic-purpose-test

Conversation

@DanGould

@DanGould DanGould commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

Load a synthetic purpose from the config file and require the running relay to forward it to a gateway that supports only that purpose. Catch a dropped configuration setting that parsing and prober unit tests cannot. Follow up regression test for #2026

claude x kimi reviewed the prior pr and came up with this

Pull Request Checklist

Please confirm the following before requesting review:

@DanGould
DanGould requested a review from benalleng November 7, 2026 06:20
@coveralls

coveralls commented Nov 7, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 42350797805

Coverage increased (+0.1%) to 87.967%

Details

  • Coverage increased (+0.1%) from the base build.
  • Patch coverage: No coverable lines changed in this PR.
  • No coverage regressions found.

Uncovered Changes

No uncovered changes found.

Coverage Regressions

No coverage regressions found.


Coverage Stats

Coverage Status
Relevant Lines: 18616
Covered Lines: 16376
Line Coverage: 87.97%
Coverage Strength: 314.19 hits per line

💛 - Coveralls

Load a synthetic purpose from the config file and require the running relay to forward it to a gateway that supports only that purpose.
Catch a dropped configuration setting that parsing and prober unit tests cannot.

Bind the test gateway before sending traffic and use an explicit deadline. This removes the startup sleep and exposes listener failures.
@DanGould

DanGould commented Nov 7, 2026

Copy link
Copy Markdown
Member Author

force pushed to removing a race condition in the test and reduce the time it takes to run

@caarloshenriq caarloshenriq left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ACK 504fd42

@AdityaKaushal17 AdityaKaushal17 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Tested locally on the PR head (504fd42) on macOS, default features:

cargo test -p payjoin-mailroom: 78 unit tests and 4 integration tests pass, including test_extra_allowed_purpose_from_config.
cargo fmt --all -- --check: no diffs.
cargo clippy -p payjoin-mailroom --all-targets -- -D warnings: no warnings.

To check that the new test covers the config path, I misspelled the extra_allowed_purposes key in the test's TOML. The test then failed at integration.rs:237 with left: 404, right: 200, so without the setting the relay rejects the purpose, which is what the test should catch. I restored the file afterwards.

One observation, not blocking: the misspelled key loaded without any error. Config and OhttpRelayConfig don't use #[serde(deny_unknown_fields)], so a typo in a setting is silently ignored. I'm happy to open a separate issue for that if it's useful.

AdityaKaushal17 referenced this pull request in AdityaKaushal17/rust-payjoin Dec 4, 2026
A misspelled key in the config file, such as `extra_allowed_purpose`,
was silently dropped and its setting fell back to the default (payjoin#2084).

Deserialize through serde_ignored to collect the keys no setting
reads, and fail if any of them come from the file. Environment
variables are not checked, because every PJ_ variable is read,
including ones meant for other tools. A section for a feature this
build does not include, such as [acme] without the acme feature, is
reported with the name of that feature.

This builds on the load() split from payjoin#2091.

Claude-Session: https://claude.ai/code/session_01AMHTByaVgjBz8ZQGt3yRaX

This branch has not been deployed

No deployments
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.

4 participants