codeant-ai-for-open-source[bot] commented on code in PR #40132: URL: https://github.com/apache/superset/pull/40132#discussion_r3253651698
########## superset/mcp_service/dataset/tool/create_dataset.py: ########## @@ -0,0 +1,145 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import logging +from typing import Any + +from fastmcp import Context +from superset_core.mcp.decorators import tool, ToolAnnotations + +from superset.daos.dataset import DatasetDAO +from superset.exceptions import SupersetSecurityException +from superset.extensions import event_logger, security_manager +from superset.mcp_service.dataset.schemas import ( + CreateDatasetRequest, + DatasetError, + DatasetInfo, + serialize_dataset_object, +) +from superset.sql.parse import Table + +logger = logging.getLogger(__name__) + + +@tool( + tags=["mutate"], + class_permission_name="Dataset", + method_permission_name="write", + annotations=ToolAnnotations( + title="Register a physical table as a dataset", + readOnlyHint=False, + destructiveHint=False, + ), +) +async def create_dataset( + request: CreateDatasetRequest, ctx: Context +) -> DatasetInfo | DatasetError: + """Register an existing physical table as a Superset dataset. + + Use this tool when the user wants to make a physical database table available + for charting or exploration. The table must already exist in the target database. + + Workflow: + 1. Call list_databases to find the correct database_id + 2. Call this tool with database_id, schema, and table_name + 3. Use the returned id as dataset_id in generate_chart or generate_explore_link + + Returns DatasetInfo on success or DatasetError with error_type on failure. + """ + await ctx.info( + "Registering physical table as dataset: database_id=%s, schema=%r, table=%r" + % (request.database_id, request.schema_name, request.table_name) + ) + + # Verify the database exists and the caller has table-level access before + # registering. Mirrors the check in DatabaseRestApi.table_metadata(). + database = DatasetDAO.get_database_by_id(request.database_id) + if database is None: + await ctx.warning("Database %s not found" % request.database_id) + return DatasetError.create( + error=f"Database {request.database_id} not found", + error_type="DatabaseNotFoundError", + ) + + table = Table(request.table_name, request.schema_name, request.catalog) + try: + security_manager.raise_for_access(database=database, table=table) + except SupersetSecurityException as exc: + await ctx.warning("Access denied for table %r: %s" % (str(table), str(exc))) + return DatasetError.create(error=str(exc), error_type="AccessDeniedError") + + try: + from superset.commands.dataset.create import CreateDatasetCommand + from superset.commands.dataset.exceptions import ( + DatasetCreateFailedError, + DatasetExistsValidationError, + DatasetInvalidError, + TableNotFoundValidationError, + ) + + dataset_properties: dict[str, Any] = { + k: v + for k, v in { + "database": request.database_id, + "table_name": request.table_name, + "schema": request.schema_name, + "catalog": request.catalog, + "owners": request.owners, + }.items() + if v is not None + } + + with event_logger.log_context(action="mcp.create_dataset.create"): + dataset = CreateDatasetCommand(dataset_properties).run() + + result = serialize_dataset_object(dataset) + if result is None: + return DatasetError.create( + error="Dataset was created but could not be serialized", + error_type="InternalError", + ) + + await ctx.info( + "Dataset registered: id=%s, table=%r" % (dataset.id, dataset.table_name) + ) + return result + + except DatasetInvalidError as exc: + # CreateDatasetCommand.validate() aggregates individual validation errors + # into DatasetInvalidError; use the public get_list_classnames() helper + # to identify which specific validation errors are present. + classnames = exc.get_list_classnames() + if DatasetExistsValidationError.__name__ in classnames: + await ctx.warning("Dataset already exists: %s" % str(exc)) + return DatasetError.create(error=str(exc), error_type="DatasetExistsError") + if TableNotFoundValidationError.__name__ in classnames: + await ctx.warning("Table not found: %s" % str(exc)) + return DatasetError.create(error=str(exc), error_type="TableNotFoundError") + messages = exc.normalized_messages() + await ctx.warning("Dataset validation failed: %s" % (messages,)) + return DatasetError.create(error=str(messages), error_type="ValidationError") + except DatasetCreateFailedError as exc: + await ctx.error("Dataset creation failed: %s" % str(exc)) + return DatasetError.create(error=str(exc), error_type="CreateFailedError") + except Exception as exc: + await ctx.error( + "Unexpected error registering dataset: %s: %s" + % (type(exc).__name__, str(exc)) + ) + return DatasetError.create( + error=f"Failed to create dataset: {exc}", error_type="InternalError" + ) Review Comment: **Suggestion:** The internal-exception path returns the raw exception text to callers, which can expose backend details (driver errors, SQL fragments, connection metadata) in MCP responses. Return a generic user-safe message and keep full exception details only in server logs. [security] <details> <summary><b>Severity Level:</b> Critical π¨</summary> ```mdx - β Internal exceptions leak raw details to MCP clients. - β οΈ Error strings may expose database, schema, or SQL. ``` </details> <details> <summary><b>Steps of Reproduction β </b></summary> ```mdx 1. Run the MCP server so that `create_dataset` is registered via `init_fastmcp_server()` in `superset/mcp_service/app.py:48-54`, which imports the tool defined in `superset/mcp_service/dataset/tool/create_dataset.py:38-50`. 2. Trigger an unexpected internal error inside the `try` block of `create_dataset()` (`superset/mcp_service/dataset/tool/create_dataset.py:85-107`)βfor example, by misconfiguring the database or temporarily modifying `CreateDatasetCommand.run()` (from `superset/commands/dataset/create.py`) to raise `RuntimeError("DB host=db.internal.example.com user=superset password=secret")` so that the exception is not a `DatasetInvalidError` or `DatasetCreateFailedError`. 3. The generic `except Exception as exc:` handler at `superset/mcp_service/dataset/tool/create_dataset.py:138-142` catches this error, logs it via `await ctx.error("Unexpected error registering dataset: %s: %s" % (type(exc).__name__, str(exc)))`, and then returns `DatasetError.create(error=f"Failed to create dataset: {exc}", error_type="InternalError")` at lines 143-144; this constructs a `DatasetError` whose `error` field includes the full exception string, including any backend-specific details. 4. When `DatasetError.create()` is called, the `DatasetError` model in `superset/mcp_service/dataset/schemas.py:6-27` applies the `sanitize_error_for_llm_context` validator at lines 12-16, which wraps the `error` string with LLM context delimiters via `sanitize_for_llm_context()` in `superset/mcp_service/utils/sanitization.py:116-171` but does not redact or remove the underlying text; the resulting MCP response returned to the client contains the full internal exception message (e.g., hostnames, usernames, SQL fragments) in the `error` field, exposing internal system details to MCP clients and any downstream LLM or logs that consume these responses. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset%2Fmcp_service%2Fdataset%2Ftool%2Fcreate_dataset.py%0A%2A%2ALine%3A%2A%2A%20143%3A145%0A%2A%2AComment%3A%2A%2A%0A%09%2ASecurity%3A%20The%20internal-exception%20path%20returns%20the%20raw%20exception%20text%20to%20callers%2C%20which%20can%20expose%20backend%20details%20%28driver%20errors%2C%20SQL%20fragments%2C%20connection%20metadata%29%20in%20MCP%20responses.%20Return%20a%20generic%20user-safe%20message%20and%20keep%20full%20exception%20details%20only%20in%20server%20logs.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to %20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset%2Fmcp_service%2Fdataset%2Ftool%2Fcreate_dataset.py%0A%2A%2ALine%3A%2A%2A%20143%3A145%0A%2A%2AComment%3A%2A%2A%0A%09%2ASecurity%3A%20The%20internal-exception%20path%20returns%20the%20raw%20exception%20text%20to%20callers%2C%20which%20can%20expose%20backend%20details%20%28driver%20errors%2C%20SQL%20fragments%2C%20connection%20metadata%29%20in%20MCP%20responses.%20Return%20a%20generic%20user-safe%20message%20and%20keep%20full%20exception%20details%20only%20in%20server%20logs.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2 C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent π€ </b></summary> ```mdx This is a comment left during a code review. **Path:** superset/mcp_service/dataset/tool/create_dataset.py **Line:** 143:145 **Comment:** *Security: The internal-exception path returns the raw exception text to callers, which can expose backend details (driver errors, SQL fragments, connection metadata) in MCP responses. Return a generic user-safe message and keep full exception details only in server logs. 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. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40132&comment_hash=34cd5025cbcb3bb60682cc47a5fa272aa3334504ffe2b61258412ff4d08831ca&reaction=like'>π</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40132&comment_hash=34cd5025cbcb3bb60682cc47a5fa272aa3334504ffe2b61258412ff4d08831ca&reaction=dislike'>π</a> ########## superset/mcp_service/dataset/schemas.py: ########## @@ -323,6 +323,52 @@ class GetDatasetInfoRequest(MetadataCacheControl): ] +class CreateDatasetRequest(BaseModel): + """Request schema for create_dataset to register a physical table as a dataset.""" + + model_config = ConfigDict(populate_by_name=True) + + database_id: Annotated[ + int, + Field( + description="ID of the database connection to register the table against" + ), + ] + schema_name: Annotated[ + str | None, + Field( + default=None, + alias="schema", + description="Schema where the table lives (optional).", + ), + ] + table_name: Annotated[ + str, + Field(description="Name of the physical table to register as a dataset"), + ] + catalog: Annotated[ + str | None, + Field( + default=None, + description="Catalog where the table lives (optional).", + ), + ] Review Comment: **Suggestion:** `catalog` is also accepted as-is without trimming, so a whitespace-only catalog is propagated to table resolution and permission checks as a non-empty value, causing avoidable lookup/authorization failures. Normalize `catalog` the same way as `table_name` (trim and treat blank as `None`). [logic error] <details> <summary><b>Severity Level:</b> Major β οΈ</summary> ```mdx - β MCP create_dataset mis-resolves tables when catalog is whitespace. - β οΈ Breaks flows using optional catalog in dataset creation. ``` </details> <details> <summary><b>Steps of Reproduction β </b></summary> ```mdx 1. Ensure the MCP server is running and tools are registered via `init_fastmcp_server()` in `superset/mcp_service/app.py:48-54`, which imports the `create_dataset` tool from `superset/mcp_service/dataset/tool/__init__.py:18-25`. 2. From an MCP client, invoke the `create_dataset` tool (`create_dataset()` in `superset/mcp_service/dataset/tool/create_dataset.py:48-120`) with a payload like `{"database_id": 1, "schema": null, "catalog": " ", "table_name": "existing_table"}` where `existing_table` actually lives in the default catalog. 3. The request is parsed into `CreateDatasetRequest` (`superset/mcp_service/dataset/schemas.py:39-55`); the `catalog` field defined at `superset/mcp_service/dataset/schemas.py:349-355` has no validator, so the whitespace value `" "` is accepted and stored as a non-`None` string. 4. In `create_dataset()`, the `Table` dataclass from `superset/sql/parse.py:15-24` is instantiated at `superset/mcp_service/dataset/tool/create_dataset.py:78` as `Table(request.table_name, request.schema_name, request.catalog)`, producing a `Table` whose `catalog` property is `" "`; both `security_manager.raise_for_access(database=database, table=table)` at line 80 and `CreateDatasetCommand(dataset_properties).run()` at lines 86-107 then operate on the wrong fully-qualified name (catalog `" "` plus table), causing access or lookup to fail for a physically existing table that actually resides in the default catalog. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset%2Fmcp_service%2Fdataset%2Fschemas.py%0A%2A%2ALine%3A%2A%2A%20349%3A355%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20%60catalog%60%20is%20also%20accepted%20as-is%20without%20trimming%2C%20so%20a%20whitespace-only%20catalog%20is%20propagated%20to%20table%20resolution%20and%20permission%20checks%20as%20a%20non-empty%20value%2C%20causing%20avoidable%20lookup%2Fauthorization%20failures.%20Normalize%20%60catalog%60%20the%20same%20way%20as%20%60table_name%60%20%28trim%20and%20treat%20blank%20as%20%60None%60%29.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20as k%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset%2Fmcp_service%2Fdataset%2Fschemas.py%0A%2A%2ALine%3A%2A%2A%20349%3A355%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20%60catalog%60%20is%20also%20accepted%20as-is%20without%20trimming%2C%20so%20a%20whitespace-only%20catalog%20is%20propagated%20to%20table%20resolution%20and%20permission%20checks%20as%20a%20non-empty%20value%2C%20causing%20avoidable%20lookup%2Fauthorization%20failures.%20Normalize%20%60catalog%60%20the%20same%20way%20as%20%60table_name%60%20%28trim%20and%20treat%20blank%20as%20%60None%60%29.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20c orrect%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent π€ </b></summary> ```mdx This is a comment left during a code review. **Path:** superset/mcp_service/dataset/schemas.py **Line:** 349:355 **Comment:** *Logic Error: `catalog` is also accepted as-is without trimming, so a whitespace-only catalog is propagated to table resolution and permission checks as a non-empty value, causing avoidable lookup/authorization failures. Normalize `catalog` the same way as `table_name` (trim and treat blank as `None`). 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. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40132&comment_hash=fc91a45c2350c22a05edcce0f5c91e9e4d695ff1cb25ae4aa717b0c739a708e4&reaction=like'>π</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40132&comment_hash=fc91a45c2350c22a05edcce0f5c91e9e4d695ff1cb25ae4aa717b0c739a708e4&reaction=dislike'>π</a> ########## superset/mcp_service/dataset/schemas.py: ########## @@ -323,6 +323,52 @@ class GetDatasetInfoRequest(MetadataCacheControl): ] +class CreateDatasetRequest(BaseModel): + """Request schema for create_dataset to register a physical table as a dataset.""" + + model_config = ConfigDict(populate_by_name=True) + + database_id: Annotated[ + int, + Field( + description="ID of the database connection to register the table against" + ), + ] + schema_name: Annotated[ + str | None, + Field( + default=None, + alias="schema", + description="Schema where the table lives (optional).", + ), + ] Review Comment: **Suggestion:** `schema` input is accepted without normalization, so whitespace-only values (for example `" "`) pass validation and are treated as a real schema, which causes false `TableNotFound`/access-denied behavior for otherwise valid requests. Add a validator that trims `schema_name` and converts empty/whitespace-only values to `None`. [logic error] <details> <summary><b>Severity Level:</b> Major β οΈ</summary> ```mdx - β MCP create_dataset fails when schema has only whitespace. - β οΈ Blocks agent workflows registering tables via MCP tooling. ``` </details> <details> <summary><b>Steps of Reproduction β </b></summary> ```mdx 1. Start the MCP server so tools from `superset.mcp_service.dataset.tool` are registered via `init_fastmcp_server()` in `superset/mcp_service/app.py:48-53` (the module imports `create_dataset` and registers it through the `@tool` decorator at `superset/mcp_service/dataset/tool/create_dataset.py:38-48`). 2. From an MCP client, call the `create_dataset` tool (function `create_dataset()` at `superset/mcp_service/dataset/tool/create_dataset.py:48`) with a JSON payload like `{"database_id": 1, "schema": " ", "table_name": "existing_table"}` where `database_id` points to a real database and `existing_table` exists in the default schema. 3. The payload is parsed into `CreateDatasetRequest` (`superset/mcp_service/dataset/schemas.py:39-55`); since only `table_name` has a validator (lines 55-60), `schema_name` at `superset/mcp_service/dataset/schemas.py:337-344` is accepted as the literal whitespace string `" "` instead of being normalized to `None`. 4. In `create_dataset()` the code constructs `table = Table(request.table_name, request.schema_name, request.catalog)` at `superset/mcp_service/dataset/tool/create_dataset.py:78`, so the `Table` instance (`superset/sql/parse.py:15-24`) has `schema=" "`; this table is passed into `security_manager.raise_for_access(database=database, table=table)` at line 80, and subsequently into `CreateDatasetCommand(dataset_properties).run()` at lines 86-107. Because there is no real schema named `" "`, permission checks or dataset creation treat the request as targeting a non-existent schema, causing `AccessDeniedError` or `TableNotFoundError` even though the table exists in the default schema. ``` </details> [Fix in Cursor](https://app.codeant.ai/fix-in-ide?tool=cursor&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset%2Fmcp_service%2Fdataset%2Fschemas.py%0A%2A%2ALine%3A%2A%2A%20337%3A344%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20%60schema%60%20input%20is%20accepted%20without%20normalization%2C%20so%20whitespace-only%20values%20%28for%20example%20%60%22%20%20%20%22%60%29%20pass%20validation%20and%20are%20treated%20as%20a%20real%20schema%2C%20which%20causes%20false%20%60TableNotFound%60%2Faccess-denied%20behavior%20for%20otherwise%20valid%20requests.%20Add%20a%20validator%20that%20trims%20%60schema_name%60%20and%20converts%20empty%2Fwhitespace-only%20values%20to%20%60None%60.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20c heck%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) | [Fix in VSCode Claude](https://app.codeant.ai/fix-in-ide?tool=vscode-claude&prompt=This%20is%20a%20comment%20left%20during%20a%20code%20review.%0A%0A%2A%2APath%3A%2A%2A%20superset%2Fmcp_service%2Fdataset%2Fschemas.py%0A%2A%2ALine%3A%2A%2A%20337%3A344%0A%2A%2AComment%3A%2A%2A%0A%09%2ALogic%20Error%3A%20%60schema%60%20input%20is%20accepted%20without%20normalization%2C%20so%20whitespace-only%20values%20%28for%20example%20%60%22%20%20%20%22%60%29%20pass%20validation%20and%20are%20treated%20as%20a%20real%20schema%2C%20which%20causes%20false%20%60TableNotFound%60%2Faccess-denied%20behavior%20for%20otherwise%20valid%20requests.%20Add%20a%20validator%20that%20trims%20%60schema_name%60%20and%20converts%20empt y%2Fwhitespace-only%20values%20to%20%60None%60.%0A%0AValidate%20the%20correctness%20of%20the%20flagged%20issue.%20If%20correct%2C%20How%20can%20I%20resolve%20this%3F%20If%20you%20propose%20a%20fix%2C%20implement%20it%20and%20please%20make%20it%20concise.%0AOnce%20fix%20is%20implemented%2C%20also%20check%20other%20comments%20on%20the%20same%20PR%2C%20and%20ask%20user%20if%20the%20user%20wants%20to%20fix%20the%20rest%20of%20the%20comments%20as%20well.%20if%20said%20yes%2C%20then%20fetch%20all%20the%20comments%20validate%20the%20correctness%20and%20implement%20a%20minimal%20fix%0A) *(Use Cmd/Ctrl + Click for best experience)* <details> <summary><b>Prompt for AI Agent π€ </b></summary> ```mdx This is a comment left during a code review. **Path:** superset/mcp_service/dataset/schemas.py **Line:** 337:344 **Comment:** *Logic Error: `schema` input is accepted without normalization, so whitespace-only values (for example `" "`) pass validation and are treated as a real schema, which causes false `TableNotFound`/access-denied behavior for otherwise valid requests. Add a validator that trims `schema_name` and converts empty/whitespace-only values to `None`. 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. Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix ``` </details> <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40132&comment_hash=a55254359152300aa7e434154b6c19b236c3c4a98cbd618ab488456400dd3dfd&reaction=like'>π</a> | <a href='https://app.codeant.ai/feedback?pr_url=https%3A%2F%2Fgithub.com%2Fapache%2Fsuperset%2Fpull%2F40132&comment_hash=a55254359152300aa7e434154b6c19b236c3c4a98cbd618ab488456400dd3dfd&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: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
