Skip to content

feat: report connector version information#102

Merged
zitsen merged 12 commits intomainfrom
feat/main/6666017184
Mar 4, 2026
Merged

feat: report connector version information#102
zitsen merged 12 commits intomainfrom
feat/main/6666017184

Conversation

@qevolg
Copy link
Contributor

@qevolg qevolg commented Feb 10, 2026

Description

feat: report connector version information

Issue(s)

Checklist

Please check the items in the checklist if applicable.

  • Is the user manual updated?
  • Are the test cases passed and automated?
  • Is there no significant decrease in test coverage?

Copilot AI review requested due to automatic review settings February 10, 2026 09:52
@gemini-code-assist
Copy link

Summary of Changes

Hello @qevolg, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on improving the security and observability of the Node.js client. It introduces a robust mechanism to redact sensitive data from logs, ensuring that credentials are not inadvertently recorded. Additionally, it enhances connection transparency by reporting the client's version, which will be valuable for diagnostics. These changes are supported by new unit tests and general code maintenance.

Highlights

  • Enhanced Security Logging: Implemented a new redactMessage utility to automatically sanitize sensitive information like passwords and tokens from log outputs, significantly improving security by preventing accidental exposure of credentials.
  • Client Connector Version Reporting: Added functionality to include the Node.js client's version information in WebSocket connection requests, which can aid in debugging and monitoring client connections on the server side.
  • Comprehensive Unit Testing: Introduced extensive unit tests for the new log redaction feature, covering various scenarios including JSON strings, URL query parameters, nested objects, and credential-containing URLs. A new test was also added to verify the connector version reporting.
  • Code Cleanup and Formatting: Performed minor code cleanup across several files, including removing unused imports, commented-out code, and adjusting formatting for better readability.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • nodejs/prepare.js
    • Added a blank line for formatting.
  • nodejs/src/client/wsClient.ts
    • Imported package.json to retrieve client version.
    • Defined connectorInfo string using the package version.
    • Included connectorInfo in WebSocket connection options.
  • nodejs/src/client/wsConnectorPool.ts
    • Simplified logger.info messages in SIGINT and SIGTERM handlers.
    • Removed a commented-out line.
  • nodejs/src/client/wsEventCallback.ts
    • Added a blank line and reformatted _msgActionRegister initialization.
  • nodejs/src/client/wsResponse.ts
    • Removed an outdated JSDoc comment.
    • Added blank lines for consistent formatting.
  • nodejs/src/common/log.ts
    • Added redactMessage function to sanitize sensitive data (passwords, tokens) from messages.
    • Integrated redactMessage into the custom log format to apply redaction to all log messages.
  • nodejs/src/common/taosResult.ts
    • Removed an unused import TMQRawDataSchema.
  • nodejs/src/tmq/config.ts
    • Removed a commented-out req_id property.
  • nodejs/src/tmq/tmqResponse.ts
    • Removed commented-out lines related to data buffer parsing and timing.
  • nodejs/src/tmq/wsTmq.ts
    • Removed an unused import WsTmqQueryResponse.
    • Added a blank line for formatting.
  • nodejs/test/bulkPulling/log.test.ts
    • Imported redactMessage for testing.
    • Added comprehensive unit tests for the redactMessage function, covering various redaction scenarios.
  • nodejs/test/bulkPulling/sql.test.ts
    • Added a new test case to verify that the client's connector version is reported correctly in show connections.
  • nodejs/tsconfig.json
    • Enabled the resolveJsonModule compiler option.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the Node.js WebSocket connector to (1) attach a connector identification string (including package version) on connect, and (2) redact sensitive fields in log output, with accompanying tests and minor cleanup.

Changes:

  • Enable resolveJsonModule to allow importing package.json in TypeScript.
  • Add connector metadata to the WebSocket connect payload and add an integration test validating it appears in show connections.
  • Add redactMessage() to sanitize logs (password/token/URL credentials) and add unit tests for redaction.

Reviewed changes

Copilot reviewed 13 out of 13 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
nodejs/tsconfig.json Enables JSON imports to support reading connector version metadata.
nodejs/src/client/wsClient.ts Imports package version and includes connector info in connect args.
nodejs/src/common/log.ts Adds redactMessage() and applies it to winston output formatting.
nodejs/test/bulkPulling/log.test.ts Adds unit tests for redactMessage() behavior.
nodejs/test/bulkPulling/sql.test.ts Adds integration test verifying connector info appears in server connections.
nodejs/src/client/wsConnectorPool.ts Minor log formatting; SIGINT/SIGTERM handlers updated.
nodejs/src/tmq/wsTmq.ts Removes unused import / formatting cleanup.
nodejs/src/tmq/tmqResponse.ts Removes commented-out code.
nodejs/src/tmq/config.ts Removes commented-out field.
nodejs/src/common/taosResult.ts Removes unused import.
nodejs/src/client/wsResponse.ts Removes outdated file header comment / formatting cleanup.
nodejs/src/client/wsEventCallback.ts Formatting cleanup for static map initialization.
nodejs/prepare.js Minor formatting (blank line).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces two main features: sending connector version information during connection and redacting sensitive data (passwords, tokens) from logs for improved security. While the intention to redact sensitive data is positive, the implementation of the redactMessage function contains several flaws in its regular expressions, leading to incomplete redaction. Specifically, passwords in URLs without usernames are not redacted, passwords containing escaped quotes or '@' characters are only partially redacted, and bearer tokens in string logs are not redacted. Additionally, there is a minor copy-paste error in a log message and a potentially flaky test that uses a fixed sleep. Addressing these points will significantly improve the robustness and security of the changes.

