Skip to content

uploader: add opt-in parallel Python runtime - #233

Open
tonyredondo wants to merge 26 commits into
mainfrom
feature/python-parallel-uploader
Open

uploader: add opt-in parallel Python runtime#233
tonyredondo wants to merge 26 commits into
mainfrom
feature/python-parallel-uploader

Conversation

@tonyredondo

Copy link
Copy Markdown
Member

Summary

  • add one cross-platform, standard-library Python uploader behind the temporary use_python_uploader rollout switch
  • process independent payload files through a bounded pool where each worker owns enrichment, validation, preventive split, upload retries, and cleanup for one source
  • prepare CODEOWNERS, contexts, schema, expected targets, freshness data, and telemetry plans once before worker startup
  • split enriched test payloads before HTTP at the conservative 4.5 MiB threshold and treat HTTP 413 as terminal contract drift
  • support test, coverage, and telemetry payloads from every worker, including deterministic telemetry-derived requests
  • add dry-run request preparation, verbose redacted debug diagnostics, deterministic final statistics, and schema-v1 report compatibility
  • generate small Bash and PowerShell Python launchers while retaining the legacy runtimes as the default during the rollout window
  • add the implementation guide and release-gate tracker

Rollout

This is an implementation milestone, not the final migration switch. The legacy uploader remains the default. Linux, macOS, Windows, consumer-fixture, documentation, default-switch, and legacy-removal gates remain tracked in docs/python_parallel_uploader_migration_plan.md.

Validation

  • python3 -m unittest discover -s tools/tests/python -p test*_tools.py: 426 tests, 425 passed, 1 platform-specific skip
  • ./bazelw test //tools/tests/python:python_tools_test --noexperimental_split_xml_generation --nocache_test_results: passed
  • repository mock-server integration harness: passed
  • generated uploader launcher dry-run through bazel run: passed with final statistics
  • ShellCheck and PowerShell template parsing: passed
  • Buildifier, Python compilation, module-version alignment, and git diff --check: passed

Introduce a cross-platform Python uploader with bounded file workers, shared CODEOWNERS preparation, preventive 4.5 MiB splitting, retries, dry-run, debug diagnostics, and final statistics.

Keep the legacy runtimes as the default during rollout and document the remaining cross-platform and consumer validation gates.
@tonyredondo
tonyredondo requested a review from a team as a code owner August 28, 2026 16:25

@datadog-datadog-prod-us1-2 datadog-datadog-prod-us1-2 Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Datadog Autotest: FAIL

The opt-in Python uploader checks credentials before it can return a no-op result. It also treats false CI markers as true and writes an empty staging path in schema-v1 reports.

Open Bits AI session

🤖 Datadog Autotest · Commit 44cca3b · What is Autotest? · @DataDog review to ask questions · Any feedback? Reach out in #autotest

Comment thread tools/core/uploader_py/main.py Outdated
Comment thread tools/core/uploader_py/config.py Outdated
Comment thread tools/core/uploader_py/application.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f90062726

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/application.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: fbf426cd40

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_python_launcher.ps1.tpl Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0f591b5807

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_python_launcher.ps1.tpl

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5a5bba148d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/test_optimization_uploader.bzl Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 33cbe29432

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/application.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 73fb10c0ff

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/application.py Outdated

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3dc8478f72

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/locking.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 85ddbe264c

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/application.py Outdated
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review Completed 2026-08-31T16:47:12.437458Z 464306b New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@datadog-datadog-prod-us1-2

datadog-datadog-prod-us1-2 Bot commented Aug 28, 2026

Copy link
Copy Markdown

Tests

🔄 Datadog auto-retried 11 jobs - 4 passed on retry View in Datadog

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 464306b | Docs | View more details | Give us feedback!

Preserve cross-runtime lock and CODEOWNERS lookup parity, validate endpoint ports, and reject non-standard JSON before upload.

Expand split, retry, replay, backpressure, launcher, and dry-run coverage and align the migration tracker and troubleshooting docs.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9c9cb5afd2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/transport.py
Reduce orchestration and transport duplication, clarify module boundaries and lifecycle reporting, and centralize uploader test runfile setup. Keep the existing uploader behavior while making the implementation and migration tracker easier to review and maintain.

Validated with the 449-test Python tooling suite, all 199 //tools tests, shellcheck, PowerShell parsing, buildifier, compileall, and git diff checks.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d5e2a974a1

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/transport.py Outdated
Use domain-specific names for telemetry, result, resource, and legacy-report state. Remove a redundant report wrapper and unused telemetry property while preserving configuration precedence and output contracts.

Validated with the 449-test Python tooling suite, all 199 //tools tests, template lint, compileall, and git diff checks.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: de4b02e6c5

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/freshness.py Outdated
Distinguish HTTP outcomes from file results, give resource and telemetry state domain-specific names, and replace string-based report aggregation with explicit fields. Remove stale rule commentary while preserving runtime and report contracts.

Validated with the 449-test Python suite, all 199 //tools tests, compileall, template lint, buildifier, and git diff checks.
Share payload-type counting across discovery filters and replace terse enrichment, splitting, and runfiles names with domain-specific ones. Preserve unsupported-type handling while removing duplicated aggregation code.

Validated with the 449-test Python suite, all 199 //tools tests, compileall, template lint, and git diff checks.
Pass PreparedHttpRequest through the transport boundary intact and distinguish prepared requests, body streams, HTTP requests, response excerpts, and transport failures. Reuse canonical payload counters for empty discovery.

Validated with the 449-test Python suite, all 199 //tools tests, compileall, template lint, and git diff checks.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 89b9b1e6f2

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/discovery.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 2ff6e34be9

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_python_launcher.sh.tpl

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9ba8869e62

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread tools/core/uploader_py/transport.py

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 464306b4a3

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +963 to +966
sidecar = task.test_outputs_dir / "bazel_target_metadata.json"
if not sidecar.is_file():
return None, None
payload, failure = _read_json_object(sidecar, "Bazel metadata")

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Reject symlinked Bazel metadata sidecars

When a Unix test emits bazel_target_metadata.json as a symlink to a JSON file outside test.outputs, is_file() and the subsequent read both follow it. The uploader then merges every key/value from that host-side file into outbound event metadata, allowing sandboxed test code to exfiltrate JSON that it could not read during the test; require a non-symlink regular file whose resolved path remains beneath task.test_outputs_dir.

AGENTS.md reference: AGENTS.md:L163-L164

Useful? React with 👍 / 👎.

Comment on lines +168 to +171
not freshness_preparation.scan_roots
and config.fail_on_error
and not all_expected_outputs_cached
):

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Reject unavailable remote-only expected outputs

With fail_on_error=True, optional BEP freshness, and an existing but empty bazel-testlogs directory, an expected remote-only output passes this guard because a scan root exists; it is not added to eligible_outputs, and the later tests_executed() marker check is false, so the invocation exits 0 despite the documented requirement that missing fresh payloads fail. The fresh evidence beyond the resolved cached-coverage thread is this existing-root path, which still reproduces with one cached expected target and one remote-only expected target; fail the plan based on the uncovered remote-only expected output rather than only on whether the root exists.

Useful? React with 👍 / 👎.

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.

1 participant