Skip to content

Add test coverage for a claimed req- parameter - #15

Closed
caarloshenriq wants to merge 1 commit into
payjoin:masterfrom
caarloshenriq:test/req-parameter-coverage-issue-7
Closed

caarloshenriq wants to merge 1 commit into
payjoin:masterfrom
caarloshenriq:test/req-parameter-coverage-issue-7

Conversation

@caarloshenriq

Copy link
Copy Markdown

Fixes #7

required_not_understood above only covered a req- key nobody claims. It never covered the other half: a req- key an Extras implementation does claim must not cause a parse error, the same way pj/pjos already don't for payjoin.

Renames a misleadingly-named existing test (required_understood -> non_required_unknown_params_are_silently_ignored): the old name claimed to cover req- enforcement, but the params it uses don't carry the req- prefix at all, so what it actually tests is that plain unknown (non-req-) params are silently ignored rather than rejected.

Adds two new tests: a claimed req- parameter parses successfully, and an unclaimed req- parameter alongside a claimed one still fails (claiming one key does not excuse an unrelated unclaimed one).

Test-only change, no production code touched.

Related to #14, which adds unsatisfied_requirements() for the other side of that same acceptance item in #12 - together they close it.

Closes payjoin#7

`required_understood` tested that a non-`req-` unknown parameter is
silently ignored, not that a `req-` parameter someone claims lets the
URI parse. Rename it to say what it actually covers, and add the
missing case: an Extras implementation that claims a `req-` key must
not error, the same way payjoin's `pj`/`pjos` already don't. A third
test confirms claiming one `req-` key doesn't excuse a different
unclaimed one.

Test-only change, no production code touched.

@DanGould DanGould left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

concept NACK

a req- key an Extras implementation does claim must not cause a parse error

I'm a bit confused by this PR.

From bip21 § forward compatibility

variables which are prefixed with a req- are considered required. If a client does not implement any variables which are prefixed with req-, it MUST consider the entire URI invalid. Any other variables which are not implemented, but which are not prefixed with a req-, can be safely ignored.

It seems like this test enforces non-spec behavior, when perhaps it should be fixing the behavior if it's wrong.

@caarloshenriq

Copy link
Copy Markdown
Author

concept NACK

a req- key an Extras implementation does claim must not cause a parse error

I'm a bit confused by this PR.

From bip21 § forward compatibility

variables which are prefixed with a req- are considered required. If a client does not implement any variables which are prefixed with req-, it MUST consider the entire URI invalid. Any other variables which are not implemented, but which are not prefixed with a req-, can be safely ignored.

It seems like this test enforces non-spec behavior, when perhaps it should be fixing the behavior if it's wrong.

Agreed, this pinned current behavior rather than the spec. Under #12 the parser never errors on req- and the unimplemented ones surface through unsatisfied_requirements(understood), so the #7 cases go there instead. Closing.

@caarloshenriq
caarloshenriq deleted the test/req-parameter-coverage-issue-7 branch October 14, 2026 19:02
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.

no test coverage for required parameters

2 participants