← Back to Pull requests

fix(mariadb): support connector 3.5.1 and newer #9509

Closed
unknown closed this pull request without merging on Aug 10, 2026 15:17 UTC
View on GitHub
unknown unknown commented on Jul 23, 2026 20:44 UTC
Author

What does this PR do?

Adds tracing support for MariaDB Connector/Node.js 3.5.1 and newer across both module formats:

  • enables ESM internal hooks for MariaDB 3.5.1+ while limiting patchDefault to the ESM range

  • supports the conditional CommonJS bundles introduced in 3.5.3 by wrapping runtime objects returned by their public factories

  • uses one connection-owned command lifecycle for queries, execute calls, prepared statements, streams, and transaction helpers queued behind active commands

  • finishes spans on promise, callback, stream, error, close, and synchronous-throw paths without changing returned stream identity

  • extracts SQL from string and object command forms

  • instruments public connections emitted by bundled pool connection events while keeping pool internals in the skip context

  • suppresses cluster minimum-idle setup spans and preserves exact, ambiguous, removed, and falsy-selector metadata behavior

  • normalizes URI and object connection options through MariaDB's public parser

  • associates forced package shards with their owning Node-gated declarations, preventing MariaDB 3.5.3+ installation on Node.js 18 backports

  • delays ESM default-export unwrapping until the instrumentation file and version match

  • explicitly tests 2.5.6, 3.0.0, 3.4.0, 3.4.5, 3.5.1, 3.5.2, and 3.5.3

  • updates generated supported-version metadata through 3.5.3
  • Motivation

    MariaDB 3.5.1 changed the connector to a pure ESM package, so the existing CommonJS module hooks no longer reached its internals. MariaDB 3.5.3 restored CommonJS through conditional exports, but those entries are minified single-file bundles whose Query, Execute, Stream, Pool, and Cluster classes never pass through the module loader.

    The 3.5.3+ CommonJS path therefore instruments public runtime objects. Because MariaDB queues transaction helpers behind any active command, the bundle adapter tracks one count per owning public connection rather than maintaining transaction-specific state. Prepared statements retain their owning connection, and stream wrappers observe terminal events without replacing or consuming the Readable.

    Default-export unwrapping also previously occurred before checking the internal filename. Restricting it to matched file/version hooks prevents unrelated namespace exports from being mutated.

    Verification

  • MariaDB 3.5.3 full CommonJS and ESM slice: 80 passing

  • MariaDB 3.4.5 focused CommonJS regression slice: 11 passing

  • MariaDB 3.5.1 ESM named/namespace matrix: 2 passing

  • MariaDB 3.5.2 ESM named/namespace matrix: 2 passing

  • focused 3.5.3 lifecycle, SQL, stream, pool-event, and cluster coverage: 15 passing

  • version resolver unit suite: 31 passing, including forced 3.5.3 and latest shards on Node.js 18

  • npm run lint

  • npm run verify:supported-integrations

  • git diff --check

  • command-lifecycle microbenchmark in two fresh shells: approximately 28 ns added per traced operation; unsubscribed fast path unchanged
  • Diff: 371 lines (+278 / -93) across 4 files Reviewer: crysmags Review duration: 25592m
    All Vouch review confidence checks passed
    Residual risk 0.17 = Change Risk (0.43) × (1 − Review Confidence (0.60)). Review depth and reviewer attention state are adequate.
    Model 1 · Change Risk (XGBoost)
    Score: 0.43 · 371 lines diff across 4 files
    0.43
    Model 2 · Review Depth (DistilBERT)
    Depth Score: 0.17 · 1 substantive comment(s)
    0.17
    Model 3 · Review Timing & Attention
    Session adequacy: 100% · Reviewer familiarity: 35%
    60%
    Bedrock Claude 3 · Risk Narration
    (disconnected)
    Groq
    Groq Risk Narration
    AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
    Model 1 · Change Risk Attribution
    SHAP Weights
    Diff Size diff_size
    0.354
    Shallow Review Depth shallow_review_depth
    0.289
    Real PR Conversation Timeline
    1 comments
    "Review active on #9509"
    general weight: 0.35
    Reviewers
    Assignees
    Unassigned
    Labels
    risk: low confidence: 60.5% reviewed
    Vouch Risk Breakdown
    AI-powered review risk analysis
    Change Risk
    Change Risk · Model 1 (XGBoost)
    Predicted defect probability (0.00–1.00) based on diff churn, modified sensitive files, and author risk history.
    Score: 42.8% (MEDIUM) · Higher = larger blast radius
    42.8%
    Review Confidence
    Review Confidence · Models 2 & 3
    Scrutiny score (0.00–1.00) combining DistilBERT semantic review depth with reviewer familiarity and session dwell time.
    Score: 60.5% · Lower = rushed or shallow review
    60.5%
    Residual Risk
    Residual Risk · Core Equation
    Residual = Change × (1 − Confidence)
    Unmitigated risk surviving review. ≥ 0.65 triggers an automated re-queue to protect production.
    Score: 16.9% · Safe to merge
    16.9%