@codecov-commenter
Copy link

codecov-commenter commented Feb 11, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.21%. Comparing base (460837f) to head (7bddc9a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #102      +/-   ##
==========================================
- Coverage   80.21%   80.21%   -0.01%     
==========================================
  Files          30       30              
  Lines        2482     2487       +5     
  Branches      436      437       +1     
==========================================
+ Hits         1991     1995       +4     
  Misses        378      378              
- Partials      113      114       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@qevolg
Copy link
Contributor Author

qevolg commented Feb 11, 2026

/gemini review

@qevolg qevolg changed the title Feat/main/6666017184 feat: report connector version information Feb 11, 2026
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a feature to send connector information, including the version from package.json, when establishing a WebSocket connection. This is implemented for both regular SQL connections and TMQ consumers. The changes are well-tested with new test cases that verify the connector information is correctly reported in show connections.

The PR also includes several valuable code cleanups, such as removing unused imports, commented-out code, and fixing a bug in a log message within a SIGTERM handler.

I have a couple of suggestions to improve the reliability of the new tests by replacing fixed-time waits with a polling mechanism to avoid potential flakiness. Overall, this is a solid contribution.

Copilot AI review requested due to automatic review settings February 28, 2026 02:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@qevolg
Copy link
Contributor Author

qevolg commented Feb 28, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a feature to report the connector version to the TDengine server. The implementation correctly adds the connector information, including the version from package.json, to the connection arguments for both SQL and TMQ clients. The accompanying tests verify this new behavior. My feedback focuses on improving the reliability of the new tests by replacing fixed delays with a more robust polling mechanism to avoid potential flakiness.

Copilot AI review requested due to automatic review settings March 3, 2026 07:28
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 3 comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported
Comments suppressed due to low confidence (2)

nodejs/test/bulkPulling/sql.test.ts:336

  • This test uses a fixed Sleep(2000) before checking show connections, which makes the suite slower and can still be flaky on slower/faster environments. Prefer polling show connections until the expected row appears (with an overall timeout) instead of an unconditional sleep.
        const wsSql = await WsSql.open(conf);
        await Sleep(2000);
        const wsRows = await wsSql.query("show connections");

nodejs/test/bulkPulling/tmq.test.ts:524

  • This test uses a fixed Sleep(2000) before querying show connections, which adds latency and can still be timing-flaky. Prefer polling until the expected connector string appears (with an overall timeout) rather than sleeping unconditionally.
        conf.setPwd(testPassword());
        const wsSql = await WsSql.open(conf);
        await Sleep(2000);

        const wsRows = await wsSql.query("show connections");

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copilot AI review requested due to automatic review settings March 3, 2026 08:31
@qevolg qevolg force-pushed the feat/main/6666017184 branch from d59c2d7 to 38b736d Compare March 3, 2026 08:31
@qevolg
Copy link
Contributor Author

qevolg commented Mar 3, 2026

/gemini review

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a feature to report connector version information to the server by adding a connector field in the connection message for both SQL and TMQ connections. The connector information string includes the version from package.json. The changes are well-implemented and include tests. My feedback focuses on improving the test suite's reliability by replacing fixed-time sleeps with a polling mechanism, and on using modern TypeScript syntax for JSON imports.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated no new comments.

Files not reviewed (1)
  • nodejs/package-lock.json: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Collaborator

@zitsen zitsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

Approval: ✅ APPROVED

This PR successfully adds connector version reporting functionality to the TDengine Node.js WebSocket connector. The implementation is clean, well-tested, and follows good practices.

Key Changes

  • Added ConnectorInfo constant with format: nodejs-ws-v{version}-ncid000
  • Integrated version reporting in both SQL and TMQ connection paths
  • Added comprehensive tests verifying connector info appears in show connections
  • Version bump to 3.2.3
  • Enabled resolveJsonModule in TypeScript config

Strengths

  • Clean, focused implementation with minimal changes
  • Good test coverage for both connection types
  • Proper constant definition and reuse
  • Well-integrated into existing connection flow

Tests Verified

  • SQL connection shows connector version info
  • TMQ connection shows connector version info
  • Conditional test execution with TEST_3360 environment variable

The code quality is solid and the feature is production-ready. LGTM! 🚀

@zitsen zitsen merged commit 86b9aaf into main Mar 4, 2026
8 checks passed
@zitsen zitsen deleted the feat/main/6666017184 branch March 4, 2026 02:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants