Repository navigation
ci(native): check that libdatadog uses one release tag - #21843
gh-worker-dd-mergequeue-cf854d[bot] merged 2 commits into
Conversation
Add scripts/check_libdatadog_pins.py. The script reads all tracked Cargo.toml and Cargo.lock files with tomllib. It makes sure that each libdatadog git dependency and each Cargo.lock source uses a "vX.Y.Z" release tag, that the Cargo.lock files have exactly one libdatadog source, and that the Cargo.toml and Cargo.lock tags are the same. Add the "libdatadog pins" GitLab job to run the script. Add the script to the script doctests, and set the doctest runner to Python 3.11 or later because the script uses tomllib. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Co-authored-by: brettlangdon <me@brett.is>
|
Bits Code status: ✅ Done Comment @DataDog to request changes |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
There was a problem hiding this comment.
More details
The checker accepts the repository’s current release pin and correctly handles the valid and invalid pin scenarios exercised by the specialist. Execution of the GitLab job remains unverified.
🤖 Bits Code Review · Commit 7c88484
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 2246393 | Docs | View more details | Give us feedback! |
BenchmarksBenchmark execution time: 2026-11-17 17:14:55 Comparing candidate commit 2246393 in PR branch Found 4 performance improvements and 0 performance regressions! Performance is the same for 634 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.
|
Description
The libdatadog project releases all its crates together. dd-trace-py must thus depend on libdatadog through exactly one release tag. A commit SHA, a branch, the default branch or a mix of releases can ship unreleased native code or put two copies of libdatadog into the native extension. Reviewers check this by hand at this time.
This PR adds a CI check for this rule. It replaces the approach in #21692 (Bash and regular expressions) with a small Python script that uses the
tomllibTOML parser. There is no opt-out marker.scripts/check_libdatadog_pins.pyfinds all trackedCargo.tomlandCargo.lockfiles withgit ls-files, and makes sure that:Cargo.tomlsetsrevortagto avX.Y.Zrelease tag. The script examines all tables, which includes[dependencies],[dev-dependencies],[build-dependencies],[target.*.dependencies],[workspace.dependencies]and[patch.*].[[package]].sourcein aCargo.lockusesrev=ortag=with avX.Y.Zrelease tag.Cargo.lockfiles together have exactly one libdatadog source. This includes the commit hash, thus two lockfiles that resolve the same tag to different commits also fail.Cargo.tomlfiles is the same as the release tag in theCargo.lockfiles.Other changes:
.gitlab/native.yml: newlibdatadog pinsjob. It extends.ci_utils(small image with Python 3.14) and runspython3 scripts/check_libdatadog_pins.py.scripts/run-script-doctests.py: runs the doctests of the new script. Therequires-pythonvalue changes from>=3.9to>=3.11because the script usestomllib.The script uses a TOML parser, thus these edge cases from the #21692 review are not a problem:
[dependencies.libdd-common]withgitandrevon different lines) are accepted.rev = "deadbeef" # rev = "v49.0.0") does not hide a SHA pin.tag = "vX.Y.Z"is accepted, andrev = "vX.Y.Z"is also accepted.sort -V.Testing
python3 scripts/check_libdatadog_pins.pyon this branch passes:OK: libdatadog source is git+https://github.com/DataDog/libdatadog?rev=v49.0.0#34293ad2.....gitsuffix, trailing slash, case,ssh://, other repositories), table-form dependencies, single quotes, inline comments,branch, the default branch,[target.*]and[patch.*]tables, andCargo.lockrev=/tag=/branch=/no query. They run in theRun scripts/*.py testsprecheck.Cargo.tomlandCargo.lock, mixedv48.0.0/v49.0.0tags, staleCargo.lock(Cargo.tomlatv50.0.0, lock atv49.0.0),branchand default branch, a second lockfile with a different libdatadog source, a SHA hidden by a comment, a[patch]entry on a branch, and no libdatadog source. Table-form, single-quoted, commented andtag =dependencies (with a?tag=lock source) pass.scripts/lint checkspasses.Risks
libdd-profiling-heap-gotterinsrc/native_heap_gotter) are not checked. They do not use a git tag.scripts/run-script-doctests.pynow needs Python 3.11 or later.Additional Notes
🤖 Generated with Claude Code (https://claude.com/claude-code)
PR by Bits - View session in Datadog • Open in Slack
Comment @DataDog to request changes