You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "BinhPhamQuang (via GitHub)" <gi...@apache.org> on 2026/02/15 08:10:30 UTC

[PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

BinhPhamQuang opened a new pull request, #37984:
URL: https://github.com/apache/superset/pull/37984

   
   ### SUMMARY
   StarRocks implements user impersonation via get_prequeries (EXECUTE AS) rather than impersonate_user. It calls database.get_effective_user() directly, which bypasses the IMPERSONATE_WITH_EMAIL_PREFIX feature flag transformation. When the flag is enabled, Trino/Presto/Drill/Hive use the email prefix (e.g., alice from alice@example.org), but StarRocks still used the raw username.
   
   This change centralizes the IMPERSONATE_WITH_EMAIL_PREFIX logic inside get_effective_user so all impersonation paths (including StarRocks get_prequeries) receive the correct transformed identity.
   
   ### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
   
   ### TESTING INSTRUCTIONS
   1. Enable IMPERSONATE_WITH_EMAIL_PREFIX in config.
   2. Create a StarRocks database with "Impersonate logged in user" enabled.
   3. Create a user with email alice@example.org and username alice.
   4. Run a query as that user; verify the executed query uses alice(email prefix) in the EXECUTE AS clause, not alice.
   5. Run unit tests: pytest tests/unit_tests/models/core_test.py tests/unit_tests/db_engine_specs/test_starrocks.py
   
   ### ADDITIONAL INFORMATION
   - [ ] Has associated issue:
   - [x] Required feature flags: IMPERSONATE_WITH_EMAIL_PREFIX
   - [ ] Changes UI
   - [ ] Includes DB Migration
     - [ ] Migration is atomic, supports rollback & is backwards-compatible
     - [ ] Confirm DB migration upgrade and downgrade tested
     - [ ] Runtime estimates and downtime expectations provided
   - [ ] Introduces new feature or API
   - [ ] Removes existing feature or API
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "codeant-ai-for-open-source[bot] (via GitHub)" <gi...@apache.org>.
codeant-ai-for-open-source[bot] commented on code in PR #37984:
URL: https://github.com/apache/superset/pull/37984#discussion_r2808781033


##########
tests/unit_tests/db_engine_specs/test_starrocks.py:
##########
@@ -224,8 +225,8 @@ def test_get_catalog_names(mocker: MockerFixture) -> None:
     # StarRocks returns rows with keys: ['Catalog', 'Type', 'Comment']
     mock_row_1 = mocker.MagicMock()
     mock_row_1.keys.return_value = ["Catalog", "Type", "Comment"]
-    mock_row_1.__getitem__ = (
-        lambda self, key: "default_catalog" if key == "Catalog" else None
+    mock_row_1.__getitem__ = lambda self, key: (

Review Comment:
   **Suggestion:** The test attempts to override `__getitem__` on a `MagicMock` instance with a function taking `(self, key)`, but special methods are resolved on the class and this instance attribute is ignored, so `row["Catalog"]` will not return the expected string and the assertion on catalog names may fail; using `__getitem__.side_effect` with a single `key` argument correctly controls subscription behavior. [logic error]
   
   <details>
   <summary><b>Severity Level:</b> Major ⚠️</summary>
   
   ```mdx
   - ❌ `test_get_catalog_names` fails in unit test suite.
   - ⚠️ StarRocks catalog-name extraction logic left unverified.
   ```
   </details>
   
   ```suggestion
       mock_row_1.__getitem__.side_effect = lambda key: (
   ```
   <details>
   <summary><b>Steps of Reproduction ✅ </b></summary>
   
   ```mdx
   1. Run the unit test `pytest
   tests/unit_tests/db_engine_specs/test_starrocks.py::test_get_catalog_names`.
   
   2. In `test_get_catalog_names` (around lines 226-237), three `MagicMock` rows are created;
   for `mock_row_1`, `__getitem__` is overridden via instance assignment:
   
      `mock_row_1.__getitem__ = lambda self, key: ("default_catalog" if key == "Catalog" else
      None)`.
   
   3. The test sets `inspector.bind.execute.return_value = [mock_row_1, mock_row_2,
   mock_row_3]` and then calls `StarRocksEngineSpec.get_catalog_names(database, inspector)`,
   implemented in `superset/db_engine_specs/starrocks.py:335-367`, which does
   `catalogs.add(row["Catalog"])` when `"Catalog" in row.keys()`.
   
   4. Because special method lookup (`row["Catalog"]`) uses the class-level
   `MagicMock.__getitem__` and ignores the instance attribute assigned in the test, each
   `row["Catalog"]` returns a new `MagicMock` instead of the intended string; the resulting
   `catalogs` is a set of `MagicMock` objects, so the assertion `assert catalogs ==
   {"default_catalog", "hive", "iceberg"}` in the test fails.
   ```
   </details>
   <details>
   <summary><b>Prompt for AI Agent 🤖 </b></summary>
   
   ```mdx
   This is a comment left during a code review.
   
   **Path:** tests/unit_tests/db_engine_specs/test_starrocks.py
   **Line:** 228:228
   **Comment:**
   	*Logic Error: The test attempts to override `__getitem__` on a `MagicMock` instance with a function taking `(self, key)`, but special methods are resolved on the class and this instance attribute is ignored, so `row["Catalog"]` will not return the expected string and the assertion on catalog names may fail; using `__getitem__.side_effect` with a single `key` argument correctly controls subscription behavior.
   
   Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
   ```
   </details>
   <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37984&comment_hash=8e7b2192bb3e5d38de8b94703b9eec8d945822b7c6518058997fc5fc64a8a290&reaction=like'>👍</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F37984&comment_hash=8e7b2192bb3e5d38de8b94703b9eec8d945822b7c6518058997fc5fc64a8a290&reaction=dislike'>👎</a>



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "codecov[bot] (via GitHub)" <gi...@apache.org>.
codecov[bot] commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-3903729497

   ## [Codecov](https://app.codecov.io/gh/apache/superset/pull/37984?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `33.33333%` with `4 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 65.87%. Comparing base ([`76d897e`](https://app.codecov.io/gh/apache/superset/commit/76d897eaa2f9e137102bc194c2e3109c29d0348f?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`592341d`](https://app.codecov.io/gh/apache/superset/commit/592341d6cad48e8138f768ad6405e7b36a3d5442?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 3750 commits behind head on master.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/superset/pull/37984?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [superset/db\_engine\_specs/starrocks.py](https://app.codecov.io/gh/apache/superset/pull/37984?src=pr&el=tree&filepath=superset%2Fdb_engine_specs%2Fstarrocks.py&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-c3VwZXJzZXQvZGJfZW5naW5lX3NwZWNzL3N0YXJyb2Nrcy5weQ==) | 33.33% | [4 Missing :warning: ](https://app.codecov.io/gh/apache/superset/pull/37984?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@            Coverage Diff             @@
   ##           master   #37984      +/-   ##
   ==========================================
   + Coverage   60.48%   65.87%   +5.38%     
   ==========================================
     Files        1931      668    -1263     
     Lines       76236    51328   -24908     
     Branches     8568     5778    -2790     
   ==========================================
   - Hits        46114    33810   -12304     
   + Misses      28017    16123   -11894     
   + Partials     2105     1395     -710     
   ```
   
   | [Flag](https://app.codecov.io/gh/apache/superset/pull/37984/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Coverage Δ | |
   |---|---|---|
   | [hive](https://app.codecov.io/gh/apache/superset/pull/37984/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.47% <33.33%> (-7.69%)` | :arrow_down: |
   | [javascript](https://app.codecov.io/gh/apache/superset/pull/37984/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `?` | |
   | [presto](https://app.codecov.io/gh/apache/superset/pull/37984/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `41.49% <33.33%> (-12.32%)` | :arrow_down: |
   | [python](https://app.codecov.io/gh/apache/superset/pull/37984/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `65.85% <33.33%> (+2.35%)` | :arrow_up: |
   | [sqlite](https://app.codecov.io/gh/apache/superset/pull/37984/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `64.20% <33.33%> (?)` | |
   | [unit](https://app.codecov.io/gh/apache/superset/pull/37984/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | `100.00% <ø> (+42.36%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#carryforward-flags-in-the-pull-request-comment) to find out more.
   </details>
   
   [:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/superset/pull/37984?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   - :package: [JS Bundle Analysis](https://docs.codecov.com/docs/javascript-bundle-analysis): Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "nvbien2000 (via GitHub)" <gi...@apache.org>.
nvbien2000 commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-3904090238

   thanks for your contribution


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #37984:
URL: https://github.com/apache/superset/pull/37984#discussion_r2848895318


##########
tests/unit_tests/db_engine_specs/test_starrocks.py:
##########
@@ -283,3 +284,25 @@ def test_adjust_engine_params_with_catalog(
         url, {}, catalog=catalog, schema=schema
     )
     assert returned_url.database == expected_database
+
+
+@with_feature_flags(IMPERSONATE_WITH_EMAIL_PREFIX=True)
+def test_get_prequeries_with_email_prefix(mocker: MockerFixture) -> None:
+    """Test that get_prequeries uses email prefix when IMPERSONATE_WITH_EMAIL_PREFIX"""
+    from superset.db_engine_specs.starrocks import StarRocksEngineSpec
+
+    user = mocker.MagicMock()
+    user.email = "alice@example.org"
+    mocker.patch(
+        "superset.db_engine_specs.starrocks.security_manager.find_user",
+        return_value=user,
+    )
+
+    database = mocker.MagicMock()
+    database.impersonate_user = True
+    database.url_object = make_url("starrocks://localhost:9030/")
+    database.get_effective_user.return_value = "alice@example.org"
+

Review Comment:
   This test setup uses `database.get_effective_user.return_value = "alice@example.org"` and `user.email = "alice@example.org"`, so the asserted result only validates splitting an email-like string at '@'. It doesn’t cover the more important feature behavior where the effective username differs from the email prefix (e.g. username "alice" with email "alice.doe@example.org" should impersonate as "alice.doe"), which could let regressions slip by.



##########
superset/db_engine_specs/starrocks.py:
##########
@@ -413,6 +415,11 @@ def get_prequeries(
             username = database.get_effective_user(database.url_object)
 
             if username:
+                if is_feature_enabled("IMPERSONATE_WITH_EMAIL_PREFIX"):
+                    user = security_manager.find_user(username=username)
+                    if user and user.email:
+                        username = user.email.split("@", 1)[0]
+

Review Comment:
   The PR description says the IMPERSONATE_WITH_EMAIL_PREFIX logic is centralized inside `Database.get_effective_user`, but this change adds the transformation directly in `StarRocksEngineSpec.get_prequeries`. This duplicates the existing transformation already performed in `Database._get_sqla_engine` and risks the two paths drifting; consider moving the feature-flag/email-prefix logic into `Database.get_effective_user` (or a shared helper) and letting StarRocks rely on that transformed effective user instead of re-implementing it here.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-3903690182

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-4769187194

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-4149716507

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "bito-code-review[bot] (via GitHub)" <gi...@apache.org>.
bito-code-review[bot] commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-4754461557

   AI Code Review is in progress (usually takes 3 to 15 minutes unless it's a very large PR).
   
   <details>
   <summary>
   Bito Usage Guide
   </summary>
   
   **Commands**
         
   Type the following command in the pull request comment and save the comment.
         
   - `/review` - Manually triggers a full AI review.
   
   - `/pause` - Pauses automatic reviews on this pull request.
   - `/resume` - Resumes automatic reviews.
   - `/resolve` - Marks all Bito-posted review comments as resolved.
   - `/abort` - Cancels all in-progress reviews.
   
         
   Refer to the <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/available-commands" target="_blank" rel="noopener noreferrer">documentation</a> for additional commands.
         
   **Configuration**
   
   This repository uses `Superset` You can customize the agent settings <a href="https://alpha.bito.ai/home/ai-agents/code-review-agent" target="_blank" rel="noopener noreferrer">here</a> or contact your Bito workspace admin at evan@preset.io.
         
   **Documentation & Help**
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/getting-started/install-run-using-bito-cloud/create-or-customize-an-agent-instance" target="_blank" rel="noopener noreferrer">Customize agent settings</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/implementing-custom-code-review-rules" target="_blank" rel="noopener noreferrer">Review rules</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent" target="_blank" rel="noopener noreferrer">General documentation</a>
   - <a href="https://docs.bito.ai/bito-dev-agents/ai-code-review-agent/faqs" target="_blank" rel="noopener noreferrer">FAQ</a>
   
   </details>
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "BinhPhamQuang (via GitHub)" <gi...@apache.org>.
BinhPhamQuang commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-4767647779

   Hi @michael-hoffman-26, @dacopan, could you help me take a look at this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "hainenber (via GitHub)" <gi...@apache.org>.
hainenber commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-4767866915

   Sorry @BinhPhamQuang, this slipped out of my radar. Let's see how CI goes.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "BinhPhamQuang (via GitHub)" <gi...@apache.org>.
BinhPhamQuang commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-4105784874

   Hi @hainenber, could you help me take a look at this PR?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "hainenber (via GitHub)" <gi...@apache.org>.
hainenber commented on code in PR #37984:
URL: https://github.com/apache/superset/pull/37984#discussion_r2975887087


##########
tests/unit_tests/db_engine_specs/test_starrocks.py:
##########
@@ -283,3 +284,25 @@ def test_adjust_engine_params_with_catalog(
         url, {}, catalog=catalog, schema=schema
     )
     assert returned_url.database == expected_database
+
+
+@with_feature_flags(IMPERSONATE_WITH_EMAIL_PREFIX=True)
+def test_get_prequeries_with_email_prefix(mocker: MockerFixture) -> None:
+    """Test that get_prequeries uses email prefix when IMPERSONATE_WITH_EMAIL_PREFIX"""
+    from superset.db_engine_specs.starrocks import StarRocksEngineSpec
+
+    user = mocker.MagicMock()
+    user.email = "alice@example.org"
+    mocker.patch(
+        "superset.db_engine_specs.starrocks.security_manager.find_user",
+        return_value=user,
+    )
+
+    database = mocker.MagicMock()
+    database.impersonate_user = True
+    database.url_object = make_url("starrocks://localhost:9030/")
+    database.get_effective_user.return_value = "alice@example.org"
+

Review Comment:
   @BinhPhamQuang this is a valid feedback. Can you expand the test suite to verify this potential use case?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "netlify[bot] (via GitHub)" <gi...@apache.org>.
netlify[bot] commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-4149638679

   ### <span aria-hidden="true">✅</span> Deploy Preview for *superset-docs-preview* ready!
   
   
   |  Name | Link |
   |:-:|------------------------|
   |<span aria-hidden="true">🔨</span> Latest commit | b2096188ae60efe5a0be74cbd0c97d453e2dac62 |
   |<span aria-hidden="true">🔍</span> Latest deploy log | https://app.netlify.com/projects/superset-docs-preview/deploys/69c8d6a2beb0360008618a58 |
   |<span aria-hidden="true">😎</span> Deploy Preview | [https://deploy-preview-37984--superset-docs-preview.netlify.app](https://deploy-preview-37984--superset-docs-preview.netlify.app) |
   |<span aria-hidden="true">📱</span> Preview on mobile | <details><summary> Toggle QR Code... </summary><br /><br />![QR Code](https://app.netlify.com/qr-code/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJodHRwczovL2RlcGxveS1wcmV2aWV3LTM3OTg0LS1zdXBlcnNldC1kb2NzLXByZXZpZXcubmV0bGlmeS5hcHAifQ.Mnj7taQ4Gg84U-ML-6FMblWDyBeMaUh9QtNfnyqDuEQ)<br /><br />_Use your smartphone camera to open QR code link._</details> |
   ---
   <!-- [superset-docs-preview Preview](https://deploy-preview-37984--superset-docs-preview.netlify.app) -->
   _To edit notification comments on pull requests, go to your [Netlify project configuration](https://app.netlify.com/projects/superset-docs-preview/configuration/notifications#deploy-notifications)._


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "hainenber (via GitHub)" <gi...@apache.org>.
hainenber commented on PR #37984:
URL: https://github.com/apache/superset/pull/37984#issuecomment-3909329375

   LGTM but I'll need to verify, integration-wise. Likely after Tết :D


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "BinhPhamQuang (via GitHub)" <gi...@apache.org>.
BinhPhamQuang commented on code in PR #37984:
URL: https://github.com/apache/superset/pull/37984#discussion_r3005874590


##########
tests/unit_tests/db_engine_specs/test_starrocks.py:
##########
@@ -283,3 +284,25 @@ def test_adjust_engine_params_with_catalog(
         url, {}, catalog=catalog, schema=schema
     )
     assert returned_url.database == expected_database
+
+
+@with_feature_flags(IMPERSONATE_WITH_EMAIL_PREFIX=True)
+def test_get_prequeries_with_email_prefix(mocker: MockerFixture) -> None:
+    """Test that get_prequeries uses email prefix when IMPERSONATE_WITH_EMAIL_PREFIX"""
+    from superset.db_engine_specs.starrocks import StarRocksEngineSpec
+
+    user = mocker.MagicMock()
+    user.email = "alice@example.org"
+    mocker.patch(
+        "superset.db_engine_specs.starrocks.security_manager.find_user",
+        return_value=user,
+    )
+
+    database = mocker.MagicMock()
+    database.impersonate_user = True
+    database.url_object = make_url("starrocks://localhost:9030/")
+    database.get_effective_user.return_value = "alice@example.org"
+

Review Comment:
   @hainenber, I just expanded the testcases to cover this case



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [PR] fix(databases): apply IMPERSONATE_WITH_EMAIL_PREFIX to StarRocks engine [superset]

Posted by "hainenber (via GitHub)" <gi...@apache.org>.
hainenber merged PR #37984:
URL: https://github.com/apache/superset/pull/37984


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org