Skip to content

tests: nrf_cloud: codec/cbor: Fix build after REST removal - #28847

Merged
rlubos merged 1 commit into
nrfconnect:mainfrom
pascal-nordic:fix-cbor-codec-test-after-rest-removal
May 18, 2026
Merged

tests: nrf_cloud: codec/cbor: Fix build after REST removal#28847
rlubos merged 1 commit into
nrfconnect:mainfrom
pascal-nordic:fix-cbor-codec-test-after-rest-removal

Conversation

@pascal-nordic

Copy link
Copy Markdown
Contributor

The CBOR codec unit-test PR (#27892) and the REST removal PR (#28522) were merged independently and produced a semantic conflict that left net.lib.nrf_cloud.codec.cbor failing to build on main:

  • The test referenced REST types (nrf_cloud_rest_agnss_request, nrf_cloud_rest_pgps_request, nrf_cloud_rest_agnss_result, NRF_CLOUD_REST_AGNSS_REQ_, nrf_cloud_rest_fota_execution_decode) that were renamed to their nrf_cloud_coap_ counterparts by the REST removal.

  • The REST removal made coap_codec.h transitively pull in net/nrf_cloud_coap.h. Its CoAP-disabled fallback redefined enum coap_content_format, conflicting with zephyr/net/coap.h that the test (and the codec source) include directly.

  • struct nrf_cloud_coap_pgps_request was gated on CONFIG_NRF_CLOUD_COAP in net/nrf_cloud_pgps.h, so building any codec consumer with PGPS but without COAP left the struct undeclared.

Fixes applied:

  • Rename REST types in the test sources to their nrf_cloud_coap_* equivalents.
  • In nrf_cloud_coap.h, include zephyr/net/coap.h unconditionally so enum coap_content_format always comes from the canonical Zephyr header. Only zephyr/net/coap_client.h stays gated on CONFIG_NRF_CLOUD_COAP since it requires CONFIG_COAP_CLIENT_*.
  • In nrf_cloud_pgps.h, define struct nrf_cloud_coap_pgps_request unconditionally - it is a pure data carrier and does not require any CoAP machinery.

Verified: net.lib.nrf_cloud.codec.cbor and net.lib.nrf_cloud.codec.json both pass on native_sim and qemu_cortex_m3 (266/266 test cases).

@NordicBuilder

NordicBuilder commented May 18, 2026

Copy link
Copy Markdown
Contributor

CI Information

To view the history of this post, click the 'edited' button above
Build number: 2

Inputs:

Sources:

sdk-nrf: PR head: 2065edc32fd6c9e15d3b55a7446806fca0b866d6

more details

sdk-nrf:

PR head: 2065edc32fd6c9e15d3b55a7446806fca0b866d6
merge base: d2fd397daea91dd4f687c72340698a25da464d21
target head (main): d2fd397daea91dd4f687c72340698a25da464d21
Diff

Github labels

Enabled Name Description
ci-disabled Disable the ci execution
ci-all-test Run all of ci, no test spec filtering will be done
ci-force-downstream Force execution of downstream even if twister fails
ci-run-twister Force run twister
ci-run-zephyr-twister Force run zephyr twister
List of changed files detected by CI (4)
include
│  ├── net
│  │  ├── nrf_cloud_coap.h
│  │  │ nrf_cloud_pgps.h
tests
│  ├── subsys
│  │  ├── net
│  │  │  ├── lib
│  │  │  │  ├── nrf_cloud
│  │  │  │  │  ├── codec
│  │  │  │  │  │  ├── cbor
│  │  │  │  │  │  │  ├── src
│  │  │  │  │  │  │  │  ├── fakes.c
│  │  │  │  │  │  │  │  │ main.c

Outputs:

Toolchain

Version: f0aa129f09
Build docker image: docker-dtr.nordicsemi.no/sw-production/ncs-build:f0aa129f09_5ea73affbf

Test Spec & Results: ✅ Success; ❌ Failure; 🟠 Queued; 🟡 Progress; ◻️ Skipped; ⚠️ Quarantine

  • ◻️ Toolchain - Skipped: existing toolchain is used
  • ✅ Build twister
    • sdk-nrf test count: 342
  • ✅ Integration tests
    • ✅ test-fw-nrfconnect-nrf_lrcs_mosh
    • ✅ test-fw-nrfconnect-nrf_lrcs_positioning
    • ✅ test-sdk-mcuboot
    • ✅ test-sdk-dfu
    • ⚠️ test-fw-nrfconnect-nrf-iot_cloud
    • ⚠️ test-fw-nrfconnect-nrf_lrcs_mosh
    • ⚠️ test-fw-nrfconnect-nrf_lrcs_positioning
Disabled integration tests
    • desktop52_verification
    • test_ble_nrf_config
    • test-fw-nrfconnect-apps
    • test-fw-nrfconnect-apps_nrfdesktop
    • test-fw-nrfconnect-ble_mesh
    • test-fw-nrfconnect-ble_samples
    • test-fw-nrfconnect-chip
    • test-fw-nrfconnect-fem
    • test-fw-nrfconnect-nfc
    • test-fw-nrfconnect-nrf-iot_libmodem-nrf
    • test-fw-nrfconnect-nrf-iot_lwm2m
    • test-fw-nrfconnect-nrf-iot_samples
    • test-fw-nrfconnect-nrf-iot_thingy91
    • test-fw-nrfconnect-nrf-iot_zephyr_lwm2m
    • test-fw-nrfconnect-nrf_crypto
    • test-fw-nrfconnect-ps-main
    • test-fw-nrfconnect-rpc
    • test-fw-nrfconnect-rs
    • test-fw-nrfconnect-tfm
    • test-fw-nrfconnect-thread-main
    • test-low-level
    • test-sdk-audio
    • test-sdk-find-my
    • test-sdk-wifi
    • test-secdom-samples-public

Note: This message is automatically posted and updated by the CI

@pascal-nordic
pascal-nordic marked this pull request as ready for review May 18, 2026 14:39
@pascal-nordic
pascal-nordic requested a review from a team as a code owner May 18, 2026 14:39
The CBOR codec unit-test PR (nrfconnect#27892) and the REST removal PR (nrfconnect#28522)
were merged independently and produced a semantic conflict that left
net.lib.nrf_cloud.codec.cbor failing to build on main:

  * The test referenced REST types (nrf_cloud_rest_agnss_request,
    nrf_cloud_rest_pgps_request, nrf_cloud_rest_agnss_result,
    NRF_CLOUD_REST_AGNSS_REQ_*, nrf_cloud_rest_fota_execution_decode)
    that were renamed to their nrf_cloud_coap_* counterparts by the
    REST removal.

  * The REST removal made coap_codec.h transitively pull in
    net/nrf_cloud_coap.h. Its CoAP-disabled fallback redefined
    enum coap_content_format, conflicting with zephyr/net/coap.h that
    the test (and the codec source) include directly.

  * struct nrf_cloud_coap_pgps_request was gated on
    CONFIG_NRF_CLOUD_COAP in net/nrf_cloud_pgps.h, so building any
    codec consumer with PGPS but without COAP left the struct
    undeclared.

Fixes applied:
  * Rename REST types in the test sources to their nrf_cloud_coap_*
    equivalents.
  * In nrf_cloud_coap.h, include zephyr/net/coap.h unconditionally so
    enum coap_content_format always comes from the canonical Zephyr
    header. Only zephyr/net/coap_client.h stays gated on
    CONFIG_NRF_CLOUD_COAP since it requires CONFIG_COAP_CLIENT_*.
  * In nrf_cloud_pgps.h, define struct nrf_cloud_coap_pgps_request
    unconditionally - it is a pure data carrier and does not require
    any CoAP machinery.

Verified: net.lib.nrf_cloud.codec.cbor and net.lib.nrf_cloud.codec.json
both pass on native_sim and qemu_cortex_m3 (266/266 test cases).

Signed-off-by: Pascal Hernandez <pascal.hernandez@nordicsemi.no>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR resolves build failures in the nRF Cloud CBOR codec unit tests caused by the earlier nRF Cloud REST removal, by aligning test types/symbols with the CoAP equivalents and removing a header-level enum conflict.

Changes:

  • Update CBOR codec tests to use nrf_cloud_coap_* request/result types and NRF_CLOUD_COAP_* enums instead of removed REST symbols.
  • Ensure include/net/nrf_cloud_coap.h always includes Zephyr’s canonical <zephyr/net/coap.h> to avoid enum coap_content_format redefinition conflicts when CoAP is disabled.
  • Make struct nrf_cloud_coap_pgps_request available unconditionally in include/net/nrf_cloud_pgps.h so PGPS-only builds can still construct requests without requiring CONFIG_NRF_CLOUD_COAP.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.

File Description
tests/subsys/net/lib/nrf_cloud/codec/cbor/src/main.c Renames REST test references to CoAP equivalents for A-GNSS/P-GPS CBOR codec tests.
tests/subsys/net/lib/nrf_cloud/codec/cbor/src/fakes.c Renames the FOTA decode stub to the CoAP symbol used by the codec implementation.
include/net/nrf_cloud_pgps.h Defines nrf_cloud_coap_pgps_request unconditionally to fix PGPS-without-CoAP build cases.
include/net/nrf_cloud_coap.h Includes <zephyr/net/coap.h> unconditionally to prevent coap_content_format enum conflicts.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@rlubos

rlubos commented May 18, 2026

Copy link
Copy Markdown
Contributor

Please fix the compliance:

 LONG_LINE_COMMENT: line length of 109 exceeds 100 columns
File:tests/subsys/net/lib/nrf_cloud/codec/cbor/src/main.c
Line:45

 18: UC4 Commit message body line exceeds max length (73>72): "  * struct nrf_cloud_coap_pgps_request was gated on CONFIG_NRF_CLOUD_COAP"

@rlubos rlubos added the Hotfix Fixes CI or a mistake label May 18, 2026
@pascal-nordic
pascal-nordic force-pushed the fix-cbor-codec-test-after-rest-removal branch from dbd06dc to 2065edc Compare May 18, 2026 14:43
@NordicBuilder
NordicBuilder requested a review from a team May 18, 2026 14:44
@github-actions

Copy link
Copy Markdown

You can find the documentation preview for this PR here.

@rlubos
rlubos merged commit 4dc13a8 into nrfconnect:main May 18, 2026
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Hotfix Fixes CI or a mistake no-changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants