From 00a82cb235f0e5aa4dea246b3de0fd20faf0463c Mon Sep 17 00:00:00 2001 From: bobra200 Date: Mon, 8 Jun 2026 08:47:01 -0700 Subject: [PATCH 01/38] feat: prepare for coverity integration --- build_dependencies.sh | 90 +++++++++++++++++++++++++++++++++++++++++++ cov_build.sh | 20 ++++++++++ coverity_local.sh | 19 +++++++++ test/CMakeLists.txt | 21 +++++++++- 4 files changed, 149 insertions(+), 1 deletion(-) create mode 100755 build_dependencies.sh create mode 100755 cov_build.sh create mode 100755 coverity_local.sh diff --git a/build_dependencies.sh b/build_dependencies.sh new file mode 100755 index 0000000..d050731 --- /dev/null +++ b/build_dependencies.sh @@ -0,0 +1,90 @@ +#!/usr/bin/env bash +# build_dependencies.sh — install all build dependencies for firebolt-cpp-transport +# +# Installs to the system prefix (/usr/local) and is intentionally idempotent: +# running it multiple times is safe. Mirrors the dep set and versions pinned in +# .github/Dockerfile so that both the native CI image and the Coverity container +# end up with an identical build environment. +# +# Usage: sh build_dependencies.sh +# (run as root, or with sudo, from any directory) +set -x +set -e + +DEPS_GOOGLETEST_V="1.15.2" +DEPS_NLOHMANN_JSON_V="3.11.3" +DEPS_JSON_SCHEMA_VALIDATOR_V="2.3.0" +DEPS_WEBSOCKETPP_V="0.8.2" + +# --------------------------------------------------------------------------- +# 1. System packages +# --------------------------------------------------------------------------- +apt-get update +apt-get install -y --no-install-recommends --fix-missing \ + build-essential ca-certificates \ + cmake pkg-config clang-format \ + libboost-all-dev \ + curl wget git \ + python3-pip + +if python3 -m pip help install | grep -q -- '--break-system-packages'; then + python3 -m pip install --break-system-packages gcovr +else + python3 -m pip install gcovr +fi + +# --------------------------------------------------------------------------- +# 2. googletest +# --------------------------------------------------------------------------- +WORK_DIR="$(mktemp -d)" +trap 'rm -rf "$WORK_DIR"' EXIT + +dir="googletest-${DEPS_GOOGLETEST_V}" +curl -sL "https://github.com/google/googletest/releases/download/v${DEPS_GOOGLETEST_V}/${dir}.tar.gz" \ + | tar xzf - -C "$WORK_DIR" +cmake -B "$WORK_DIR/build/${dir}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + "$WORK_DIR/${dir}" +cmake --build "$WORK_DIR/build/${dir}" --target install + +# --------------------------------------------------------------------------- +# 3. nlohmann/json +# --------------------------------------------------------------------------- +dir="nlohmann-json-${DEPS_NLOHMANN_JSON_V}" +git clone --depth 1 --branch "v${DEPS_NLOHMANN_JSON_V}" \ + "https://github.com/nlohmann/json" "$WORK_DIR/${dir}" +cmake -B "$WORK_DIR/build/${dir}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DJSON_BuildTests=OFF \ + "$WORK_DIR/${dir}" +cmake --build "$WORK_DIR/build/${dir}" --target install + +# --------------------------------------------------------------------------- +# 4. json-schema-validator +# --------------------------------------------------------------------------- +dir="json-schema-validator-${DEPS_JSON_SCHEMA_VALIDATOR_V}" +curl -sL "https://github.com/pboettch/json-schema-validator/archive/refs/tags/${DEPS_JSON_SCHEMA_VALIDATOR_V}.tar.gz" \ + | tar xzf - -C "$WORK_DIR" +cmake -B "$WORK_DIR/build/${dir}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DJSON_VALIDATOR_BUILD_TESTS=OFF \ + -DJSON_VALIDATOR_BUILD_EXAMPLES=OFF \ + "$WORK_DIR/${dir}" +cmake --build "$WORK_DIR/build/${dir}" --target install + +# --------------------------------------------------------------------------- +# 5. websocketpp (header-only, cmake install registers package config) +# --------------------------------------------------------------------------- +dir="websocketpp-${DEPS_WEBSOCKETPP_V}" +curl -sL "https://github.com/zaphoyd/websocketpp/archive/refs/tags/${DEPS_WEBSOCKETPP_V}.tar.gz" \ + | tar xzf - -C "$WORK_DIR" +cmake -B "$WORK_DIR/build/${dir}" \ + -DCMAKE_BUILD_TYPE=Release \ + -DBUILD_SHARED_LIBS=ON \ + -DBUILD_TESTS=OFF \ + -DBUILD_EXAMPLES=OFF \ + "$WORK_DIR/${dir}" +cmake --build "$WORK_DIR/build/${dir}" --target install diff --git a/cov_build.sh b/cov_build.sh new file mode 100755 index 0000000..e72c472 --- /dev/null +++ b/cov_build.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env bash +# cov_build.sh — configure and build firebolt-cpp-transport +# +# Run from the repo root after build_dependencies.sh has prepared the +# environment. Produces a Debug build with tests enabled so that +# Coverity can intercept the full compilation including test code. +# +# Usage: sh cov_build.sh +set -x +set -e + +GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-${PWD}}" +cd "${GITHUB_WORKSPACE}" + +cmake -B build-dev -S . \ + -UGTest_DIR \ + -DCMAKE_BUILD_TYPE=Debug \ + -DENABLE_TESTS=ON + +cmake --build build-dev --parallel diff --git a/coverity_local.sh b/coverity_local.sh new file mode 100755 index 0000000..7b18782 --- /dev/null +++ b/coverity_local.sh @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# cov_build.sh — configure and build firebolt-cpp-transport +# +# Run from the repo root after build_dependencies.sh has prepared the +# environment. Produces a Debug build with tests enabled so that +# Coverity can intercept the full compilation including test code. +# +# Usage: sh cov_build.sh +set -x +set -e + +GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-${PWD}}" +cd "${GITHUB_WORKSPACE}" + +cmake -B build-dev -S . \ + -DCMAKE_BUILD_TYPE=Debug \ + -DENABLE_TESTS=ON + +cmake --build build-dev --parallel diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index a27713b..b66aef0 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -15,7 +15,26 @@ # SPDX-License-Identifier: Apache-2.0 find_package(Curl REQUIRED ) -find_package(GTest CONFIG REQUIRED) + +set(FIREBOLT_GTEST_PREFIXES + /usr/local + $ENV{HOME}/.local +) + +set(FIREBOLT_GTEST_LOCAL_PREFIX "") +foreach(prefix IN LISTS FIREBOLT_GTEST_PREFIXES) + if(EXISTS "${prefix}/include/gtest/gtest.h" AND EXISTS "${prefix}/lib/cmake/GTest/GTestConfig.cmake") + set(FIREBOLT_GTEST_LOCAL_PREFIX "${prefix}") + break() + endif() +endforeach() + +if(FIREBOLT_GTEST_LOCAL_PREFIX) + find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}" NO_DEFAULT_PATH) +else() + find_package(GTest CONFIG REQUIRED) +endif() + find_package(nlohmann_json_schema_validator CONFIG REQUIRED) include(GoogleTest) From 9e8e6754a5027ba9ade1bdd7667718ea7137cfc6 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 09:56:28 -0700 Subject: [PATCH 02/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index d050731..419a4bd 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -24,7 +24,8 @@ apt-get install -y --no-install-recommends --fix-missing \ build-essential ca-certificates \ cmake pkg-config clang-format \ libboost-all-dev \ - curl wget git \ + libcurl4-openssl-dev \ + curl wget git jq netcat-openbsd \ python3-pip if python3 -m pip help install | grep -q -- '--break-system-packages'; then From fc55ed28ddb83f05d47012b11e8306ce2110b2c8 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 09:56:43 -0700 Subject: [PATCH 03/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index 419a4bd..713f77d 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -1,12 +1,12 @@ #!/usr/bin/env bash -# build_dependencies.sh — install all build dependencies for firebolt-cpp-transport +# build_dependencies.sh — install all build dependencies for firebolt-cpp-client # # Installs to the system prefix (/usr/local) and is intentionally idempotent: # running it multiple times is safe. Mirrors the dep set and versions pinned in # .github/Dockerfile so that both the native CI image and the Coverity container # end up with an identical build environment. # -# Usage: sh build_dependencies.sh +# Usage: sudo ./build_dependencies.sh # (run as root, or with sudo, from any directory) set -x set -e From 5721424d2143a54c8e21d57081123062b88a8cb3 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 09:56:57 -0700 Subject: [PATCH 04/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index 713f77d..95a2bf8 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -8,8 +8,8 @@ # # Usage: sudo ./build_dependencies.sh # (run as root, or with sudo, from any directory) +set -euo pipefail set -x -set -e DEPS_GOOGLETEST_V="1.15.2" DEPS_NLOHMANN_JSON_V="3.11.3" From 306f34d0cbe0ee1aef334381785d05a92e506d71 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 09:57:10 -0700 Subject: [PATCH 05/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- cov_build.sh | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cov_build.sh b/cov_build.sh index e72c472..9815831 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -1,13 +1,13 @@ #!/usr/bin/env bash -# cov_build.sh — configure and build firebolt-cpp-transport +# cov_build.sh — configure and build firebolt-cpp-client # # Run from the repo root after build_dependencies.sh has prepared the # environment. Produces a Debug build with tests enabled so that # Coverity can intercept the full compilation including test code. # -# Usage: sh cov_build.sh +# Usage: ./cov_build.sh +set -euo pipefail set -x -set -e GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-${PWD}}" cd "${GITHUB_WORKSPACE}" From bce53ae8f7ab2739055fe944c02654b469b01907 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:03:08 -0700 Subject: [PATCH 06/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b66aef0..b34360f 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,7 +29,7 @@ foreach(prefix IN LISTS FIREBOLT_GTEST_PREFIXES) endif() endforeach() -if(FIREBOLT_GTEST_LOCAL_PREFIX) +if(FIREBOLT_GTEST_LOCAL_PREFIX AND NOT DEFINED GTest_DIR) find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}" NO_DEFAULT_PATH) else() find_package(GTest CONFIG REQUIRED) From 88d98f4e5bff93f1862cca2bca76905f8641bb5e Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:03:22 -0700 Subject: [PATCH 07/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- coverity_local.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverity_local.sh b/coverity_local.sh index 7b18782..9686624 100755 --- a/coverity_local.sh +++ b/coverity_local.sh @@ -1,5 +1,5 @@ #!/usr/bin/env bash -# cov_build.sh — configure and build firebolt-cpp-transport +# coverity_local.sh — configure and build firebolt-cpp-client # # Run from the repo root after build_dependencies.sh has prepared the # environment. Produces a Debug build with tests enabled so that From e89c5126f397aeeba8b0b0114c80c4e6e6cd0773 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:03:38 -0700 Subject: [PATCH 08/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- coverity_local.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverity_local.sh b/coverity_local.sh index 9686624..f61f379 100755 --- a/coverity_local.sh +++ b/coverity_local.sh @@ -5,7 +5,7 @@ # environment. Produces a Debug build with tests enabled so that # Coverity can intercept the full compilation including test code. # -# Usage: sh cov_build.sh +# Usage: ./coverity_local.sh set -x set -e From ba97cf027a255cce991c939efc98a2524aedb9cd Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:04:04 -0700 Subject: [PATCH 09/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index 95a2bf8..ac57c98 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -2,9 +2,12 @@ # build_dependencies.sh — install all build dependencies for firebolt-cpp-client # # Installs to the system prefix (/usr/local) and is intentionally idempotent: -# running it multiple times is safe. Mirrors the dep set and versions pinned in -# .github/Dockerfile so that both the native CI image and the Coverity container -# end up with an identical build environment. +# running it multiple times is safe. +# +# Note: this installs the core C/C++ build dependencies used by this repo's CI +# image (see .github/Dockerfile), but it does not attempt to reproduce every +# Dockerfile step (for example, it does not install Node/nvm or FireboltTransport). +# # # Usage: sudo ./build_dependencies.sh # (run as root, or with sudo, from any directory) From d9c6406727075b74750e4ad255a34ae82e6710bd Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:10:55 -0700 Subject: [PATCH 10/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index ac57c98..bf66e6d 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash + +# Copyright 2026 Comcast Cable Communications Management, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # build_dependencies.sh — install all build dependencies for firebolt-cpp-client # # Installs to the system prefix (/usr/local) and is intentionally idempotent: @@ -13,7 +30,6 @@ # (run as root, or with sudo, from any directory) set -euo pipefail set -x - DEPS_GOOGLETEST_V="1.15.2" DEPS_NLOHMANN_JSON_V="3.11.3" DEPS_JSON_SCHEMA_VALIDATOR_V="2.3.0" From a65c5605bfb51787937a4422ac20f4ead185804e Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:11:24 -0700 Subject: [PATCH 11/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- test/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b34360f..2ce986a 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -29,8 +29,8 @@ foreach(prefix IN LISTS FIREBOLT_GTEST_PREFIXES) endif() endforeach() -if(FIREBOLT_GTEST_LOCAL_PREFIX AND NOT DEFINED GTest_DIR) - find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}" NO_DEFAULT_PATH) +if(FIREBOLT_GTEST_LOCAL_PREFIX AND NOT DEFINED GTest_DIR AND NOT SYSROOT_PATH) + find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}") else() find_package(GTest CONFIG REQUIRED) endif() From 464bc92b8786d24961c9389c715b97732670fad3 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:39:04 -0700 Subject: [PATCH 12/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- test/CMakeLists.txt | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2ce986a..1de5e5d 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -22,12 +22,14 @@ set(FIREBOLT_GTEST_PREFIXES ) set(FIREBOLT_GTEST_LOCAL_PREFIX "") -foreach(prefix IN LISTS FIREBOLT_GTEST_PREFIXES) - if(EXISTS "${prefix}/include/gtest/gtest.h" AND EXISTS "${prefix}/lib/cmake/GTest/GTestConfig.cmake") - set(FIREBOLT_GTEST_LOCAL_PREFIX "${prefix}") - break() - endif() -endforeach() +if(NOT SYSROOT_PATH AND NOT CMAKE_CROSSCOMPILING) + foreach(prefix IN LISTS FIREBOLT_GTEST_PREFIXES) + if(EXISTS "${prefix}/include/gtest/gtest.h" AND EXISTS "${prefix}/lib/cmake/GTest/GTestConfig.cmake") + set(FIREBOLT_GTEST_LOCAL_PREFIX "${prefix}") + break() + endif() + endforeach() +endif() if(FIREBOLT_GTEST_LOCAL_PREFIX AND NOT DEFINED GTest_DIR AND NOT SYSROOT_PATH) find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}") From 4884ae849b282dcddb60ba5330122bbe4cc0db9c Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:39:19 -0700 Subject: [PATCH 13/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- coverity_local.sh | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/coverity_local.sh b/coverity_local.sh index f61f379..765acfa 100755 --- a/coverity_local.sh +++ b/coverity_local.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash + +# Copyright 2026 Comcast Cable Communications Management, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # coverity_local.sh — configure and build firebolt-cpp-client # # Run from the repo root after build_dependencies.sh has prepared the @@ -6,9 +23,8 @@ # Coverity can intercept the full compilation including test code. # # Usage: ./coverity_local.sh +set -euo pipefail set -x -set -e - GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-${PWD}}" cd "${GITHUB_WORKSPACE}" From 51646fef7ff0cd5f1964fa1b53cfe446faeb471b Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:39:32 -0700 Subject: [PATCH 14/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- cov_build.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/cov_build.sh b/cov_build.sh index 9815831..18a5b61 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -1,4 +1,21 @@ #!/usr/bin/env bash + +# Copyright 2026 Comcast Cable Communications Management, LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# SPDX-License-Identifier: Apache-2.0 + # cov_build.sh — configure and build firebolt-cpp-client # # Run from the repo root after build_dependencies.sh has prepared the From 4d88158723ca40bbf794ad79cda51729c7c19bf2 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:39:44 -0700 Subject: [PATCH 15/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index bf66e6d..c4b82aa 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -60,7 +60,7 @@ WORK_DIR="$(mktemp -d)" trap 'rm -rf "$WORK_DIR"' EXIT dir="googletest-${DEPS_GOOGLETEST_V}" -curl -sL "https://github.com/google/googletest/releases/download/v${DEPS_GOOGLETEST_V}/${dir}.tar.gz" \ +curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused "https://github.com/google/googletest/releases/download/v${DEPS_GOOGLETEST_V}/${dir}.tar.gz" \ | tar xzf - -C "$WORK_DIR" cmake -B "$WORK_DIR/build/${dir}" \ -DCMAKE_BUILD_TYPE=Release \ From 1b3a99e95e789f637febec224a7b10353170c402 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:39:58 -0700 Subject: [PATCH 16/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index c4b82aa..6f4be90 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -85,7 +85,7 @@ cmake --build "$WORK_DIR/build/${dir}" --target install # 4. json-schema-validator # --------------------------------------------------------------------------- dir="json-schema-validator-${DEPS_JSON_SCHEMA_VALIDATOR_V}" -curl -sL "https://github.com/pboettch/json-schema-validator/archive/refs/tags/${DEPS_JSON_SCHEMA_VALIDATOR_V}.tar.gz" \ +curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused "https://github.com/pboettch/json-schema-validator/archive/refs/tags/${DEPS_JSON_SCHEMA_VALIDATOR_V}.tar.gz" \ | tar xzf - -C "$WORK_DIR" cmake -B "$WORK_DIR/build/${dir}" \ -DCMAKE_BUILD_TYPE=Release \ From aba4baae59a6dc455d88978743660e81e2dcf300 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:40:10 -0700 Subject: [PATCH 17/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index 6f4be90..9afd6c8 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -99,7 +99,7 @@ cmake --build "$WORK_DIR/build/${dir}" --target install # 5. websocketpp (header-only, cmake install registers package config) # --------------------------------------------------------------------------- dir="websocketpp-${DEPS_WEBSOCKETPP_V}" -curl -sL "https://github.com/zaphoyd/websocketpp/archive/refs/tags/${DEPS_WEBSOCKETPP_V}.tar.gz" \ +curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused "https://github.com/zaphoyd/websocketpp/archive/refs/tags/${DEPS_WEBSOCKETPP_V}.tar.gz" \ | tar xzf - -C "$WORK_DIR" cmake -B "$WORK_DIR/build/${dir}" \ -DCMAKE_BUILD_TYPE=Release \ From 7885ab0cca65759b9873f5b1485156a7a4294299 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:50:08 -0700 Subject: [PATCH 18/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 1de5e5d..b2458f3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -32,7 +32,7 @@ if(NOT SYSROOT_PATH AND NOT CMAKE_CROSSCOMPILING) endif() if(FIREBOLT_GTEST_LOCAL_PREFIX AND NOT DEFINED GTest_DIR AND NOT SYSROOT_PATH) - find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}") + find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}" NO_DEFAULT_PATH) else() find_package(GTest CONFIG REQUIRED) endif() From 8d947b5ba663e13b2b19d32bc58b59ab982e76ca Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 10:50:30 -0700 Subject: [PATCH 19/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- build_dependencies.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build_dependencies.sh b/build_dependencies.sh index 9afd6c8..bd54da9 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -30,6 +30,12 @@ # (run as root, or with sudo, from any directory) set -euo pipefail set -x + +if [[ ${EUID:-$(id -u)} -ne 0 ]]; then + echo "This script must be run as root (try: sudo ./build_dependencies.sh)" >&2 + exit 1 +fi + DEPS_GOOGLETEST_V="1.15.2" DEPS_NLOHMANN_JSON_V="3.11.3" DEPS_JSON_SCHEMA_VALIDATOR_V="2.3.0" From 22a1cd3001dbecd9f2dd1fb002a9adf4fa767095 Mon Sep 17 00:00:00 2001 From: bobra200 Date: Mon, 8 Jun 2026 10:52:12 -0700 Subject: [PATCH 20/38] fix(coverity): make coverity_local a thin wrapper --- coverity_local.sh | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/coverity_local.sh b/coverity_local.sh index 765acfa..1114b14 100755 --- a/coverity_local.sh +++ b/coverity_local.sh @@ -1,5 +1,4 @@ #!/usr/bin/env bash - # Copyright 2026 Comcast Cable Communications Management, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,20 +15,12 @@ # # SPDX-License-Identifier: Apache-2.0 -# coverity_local.sh — configure and build firebolt-cpp-client -# -# Run from the repo root after build_dependencies.sh has prepared the -# environment. Produces a Debug build with tests enabled so that -# Coverity can intercept the full compilation including test code. +# coverity_local.sh - local wrapper for Coverity build prep. # -# Usage: ./coverity_local.sh -set -euo pipefail -set -x -GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-${PWD}}" -cd "${GITHUB_WORKSPACE}" +# Delegates to cov_build.sh so there is a single source of truth for +# CMake configuration flags and build behavior. -cmake -B build-dev -S . \ - -DCMAKE_BUILD_TYPE=Debug \ - -DENABLE_TESTS=ON +set -euo pipefail -cmake --build build-dev --parallel +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +exec "${SCRIPT_DIR}/cov_build.sh" From daa931f34125265791c47806b73b2b4726b6275e Mon Sep 17 00:00:00 2001 From: bobra200 Date: Mon, 8 Jun 2026 10:53:33 -0700 Subject: [PATCH 21/38] fix(build): avoid piping remote archives into tar --- build_dependencies.sh | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/build_dependencies.sh b/build_dependencies.sh index bd54da9..8ded0d8 100755 --- a/build_dependencies.sh +++ b/build_dependencies.sh @@ -65,9 +65,19 @@ fi WORK_DIR="$(mktemp -d)" trap 'rm -rf "$WORK_DIR"' EXIT +download_archive() { + local url="$1" + local archive_path="$2" + + curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused \ + --output "$archive_path" \ + "$url" +} + dir="googletest-${DEPS_GOOGLETEST_V}" -curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused "https://github.com/google/googletest/releases/download/v${DEPS_GOOGLETEST_V}/${dir}.tar.gz" \ - | tar xzf - -C "$WORK_DIR" +archive="$WORK_DIR/${dir}.tar.gz" +download_archive "https://github.com/google/googletest/releases/download/v${DEPS_GOOGLETEST_V}/${dir}.tar.gz" "$archive" +tar xzf "$archive" -C "$WORK_DIR" cmake -B "$WORK_DIR/build/${dir}" \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ @@ -91,8 +101,9 @@ cmake --build "$WORK_DIR/build/${dir}" --target install # 4. json-schema-validator # --------------------------------------------------------------------------- dir="json-schema-validator-${DEPS_JSON_SCHEMA_VALIDATOR_V}" -curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused "https://github.com/pboettch/json-schema-validator/archive/refs/tags/${DEPS_JSON_SCHEMA_VALIDATOR_V}.tar.gz" \ - | tar xzf - -C "$WORK_DIR" +archive="$WORK_DIR/${dir}.tar.gz" +download_archive "https://github.com/pboettch/json-schema-validator/archive/refs/tags/${DEPS_JSON_SCHEMA_VALIDATOR_V}.tar.gz" "$archive" +tar xzf "$archive" -C "$WORK_DIR" cmake -B "$WORK_DIR/build/${dir}" \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ @@ -105,8 +116,9 @@ cmake --build "$WORK_DIR/build/${dir}" --target install # 5. websocketpp (header-only, cmake install registers package config) # --------------------------------------------------------------------------- dir="websocketpp-${DEPS_WEBSOCKETPP_V}" -curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused "https://github.com/zaphoyd/websocketpp/archive/refs/tags/${DEPS_WEBSOCKETPP_V}.tar.gz" \ - | tar xzf - -C "$WORK_DIR" +archive="$WORK_DIR/${dir}.tar.gz" +download_archive "https://github.com/zaphoyd/websocketpp/archive/refs/tags/${DEPS_WEBSOCKETPP_V}.tar.gz" "$archive" +tar xzf "$archive" -C "$WORK_DIR" cmake -B "$WORK_DIR/build/${dir}" \ -DCMAKE_BUILD_TYPE=Release \ -DBUILD_SHARED_LIBS=ON \ From 6135c558b9f5411412e3f6faabb050d8017873e9 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 11:15:33 -0700 Subject: [PATCH 22/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- test/CMakeLists.txt | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index b2458f3..bc6eea3 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -21,18 +21,29 @@ set(FIREBOLT_GTEST_PREFIXES $ENV{HOME}/.local ) -set(FIREBOLT_GTEST_LOCAL_PREFIX "") +set(FIREBOLT_GTEST_CMAKE_SUBDIRS + lib/cmake/GTest + lib64/cmake/GTest + share/cmake/GTest +) + +set(FIREBOLT_GTEST_LOCAL_GTEST_DIR "") if(NOT SYSROOT_PATH AND NOT CMAKE_CROSSCOMPILING) foreach(prefix IN LISTS FIREBOLT_GTEST_PREFIXES) - if(EXISTS "${prefix}/include/gtest/gtest.h" AND EXISTS "${prefix}/lib/cmake/GTest/GTestConfig.cmake") - set(FIREBOLT_GTEST_LOCAL_PREFIX "${prefix}") + foreach(subdir IN LISTS FIREBOLT_GTEST_CMAKE_SUBDIRS) + if(EXISTS "${prefix}/include/gtest/gtest.h" AND EXISTS "${prefix}/${subdir}/GTestConfig.cmake") + set(FIREBOLT_GTEST_LOCAL_GTEST_DIR "${prefix}/${subdir}") + break() + endif() + endforeach() + if(FIREBOLT_GTEST_LOCAL_GTEST_DIR) break() endif() endforeach() endif() -if(FIREBOLT_GTEST_LOCAL_PREFIX AND NOT DEFINED GTest_DIR AND NOT SYSROOT_PATH) - find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_PREFIX}" NO_DEFAULT_PATH) +if(FIREBOLT_GTEST_LOCAL_GTEST_DIR AND NOT DEFINED GTest_DIR AND NOT SYSROOT_PATH) + find_package(GTest CONFIG REQUIRED PATHS "${FIREBOLT_GTEST_LOCAL_GTEST_DIR}" NO_DEFAULT_PATH) else() find_package(GTest CONFIG REQUIRED) endif() From c1e16cf81f6affe457dff5b181aad29ef9fbcffd Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Mon, 8 Jun 2026 13:08:17 -0700 Subject: [PATCH 23/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- coverity_local.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/coverity_local.sh b/coverity_local.sh index 1114b14..712fef6 100755 --- a/coverity_local.sh +++ b/coverity_local.sh @@ -23,4 +23,4 @@ set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" -exec "${SCRIPT_DIR}/cov_build.sh" +exec "${SCRIPT_DIR}/cov_build.sh" "$@" From 856c6d28f2087b9b3aacbbdec5cc0da299338d5e Mon Sep 17 00:00:00 2001 From: bobra200 Date: Tue, 9 Jun 2026 09:56:13 -0700 Subject: [PATCH 24/38] chore: coverity integration round 2 --- .github/workflows/native_full_build.yml | 62 ++++++++++ .gitignore | 2 + CMakeLists.txt | 20 ++++ COVERITY.md | 150 ++++++++++++++++++++++++ Makefile.act | 26 ++++ README.md | 6 + cov_build.sh | 142 +++++++++++++++++++++- 7 files changed, 407 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/native_full_build.yml create mode 100644 COVERITY.md create mode 100644 Makefile.act diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml new file mode 100644 index 0000000..3247551 --- /dev/null +++ b/.github/workflows/native_full_build.yml @@ -0,0 +1,62 @@ +name: Build Component in Native Environment + +on: + workflow_dispatch: + inputs: + container_image: + description: Container image used for native build + required: false + default: ghcr.io/rdkcentral/docker-rdk-ci:latest + type: string + skip_build_dependencies: + description: Skip build_dependencies.sh + required: false + default: false + type: boolean + strict_transport_bootstrap: + description: Force transport bootstrap and ignore host/system package paths + required: false + default: true + type: boolean + force_release_transport: + description: Force transport bootstrap from pinned release archive (.transport.version) + required: false + default: false + type: boolean + push: + branches: [ main, '+([0-9])\.+([0-9])\.x-maintenance' ] + paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh'] + pull_request: + branches: [ main, '+([0-9])\.+([0-9])\.x-maintenance' ] + paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh'] + +permissions: + contents: read + +defaults: + run: + shell: bash + +jobs: + native-build: + name: Build firebolt-cpp-client in native environment + runs-on: ubuntu-latest + container: + image: ${{ github.event_name == 'workflow_dispatch' && inputs.container_image || 'ghcr.io/rdkcentral/docker-rdk-ci:latest' }} + + steps: + - name: Checkout code + uses: actions/checkout@v4 + + - name: Install build dependencies + if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_build_dependencies }} + run: bash -x build_dependencies.sh + + - name: Build + run: bash -x cov_build.sh + env: + COV_DEPS_PREFIX: ${{ github.workspace }}/.cov-deps + COV_FORCE_BOOTSTRAP_TRANSPORT: ${{ github.event_name == 'workflow_dispatch' && inputs.strict_transport_bootstrap && '1' || '0' }} + COV_SKIP_SYSTEM_TRANSPORT: ${{ github.event_name == 'workflow_dispatch' && inputs.strict_transport_bootstrap && '1' || '0' }} + COV_FORCE_RELEASE_TRANSPORT: ${{ github.event_name == 'workflow_dispatch' && inputs.force_release_transport && '1' || '0' }} + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} diff --git a/.gitignore b/.gitignore index 7ccfb8d..ee2b100 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ node_modules/ build/ build-*/ +.cov-deps*/ +act-*.log diff --git a/CMakeLists.txt b/CMakeLists.txt index 553f29e..e7bca95 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -45,6 +45,26 @@ list(APPEND CMAKE_MODULE_PATH "${SYSROOT_PATH}/usr/lib/cmake" ) +set(FIREBOLT_TRANSPORT_ROOT "" CACHE PATH + "Optional install prefix for FireboltTransport (contains lib/cmake/FireboltTransport)" +) + +if(NOT FIREBOLT_TRANSPORT_ROOT AND DEFINED ENV{FIREBOLT_TRANSPORT_ROOT}) + set(FIREBOLT_TRANSPORT_ROOT "$ENV{FIREBOLT_TRANSPORT_ROOT}") +endif() + +if(FIREBOLT_TRANSPORT_ROOT) + list(PREPEND CMAKE_PREFIX_PATH "${FIREBOLT_TRANSPORT_ROOT}") +endif() + +if(NOT FireboltTransport_ROOT AND DEFINED ENV{FireboltTransport_ROOT}) + set(FireboltTransport_ROOT "$ENV{FireboltTransport_ROOT}") +endif() + +if(NOT FireboltTransport_ROOT AND FIREBOLT_TRANSPORT_ROOT) + set(FireboltTransport_ROOT "${FIREBOLT_TRANSPORT_ROOT}") +endif() + find_package(nlohmann_json CONFIG REQUIRED) file(READ "${CMAKE_CURRENT_SOURCE_DIR}/.transport.version" FIREBOLT_TRANSPORT_VERSION_RAW) diff --git a/COVERITY.md b/COVERITY.md new file mode 100644 index 0000000..dcdbcd0 --- /dev/null +++ b/COVERITY.md @@ -0,0 +1,150 @@ +# Coverity Build Guide + +This document describes the Coverity-friendly build flow for firebolt-cpp-client, including fully unattended transport dependency provisioning. + +## Purpose + +`cov_build.sh` is designed to run in clean/off nodes where FireboltTransport may not already be installed. + +The script configures and builds a Debug test-enabled build so Coverity can capture both library and test compilation units. + +## Quick Start + +Run from repo root: + +```bash +./cov_build.sh +``` + +Strict no-host-dependency mode: + +```bash +COV_FORCE_BOOTSTRAP_TRANSPORT=1 \ +COV_SKIP_SYSTEM_TRANSPORT=1 \ +COV_FORCE_RELEASE_TRANSPORT=1 \ +./cov_build.sh +``` + +Local ad-hoc workflow test via act: + +```bash +make -f Makefile.act act-native +``` + +Faster local loop when dependencies are already present in the container image: + +```bash +make -f Makefile.act act-native-fast +``` + +## Dependency Resolution Order + +`cov_build.sh` resolves FireboltTransport in this order. + +1. Explicit `FireboltTransport_DIR` if provided. +2. Local bootstrap prefix (`COV_DEPS_PREFIX`, default `.cov-deps`). +3. System CMake package paths (`/usr/local/...`, `/usr/...`) unless disabled. +4. Sibling repo bootstrap from `../firebolt-cpp-transport`. +5. Release tarball bootstrap using pinned version from `.transport.version`. + +After bootstrap, the script passes `-DFireboltTransport_DIR=` to CMake for deterministic package selection. + +## Hands-Off Bootstrap Paths + +### Sibling repo bootstrap + +If `../firebolt-cpp-transport` exists, the script builds and installs it into `COV_DEPS_PREFIX`. + +### Release tarball bootstrap + +If sibling repo is unavailable or `COV_FORCE_RELEASE_TRANSPORT=1` is set: + +1. Read pinned version from `.transport.version`. +2. Download release archive from GitHub releases. +3. Extract source into `.cov-deps/src/`. +4. Build/install into `COV_DEPS_PREFIX`. +5. Re-run client configure/build against the installed package config. + +The transport bootstrap passes: + +```bash +-DFIREBOLT_TRANSPORT_VERSION= +``` + +This keeps package version compatibility aligned with client `find_package(FireboltTransport CONFIG REQUIRED)`. + +## Environment Variables + +### `COV_DEPS_PREFIX` + +Install/bootstrap prefix for local dependencies. + +Default: + +```bash +/.cov-deps +``` + +### `COV_SKIP_SYSTEM_TRANSPORT` + +When set to `1`, skip system package search paths for FireboltTransport. + +Use this to guarantee host-independent behavior. + +### `COV_FORCE_BOOTSTRAP_TRANSPORT` + +When set to `1`, do not reuse an already-discovered transport package. Force bootstrap flow. + +### `COV_FORCE_RELEASE_TRANSPORT` + +When set to `1`, bypass sibling repo bootstrap and force release tarball bootstrap. + +## CMake Root Hinting + +In addition to script bootstrap, CMake supports explicit root hinting: + +- `FIREBOLT_TRANSPORT_ROOT` (project-level convenience variable) +- `FireboltTransport_ROOT` (package-native CMake variable) + +Either can point to an install prefix containing `lib/cmake/FireboltTransport`. + +## CI Recommendations + +Use strict mode for reproducibility: + +```bash +COV_FORCE_BOOTSTRAP_TRANSPORT=1 \ +COV_SKIP_SYSTEM_TRANSPORT=1 \ +COV_FORCE_RELEASE_TRANSPORT=1 \ +./cov_build.sh +``` + +This prevents accidental coupling to preinstalled host packages. + +## Troubleshooting + +### Missing `.transport.version` + +Symptom: bootstrap fails before download. + +Fix: ensure `.transport.version` exists and contains a non-empty version. + +### Release download failure + +Symptom: both release URL patterns fail. + +Fix: verify pinned version exists in `rdkcentral/firebolt-cpp-transport` releases and that node has outbound network access. + +### Version mismatch shown during configure + +Symptom: `installed version` differs from `expected`. + +Fix: use strict mode and a clean `COV_DEPS_PREFIX`, or set `COV_FORCE_RELEASE_TRANSPORT=1` to rebuild from pinned release. + +## Artifacts + +When release bootstrap is used, expected local artifacts include: + +- `.cov-deps/src/firebolt-cpp-transport-/` +- `.cov-deps/lib/cmake/FireboltTransport/FireboltTransportConfig.cmake` +- `.cov-deps/lib/libFireboltTransport.so*` diff --git a/Makefile.act b/Makefile.act new file mode 100644 index 0000000..72aae9a --- /dev/null +++ b/Makefile.act @@ -0,0 +1,26 @@ +ACT ?= act +WORKFLOW ?= .github/workflows/native_full_build.yml +JOB ?= native-build + +ACT_CONTAINER_IMAGE ?= ghcr.io/rdkcentral/docker-rdk-ci:latest +ACT_SKIP_BUILD_DEPS ?= false +ACT_STRICT_TRANSPORT_BOOTSTRAP ?= true +ACT_FORCE_RELEASE_TRANSPORT ?= true + +.PHONY: act-list act-native act-native-fast + +act-list: + $(ACT) -l + +act-native: + $(ACT) workflow_dispatch \ + -W $(WORKFLOW) \ + -j $(JOB) \ + --input skip_build_dependencies=$(ACT_SKIP_BUILD_DEPS) \ + --input strict_transport_bootstrap=$(ACT_STRICT_TRANSPORT_BOOTSTRAP) \ + --input force_release_transport=$(ACT_FORCE_RELEASE_TRANSPORT) \ + --input container_image=$(ACT_CONTAINER_IMAGE) + +# Faster local loop if your container image already has dependencies. +act-native-fast: + $(MAKE) act-native ACT_SKIP_BUILD_DEPS=true diff --git a/README.md b/README.md index b6289a6..085c0dc 100644 --- a/README.md +++ b/README.md @@ -30,3 +30,9 @@ Examples: - `./lint.sh --tidy-only` - `./lint.sh --tidy-only --fix` - `./lint.sh --cppcheck-only` + +## Coverity + +For Coverity build and fully unattended dependency bootstrap instructions, see: + +- [COVERITY.md](COVERITY.md) diff --git a/cov_build.sh b/cov_build.sh index 18a5b61..5d6c235 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -26,12 +26,152 @@ set -euo pipefail set -x -GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-${PWD}}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +GITHUB_WORKSPACE="${GITHUB_WORKSPACE:-${SCRIPT_DIR}}" cd "${GITHUB_WORKSPACE}" +find_transport_config_dir() { + local candidates=() + local candidate + local skip_system="${COV_SKIP_SYSTEM_TRANSPORT:-0}" + + if [[ -n "${FireboltTransport_DIR:-}" ]]; then + candidates+=("${FireboltTransport_DIR}") + fi + + if [[ -n "${COV_DEPS_PREFIX:-}" ]]; then + candidates+=( + "${COV_DEPS_PREFIX}/lib/cmake/FireboltTransport" + "${COV_DEPS_PREFIX}/lib64/cmake/FireboltTransport" + ) + fi + + if [[ "${skip_system}" != "1" ]]; then + candidates+=( + "/usr/local/lib/cmake/FireboltTransport" + "/usr/local/lib64/cmake/FireboltTransport" + "/usr/lib/cmake/FireboltTransport" + "/usr/lib64/cmake/FireboltTransport" + "/usr/lib/x86_64-linux-gnu/cmake/FireboltTransport" + ) + fi + + for candidate in "${candidates[@]}"; do + if [[ -f "${candidate}/FireboltTransportConfig.cmake" ]]; then + echo "${candidate}" + return 0 + fi + done + + return 1 +} + +bootstrap_transport_if_missing() { + local transport_repo="${GITHUB_WORKSPACE}/../firebolt-cpp-transport" + local transport_build_dir="${transport_repo}/build-cov" + local transport_src_dir="${GITHUB_WORKSPACE}/.cov-deps/src" + local transport_version="" + local release_dir="" + local release_archive="" + local release_url="" + local release_url_nov="" + local release_url_v="" + local transport_config_dir="" + local transport_cmake_args=() + local force_bootstrap="${COV_FORCE_BOOTSTRAP_TRANSPORT:-0}" + local force_release="${COV_FORCE_RELEASE_TRANSPORT:-0}" + + COV_DEPS_PREFIX="${COV_DEPS_PREFIX:-${GITHUB_WORKSPACE}/.cov-deps}" + + if [[ -f "${GITHUB_WORKSPACE}/.transport.version" ]]; then + transport_version="$(tr -d '[:space:]' < "${GITHUB_WORKSPACE}/.transport.version")" + fi + + if [[ "${force_bootstrap}" != "1" ]]; then + if transport_config_dir="$(find_transport_config_dir)"; then + echo "Using FireboltTransport from ${transport_config_dir}" + FireboltTransport_DIR="${transport_config_dir}" + return 0 + fi + fi + + if [[ "${force_release}" == "1" ]]; then + transport_repo="" + fi + + if [[ ! -d "${transport_repo}" ]]; then + if [[ ! -f "${GITHUB_WORKSPACE}/.transport.version" ]]; then + echo "FireboltTransport not found and no .transport.version file is available." >&2 + echo "Provide FireboltTransport_DIR, add sibling firebolt-cpp-transport, or add .transport.version." >&2 + return 1 + fi + + if [[ -z "${transport_version}" ]]; then + echo ".transport.version is empty; cannot resolve transport release." >&2 + return 1 + fi + + release_dir="firebolt-cpp-transport-${transport_version}" + release_archive="${transport_src_dir}/${release_dir}.tar.gz" + release_url_nov="https://github.com/rdkcentral/firebolt-cpp-transport/releases/download/v${transport_version}/${release_dir}.tar.gz" + release_url_v="https://github.com/rdkcentral/firebolt-cpp-transport/releases/download/v${transport_version}/firebolt-cpp-transport-v${transport_version}.tar.gz" + + mkdir -p "${transport_src_dir}" + + if [[ ! -f "${release_archive}" ]]; then + if curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused -o "${release_archive}" "${release_url_nov}"; then + release_url="${release_url_nov}" + elif curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused -o "${release_archive}" "${release_url_v}"; then + release_url="${release_url_v}" + else + echo "Failed to download FireboltTransport release for version ${transport_version}" >&2 + echo "Tried: ${release_url_nov}" >&2 + echo "Tried: ${release_url_v}" >&2 + return 1 + fi + echo "Downloaded FireboltTransport release from ${release_url}" + fi + + rm -rf "${transport_src_dir:?}/${release_dir}" + tar -xzf "${release_archive}" -C "${transport_src_dir}" + + transport_repo="${transport_src_dir}/${release_dir}" + transport_build_dir="${transport_repo}/build-cov" + + if [[ ! -d "${transport_repo}" ]]; then + echo "Transport source extraction failed: ${transport_repo} missing" >&2 + return 1 + fi + fi + + if [[ -n "${transport_version}" ]]; then + transport_cmake_args+=("-DFIREBOLT_TRANSPORT_VERSION=${transport_version}") + fi + + cmake -S "${transport_repo}" -B "${transport_build_dir}" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="${COV_DEPS_PREFIX}" \ + "${transport_cmake_args[@]}" + + cmake --build "${transport_build_dir}" --parallel + cmake --install "${transport_build_dir}" + + if transport_config_dir="$(find_transport_config_dir)"; then + FireboltTransport_DIR="${transport_config_dir}" + echo "Bootstrapped FireboltTransport at ${FireboltTransport_DIR}" + return 0 + fi + + echo "FireboltTransport bootstrap completed but config was not found." >&2 + return 1 +} + +bootstrap_transport_if_missing + cmake -B build-dev -S . \ -UGTest_DIR \ -DCMAKE_BUILD_TYPE=Debug \ + -DFireboltTransport_DIR="${FireboltTransport_DIR}" \ -DENABLE_TESTS=ON cmake --build build-dev --parallel From a958c022c2a6c9ac8544b9a233ca63849b0367f0 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 10:45:45 -0700 Subject: [PATCH 25/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/native_full_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 3247551..2819176 100644 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -24,10 +24,10 @@ on: default: false type: boolean push: - branches: [ main, '+([0-9])\.+([0-9])\.x-maintenance' ] + branches: [ main, '*.*.x-maintenance' ] paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh'] pull_request: - branches: [ main, '+([0-9])\.+([0-9])\.x-maintenance' ] + branches: [ main, '*.*.x-maintenance' ] paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh'] permissions: From ea38ef4991a1b6e1d30ec1d3828cadd8f4f51495 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 10:45:56 -0700 Subject: [PATCH 26/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- cov_build.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/cov_build.sh b/cov_build.sh index 5d6c235..c7c6383 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -119,16 +119,20 @@ bootstrap_transport_if_missing() { mkdir -p "${transport_src_dir}" if [[ ! -f "${release_archive}" ]]; then - if curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused -o "${release_archive}" "${release_url_nov}"; then + local tmp_archive="${release_archive}.tmp" + rm -f "${tmp_archive}" + if curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused -o "${tmp_archive}" "${release_url_nov}"; then release_url="${release_url_nov}" - elif curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused -o "${release_archive}" "${release_url_v}"; then + elif curl -fsSL --retry 5 --retry-delay 1 --retry-connrefused -o "${tmp_archive}" "${release_url_v}"; then release_url="${release_url_v}" else + rm -f "${tmp_archive}" echo "Failed to download FireboltTransport release for version ${transport_version}" >&2 echo "Tried: ${release_url_nov}" >&2 echo "Tried: ${release_url_v}" >&2 return 1 fi + mv -f "${tmp_archive}" "${release_archive}" echo "Downloaded FireboltTransport release from ${release_url}" fi From 59ba1c89fa4c0e3f831d281a3c699ef00885cac4 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 10:46:06 -0700 Subject: [PATCH 27/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e7bca95..c32ba94 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -54,7 +54,7 @@ if(NOT FIREBOLT_TRANSPORT_ROOT AND DEFINED ENV{FIREBOLT_TRANSPORT_ROOT}) endif() if(FIREBOLT_TRANSPORT_ROOT) - list(PREPEND CMAKE_PREFIX_PATH "${FIREBOLT_TRANSPORT_ROOT}") + list(INSERT CMAKE_PREFIX_PATH 0 "${FIREBOLT_TRANSPORT_ROOT}") endif() if(NOT FireboltTransport_ROOT AND DEFINED ENV{FireboltTransport_ROOT}) From 6c88da5bc9d679998def358816e716e7619ced89 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 10:50:21 -0700 Subject: [PATCH 28/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- Makefile.act | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.act b/Makefile.act index 72aae9a..382a69c 100644 --- a/Makefile.act +++ b/Makefile.act @@ -21,6 +21,6 @@ act-native: --input force_release_transport=$(ACT_FORCE_RELEASE_TRANSPORT) \ --input container_image=$(ACT_CONTAINER_IMAGE) -# Faster local loop if your container image already has dependencies. +# Faster local loop if your container image already has dependencies (including FireboltTransport). act-native-fast: - $(MAKE) act-native ACT_SKIP_BUILD_DEPS=true + $(MAKE) act-native ACT_SKIP_BUILD_DEPS=true ACT_STRICT_TRANSPORT_BOOTSTRAP=false ACT_FORCE_RELEASE_TRANSPORT=false From 5fb74765a70252eb22d71bf61cc5d3625b3f9c65 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 11:42:11 -0700 Subject: [PATCH 29/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- cov_build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/cov_build.sh b/cov_build.sh index c7c6383..24081ef 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -69,7 +69,7 @@ find_transport_config_dir() { bootstrap_transport_if_missing() { local transport_repo="${GITHUB_WORKSPACE}/../firebolt-cpp-transport" local transport_build_dir="${transport_repo}/build-cov" - local transport_src_dir="${GITHUB_WORKSPACE}/.cov-deps/src" + local transport_src_dir="" local transport_version="" local release_dir="" local release_archive="" @@ -82,6 +82,7 @@ bootstrap_transport_if_missing() { local force_release="${COV_FORCE_RELEASE_TRANSPORT:-0}" COV_DEPS_PREFIX="${COV_DEPS_PREFIX:-${GITHUB_WORKSPACE}/.cov-deps}" + transport_src_dir="${COV_DEPS_PREFIX}/src" if [[ -f "${GITHUB_WORKSPACE}/.transport.version" ]]; then transport_version="$(tr -d '[:space:]' < "${GITHUB_WORKSPACE}/.transport.version")" From a2f59300995740146822a78c4f6ebe8b3025f0c6 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 11:42:34 -0700 Subject: [PATCH 30/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/native_full_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 2819176..765aadd 100644 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -49,7 +49,7 @@ jobs: uses: actions/checkout@v4 - name: Install build dependencies - if: ${{ github.event_name != 'workflow_dispatch' || !inputs.skip_build_dependencies }} + if: ${{ github.event_name != 'workflow_dispatch' || !fromJSON(github.event.inputs.skip_build_dependencies || 'false') }} run: bash -x build_dependencies.sh - name: Build From 448bc10e1163475388eb24692facba89462c61f7 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 11:43:17 -0700 Subject: [PATCH 31/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/native_full_build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 765aadd..486eee8 100644 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -25,10 +25,10 @@ on: type: boolean push: branches: [ main, '*.*.x-maintenance' ] - paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh'] + paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh', '.github/workflows/native_full_build.yml'] pull_request: branches: [ main, '*.*.x-maintenance' ] - paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh'] + paths: ['**/*.c', '**/*.cpp', '**/*.cc', '**/*.cxx', '**/*.h', '**/*.hpp', 'CMakeLists.txt', 'cmake/**', 'build_dependencies.sh', 'cov_build.sh', '.github/workflows/native_full_build.yml'] permissions: contents: read From de23a7e9ebc818b75f7b53bbcf67d05dfe7c35b1 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 11:43:43 -0700 Subject: [PATCH 32/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c32ba94..b421e72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -49,8 +49,9 @@ set(FIREBOLT_TRANSPORT_ROOT "" CACHE PATH "Optional install prefix for FireboltTransport (contains lib/cmake/FireboltTransport)" ) -if(NOT FIREBOLT_TRANSPORT_ROOT AND DEFINED ENV{FIREBOLT_TRANSPORT_ROOT}) - set(FIREBOLT_TRANSPORT_ROOT "$ENV{FIREBOLT_TRANSPORT_ROOT}") +if(NOT FIREBOLT_TRANSPORT_ROOT AND DEFINED ENV{FIREBOLT_TRANSPORT_ROOT} AND NOT "$ENV{FIREBOLT_TRANSPORT_ROOT}" STREQUAL "") + set(FIREBOLT_TRANSPORT_ROOT "$ENV{FIREBOLT_TRANSPORT_ROOT}" CACHE PATH + "Optional install prefix for FireboltTransport (contains lib/cmake/FireboltTransport)" FORCE) endif() if(FIREBOLT_TRANSPORT_ROOT) From cc9a9e9e19886a92301f6b45693dc99194f6fdd6 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 12:57:16 -0700 Subject: [PATCH 33/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- cov_build.sh | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cov_build.sh b/cov_build.sh index 24081ef..98198ec 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -137,6 +137,12 @@ bootstrap_transport_if_missing() { echo "Downloaded FireboltTransport release from ${release_url}" fi + release_dir="$(tar -tzf "${release_archive}" | sed -e 's|^\./||' | awk -F/ 'NF{print $1; exit}')" + if [[ -z "${release_dir}" ]]; then + echo "Transport archive appears to be empty: ${release_archive}" >&2 + return 1 + fi + rm -rf "${transport_src_dir:?}/${release_dir}" tar -xzf "${release_archive}" -C "${transport_src_dir}" From ec64fb8f93cff3987884f5084bb225e711628576 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 14:09:41 -0700 Subject: [PATCH 34/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- cov_build.sh | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cov_build.sh b/cov_build.sh index 98198ec..7e70d6e 100755 --- a/cov_build.sh +++ b/cov_build.sh @@ -167,7 +167,13 @@ bootstrap_transport_if_missing() { cmake --build "${transport_build_dir}" --parallel cmake --install "${transport_build_dir}" - if transport_config_dir="$(find_transport_config_dir)"; then + if [[ "${force_bootstrap}" == "1" ]]; then + if transport_config_dir="$(FireboltTransport_DIR="" find_transport_config_dir)"; then + FireboltTransport_DIR="${transport_config_dir}" + echo "Bootstrapped FireboltTransport at ${FireboltTransport_DIR}" + return 0 + fi + elif transport_config_dir="$(find_transport_config_dir)"; then FireboltTransport_DIR="${transport_config_dir}" echo "Bootstrapped FireboltTransport at ${FireboltTransport_DIR}" return 0 From cfabc3eb06f1b17967b8dc3c00e9322ee25b3b15 Mon Sep 17 00:00:00 2001 From: Brendan O'Bra Date: Tue, 9 Jun 2026 14:09:53 -0700 Subject: [PATCH 35/38] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .github/workflows/native_full_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/native_full_build.yml b/.github/workflows/native_full_build.yml index 486eee8..e93d8c2 100644 --- a/.github/workflows/native_full_build.yml +++ b/.github/workflows/native_full_build.yml @@ -59,4 +59,4 @@ jobs: COV_FORCE_BOOTSTRAP_TRANSPORT: ${{ github.event_name == 'workflow_dispatch' && inputs.strict_transport_bootstrap && '1' || '0' }} COV_SKIP_SYSTEM_TRANSPORT: ${{ github.event_name == 'workflow_dispatch' && inputs.strict_transport_bootstrap && '1' || '0' }} COV_FORCE_RELEASE_TRANSPORT: ${{ github.event_name == 'workflow_dispatch' && inputs.force_release_transport && '1' || '0' }} - GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE }} + GITHUB_TOKEN: ${{ secrets.RDKCM_RDKE || github.token }} From 99edf7b3844e621135d9b7ed147fde9195219f30 Mon Sep 17 00:00:00 2001 From: swethasukumarr Date: Wed, 10 Jun 2026 14:02:06 -0400 Subject: [PATCH 36/38] RDKEMW-17483 : Add Discovery.watchedV2 alongside Discovery.watched with same logic --- docs/openrpc/openrpc/discovery.json | 118 +++++++++++++++++++ docs/openrpc/the-spec/firebolt-open-rpc.json | 118 +++++++++++++++++++ include/firebolt/discovery.h | 18 +++ src/discovery_impl.cpp | 26 ++++ src/discovery_impl.h | 4 + test/api_test_app/apis/discoveryDemo.cpp | 26 ++++ test/component/discoveryTest.cpp | 8 ++ test/unit/discoveryTest.cpp | 39 ++++++ 8 files changed, 357 insertions(+) diff --git a/docs/openrpc/openrpc/discovery.json b/docs/openrpc/openrpc/discovery.json index 8862606..6f80f61 100644 --- a/docs/openrpc/openrpc/discovery.json +++ b/docs/openrpc/openrpc/discovery.json @@ -122,6 +122,124 @@ } } ] + }, + { + "name": "watchedV2", + "summary": "Notify the platform that content was partially or completely watched, returns whether the notification was accepted", + "tags": [ + { + "name": "polymorphic-reducer" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:discovery:watched" + ] + } + ], + "params": [ + { + "name": "entityId", + "required": true, + "schema": { + "type": "string" + }, + "summary": "The entity Id of the watched content." + }, + { + "name": "progress", + "summary": "How much of the content has been watched (percentage as (0-0.999) for VOD, number of seconds for live)", + "schema": { + "type": "number", + "minimum": 0 + } + }, + { + "name": "completed", + "summary": "Whether or not this viewing is considered \"complete,\" per the app's definition thereof", + "schema": { + "type": "boolean" + } + }, + { + "name": "watchedOn", + "summary": "Date/Time the content was watched, ISO 8601 Date/Time", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "agePolicy", + "description": "The age policy associated with the watch event. The age policy describes the age groups to which content may be directed.", + "schema": { + "$ref": "https://meta.comcast.com/firebolt/policies#/definitions/AgePolicy" + } + } + ], + "result": { + "name": "result", + "summary": "Whether the platform accepted the watched notification", + "schema": { + "type": "boolean" + } + }, + "examples": [ + { + "name": "Notify the platform of watched content (v2)", + "params": [ + { + "name": "entityId", + "value": "partner.com/entity/123" + }, + { + "name": "progress", + "value": 0.95 + }, + { + "name": "completed", + "value": true + }, + { + "name": "watchedOn", + "value": "2021-04-23T18:25:43.511Z" + } + ], + "result": { + "name": "result", + "value": true + } + }, + { + "name": "Notify the platform that child-directed content was watched (v2)", + "params": [ + { + "name": "entityId", + "value": "partner.com/entity/123" + }, + { + "name": "progress", + "value": 0.95 + }, + { + "name": "completed", + "value": true + }, + { + "name": "watchedOn", + "value": "2021-04-23T18:25:43.511Z" + }, + { + "name": "agePolicy", + "value": "app:child" + } + ], + "result": { + "name": "result", + "value": true + } + } + ] } ] } diff --git a/docs/openrpc/the-spec/firebolt-open-rpc.json b/docs/openrpc/the-spec/firebolt-open-rpc.json index 9ad9084..1315678 100644 --- a/docs/openrpc/the-spec/firebolt-open-rpc.json +++ b/docs/openrpc/the-spec/firebolt-open-rpc.json @@ -644,6 +644,124 @@ } ] }, + { + "name": "Discovery.watchedV2", + "summary": "Notify the platform that content was partially or completely watched, returns whether the notification was accepted", + "tags": [ + { + "name": "polymorphic-reducer" + }, + { + "name": "capabilities", + "x-uses": [ + "xrn:firebolt:capability:discovery:watched" + ] + } + ], + "params": [ + { + "name": "entityId", + "required": true, + "schema": { + "type": "string" + }, + "summary": "The entity Id of the watched content." + }, + { + "name": "progress", + "summary": "How much of the content has been watched (percentage as (0-0.999) for VOD, number of seconds for live)", + "schema": { + "type": "number", + "minimum": 0 + } + }, + { + "name": "completed", + "summary": "Whether or not this viewing is considered \"complete,\" per the app's definition thereof", + "schema": { + "type": "boolean" + } + }, + { + "name": "watchedOn", + "summary": "Date/Time the content was watched, ISO 8601 Date/Time", + "schema": { + "type": "string", + "format": "date-time" + } + }, + { + "name": "agePolicy", + "description": "The age policy associated with the watch event. The age policy describes the age groups to which content may be directed.", + "schema": { + "$ref": "#/x-schemas/Policies/AgePolicy" + } + } + ], + "result": { + "name": "result", + "summary": "Whether the platform accepted the watched notification", + "schema": { + "type": "boolean" + } + }, + "examples": [ + { + "name": "Notify the platform of watched content (v2)", + "params": [ + { + "name": "entityId", + "value": "partner.com/entity/123" + }, + { + "name": "progress", + "value": 0.95 + }, + { + "name": "completed", + "value": true + }, + { + "name": "watchedOn", + "value": "2021-04-23T18:25:43.511Z" + } + ], + "result": { + "name": "result", + "value": true + } + }, + { + "name": "Notify the platform that child-directed content was watched (v2)", + "params": [ + { + "name": "entityId", + "value": "partner.com/entity/123" + }, + { + "name": "progress", + "value": 0.95 + }, + { + "name": "completed", + "value": true + }, + { + "name": "watchedOn", + "value": "2021-04-23T18:25:43.511Z" + }, + { + "name": "agePolicy", + "value": "app:child" + } + ], + "result": { + "name": "result", + "value": true + } + } + ] + }, { "name": "Display.edid", "summary": "Returns the EDID (and extensions) of the connected or integral display, as a Base64 encoded string", diff --git a/include/firebolt/discovery.h b/include/firebolt/discovery.h index 885380e..894a768 100644 --- a/include/firebolt/discovery.h +++ b/include/firebolt/discovery.h @@ -44,5 +44,23 @@ class IDiscovery virtual Result watched(const std::string& entityId, std::optional progress, std::optional completed, std::optional watchedOn, std::optional agePolicy) const = 0; + + /** + * @brief Notify the platform that content was partially or completely watched, returns whether the notification + * was accepted + * + * @param[in] entityId : The entity Id of the watched content + * @param[in] progress : How much of the content has been watched (percentage as (0-0.999) for VOD, number of + * seconds for live) + * @param[in] completed : Whether or not this viewing is considered "complete" per the app's definition thereof + * @param[in] watchedOn : The ISO 8601 timestamp of when the content was watched + * @param[in] agePolicy : The age policy associated with the watch event. The age policy describes the age groups + * to which content may be directed + * + * @retval Whether the platform accepted the watched notification, or an error + */ + virtual Result watchedV2(const std::string& entityId, std::optional progress, + std::optional completed, std::optional watchedOn, + std::optional agePolicy) const = 0; }; } // namespace Firebolt::Discovery diff --git a/src/discovery_impl.cpp b/src/discovery_impl.cpp index e653777..3504399 100644 --- a/src/discovery_impl.cpp +++ b/src/discovery_impl.cpp @@ -52,4 +52,30 @@ Result DiscoveryImpl::watched(const std::string& entityId, std::optional DiscoveryImpl::watchedV2(const std::string& entityId, std::optional progress, + std::optional completed, std::optional watchedOn, + std::optional agePolicy) const +{ + nlohmann::json parameters; + parameters["entityId"] = entityId; + if (progress) + { + parameters["progress"] = *progress; + } + if (completed) + { + parameters["completed"] = *completed; + } + if (watchedOn) + { + parameters["watchedOn"] = *watchedOn; + } + if (agePolicy) + { + parameters["agePolicy"] = Firebolt::JSON::toString(Firebolt::JsonData::AgePolicyEnum, *agePolicy); + } + + return helper_.get("Discovery.watchedV2", parameters); +} } // namespace Firebolt::Discovery diff --git a/src/discovery_impl.h b/src/discovery_impl.h index 34e12f1..96b2d70 100644 --- a/src/discovery_impl.h +++ b/src/discovery_impl.h @@ -37,6 +37,10 @@ class DiscoveryImpl : public IDiscovery std::optional watchedOn, std::optional agePolicy) const override; + Result watchedV2(const std::string& entityId, std::optional progress, std::optional completed, + std::optional watchedOn, + std::optional agePolicy) const override; + private: Firebolt::Helpers::IHelper& helper_; }; diff --git a/test/api_test_app/apis/discoveryDemo.cpp b/test/api_test_app/apis/discoveryDemo.cpp index 5e0b9d6..98b199a 100644 --- a/test/api_test_app/apis/discoveryDemo.cpp +++ b/test/api_test_app/apis/discoveryDemo.cpp @@ -33,6 +33,7 @@ DiscoveryDemo::DiscoveryDemo() : DemoBase("Discovery") { methods_.push_back("Discovery.watched"); + methods_.push_back("Discovery.watchedV2"); } void DiscoveryDemo::runOption(const std::string& method) @@ -64,4 +65,29 @@ void DiscoveryDemo::runOption(const std::string& method) std::cout << "Discovery.watched: Success" << std::endl; } } + else if (method == "Discovery.watchedV2") + { + std::string entityId = paramFromConsole("entityId", "exampleEntityId"); + std::optional progress = 0.5; + try + { + progress = std::stod( + paramFromConsole("progress (percentage as (0-0.999) for VOD, number of seconds for live)", "0.5")); + } + catch (const std::exception&) + { + } + std::optional completed = paramFromConsole("completed (true/false)", "false") == "true"; + std::string watchedOn = paramFromConsole("watchedOn (ISO 8601 timestamp)", "2024-01-01T00:00:00Z"); + + std::optional agePolicyOpt = + chooseEnumFromList(Firebolt::JsonData::AgePolicyEnum, "Choose an age policy for the watch event:"); + + auto r = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().watchedV2(entityId, progress, completed, + watchedOn, agePolicyOpt); + if (succeed(r)) + { + std::cout << "Discovery.watchedV2: " << (*r ? "true" : "false") << std::endl; + } + } } diff --git a/test/component/discoveryTest.cpp b/test/component/discoveryTest.cpp index c1cfcf1..b95da12 100644 --- a/test/component/discoveryTest.cpp +++ b/test/component/discoveryTest.cpp @@ -31,3 +31,11 @@ TEST_F(DiscoveryCTest, Watched) Firebolt::AgePolicy::ADULT); ASSERT_TRUE(result) << "Failed to call watched"; } + +TEST_F(DiscoveryCTest, WatchedV2) +{ + auto result = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().watchedV2("entity123", 0.75f, true, + "2024-10-01T12:00:00Z", + Firebolt::AgePolicy::ADULT); + ASSERT_TRUE(result) << "Failed to call watchedV2"; +} diff --git a/test/unit/discoveryTest.cpp b/test/unit/discoveryTest.cpp index 9b7b1b1..46fb672 100644 --- a/test/unit/discoveryTest.cpp +++ b/test/unit/discoveryTest.cpp @@ -70,3 +70,42 @@ TEST_F(DiscoveryUTest, watched_payload) auto result = discoveryImpl_.watched(entityId, progress, completed, watchedOn, agePolicy); ASSERT_TRUE(result) << "Error on watched"; } + +TEST_F(DiscoveryUTest, watchedV2) +{ + mock("Discovery.watchedV2"); + std::string entityId = "content123"; + std::optional progress = 0.75f; + std::optional completed = true; + std::optional watchedOn = "2024-06-01T12:00:00Z"; + std::optional agePolicy = Firebolt::AgePolicy::ADULT; + auto result = discoveryImpl_.watchedV2(entityId, progress, completed, watchedOn, agePolicy); + ASSERT_TRUE(result) << "Error on watchedV2"; + EXPECT_TRUE(*result); +} + +TEST_F(DiscoveryUTest, watchedV2_payload) +{ + nlohmann::json expected; + expected["entityId"] = "content123"; + expected["progress"] = 0.75f; + expected["completed"] = true; + expected["watchedOn"] = "2024-06-01T12:00:00Z"; + expected["agePolicy"] = "app:adult"; + EXPECT_CALL(mockHelper, getJson("Discovery.watchedV2", _)) + .WillOnce(Invoke( + [&](const std::string& /* methodName */, const nlohmann::json& parameters) + { + EXPECT_EQ(parameters, expected) << "Parameters do not match expected payload: " << expected.dump() + << " but got: " << parameters.dump(); + return Firebolt::Result{nlohmann::json(true)}; + })); + std::string entityId = "content123"; + std::optional progress = 0.75f; + std::optional completed = true; + std::optional watchedOn = "2024-06-01T12:00:00Z"; + std::optional agePolicy = Firebolt::AgePolicy::ADULT; + auto result = discoveryImpl_.watchedV2(entityId, progress, completed, watchedOn, agePolicy); + ASSERT_TRUE(result) << "Error on watchedV2"; + EXPECT_TRUE(*result); +} From a7770e8b02e0254dd1670148473266df1b6368bf Mon Sep 17 00:00:00 2001 From: swethasukumarr Date: Wed, 10 Jun 2026 14:41:56 -0400 Subject: [PATCH 37/38] RDKEMW-17483 : Fix component test for discovery.watchedV2 --- test/component/discoveryTest.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/component/discoveryTest.cpp b/test/component/discoveryTest.cpp index b95da12..e0ae6f5 100644 --- a/test/component/discoveryTest.cpp +++ b/test/component/discoveryTest.cpp @@ -18,10 +18,13 @@ #include "firebolt/discovery.h" #include "firebolt/firebolt.h" +#include "json_engine.h" #include class DiscoveryCTest : public ::testing::Test { +protected: + JsonEngine jsonEngine; }; TEST_F(DiscoveryCTest, Watched) @@ -34,8 +37,10 @@ TEST_F(DiscoveryCTest, Watched) TEST_F(DiscoveryCTest, WatchedV2) { + auto expectedValue = jsonEngine.get_value("Discovery.watchedV2"); auto result = Firebolt::IFireboltAccessor::Instance().DiscoveryInterface().watchedV2("entity123", 0.75f, true, "2024-10-01T12:00:00Z", Firebolt::AgePolicy::ADULT); ASSERT_TRUE(result) << "Failed to call watchedV2"; + EXPECT_EQ(*result, expectedValue.get()); } From f93ee051eb543762d55087268be079658f4f2dd6 Mon Sep 17 00:00:00 2001 From: swethasukumarr Date: Thu, 11 Jun 2026 14:54:37 -0400 Subject: [PATCH 38/38] RDKEMW-19494: Update changelog for patch release 0.6.1 --- CHANGELOG.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 58e532d..767263f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## [0.6.1](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.6.0...v0.6.1) + +### Added +- `Discovery.watchedV2`: same as `Discovery.watched` but returns `Result` - compatibility shim for callers migrating away from the pre-v0.6.0 boolean return type + ## [0.6.0](https://github.com/rdkcentral/firebolt-cpp-client/compare/v0.5.5...v0.6.0) ### Added