Skip to content

refactor(ts): upload traces through the Rust client - #76

Open
kozlek wants to merge 1 commit into
mainfrom
devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/upload-traces-rust-client--314107d7
Open

refactor(ts): upload traces through the Rust client#76
kozlek wants to merge 1 commit into
mainfrom
devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/upload-traces-rust-client--314107d7

Conversation

@kozlek

@kozlek kozlek commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Replaces @opentelemetry/exporter-trace-otlp-proto with a SpanExporter
backed by CiApiClient.uploadTrace, so protobuf encoding, gzip,
oversized-trace splitting and upload retries are shared with pytest-mergify
rather than reimplemented. The dependency is dropped.

Span construction deliberately stays on the OpenTelemetry SDK — unlike
pytest-mergify, which dropped the SDK entirely. The framework-specific span
assembly is exactly the TS-side glue worth keeping, so NativeTraceExporter
only marshals finished spans into plain data at the boundary: hex ids,
bigint nanosecond timestamps, and attributes flattened to key/value pairs.
Array attributes are dropped — nothing these plugins emit uses one and the
upload path cannot represent them.

createTracing now takes the client instead of token/repoName/apiUrl; the
injected-exporter escape hatch and the MERGIFY_CI_DEBUG console exporter both
still short-circuit ahead of it, so the behavior suites are unaffected.

With the last caller gone, splitRepoName goes too — its only job was building
the API URLs that ApiConfig::from_full_name now builds. It was exported from
@mergifyio/ci-core, which documents itself as internal with no cross-version
API stability.

That completes the swap: quarantine, flaky-detection context and trace upload
all run through the shared Rust client, and the duplicated TS client and OTLP
export are gone.

Test selection, the remaining acceptance criterion, is deliberately not here:
the TS packages have no test-selection feature to swap — pytest has one, the TS
clients never got it — so adding it is net-new user-visible behavior, split out
to MRGFY-8497 rather than smuggled into a refactor.

FlakyDetector likewise keeps its own budget arithmetic instead of adopting
the Rust budget engine. They are not equivalent: budget::plan has no
max_test_name_length filter and no min/max execution-count repeat math, so
swapping would silently change which tests rerun and how often.

Fixes MRGFY-8439
Related to MRGFY-8497

Co-Authored-By: Claude Opus 5 (1M context) noreply@anthropic.com

@kozlek

kozlek commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator Author

This pull request is part of a Mergify stack:

# Pull Request Link
1 refactor(ts): upload traces through the Rust client #76 👈
2 refactor(ts): assemble spans directly, dropping the OpenTelemetry SDK #77

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections August 6, 2026 14:45 Failure
@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Merge Protections

🔴 1 of 7 protections blocking · waiting on 🙋 you

Protection Waiting on
🔴 No Manual Merge 🙋 you
🟢 🤖 Continuous Integration
🟢 👀 Review Requirements
🟢 Enforce conventional commit
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queue

🔴 No Manual Merge

Waiting for

  • label != manual merge
This rule is failing.
  • label != manual merge

Show 6 satisfied protections

🟢 🤖 Continuous Integration

  • all of:
    • check-success=ci-gate

🟢 👀 Review Requirements

  • any of:
    • #approved-reviews-by>=2
    • author = dependabot[bot]
    • author = mergify-ci-bot
    • author = renovate[bot]

🟢 Enforce conventional commit

Make sure that we follow https://www.conventionalcommits.org/en/v1.0.0/

  • title ~= ^(fix|feat|internal|docs|style|refactor|perf|test|build|ci|chore|revert|ui)(?:\(.+\))?!?:

🟢 🔎 Reviews

  • #changes-requested-reviews-by = 0
  • #review-requested = 0
  • #review-threads-unresolved = 0

🟢 📕 PR description

  • body ~= (?ms:.{48,})

🟢 🚦 Auto-queue

When all merge protections are satisfied, this pull request will be queued automatically.

