build(ts-native): expose the shared API client on the napi binding - #74
Merged
Conversation
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
Collaborator
Author
|
This pull request is part of a Mergify stack:
|
Merge Protections🟢 All 6 merge protections satisfied — ready to merge. Show 6 satisfied protections🟢 🤖 Continuous Integration
🟢 👀 Review Requirements
🟢 Enforce conventional commitMake sure that we follow https://www.conventionalcommits.org/en/v1.0.0/
🟢 🔎 Reviews
🟢 📕 PR description
🟢 🚦 Auto-queueWhen all merge protections are satisfied, this pull request will be queued automatically. |
kozlek
marked this pull request as ready for review
August 6, 2026 16:17
remyduthu
approved these changes
Aug 7, 2026
JulianMaurin
approved these changes
Aug 10, 2026
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
|
36 tasks
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds
CiApiClientto@mergifyio/ci-native, overcrates/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
CiApiClientthepytest 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.tsis the contract rather than a hand-written TS interface.FlakyDetectionContextkeeps snake_case field names via per-fieldjs_namebecause it is destined to be
@mergifyio/ci-core's public type — a reporteroption 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
bigintbecause nanoseconds since the epoch exceed what a JSnumberholds exactly. Attribute values arrive as
boolean | number | string; anintegral number becomes an OTLP
intValueand a fractional one adoubleValue, reproducing the split@opentelemetry/otlp-transformermade sothe wire bytes stay identical.
napi gains
async(its tokio runtime drives the client, surfacing the calls asPromises) and
napi6(which gatesBigInt). Both sit far below the N-API 9that 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