fix: remove hardcoded "Created by fab" description from mkdir and imp…#214
fix: remove hardcoded "Created by fab" description from mkdir and imp…#214HasanAboShally wants to merge 5 commits intomicrosoft:mainfrom
Conversation
…ort commands - Resolves microsoft#213 Remove the hardcoded "description" field from API payloads in mkdir (item, workspace, folder, connection) and import commands. Resources are now created without a default description unless the user explicitly provides one via params.
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Removes hardcoded default description values from mkdir and import payload generation so resources are created without metadata pollution unless a user explicitly provides a description.
Changes:
- Removed
"description": "Created by fab"frommkdirpayloads (workspace, item, folder, connection). - Removed
"description": "Imported from fab"fromimportpayloads. - Updated unit tests and added a changelog entry documenting the fix.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/test_utils/test_fab_cmd_mkdir_utils.py | Updates expected mkdir payloads to no longer include default descriptions. |
| tests/test_core/test_fab_hiearchy.py | Updates expected import payloads to no longer include default descriptions. |
| src/fabric_cli/utils/fab_cmd_import_utils.py | Stops injecting "Imported from fab" into item import payloads. |
| src/fabric_cli/commands/fs/mkdir/fab_fs_mkdir_workspace.py | Stops injecting "Created by fab" into workspace creation payloads. |
| src/fabric_cli/commands/fs/mkdir/fab_fs_mkdir_item.py | Stops injecting "Created by fab" into item creation payloads. |
| src/fabric_cli/commands/fs/mkdir/fab_fs_mkdir_folder.py | Stops injecting "Created by fab" into folder creation payloads. |
| src/fabric_cli/commands/fs/mkdir/fab_fs_mkdir_connection.py | Stops injecting "Created by fab" into connection creation payloads. |
| src/fabric_cli/commands/fs/impor/fab_fs_import_item.py | Stops injecting "Imported from fab" into environment-item import payloads. |
| .changes/unreleased/fixed-20260415-120000.yaml | Adds changelog entry for the behavior change. |
- Remove commented-out description from mkdir_gateway - Remove 'requestMessage: Created by fab' from mkdir_managedprivateendpoint - Add tests verifying workspace mkdir payload has no description by default - Add test verifying user-provided description is included via params - Add test verifying import create environment payload has no description
- Add early error handling for non-2xx response in mkdir_managedprivateendpoint - Forward user-provided description to connection mkdir payload - Fix workspace param key removal to use lowercase displayname - Use lowercase param keys in workspace tests to match CLI behavior
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 11 out of 11 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/fabric_cli/commands/fs/impor/fab_fs_import_item.py:112
_import_create_environment_itemparsesresponse.textand proceeds to publish the environment regardless of whether the create call succeeded. If the API returns a non-2xx response (or a non-JSON error body), this will raise duringjson.loads(...)and can mask the real failure. Consider checkingresponse.status_codebefore parsing/using the body, and raise aFabricCLIErrorwith the API error details (or return early) when creation fails.
item_payload["description"] = description
item_payload_str = json.dumps(item_payload)
# Create the item
response = item_api.create_item(args, payload=item_payload_str)
| "displayName": connection.short_name, | ||
| "connectivityType": connectivityType, | ||
| } | ||
| if params.get("description") is not None: |
There was a problem hiding this comment.
I think this check should be done in all commands where u remove the "created by fab"
|
|
||
| payload = { | ||
| # "description": "Created by fab", | ||
| "displayName": gateway.short_name, |
There was a problem hiding this comment.
shouldn't we add the "description" in the payload if user provided it?
There was a problem hiding this comment.
same question for other types
| args, payload= json.dumps(payload) | ||
| args, payload=json.dumps(payload) | ||
| ) | ||
| if response.status_code not in (200, 201): |
|
|
||
| # Remove all unwanted keys from the params | ||
| utils.remove_keys_from_dict(args.params, ["displayName"]) | ||
| utils.remove_keys_from_dict(args.params, ["displayname"]) |
There was a problem hiding this comment.
why change it to displayname with lower letter n?
|
|
||
|
|
||
| # ------------------------------------------------------------------- | ||
| # Tests for workspace mkdir payload — no hardcoded description |
There was a problem hiding this comment.
remove unnecessary comment
| @patch("fabric_cli.commands.fs.mkdir.fab_fs_mkdir_workspace.utils_mem_store") | ||
| @patch("fabric_cli.commands.fs.mkdir.fab_fs_mkdir_workspace.utils_ui") | ||
| @patch("fabric_cli.commands.fs.mkdir.fab_fs_mkdir_workspace.fab_state_config") | ||
| @patch("fabric_cli.commands.fs.mkdir.fab_fs_mkdir_workspace.utils") |
There was a problem hiding this comment.
do we need those mocks? I dont see we use it.
| }, | ||
| output="text", | ||
| ) | ||
| exec(workspace, args) |
There was a problem hiding this comment.
u should use cli_executor not exec directly .
looking at the other tests in this file we only create the class and verify the values - so maybe do the same
|
|
||
|
|
||
| # ------------------------------------------------------------------- | ||
| # Tests for import create environment item — no hardcoded description |
📥 Pull Request
✨ Description of new changes
"description"field from API payloads inmkdirandimportcommands. Resolves Remove hardcoded "Created by fab" description from mkdir and import commands #213.mkdir, the CLI hardcodes"description": "Created by fab". Similarly,importhardcodes"Imported from fab". Users have no way to override or opt out of this, and downstream services may propagate the description to child objects, causing unexpected metadata pollution. Resources are now created without a default description unless the user explicitly provides one via params.