Skip to content

feat: tmq supports token#385

Merged
zitsen merged 8 commits intomainfrom
feat/main/tmq/token
Mar 12, 2026
Merged

feat: tmq supports token#385
zitsen merged 8 commits intomainfrom
feat/main/tmq/token

Conversation

@qevolg
Copy link
Contributor

@qevolg qevolg commented Mar 4, 2026

Description

feat: tmq supports token

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 March 4, 2026 08:41
@gemini-code-assist
Copy link

Summary of Changes

Hello, 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 introduces token-based authentication for TMQ (TDengine Message Queue) consumers within the taos-ws-py project. This enhancement allows users to secure their TMQ connections using bearer tokens, providing a more robust and flexible authentication mechanism. The changes involve updating dependency references to a feature branch of the taos-connector-rust library, modifying the consumer logic to parse and utilize token parameters, and adding new test cases to ensure the token functionality works as expected for various configurations, including invalid token scenarios.

Highlights

  • Token-based Authentication for TMQ: Implemented support for bearer_token in TMQ consumer configurations, allowing for token-based authentication to secure connections.
  • Dependency Updates: Updated Rust taos-connector-rust dependencies in Cargo.lock and Cargo.toml to a specific feature branch, likely containing the underlying token support.
  • Comprehensive Testing: Introduced new unit tests in test_tmq.py to validate both successful and failed TMQ connections using tokens, covering various configuration methods and precedence handling.

🧠 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
  • taos-ws-py/Cargo.lock
    • Updated the source branch for mdsn, taos, taos-error, taos-macros, taos-optin, taos-query, and taos-ws packages to feat/main/6735261785.
  • taos-ws-py/Cargo.toml
    • Updated the taos dependency branch to feat/main/6735261785 for both Windows and Unix targets.
  • taos-ws-py/src/consumer.rs
    • Added logic to extract td.connect.bearer_token from DSN configuration and map it to bearer_token.
    • Included bearer_token and td.connect.bearer_token as valid arguments when initializing the consumer.
    • Added bearer_token and td.connect.bearer_token to the list of recognized configuration keys.
  • taos-ws-py/tests/test_tmq.py
    • Imported pytest, time, and utils.
    • Removed a commented-out print statement.
    • Removed an empty line.
    • Added a new test test_tmq_with_token to verify successful TMQ connection with a valid token using various configuration methods (conf dict, DSN string, with and without td.connect. prefix, and precedence handling).
    • Added a new test test_tmq_with_invalid_token to verify that TMQ connection fails gracefully with an invalid token.
Activity
  • No human activity (comments, reviews, etc.) has been recorded for this pull request yet.
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.

@codecov-commenter
Copy link

codecov-commenter commented Mar 4, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 82.00%. Comparing base (1d4a6d5) to head (ccbea1b).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #385      +/-   ##
==========================================
+ Coverage   81.95%   82.00%   +0.04%     
==========================================
  Files          24       24              
  Lines        3713     3717       +4     
==========================================
+ Hits         3043     3048       +5     
+ Misses        670      669       -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.

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 adds TMQ (consumer) support for authenticating with a bearer token, allowing token-based auth to be provided via either the Python conf dict or DSN query parameters.

Changes:

  • Add parsing/normalization of td.connect.bearer_token / bearer_token into the TMQ consumer DSN configuration.
  • Add enterprise-only TMQ tests covering valid/invalid bearer token usage and key precedence.
  • Update the Rust taos git dependency source used by taos-ws-py.

Reviewed changes

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

File Description
taos-ws-py/src/consumer.rs Accepts bearer token config keys from dict and DSN, normalizing td.connect.bearer_token to bearer_token.
taos-ws-py/tests/test_tmq.py Adds enterprise-only tests validating TMQ can subscribe using bearer tokens and fails with invalid tokens.
taos-ws-py/Cargo.toml Switches taos dependency from main to a feature branch.
taos-ws-py/Cargo.lock Updates locked git sources to match the new taos dependency branch/commit.

💡 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 adds support for token-based authentication to the TMQ consumer. The changes in the Rust implementation correctly handle the new configuration options for bearer tokens, and new Python tests cover different ways of providing the token. I've identified a few areas for improvement:

  • The Cargo.toml dependency points to a feature branch, which should be updated before merging.
  • The new tests use hardcoded names for database objects, which could be made more robust by using dynamically generated names.
  • The test for token authentication could be strengthened by verifying message consumption, not just successful subscription.

Copilot AI review requested due to automatic review settings March 5, 2026 03:26
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 6 out of 7 changed files in this pull request and generated 5 comments.


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

Copilot AI review requested due to automatic review settings March 5, 2026 06:13
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 6 out of 7 changed files in this pull request and generated 3 comments.


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

Copilot AI review requested due to automatic review settings March 9, 2026 07:23
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 13 changed files in this pull request and generated 7 comments.


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

@zitsen zitsen merged commit 2fe2bb8 into main Mar 12, 2026
19 checks passed
@zitsen zitsen deleted the feat/main/tmq/token branch March 12, 2026 02:19
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