← Back to Pull requests

chore: Give every SDK source file a unique name #451

Closed
unknown closed this pull request without merging on Nov 18, 2026 21:04 UTC
View on GitHub
unknown unknown commented on Nov 18, 2026 00:12 UTC
Author

refs: RUM-19189

Several of dd-sdk-cpp's source files have the same filename, just in different directories. For example:

  • c/attribute.cpp: implementation of dd_attribute_t API

  • cpp/attribute.cpp: implementation of datadog::Attribute API

  • impl/types/json/attribute.cpp: JSON serialization for attributes
  • A static library identifies each object by basename alone, so as a result, libddsdkcpp.a holds several members named attribute.cpp.o.

    On macOS, an application's debug map refers to an object in a static library by library path, member name and timestamp. When same-named members also share a timestamp, as they do when the application links with ZERO_AR_DATE=1, dsymutil skips them, and their debug info is missing from the application's dSYM.

    This PR renames source files to ensure that every .cpp file has a unique name. This ensures that dSYMs contain all SDK symbols.

    ## Renaming API-layer TUs

    Most of the conflicts are due to the .cpp files for API headers having the same name as other implementation files. This PR applies a new convention for .cpp files that implement public APIs:

    Old:

  • datadog/c/core.cpp (implements include-c/core.h)

  • datadog/cpp/core.cpp (implements include-cpp/core.hpp)
  • New:

  • datadog/c/core_c_api.cpp (implements include-c/core.h)

  • datadog/cpp/core_cpp_api.cpp (implements include-cpp/core.hpp)
  • (As a result, the existing datadog/impl/core/core.cpp is now unique.)

    This convention matches what we already do for API-layer test files, e.g. we already use core_c_api_test.cpp and core_cpp_api_test.cpp.

    This change trips up clang-format's automatic #include reordering: it always puts the "main header" for a given .cpp file at the top, but since the .cpp and header files for these API TUs now have different names, it no longer recognizes the "main header" correctly. We address this issue with a change to .clang-format:

    IncludeIsMainRegex: '(_c_api|_cpp_api|[-_](test|unittest))?$'
    

    With the defaults inherited from BasedOnStyle: Google, the implicit default value is:

    IncludeIsMainRegex: ([-_](test|unittest))?$
    

    ...hence the addition of those patterns in our new value.

    ## Resolving the one remaining filename conflict

    With the API-layer implementation files renamed, the only remaining conflict was between core/context.cpp and rum/context.cpp. This was resolved with one more rename:

  • rum/context.hpp -> rum/rum_context.hpp

  • rum/context.cpp -> rum/rum_context.cpp

  • tests/impl/rum/context_test.cpp -> tests/impl/rum/rum_context_test.cpp
  • ## Testing

    Before this change, linking repl against the static library with ZERO_AR_DATE=1 and running dsymutil printed warnings about skipping debug map objects with a duplicate name and timestamp, and the dSYM had only 64 of the 79 SDK compile units in the debug map.

    After this change, dsymutil prints no warnings and the dSYM has all 79 compile units.

    Diff: 371 lines (+278 / -93) across 4 files Reviewer: fuzzybinary Review duration: 1252m
    All Vouch review confidence checks passed
    Residual risk 0.19 = Change Risk (0.43) × (1 − Review Confidence (0.57)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 371 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    56%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.354
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #451"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 56.8% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 56.8% · Lower = rushed or shallow review
    56.8%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 18.5% · Safe to merge
    18.5%