Skip to content

Use system dependencies#15

Closed
saksham-chawla wants to merge 9 commits intocodex/replay-pr-14-basefrom
codex/replay-pr-14-head
Closed

Use system dependencies#15
saksham-chawla wants to merge 9 commits intocodex/replay-pr-14-basefrom
codex/replay-pr-14-head

Conversation

@saksham-chawla
Copy link
Copy Markdown
Collaborator

@saksham-chawla saksham-chawla commented Mar 18, 2026

This is a showcase of baselibs building with all system dependencies for all libraries and tools, for demonstration and discussion.

The S-CORE infrastructure team has been discussing how S-CORE can be integrated into a wider system. It is usually requirements for integrators that:

  • they can control all dependencies and tools in a centralised manner, e.g. via a meta-build tool such as Bitbake or BuildStream
  • no pre-built binaries are brought in by any component

Currently, S-CORE components do not meet either of these requirements, because:

  • all dependencies are pinned to exact versions and pulled in by Bazel
  • a specific pre-built compiler is downloaded
  • pre-built libraries are downloaded from Ubuntu (though this one is just a temporary workaround)

This PR modifies baselibs to address these points. All dependencies now must be installed in the system in order to build. For me on Ubuntu, that means installing these packages:

g++ libacl1-dev libcap-dev libseccomp-dev valgrind libboost-container1.83-dev nlohmann-json3-dev


It also shifts responsibility for the compiler/toolchain itself to the host system rather than relying on Bazel-provisioned toolchains.

Architecture Diagram:

flowchart TD
    subgraph Build_Configuration
        M["MODULE.bazel (-81 lines)"]
        RC[".bazelrc (+1 line)"]
        BF["BUILD files (-27 lines)"]
    end

    subgraph Application_Code
        AC["Baselibs C++ Code"]
        JPT["json_parser_test.cpp (-45 lines)"]
    end

    subgraph Dependency_Sources
        OldDeps[/"'Bazel-managed Dependencies (removed)'"/]
        SysDeps[("System-installed Libraries")]
    end

    M -- "removes config for" --> OldDeps
    M -- "configures for" --> SysDeps
    RC -- "configures compiler for" --> SysDeps

    BF -- "updates links to" --> SysDeps
    AC -- "now uses" --> SysDeps

    JPT -- "removes tests for" --> AC
Loading

This summary was automatically generated by @propel-code-bot

I had to delete some JSON tests because:

- they use tmpnam
- tmpnam causes the linker to emit a warning, since it's unsafe
- Bazel linking rules treat warnings as errors

I tried adding the linkopt -Wl,--no-fatal-warnings but it had no effect.
@saksham-chawla saksham-chawla marked this pull request as ready for review March 18, 2026 18:17
Copy link
Copy Markdown

@propel-code-bot propel-code-bot Bot left a comment

Choose a reason for hiding this comment

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

Changes suggested to prevent build breakages, restore public API tests, and narrow warnings.

Status: Changes Suggested | Risk: Medium | Readiness: 5/10 (Needs Polish)

Issues Identified & Suggestions
  • Fix missing system dependency targets: score/concurrency/BUILD, third_party/boost/BUILD, score/json/internal/parser/nlohmann/BUILD
  • Reinstate public JsonParser::FromFile tests: json_parser_test.cpp
  • Scope move-warning demotion per target: .bazelrc
Review Details

📁 13 files reviewed | 💬 5 comments

👍 / 👎 individual comments to help improve reviews for you

Comment thread score/concurrency/BUILD
Comment on lines 409 to 411
deps = [
":synchronized_queue",
":valgrind_on_host",
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Important

[Logic] The valgrind_on_host target and //third_party/valgrind package were deleted entirely, but synchronized_queue_test.cpp still contains #include <valgrind/valgrind.h> (line 17) and uses the RUNNING_ON_VALGRIND macro (line 172). Since no Bazel target provides this header anymore, this will cause a compile failure on non-QNX platforms.

Either:

  1. Remove the #include <valgrind/valgrind.h> and replace TEST_RUNNING_ON_VALGRIND with a non-valgrind alternative (e.g., always false), or
  2. Add a system-level cc_library wrapper for valgrind headers (like the other system deps such as libcap2, acl) and keep the dependency in the test target.
Context for Agents
The `valgrind_on_host` target and `//third_party/valgrind` package were deleted entirely, but `synchronized_queue_test.cpp` still contains `#include <valgrind/valgrind.h>` (line 17) and uses the `RUNNING_ON_VALGRIND` macro (line 172). Since no Bazel target provides this header anymore, this will cause a compile failure on non-QNX platforms.

Either:
1. Remove the `#include <valgrind/valgrind.h>` and replace `TEST_RUNNING_ON_VALGRIND` with a non-valgrind alternative (e.g., always `false`), or
2. Add a system-level `cc_library` wrapper for valgrind headers (like the other system deps such as `libcap2`, `acl`) and keep the dependency in the test target.

File: score/concurrency/BUILD
Line: 411
Chain of Thought
  • Validation Decision: accepted
  • Confidence: 0.95
  • Likelihood Score: 5/5
  • Likelihood Reason: The test file at HEAD still contains #include &lt;valgrind/valgrind.h&gt; (line 17) and uses the RUNNING_ON_VALGRIND macro (line 172), but the PR deletes both third_party/valgrind/BUILD and third_party/valgrind/valgrind.BUILD entirely, removes the valgrind_on_host cc_library target, and removes :valgrind_on_host from the test's deps. Without any Bazel target providing the valgrind headers, this will inevitably cause a compile failure on non-QNX platforms.
  • Suggested Action: modify
  • Tool Calls Used: 10

Reasoning

The comment correctly identifies a build break introduced by this PR. Here's the evidence:

  1. Test file still includes valgrind header: synchronized_queue_test.cpp at HEAD (line 17) still has #include &lt;valgrind/valgrind.h&gt; (guarded by #if !defined(__QNX__)), and uses the RUNNING_ON_VALGRIND macro at line 172.

  2. All valgrind Bazel targets deleted: The PR deletes third_party/valgrind/BUILD and third_party/valgrind/valgrind.BUILD entirely (confirmed: both return "File not found" at HEAD). The valgrind_on_host cc_library in score/concurrency/BUILD is also deleted, and the :valgrind_on_host dep is removed from synchronized_queue_test.

  3. No replacement system dependency: The PR converts other third-party deps to system wrappers using cc_library with linkopts (e.g., libcap2, libseccomp2, acl), but no equivalent system wrapper was created for valgrind. Unlike linking libraries, valgrind is a headers-only dependency for annotations, but it still needs a Bazel target or system include path.

  4. This is introduced by the PR: Before this PR, the dependency chain was intact: synchronized_queue_test:valgrind_on_host//third_party/valgrind@valgrind-deb//:valgrind which provided the headers. The PR breaks this chain without updating the source file.

Minor inaccuracy: The comment mentions valgrind/helgrind.h and valgrind/memcheck.h, but the actual include is valgrind/valgrind.h. This doesn't affect the validity of the core issue.

The fix is clear: either remove the valgrind includes from the test source file and refactor the TEST_RUNNING_ON_VALGRIND macro, or create a system-level cc_library wrapper for valgrind headers (consistent with the pattern used for other system deps) and maintain the dependency.

Evidence Summary

1. File Lookup

  • Filename: synchronized_queue_test.cpp
Found 1 file(s) matching 'synchronized_queue_test.cpp':
- score/concurrency/synchronized_queue_test.cpp

2. File Snapshot (BASE)

  • File: third_party/valgrind/BUILD
1: alias(
2:     name = "valgrind",
3:     actual = "@valgrind-deb//:valgrind",
4:     visibility = ["//visibility:public"],
5: )

3. File Snapshot (BASE)

  • File: third_party/valgrind/valgrind.BUILD
1: cc_library(
2:     name = "valgrind",
3:     hdrs = glob(["usr/include/**/*.h"]),
4:     includes = ["usr/include/"],
5:     visibility = ["//visibility:public"],
6: )
7:

4. File Snapshot (HEAD)

  • File: score/concurrency/synchronized_queue_test.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

5. File Snapshot (BASE)

  • File: score/concurrency/synchronized_queue_test.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

6. File Snapshot (HEAD)

  • File: third_party/libcap2/BUILD
1: cc_library(
2:     name = "libcap2",
3:     linkopts = ["-lcap"],
4:     visibility = ["//visibility:public"],
5: )
6:

7. File Snapshot (HEAD)

  • File: third_party/acl/BUILD
1: cc_library(
2:     name = "acl",
3:     linkopts = ["-lacl"],
4:     visibility = ["//visibility:public"],
5: )
6:

8. File Snapshot (HEAD)

  • File: third_party/libseccomp2/BUILD
1: cc_library(
2:     name = "libseccomp2",
3:     linkopts = ["-lseccomp"],
4:     visibility = ["//visibility:public"],
5: )
6:

Fix in Cursor

Comment thread third_party/boost/BUILD
Comment on lines +1 to 5
cc_library(
name = "container",
actual = "@boost//:container",
visibility =["//visibility:public"],
linkopts = ["-lboost_container"],
visibility = ["//visibility:public"],
)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Important

[Reliability] Removing the //third_party/boost:interprocess target from the BUILD file and the dependency from map will break any downstream consumer (inside or outside this repo) that depends on //third_party/boost:interprocess. The program_options target was also silently removed. If any target in the wider build graph still references these, the build will fail with a missing target error.

Either keep stub cc_library targets for interprocess and program_options (with system linkopts, like container), or verify no remaining consumer exists and document the removal as a breaking change.

Suggested change
cc_library(
name = "container",
actual = "@boost//:container",
visibility =["//visibility:public"],
linkopts = ["-lboost_container"],
visibility = ["//visibility:public"],
)
cc_library(
name = "container",
linkopts = ["-lboost_container"],
visibility = ["//visibility:public"],
)
cc_library(
name = "interprocess",
# header-only on Linux; no linkopts needed
visibility = ["//visibility:public"],
)
cc_library(
name = "program_options",
linkopts = ["-lboost_program_options"],
visibility = ["//visibility:public"],
)
Context for Agents
Removing the `//third_party/boost:interprocess` target from the BUILD file and the dependency from `map` will break any downstream consumer (inside or outside this repo) that depends on `//third_party/boost:interprocess`. The `program_options` target was also silently removed. If any target in the wider build graph still references these, the build will fail with a missing target error.

Either keep stub `cc_library` targets for `interprocess` and `program_options` (with system linkopts, like `container`), or verify no remaining consumer exists and document the removal as a breaking change.

```suggestion
cc_library(
    name = "container",
    linkopts = ["-lboost_container"],
    visibility = ["//visibility:public"],
)

cc_library(
    name = "interprocess",
    # header-only on Linux; no linkopts needed
    visibility = ["//visibility:public"],
)

cc_library(
    name = "program_options",
    linkopts = ["-lboost_program_options"],
    visibility = ["//visibility:public"],
)
```

File: third_party/boost/BUILD
Line: 5
Chain of Thought
  • Validation Decision: accepted
  • Confidence: 0.00
  • Likelihood Score: 0/5
  • Suggested Action: keep
  • Tool Calls Used: 16

Reasoning

Failed to parse validation response

Evidence Summary

1. File Snapshot (HEAD)

  • File: score/memory/shared/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

2. File Snapshot (BASE)

  • File: score/memory/shared/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

3. File Snapshot (HEAD)

  • File: score/concurrency/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

4. File Snapshot (HEAD)

  • File: third_party/boost/BUILD
1: cc_library(
2:     name = "container",
3:     linkopts = ["-lboost_container"],
4:     visibility = ["//visibility:public"],
5: )
6:

5. File Snapshot (BASE)

  • File: score/concurrency/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

6. File Snapshot (HEAD)

  • File: MODULE.bazel
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

7. File Snapshot (BASE)

  • File: MODULE.bazel
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

Fix in Cursor

Comment on lines 21 to 25
deps = [
"@score-baselibs//score/json/internal/model",
"@score-baselibs//score/result",
"@nlohmann_json//:json",
"@score-baselibs//score/language/futurecpp",
],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Important

[Maintainability] The @nlohmann_json//:json dependency was removed from both json_builder and nlohmann_parser targets, but the source code (e.g., nlohmann_parser.cpp includes "nlohmann/json.hpp") still requires this header. Unlike the other system dependencies (acl, libcap2, libseccomp2, boost), no cc_library wrapper was created in third_party/ for nlohmann_json. This makes the nlohmann header dependency invisible to Bazel's dependency graph and relies entirely on the system compiler's implicit include paths finding the header.

Create a wrapper target (e.g., third_party/nlohmann_json/BUILD) consistent with the pattern used for other system dependencies:

cc_library(
    name = "json",
    # header-only, no linkopts needed
    visibility = ["//visibility:public"],
)

and reference it from the deps here.

Context for Agents
The `@nlohmann_json//:json` dependency was removed from both `json_builder` and `nlohmann_parser` targets, but the source code (e.g., `nlohmann_parser.cpp` includes `"nlohmann/json.hpp"`) still requires this header. Unlike the other system dependencies (acl, libcap2, libseccomp2, boost), no `cc_library` wrapper was created in `third_party/` for nlohmann_json. This makes the nlohmann header dependency invisible to Bazel's dependency graph and relies entirely on the system compiler's implicit include paths finding the header.

Create a wrapper target (e.g., `third_party/nlohmann_json/BUILD`) consistent with the pattern used for other system dependencies:
```starlark
cc_library(
    name = "json",
    # header-only, no linkopts needed
    visibility = ["//visibility:public"],
)
```
and reference it from the deps here.

File: score/json/internal/parser/nlohmann/BUILD
Line: 25
Chain of Thought
  • Validation Decision: accepted
  • Confidence: 0.92
  • Likelihood Score: 4/5
  • Likelihood Reason: The nlohmann_json dependency is removed from both MODULE.bazel and the BUILD file, but source files still include nlohmann/json.hpp. This makes the build rely on implicit system include paths. In sandboxed Bazel builds or clean environments, this could break. The inconsistency with other system dependencies (which all have third_party/ wrappers) will create maintenance confusion and could cause build failures.
  • Suggested Action: keep
  • Tool Calls Used: 18

Reasoning

The comment is accurate on all points:

  1. Dependency removal confirmed: @nlohmann_json//:json was removed from both json_builder and nlohmann_parser targets in the BUILD file, AND bazel_dep(name = &#34;nlohmann_json&#34;, version = &#34;3.11.3&#34;) was removed from MODULE.bazel.

  2. Source code still requires the header: Both nlohmann_parser.cpp (line 17) and json_builder.cpp (line 21) include &#34;nlohmann/json.hpp&#34;.

  3. No wrapper created: There is no third_party/nlohmann_json/BUILD file — confirmed by find_file.

  4. Inconsistency with other dependencies: The PR creates wrapper cc_library targets in third_party/ for acl, boost, libcap2, and libseccomp2, but not for nlohmann_json. This is a clear inconsistency in the approach.

  5. Issue introduced by this PR: This is directly caused by the PR's changes — the dependency was properly managed before (via bazel_dep + @nlohmann_json//:json), and this PR removes it without creating a replacement wrapper.

  6. Actionable: The comment provides a concrete code suggestion with a wrapper BUILD file, consistent with the pattern used for other system dependencies.

The only nuance is that nlohmann_json is header-only (no linkopts needed), but the comment correctly acknowledges this with its # header-only, no linkopts needed suggestion. Even without linkopts, a wrapper target would maintain consistency, make the dependency visible in the graph, and ensure proper Bazel sandboxing behavior.

Evidence Summary

1. File Snapshot (HEAD)

  • File: score/json/internal/parser/nlohmann/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

2. File Lookup

  • Filename: nlohmann_parser.cpp
Found 1 file(s) matching 'nlohmann_parser.cpp':
- score/json/internal/parser/nlohmann/nlohmann_parser.cpp

3. File Lookup

  • Filename: BUILD
  • Max Results: 10
Found 10 file(s) matching 'BUILD':
- bazel/settings/qemu/BUILD
- BUILD
- score/analysis/tracing/common/canary_wrapper/BUILD
- score/analysis/tracing/common/canary_wrapper/test/BUILD
- score/analysis/tracing/common/flexible_circular_allocator/BUILD
- score/analysis/tracing/common/flexible_circular_allocator/error_codes/factory/BUILD
- score/analysis/tracing/common/flexible_circular_allocator/error_codes/flexible_circular_allocator/BUILD
- score/analysis/tracing/common/flexible_circular_allocator/error_codes/lockless_flexible_circular_allocator/BUILD
- score/analysis/tracing/common/flexible_circular_allocator/test/mocks/BUILD
...

4. File Lookup

  • Filename: json_builder.cpp
Found 1 file(s) matching 'json_builder.cpp':
- score/json/internal/parser/nlohmann/json_builder.cpp

5. File Snapshot (HEAD)

  • File: third_party/libcap2/BUILD
1: cc_library(
2:     name = "libcap2",
3:     linkopts = ["-lcap"],
4:     visibility = ["//visibility:public"],
5: )
6:

6. File Snapshot (HEAD)

  • File: third_party/libseccomp2/BUILD
1: cc_library(
2:     name = "libseccomp2",
3:     linkopts = ["-lseccomp"],
4:     visibility = ["//visibility:public"],
5: )
6:

7. File Snapshot (HEAD)

  • File: .bazelrc
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

8. File Snapshot (HEAD)

  • File: third_party/acl/BUILD
1: cc_library(
2:     name = "acl",
3:     linkopts = ["-lacl"],
4:     visibility = ["//visibility:public"],
5: )
6:

9. File Snapshot (HEAD)

  • File: third_party/boost/BUILD
1: cc_library(
2:     name = "container",
3:     linkopts = ["-lboost_container"],
4:     visibility = ["//visibility:public"],
5: )
6:

10. File Snapshot (HEAD)

  • File: score/json/internal/parser/nlohmann/nlohmann_parser.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

11. File Snapshot (HEAD)

  • File: score/json/internal/parser/nlohmann/json_builder.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

12. File Snapshot (HEAD)

  • File: MODULE.bazel
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

13. File Lookup

  • Filename: nlohmann_json
No files found matching 'nlohmann_json'

14. File Snapshot (BASE)

  • File: MODULE.bazel
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

15. File Snapshot (HEAD)

  • File: score/concurrency/BUILD
  • Lines: 1-30
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

16. File Snapshot (HEAD)

  • File: score/memory/shared/BUILD
  • Lines: 1-30
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

Fix in Cursor

EXPECT_EXIT(JSON_ERROR_INPUT ""_json, ::testing::KilledBySignal(SIGABRT), "");
}

TEST(JsonParserTest, FromFileSuceess)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Important

[Testing] The FromFileSuceess and FromFileParseError tests that verified requirement SCR-5310867 for the public JsonParser::FromFile API were removed entirely. While the typed test suite in parsers_test_suite.h covers FromFile at the internal parser level (ParsingFromFileWorks, FromFileFail), these were the only tests exercising the public JsonParser::FromFile entry point. This reduces requirement coverage for a safety-relevant (ASIL B) API.

If these tests were removed solely because std::tmpnam doesn't work in the sandboxed build, consider rewriting them using TEST_TMPDIR (set by Bazel) or the existing FileTestUtils::GetTempDirectory() helper (seen in score/filesystem/file_utils/file_test_utils.cpp from the codebase context).

Context for Agents
The `FromFileSuceess` and `FromFileParseError` tests that verified requirement SCR-5310867 for the public `JsonParser::FromFile` API were removed entirely. While the typed test suite in `parsers_test_suite.h` covers `FromFile` at the internal parser level (`ParsingFromFileWorks`, `FromFileFail`), these were the only tests exercising the **public** `JsonParser::FromFile` entry point. This reduces requirement coverage for a safety-relevant (ASIL B) API.

If these tests were removed solely because `std::tmpnam` doesn't work in the sandboxed build, consider rewriting them using `TEST_TMPDIR` (set by Bazel) or the existing `FileTestUtils::GetTempDirectory()` helper (seen in `score/filesystem/file_utils/file_test_utils.cpp` from the codebase context).

File: score/json/internal/parser/json_parser_test.cpp
Line: 92
Chain of Thought
  • Validation Decision: accepted
  • Confidence: 0.00
  • Likelihood Score: 0/5
  • Suggested Action: keep
  • Tool Calls Used: 17

Reasoning

Failed to parse validation response

Evidence Summary

1. File Lookup

  • Filename: file_test_utils.cpp
Found 1 file(s) matching 'file_test_utils.cpp':
- score/filesystem/file_utils/file_test_utils.cpp

2. File Lookup

  • Filename: parsers_test_suite.h
Found 1 file(s) matching 'parsers_test_suite.h':
- score/json/internal/parser/parsers_test_suite.h

3. File Snapshot (BASE)

  • File: score/json/internal/parser/json_parser_test.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

4. File Snapshot (BASE)

  • File: score/json/internal/parser/parsers_test_suite.h
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

5. File Snapshot (BASE)

  • File: score/filesystem/file_utils/file_test_utils.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

6. File Lookup

  • Filename: json_parser.h
Found 1 file(s) matching 'json_parser.h':
- score/json/json_parser.h

7. File Lookup

  • Filename: nlohmann_parser_test.cpp
Found 1 file(s) matching 'nlohmann_parser_test.cpp':
- score/json/internal/parser/nlohmann/nlohmann_parser_test.cpp

8. File Snapshot (BASE)

  • File: score/json/json_parser.h
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

9. File Snapshot (BASE)

  • File: score/json/internal/parser/nlohmann/nlohmann_parser_test.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

10. File Lookup

  • Filename: json_parser.cpp
Found 1 file(s) matching 'json_parser.cpp':
- score/json/json_parser.cpp

11. File Lookup

  • Filename: nlohmann_parser.h
Found 1 file(s) matching 'nlohmann_parser.h':
- score/json/internal/parser/nlohmann/nlohmann_parser.h

12. File Snapshot (BASE)

  • File: score/json/json_parser.cpp
1: /********************************************************************************
2:  * Copyright (c) 2025 Contributors to the Eclipse Foundation
3:  *
4:  * See the NOTICE file(s) distributed with this work for additional
5:  * information regarding copyright ownership.
6:  *
7:  * This program and the accompanying materials are made available under the
8:  * terms of the Apache License Version 2.0 which is available at
9:  * https://www.apache.org/licenses/LICENSE-2.0
10:  *
...

Fix in Cursor

Comment thread .bazelrc
common --//score/json:base_library=nlohmann
common --extra_toolchains=@gcc_toolchain//:host_gcc_12
build --incompatible_strict_action_env
build --cxxopt=-std=c++17 --cxxopt=-Wno-error=deprecated-declarations --cxxopt=-Wno-error=self-move --cxxopt=-Wno-error=pessimizing-move
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Recommended

[Maintainability] -Wno-error=self-move and -Wno-error=pessimizing-move demote move-semantics warnings from errors to warnings globally for all targets. These warnings catch real bugs (e.g., return std::move(local) preventing copy elision, self-move-assignment). Applying them project-wide means these issues won't cause build failures in any existing or future code.

Consider scoping these to specific targets that need them (via copts in their cc_library/cc_test rules, e.g., the third_party wrappers) instead of applying globally in .bazelrc. The codebase already has per-target warning configuration via COMPILER_WARNING_FEATURES.

Context for Agents
`-Wno-error=self-move` and `-Wno-error=pessimizing-move` demote move-semantics warnings from errors to warnings globally for all targets. These warnings catch real bugs (e.g., `return std::move(local)` preventing copy elision, self-move-assignment). Applying them project-wide means these issues won't cause build failures in any existing or future code.

Consider scoping these to specific targets that need them (via `copts` in their `cc_library`/`cc_test` rules, e.g., the third_party wrappers) instead of applying globally in `.bazelrc`. The codebase already has per-target warning configuration via `COMPILER_WARNING_FEATURES`.

File: .bazelrc
Line: 22
Chain of Thought
  • Validation Decision: accepted
  • Confidence: 0.85
  • Likelihood Score: 4/5
  • Likelihood Reason: The flags are newly introduced by this PR and apply globally to all build targets. As the codebase grows, this will hide real move-semantics issues in all future code. The individual targets already demonstrate per-target feature usage (COMPILER_WARNING_FEATURES), so scoping these overrides would be consistent and feasible.
  • Suggested Action: modify
  • Tool Calls Used: 9

Reasoning

The comment is valid and addresses a real issue introduced by this PR:

  1. New issue introduced by PR: The base .bazelrc does NOT contain -Wno-error=self-move or -Wno-error=pessimizing-move. This PR adds line 22: build --cxxopt=-std=c++17 --cxxopt=-Wno-error=deprecated-declarations --cxxopt=-Wno-error=self-move --cxxopt=-Wno-error=pessimizing-move. This is clearly new, not legacy debt.

  2. Accuracy: The comment correctly identifies that these flags apply globally to all targets. Technically, -Wno-error= flags don't suppress warnings entirely but prevent them from being treated as errors (demoting them from errors to warnings). The comment says "suppress...warnings" which is slightly imprecise, but the core concern is valid — issues that would otherwise cause build failures will now be silently passed.

  3. Actionability: The suggestion is concrete and actionable — use copts in specific cc_library/cc_test rules that actually need these suppressions. Looking at the BUILD files in this PR, the codebase already has a well-established pattern of per-target feature configuration (e.g., features = COMPILER_WARNING_FEATURES is used extensively in score/concurrency/BUILD and score/memory/shared/BUILD). This makes the suggestion particularly apt — the infrastructure for per-target configuration already exists.

  4. Context: This PR is about switching to system dependencies. The warning suppressions are likely needed because system-installed headers (e.g., Boost, nlohmann-json) trigger these warnings. Scoping them to the third_party/ BUILD files (which wrap system libraries) would be the ideal approach, limiting the blast radius.

  5. Impact: Applying these globally means any future code with self-move or pessimizing-move issues will not trigger build errors, reducing code quality enforcement across the entire project.

Evidence Summary

1. File Snapshot (HEAD)

  • File: .bazelrc
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

2. File Snapshot (BASE)

  • File: .bazelrc
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

3. File Snapshot (HEAD)

  • File: third_party/boost/BUILD
1: cc_library(
2:     name = "container",
3:     linkopts = ["-lboost_container"],
4:     visibility = ["//visibility:public"],
5: )
6:

4. File Snapshot (HEAD)

  • File: score/json/internal/parser/nlohmann/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

5. File Snapshot (HEAD)

  • File: score/concurrency/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

6. File Snapshot (HEAD)

  • File: score/memory/shared/BUILD
1: # *******************************************************************************
2: # Copyright (c) 2025 Contributors to the Eclipse Foundation
3: #
4: # See the NOTICE file(s) distributed with this work for additional
5: # information regarding copyright ownership.
6: #
7: # This program and the accompanying materials are made available under the
8: # terms of the Apache License Version 2.0 which is available at
9: # https://www.apache.org/licenses/LICENSE-2.0
10: #
...

Fix in Cursor

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