Skip to content

build(ts-native): expose the shared API client on the napi binding - #74

Merged
mergify[bot] merged 1 commit into
mainfrom
devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/expose-shared-api-client-napi-binding--7ab86c8c
Aug 10, 2026
Merged

build(ts-native): expose the shared API client on the napi binding#74
mergify[bot] merged 1 commit into
mainfrom
devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/expose-shared-api-client-napi-binding--7ab86c8c

Conversation

@kozlek

@kozlek kozlek commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Adds CiApiClient to @mergifyio/ci-native, over crates/mergify-ci-api
the quarantine and flaky-detection fetches plus the OTLP trace upload, so the
TS packages can stop reimplementing them. Mirrors the PyO3 CiApiClient the
pytest wheel already bundles.

Unlike detection's JSON-string surface, the returns are typed
#[napi(object)] structs: these are closed, known shapes, so the generated
.d.ts is the contract rather than a hand-written TS interface.
FlakyDetectionContext keeps snake_case field names via per-field js_name
because it is destined to be @mergifyio/ci-core's public type — a reporter
option and a Playwright state-file field — and the keys are the API's own wire
contract, shared with pytest-mergify.

The boundary carries plain data only, never live OpenTelemetry objects: span
ids are the lowercase hex strings the JS SDK already exposes, and timestamps
are bigint because nanoseconds since the epoch exceed what a JS number
holds exactly. Attribute values arrive as boolean | number | string; an
integral number becomes an OTLP intValue and a fractional one a
doubleValue, reproducing the split @opentelemetry/otlp-transformer made so
the wire bytes stay identical.

napi gains async (its tokio runtime drives the client, surfacing the calls as
Promises) and napi6 (which gates BigInt). Both sit far below the N-API 9
that Node >=22 ships.

No TS consumer yet — adoption lands in the commits above this one.

Related to MRGFY-8439

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

Adds `CiApiClient` to `@mergifyio/ci-native`, over `crates/mergify-ci-api` —
the quarantine and flaky-detection fetches plus the OTLP trace upload, so the
TS packages can stop reimplementing them. Mirrors the PyO3 `CiApiClient` the
pytest wheel already bundles.

Unlike detection's JSON-string surface, the returns are typed
`#[napi(object)]` structs: these are closed, known shapes, so the generated
`.d.ts` is the contract rather than a hand-written TS interface.
`FlakyDetectionContext` keeps snake_case field names via per-field `js_name`
because it is destined to *be* `@mergifyio/ci-core`'s public type — a reporter
option and a Playwright state-file field — and the keys are the API's own wire
contract, shared with pytest-mergify.

The boundary carries plain data only, never live OpenTelemetry objects: span
ids are the lowercase hex strings the JS SDK already exposes, and timestamps
are `bigint` because nanoseconds since the epoch exceed what a JS `number`
holds exactly. Attribute values arrive as `boolean | number | string`; an
integral number becomes an OTLP `intValue` and a fractional one a
`doubleValue`, reproducing the split `@opentelemetry/otlp-transformer` made so
the wire bytes stay identical.

napi gains `async` (its tokio runtime drives the client, surfacing the calls as
Promises) and `napi6` (which gates `BigInt`). Both sit far below the N-API 9
that Node >=22 ships.

No TS consumer yet — adoption lands in the commits above this one.

Related to MRGFY-8439

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Change-Id: I7ab86c8ce6e83156e935c50a1a8b7961c52e6863
@mergify
mergify Bot deployed to Mergify Merge Protections August 6, 2026 14:45 Active
@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 build(ts-native): expose the shared API client on the napi binding #74 👈
2 refactor(ts): fetch quarantine and flaky context through the Rust client #75
3 refactor(ts): upload traces through the Rust client #76
4 refactor(ts): assemble spans directly, dropping the OpenTelemetry SDK #77

@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown

Merge Protections

🟢 All 6 merge protections satisfied — ready to 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:48
@kozlek
kozlek marked this pull request as ready for review August 6, 2026 16:17
@kozlek kozlek added the manual merge Merge by hand with a merge commit; bypasses the squash queue label Aug 6, 2026
@mergify
mergify Bot requested a review from a team August 7, 2026 09:39
@kozlek kozlek removed the manual merge Merge by hand with a merge commit; bypasses the squash queue label Aug 10, 2026
@mergify

mergify Bot commented Aug 10, 2026

Copy link
Copy Markdown

Merge Queue Status

This pull request spent 3 minutes 12 seconds in the queue, including 2 minutes 49 seconds running CI.

Required conditions to merge

@mergify mergify Bot added the queued label Aug 10, 2026
@mergify
mergify Bot merged commit b0626ff into main Aug 10, 2026
22 checks passed
@mergify
mergify Bot deleted the devs/kozlek/thomasberdy/mrgfy-8439-rust-api-client/expose-shared-api-client-napi-binding--7ab86c8c branch August 10, 2026 12:07
@mergify mergify Bot removed the queued label Aug 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants