Repository navigation
chore(package-split): bridge codeowners to the extracted package - #21725
Conversation
ddtrace.internal.codeowners has been extracted to datadog-apm-python as _ddtrace_internal_base.codeowners (published as ddtrace-internal-base). Replace the vendored implementation with a bridge that re-exports the extracted package, so there is a single source of truth. The bridge fails loudly if the package is missing; the vendored code remains in git history. Also pin the package in the lint dependency group: mypy runs with --only-group lint, and without the installed package ignore_missing_imports=true would silently degrade Codeowners to Any downstream (e.g. bdd.py returning-Any). Verified locally with a wheel built from datadog-apm-python: internal, ci_visibility::testing, and detect_global_locks suites pass, along with scripts/lint checks.
Codeowners resolved asResolved from the full PR diff against |
Dependency direction analysis
|
🎉 All green!🧪 All tests passed 🔗 Commit SHA: 8a30f08 | Docs | View more details | Give us feedback! |
…rkflow skill Automates the bridge pattern proven for ddtrace.internal.codeowners (#21725) so the next extractions (forksafe, W3C tracestate, OTel sampling) are mechanical instead of hand-assembled: - scripts/package-split make-bridge generates the scaffold: the bridge module (alias-form re-exports, required by the repo mypy config no_implicit_reexport), the runtime dependency and the lint-group pin (mypy resolves the lint group only -- a missing pin silently degrades every bridged name to Any), regenerated requirements CSVs, the bridge resolution test, and a reno note. - scripts/lint bridged-modules (also part of scripts/lint checks and pre-commit hook 13-check-bridged-modules) fails loudly when any coordinated piece is missing: dependency wiring, CSV sync, coverage test, and re-export/consumer symbol parity against the extracted package. - the bridge-extracted-module skill and docs/package-split/bridges.md tracker encode the full workflow, including pre-publication verification through a local PEP 503 index.
cc339af to
0703e06
Compare
The extracted module moved: datadog-apm-python absorbed ddtrace-internal-base into ddtrace-internal, so the bridge imports _ddtrace_internal.codeowners and the dependency it needs is one ddtrace already has, at a newer version. That makes this a version bump rather than a new dependency: ddtrace-internal goes from 0.2.0 to 0.3.0, the release that carries codeowners, and ddtrace-internal-base disappears from the runtime dependencies, the lint group and both requirements CSVs. The release note says the same -- mirrors must carry the new version, not a new distribution. CSVs regenerated with scripts/requirements_to_csv.py.
BenchmarksBenchmark execution time: 2026-11-23 08:54:42 Comparing candidate commit 8a30f08 in PR branch Found 0 performance improvements and 0 performance regressions! Performance is the same for 646 metrics, 10 unstable metrics, 1 flaky benchmarks without significant changes.
|
The aws_lambda suite depends on datadog-lambda, which transitively depends on the released ddtrace, so its environment lock pins the full transitive closure, including ddtrace-internal. scripts/run-tests strips the ddtrace pin when installing the locally built ddtrace, but keeps the ddtrace-internal pin, which must match the local wheel's requirement. With the bridge pointing at ddtrace-internal 0.3.0, the stale 0.2.0 pin made the env build unsatisfiable (uv exit 1 for 6abbc5115929, Python 3.15 job). Same manual bump as 96e3c67 (ddtrace-internal 0.1.0 -> 0.2.0). The pin will track 0.3.0 again naturally once a released ddtrace that requires ddtrace-internal 0.3.0 is past the lock cooldown.
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. |
There was a problem hiding this comment.
The bridge replacement violates the existing CODEOWNERS file freeze, causing the freeze workflow to reject the PR. A separate prerequisite PR must lift the freeze before this change can pass.
🤖 Bits Code Review · Commit 8c6734f
Removed frozen entry for codeowners Requirement for: #21725 Co-authored-by: brett.langdon <brett.langdon@datadoghq.com>
There was a problem hiding this comment.
More details
The PR replaces the vendored CODEOWNERS implementation with a bridge to _ddtrace_internal.codeowners and pins ddtrace-internal to 0.3.0 across runtime, lint, and requirements files. It adds a bridge identity check and an upgrade note for private mirrors. The earlier freeze blocker is resolved: neither the current base nor head freezes codeowners.py. No reportable findings remain; runtime behavior was not exercised.
🤖 Bits Code Review · Commit 8a30f08
## Description The freeze check enforced the `frozen-paths.txt` manifest at both the PR base and the merge result, so a PR could not lift its own freeze: unfreezing required one PR that removed the entry while leaving the file untouched, and a second, later PR with the authorized change (e.g. replacing the file with a bridge to the extracted package — #21979 then #21725). That gap left the path unprotected on main between the two merges, risking drift or lost work. An entry removed from the merge-result manifest now unfreezes its path in the same PR: the manifest removal and the change it authorizes (bridge code) can land together. What stays enforced: - Base rules still use the target base, so branches predating a freeze are checked too. - Base rules still block updating an entry's hash in the same PR — only removing the entry unfreezes. - Merge rules still validate every freeze on the merge result, including newly added ones. - Manifest edits remain gated by the CODEOWNERS entry on `/frozen-paths.txt` (@DataDog/apm-core-python), which is the human authorization for a same-PR unfreeze. Unfrozen paths are reported as `::notice::` annotations for an audit trail of what a PR unfreezes. ## Testing - Ran the exact workflow shell (extracted from `freeze-check.yml`) against synthetic base/merge git states — 12 scenarios, all passing: - change file + remove entry (bridge) → pass with notice - change file + keep entry (old hash) → fail - change file + update hash in same PR → fail (hash update must not lift a freeze) - remove entry, file unchanged → pass with notice - delete frozen file + remove entry → pass with notice - new freeze with correct/wrong hash → pass/fail - base predating a freeze → merge rules still enforced - remove manifest entirely → pass - unfreeze one path while changing another still-frozen path → fail - `scripts/lint checks` — all passing. - Runtime tests/benchmarks unnecessary: CI metadata only. ## Risks The freeze check no longer structurally prevents a PR author from removing an entry and changing the file in the same PR. Authorization relies on the required CODEOWNERS review of `/frozen-paths.txt` from @DataDog/apm-core-python (branch protection) — same trust model as manifest edits in general. ## Additional Notes No release note: CI metadata only, no customer-visible behavior (`changelog/no-changelog`). Co-authored-by: federico.mon <federico.mon@datadoghq.com>

Description
ddtrace.internal.codeownershas been extracted to thedatadog-apm-python repository, where it ships in
the
ddtrace-internalpackage as_ddtrace_internal.codeowners. This PR replaces the vendoredimplementation in dd-trace-py with a bridge that re-exports the extracted module, leaving a single
source of truth. There is no fallback to the vendored copy — the bridge fails loudly if the
dependency is missing, and the previous implementation remains in git history if a revert is ever
needed.
This is a version bump, not a new dependency. ddtrace already depends on
ddtrace-internal;the extraction originally landed in a separate
ddtrace-internal-basedistribution, whichdatadog-apm-python#69 absorbed back into
ddtrace-internalbefore either was published. So thepin moves
0.2.0→0.3.0(the release that carriescodeowners) andddtrace-internal-basedisappears from the runtime dependencies, the lint group and both requirements CSVs.
Notes:
lintdependency group: mypy runs with--only-group lint,and without the installed package
ignore_missing_imports = truewould silently resolveCodeownerstoAnyfor every consumer.scripts/requirements_to_csv.pyrather than hand-edited — they areCRLF, and editing them as text rewrites every line ending.
requirements.csvandlib-injection/sources/requirements.csvare regenerated to include thenew dependency.
Testing
tests/internal/test_codeowners.pyasserts the bridge resolvesto the extracted class.
(py3.12), plus
scripts/lint checks— all passing.Risks
ddtrace-internal0.3.0 on PyPI; the published 0.2.0 does not containcodeowners. CI environment builds resolve strictly from PyPI and will fail until that releaseexists — kept in draft until then. The bump is datadog-apm-python#72.
PEP 503 index, which is enough for the full pre-commit suite (ruff, mypy, codespell, bandit,
ast-grep, error-log check) to run for real rather than be skipped.
(covered by the release note).
Additional Notes
upgradesection): installing or upgrading ddtrace now pulls inddtrace-internal-base.