Remove Error and other unnecessary exports

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Unresolved
    • Priority: Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • 1
    • Not Needed
    • None
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?
    • None
    • None
    • None
    • None
    • None
    • None

      Use Case

      As a... Node driver developer
      I want... remove unnecessary exports from VM bundle context (as per https://github.com/mongodb/node-mongodb-native/pull/4876#discussion_r2860323922)
      So that... the VM bundle context only exports the bare necessities

      User Experience

      • What is the desired/expected outcome for the user once this ticket is implemented?
      • If bug: What is the number of impacted customers? How severe is the impact? Is anyone blocked or broken?
        No changes in the user experience.

      Dependencies

      • upstream and/or downstream requirements and timelines to bear in mind
        We have a dependency on chai, but we are on an old version (4.3).
        We need to export some types like Error to global, because chai 4 uses `instanceof` to verify that the thrown error is of the expected type.
        Chai 5 uses a different check (https://github.com/chaijs/check-error/commit/d3622a0af07ddafe5275e452e3d780bbfda14110), so we can remove these exports, and the tests will still pass.
        The problem is that chai 5 is ESM only, so we can't easily upgrade just yet.

      So once we start using chai 5, we can remove these "extra" exports from the VM, and the tests that expect type equality will continue to pass.

      Risks/Unknowns

      • What could go wrong while implementing this change? (e.g., performance, inadvertent behavioral changes in adjacent functionality, existing tech debt, etc)
      • Is there an opportunity for better cross-driver alignment or testing in this area?
      • Is there an opportunity to improve existing documentation on this subject?

      Update to chai 5 is a major change.

      Acceptance Criteria

      Implementation Requirements

      • functional reqs, potential snafus to avoid, performance targets, etc
        We are using chai 5 and don't have to export Error and other types.

      Testing Requirements

      • unit test, spec test sync, etc
        All tests pass.

      Documentation Requirements

      • DOCSP ticket, API docs, etc
        None.

      Follow Up Requirements

      • additional tickets to file, required releases, etc
      • if node behavior differs/will differ from other drivers, confirm with dbx devs what standard to aim for and what plan, if any, exists to reconcile the diverging behavior moving forward
        None.

            Assignee:
            Pavel Safronov
            Reporter:
            Pavel Safronov
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: