Skip to content

test!(ipip-524/v0.10): codec mismatch returns 406#254

Merged
lidel merged 5 commits intomainfrom
feat/ipip-0524-remove-conversion-tests
Feb 5, 2026
Merged

test!(ipip-524/v0.10): codec mismatch returns 406#254
lidel merged 5 commits intomainfrom
feat/ipip-0524-remove-conversion-tests

Conversation

@lidel
Copy link
Member

@lidel lidel commented Dec 3, 2025

Update tests to reflect IPIP-524 which removes codec conversions from the gateway spec. Gateways now return 406 Not Acceptable when the requested format doesn't match the block's codec.

  • Replace TestDagPbConversion with TestCodecMismatchReturns406
  • Remove codec conversion tests (dag-pb→dag-json, dag-cbor→dag-json)
  • Fix TestPathing to request matching codec format
  • Add body verification for DAG-CBOR traversal test
  • Clarify that HTML rendering remains in spec (unlike conversions)

Implementations supporting optional codec conversions for backward compatibility are free to skip the 406 tests. I'll move conversion tests to boxo/gateway and make it configurable behind a config flag.

This needs to be released as minor release as its technically a breaking change.

Update tests to reflect IPIP-0524 which removes codec conversions from
the gateway spec. Gateways now return 406 Not Acceptable when the
requested format doesn't match the block's codec.

- Replace TestDagPbConversion with TestCodecMismatchReturns406
- Remove codec conversion tests (dag-pb→dag-json, dag-cbor→dag-json)
- Fix TestPathing to request matching codec format
- Add body verification for DAG-CBOR traversal test
- Clarify that HTML rendering remains in spec (unlike conversions)

Implementations supporting optional codec conversions for backward
compatibility are free to skip the 406 tests.

Ref: ipfs/specs#524
lidel added a commit to ipfs/boxo that referenced this pull request Dec 3, 2025
Add AllowCodecConversion to gateway.Config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec. When true, conversions between codecs are performed for backward
compatibility.

Codec conversion tests moved here from gateway-conformance since
conversions are now an optional implementation feature, not a spec
requirement. Gateway-conformance now tests for 406 responses.

Ref: ipfs/specs#524
Ref: ipfs/gateway-conformance#254
@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Results against Kubo latest:

Summary

Tests Failures Errors Skipped
1231 26 0 0

@github-actions
Copy link
Contributor

github-actions bot commented Dec 3, 2025

Results against Kubo master:

Important

See the action summary for full results. This PR cannot be merged until there is a Kubo PR that uses tests from this branch and passes CI. Link related PRs (boxo, kubo) in the PR description.

Summary

Tests Failures Errors Skipped
1231 13 0 0

lidel added a commit to ipfs/boxo that referenced this pull request Dec 3, 2025
Add AllowCodecConversion to gateway.Config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec. When true, conversions between codecs are performed for backward
compatibility.

Codec conversion tests moved here from gateway-conformance since
conversions are now an optional implementation feature, not a spec
requirement. Gateway-conformance now tests for 406 responses.

Ref: ipfs/specs#524
Ref: ipfs/gateway-conformance#254
lidel added a commit to ipfs/boxo that referenced this pull request Dec 3, 2025
Add AllowCodecConversion to gateway.Config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec. When true, conversions between codecs are performed for backward
compatibility.

Codec conversion tests moved here from gateway-conformance since
conversions are now an optional implementation feature, not a spec
requirement. Gateway-conformance now tests for 406 responses.

Ref: ipfs/specs#524
Ref: ipfs/gateway-conformance#254
- Replace TestNativeDag explicit DAG-JSON format with matching format
- Replace cache tests using format=dag-json/json with format=raw
- Add body verification for raw block responses

IPIP-0524 removes codec conversions from gateway spec, so tests
should not expect 200 for cross-codec requests.
lidel added a commit to ipfs/boxo that referenced this pull request Dec 3, 2025
Add AllowCodecConversion to gateway.Config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec. When true, conversions between codecs are performed for backward
compatibility.

Codec conversion tests moved here from gateway-conformance since
conversions are now an optional implementation feature, not a spec
requirement. Gateway-conformance now tests for 406 responses.

Ref: ipfs/specs#524
Ref: ipfs/gateway-conformance#254
lidel added a commit to ipfs/boxo that referenced this pull request Dec 3, 2025
Add AllowCodecConversion to gateway.Config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec. When true, conversions between codecs are performed for backward
compatibility.

Codec conversion tests moved here from gateway-conformance since
conversions are now an optional implementation feature, not a spec
requirement. Gateway-conformance now tests for 406 responses.

Ref: ipfs/specs#524
Ref: ipfs/gateway-conformance#254
lidel added a commit to ipfs/kubo that referenced this pull request Dec 3, 2025
Wire up boxo's AllowCodecConversion config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec.

Clients should fetch raw blocks (`?format=raw`) and convert client-side.

Ref: ipfs/specs#524
Ref: ipfs/boxo#1077
Ref: ipfs/gateway-conformance#254
lidel added a commit to ipfs/kubo that referenced this pull request Dec 3, 2025
Wire up boxo's AllowCodecConversion config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec.

Clients should fetch raw blocks (`?format=raw`) and convert client-side.

Ref: ipfs/specs#524
Ref: ipfs/boxo#1077
Ref: ipfs/gateway-conformance#254
lidel added a commit to ipfs/kubo that referenced this pull request Dec 3, 2025
Wire up boxo's AllowCodecConversion config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec.

Clients should fetch raw blocks (`?format=raw`) and convert client-side.

Ref: ipfs/specs#524
Ref: ipfs/boxo#1077
Ref: ipfs/gateway-conformance#254
@lidel lidel changed the title test!: IPIP-524 codec mismatch returns 406 test!(ipip-524/v0.10): codec mismatch returns 406 Feb 5, 2026
@lidel lidel marked this pull request as ready for review February 5, 2026 23:09
@github-actions
Copy link
Contributor

github-actions bot commented Feb 5, 2026

v0.10.0

Changed

  • IPIP-524: codec conversion tests now expect HTTP 406 Not Acceptable when the requested format does not match the block's native codec. Implementations supporting optional codec conversions for backward compatibility may skip these tests. #254

@lidel
Copy link
Member Author

lidel commented Feb 5, 2026

I'm going to ship this as v0.10 and include it in Kubo 0.40 RC1, together with the other two IPIPs. This way we group all "formally breaking changes" in one release that saves people time on testing (can smoke-test everything in one go).

@lidel lidel merged commit 68b916f into main Feb 5, 2026
10 checks passed
@lidel lidel deleted the feat/ipip-0524-remove-conversion-tests branch February 5, 2026 23:15
lidel added a commit to ipfs/boxo that referenced this pull request Feb 5, 2026
* feat(gateway): add AllowCodecConversion config option

Add AllowCodecConversion to gateway.Config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec. When true, conversions between codecs are performed for backward
compatibility.

Codec conversion tests moved here from gateway-conformance since
conversions are now an optional implementation feature, not a spec
requirement. Gateway-conformance now tests for 406 responses.

Ref: ipfs/specs#524
Ref: ipfs/gateway-conformance#254

* ci: update gateway-conformance to e17586f4

* fix(gateway): 406 error now tells you how to get the data you need

when codec conversion is disabled (IPIP-0524) and you request
?format=dag-json for a dag-pb block, the 406 response now suggests
fetching the raw block with ?format=raw and converting client-side.

covers dag-pb directories, dag-pb files, and raw blocks requested
with ?format=dag-json or ?format=dag-cbor. plain ?format=json and
Accept: application/json continue to serve the default response,
so existing HTTP clients are not affected.

* chore: update changelog with PR link for IPIP-0524

* fix(gateway): show only native codec download link in HTML preview

only show the matching format download link (dag-json or dag-cbor) in
the HTML preview page when AllowCodecConversion is disabled, preventing
users from clicking links that would return 406.

when AllowCodecConversion is enabled, both links are shown as before.

* ci: switch gateway-conformance to v0.10
lidel added a commit to ipfs/kubo that referenced this pull request Feb 6, 2026
…11090)

* feat(gateway): IPIP-0524 Gateway.AllowCodecConversion config option

Wire up boxo's AllowCodecConversion config to control codec conversion
behavior per IPIP-0524. When false (default), the gateway returns
406 Not Acceptable if the requested format doesn't match the block's
codec.

Clients should fetch raw blocks (`?format=raw`) and convert client-side.

Ref: ipfs/specs#524
Ref: ipfs/boxo#1077
Ref: ipfs/gateway-conformance#254

* chore: update boxo for improved 406 codec conversion error

boxo now returns an actionable hint when codec conversion is rejected:
suggests fetching raw block with ?format=raw and converting client-side.

* chore: bump boxo and gateway-conformance to v0.10

* docs: add IPLD Logical Format note to AllowCodecConversion
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.

2 participants