@mergify
mergify Bot requested a review from a team August 6, 2026 14:49
@kozlek
kozlek marked this pull request as ready for review August 6, 2026 16:50
@kozlek
kozlek force-pushed the devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/upload-traces-rust-client--314107d7 branch from 46ffe3a to 1e9efd0 Compare August 10, 2026 12:12
@kozlek

kozlek commented Aug 10, 2026

Copy link
Copy Markdown
Collaborator Author

Revision history

# Type Changes Reason Date
1 initial 46ffe3a 2026-08-10 12:12 UTC
2 rebase 46ffe3a → 1e9efd0 (rebase only) 2026-08-10 12:12 UTC
3 rebase 1e9efd0 → 3d270a6 (rebase only) 2026-08-11 15:50 UTC

@mergify
mergify Bot had a problem deploying to Mergify Merge Protections August 10, 2026 12:13 Failure
Base automatically changed from devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/fetch-quarantine-flaky-context-rust-client--26ec074f to main August 11, 2026 15:28
@mergify

mergify Bot commented Aug 11, 2026

Copy link
Copy Markdown

@kozlek this pull request is now in conflict 😩

@mergify mergify Bot added the conflict label Aug 11, 2026
Replaces `@opentelemetry/exporter-trace-otlp-proto` with a `SpanExporter`
backed by `CiApiClient.uploadTrace`, so protobuf encoding, gzip,
oversized-trace splitting and upload retries are shared with pytest-mergify
rather than reimplemented. The dependency is dropped.

Span *construction* deliberately stays on the OpenTelemetry SDK — unlike
pytest-mergify, which dropped the SDK entirely. The framework-specific span
assembly is exactly the TS-side glue worth keeping, so `NativeTraceExporter`
only marshals *finished* spans into plain data at the boundary: hex ids,
`bigint` nanosecond timestamps, and attributes flattened to key/value pairs.
Array attributes are dropped — nothing these plugins emit uses one and the
upload path cannot represent them.

`createTracing` now takes the client instead of token/repoName/apiUrl; the
injected-exporter escape hatch and the `MERGIFY_CI_DEBUG` console exporter both
still short-circuit ahead of it, so the behavior suites are unaffected.

With the last caller gone, `splitRepoName` goes too — its only job was building
the API URLs that `ApiConfig::from_full_name` now builds. It was exported from
`@mergifyio/ci-core`, which documents itself as internal with no cross-version
API stability.

That completes the swap: quarantine, flaky-detection context and trace upload
all run through the shared Rust client, and the duplicated TS client and OTLP
export are gone.

Test selection, the remaining acceptance criterion, is deliberately not here:
the TS packages have no test-selection feature to swap — pytest has one, the TS
clients never got it — so adding it is net-new user-visible behavior, split out
to MRGFY-8497 rather than smuggled into a refactor.

`FlakyDetector` likewise keeps its own budget arithmetic instead of adopting
the Rust budget engine. They are not equivalent: `budget::plan` has no
`max_test_name_length` filter and no min/max execution-count repeat math, so
swapping would silently change which tests rerun and how often.

Fixes MRGFY-8439
Related to MRGFY-8497

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: I314107d73f6dff7757c2fdfd61399089c8882a22
@kozlek
kozlek force-pushed the devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/upload-traces-rust-client--314107d7 branch from 1e9efd0 to 3d270a6 Compare August 11, 2026 15:50
@mergify
mergify Bot had a problem deploying to Mergify Merge Protections August 11, 2026 15:50 Failure
@mergify mergify Bot removed the conflict label Aug 11, 2026
@kozlek kozlek added the manual merge Merge by hand with a merge commit; bypasses the squash queue label Aug 12, 2026
@mergify
mergify Bot requested a review from a team August 12, 2026 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

manual merge Merge by hand with a merge commit; bypasses the squash queue

Development

Successfully merging this pull request may close these issues.

3 participants