Skip to content

docs: Add release notes for 3.6.10#117

Open
tomerqodo wants to merge 3 commits into
qodo_combined-20260114-qodo-grep-copilot_base_docs_add_release_notes_for_3610_pr377from
qodo_combined-20260114-qodo-grep-copilot_head_docs_add_release_notes_for_3610_pr377
Open

docs: Add release notes for 3.6.10#117
tomerqodo wants to merge 3 commits into
qodo_combined-20260114-qodo-grep-copilot_base_docs_add_release_notes_for_3610_pr377from
qodo_combined-20260114-qodo-grep-copilot_head_docs_add_release_notes_for_3610_pr377

Conversation

@tomerqodo
Copy link
Copy Markdown

Benchmark PR from qodo-benchmark#377

@github-actions github-actions Bot added the docs label Jan 15, 2026
@qodo-code-review
Copy link
Copy Markdown

Code Review by Qodo (Alpha)

🐞 Bugs (3) 📘 Rule Violations (2) 📎 Requirement Gaps (0) 💡 Suggestions (0)

Grey Divider


Action Required

1. `parse_automation_file` leaks errors 📘 Rule Violation
Description
• The new parse_automation_file reads files via open() without a context manager and does not
  close the file handle, creating a resource leak and avoidable failure mode.
• It also does not catch file I/O or parsing exceptions (e.g., invalid JSON/YAML), which can surface
  as uncaught exceptions/tracebacks to the CLI user instead of a controlled, contextual error.
• This weakens robustness and may expose internal exception details in user-facing output.

reliability

Code

src/prefect/events/cli/automations.py[R511-522]

+    def parse_automation_file(file_path: Path):
+        """Parse automation data from a YAML or JSON file."""
+        if not file_path.exists():
+            exit_with_error(f"File not found: {file_path}")

-        with open(from_file, "r") as f:
-            content = f.read()
+        f = open(file_path, "r")
+        content = f.read()

-        if from_file.suffix.lower() in [".yaml", ".yml"]:
-            data = pyyaml.safe_load(content)
-        elif from_file.suffix.lower() == ".json":
-            data = orjson.loads(content)
+        if file_path.suffix.lower() in [".yaml", ".yml"]:
+            return pyyaml.safe_load(content)
+        elif file_path.suffix.lower() == ".json":
+            return orjson.loads(content)
Evidence
PR Compliance requires that failure points be handled gracefully with meaningful, controlled errors
and without exposing internal details. The new helper opens and reads files without with and
returns parser results without catching parser exceptions, meaning invalid files can raise unhandled
exceptions and the file handle is not closed.

Rule 3: Generic: Robust Error Handling and Edge Case Management
Rule 4: Generic: Secure Error Handling
src/prefect/events/cli/automations.py[511-523]

Agent Prompt
## Issue description
`parse_automation_file` uses `open()` without closing the file handle and does not handle YAML/JSON parsing failures or I/O errors. This can leak resources and produce uncaught exceptions/tracebacks in the CLI.

## Issue Context
This logic runs in a CLI command; invalid user input (bad path, unreadable file, invalid YAML/JSON) is expected and should be handled gracefully with safe error messages.

## Fix Focus Areas
- src/prefect/events/cli/automations.py[511-535]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


2. `data["tags"]` assumes dict 📘 Rule Violation
Description
• The new logic unconditionally treats data as a mutable mapping by doing if "tags" not in data
  then data["tags"] = [].
• If the YAML/JSON content parses to None (empty YAML) or a non-object type (e.g., list/string),
  this will raise before validation, violating the requirement to handle edge cases explicitly.

reliability

Code

src/prefect/events/cli/automations.py[R536-538]

+    # Ensure tags field is always set to empty list if not provided
+    if "tags" not in data:
+        data["tags"] = []
Evidence
The compliance checklist requires explicit handling of null/empty/boundary values and other edge
cases. The new code mutates data as though it is always a dict, but parse results can legally be
None or other JSON/YAML types, causing runtime errors before validation.

Rule 3: Generic: Robust Error Handling and Edge Case Management
src/prefect/events/cli/automations.py[536-543]

Agent Prompt
## Issue description
The code assumes parsed automation config `data` is always a dict and mutates it (`data["tags"] = []`) before validation. Non-dict or empty inputs can crash the CLI.

## Issue Context
YAML/JSON can parse to non-object types (e.g., `[]`, `"str"`, `null`/empty YAML). The CLI should detect and report this as an invalid automation config format.

## Fix Focus Areas
- src/prefect/events/cli/automations.py[536-543]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


3. Tags cleared on update 🐞 Bug
Description
• The CLI now injects tags: [] when the input omits tags, causing tags to be treated as
  explicitly-set.
• The orchestration client serializes updates with exclude_unset=True, so explicitly-set tags is
  sent to the server and can overwrite/clear existing tags.
• This causes silent data loss: updating an automation without specifying tags will clear tags in
  the backend.

correctness

Code

src/prefect/events/cli/automations.py[R536-538]

+    # Ensure tags field is always set to empty list if not provided
+    if "tags" not in data:
+        data["tags"] = []
Evidence
The CLI forcibly adds tags to the user-provided payload. Because the client uses `model_dump(...,
exclude_unset=True)`, any field present in the validated model’s fields-set will be sent in the PUT
body. This turns an omitted tags field (which would otherwise be left unchanged server-side) into
an explicit empty list update.

src/prefect/events/cli/automations.py[536-538]
src/prefect/client/orchestration/_automations/client.py[28-37]
src/prefect/server/events/models/automations.py[211-215]
src/prefect/events/schemas/automations.py[445-451]

Agent Prompt
### Issue description
The CLI update command injects `tags: []` when the input omits tags. Because the client uses `model_dump(..., exclude_unset=True)`, this makes `tags` appear explicitly set and forces `tags: []` into the PUT payload, clearing existing tags unexpectedly.

### Issue Context
The update API path applies `exclude_unset=True` updates server-side as well, so omitting fields is the way to preserve existing values. The current change breaks that behavior for tags specifically.

### Fix Focus Areas
- src/prefect/events/cli/automations.py[536-538]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools



Advisory Comments

4. Misleading success name 🐞 Bug
Description
• The success message prints existing_automation.name instead of the updated automation’s name.
• If the update changes the name, the CLI will report the old name, making it harder to confirm what
  was updated.
• This is an observability/usability regression in CLI output.

observability

Code

src/prefect/events/cli/automations.py[R556-557]

        await client.update_automation(automation_id, automation)
-        exit_with_success(f"Updated automation '{automation.name}' ({id})")
+        exit_with_success(f"Updated automation '{existing_automation.name}' ({id})")
Evidence
The update call uses the newly validated automation, but the printed name comes from
existing_automation read before the update is applied.

src/prefect/events/cli/automations.py[545-557]

Agent Prompt
### Issue description
The CLI prints the pre-update automation name even if the update changed it.

### Issue Context
This is user-facing output; printing the requested updated name is generally more useful.

### Fix Focus Areas
- src/prefect/events/cli/automations.py[556-557]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


5. Docs plural example mismatch 🐞 Bug
Description
• The prefect automations update docs section uses plural in the header/command block but the
  examples use the singular prefect automation update.
• Since both forms work via aliases, this won’t break execution, but it is confusing and
  inconsistent within the same section.
• Align the examples with the documented command form for clarity.

correctness

Code

docs/v3/api-ref/cli/automations.mdx[R446-494]

+## `prefect automations update`
+
+
+
+```command
+prefect automations update [OPTIONS]
+```
+
+
+
+<Info>
+Update an existing automation from a file or JSON string.
+</Info>
+
+
+
+
+
+
+<AccordionGroup>
+
+
+
+
+<Accordion title="Options" defaultOpen>
+
+<ResponseField name="--id">
+    The ID of the automation to update
+</ResponseField>
+
+<ResponseField name="--from-file">
+    Path to YAML or JSON file containing the updated automation
+</ResponseField>
+
+<ResponseField name="--from-json">
+    JSON string containing the updated automation
+</ResponseField>
+
+</Accordion>
+
+</AccordionGroup>
+
+
+<Note>
+**Example:**
+
+`$ prefect automation update --id "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" --from-file automation.yaml`
+`$ prefect automation update --id "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" -f automation.json`
+`$ prefect automation update --id "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" --from-json '{"name": "updated-automation", "trigger": {...}, "actions": [...]}'`
Evidence
The plural page explicitly documents prefect automations update yet shows `prefect automation
update` in its examples.

docs/v3/api-ref/cli/automations.mdx[446-452]
docs/v3/api-ref/cli/automations.mdx[492-494]

Agent Prompt
### Issue description
The plural-form docs page shows singular-form examples, which is inconsistent and confusing.

### Issue Context
The CLI supports both `automation` and `automations` via aliases, but docs should be internally consistent.

### Fix Focus Areas
- docs/v3/api-ref/cli/automations.mdx[446-494]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools


Grey Divider

Qodo Logo

Comment on lines +511 to +522
def parse_automation_file(file_path: Path):
"""Parse automation data from a YAML or JSON file."""
if not file_path.exists():
exit_with_error(f"File not found: {file_path}")

with open(from_file, "r") as f:
content = f.read()
f = open(file_path, "r")
content = f.read()

if from_file.suffix.lower() in [".yaml", ".yml"]:
data = pyyaml.safe_load(content)
elif from_file.suffix.lower() == ".json":
data = orjson.loads(content)
if file_path.suffix.lower() in [".yaml", ".yml"]:
return pyyaml.safe_load(content)
elif file_path.suffix.lower() == ".json":
return orjson.loads(content)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action Required

1. parse_automation_file leaks errors 📘 Rule Violation

• The new parse_automation_file reads files via open() without a context manager and does not
  close the file handle, creating a resource leak and avoidable failure mode.
• It also does not catch file I/O or parsing exceptions (e.g., invalid JSON/YAML), which can surface
  as uncaught exceptions/tracebacks to the CLI user instead of a controlled, contextual error.
• This weakens robustness and may expose internal exception details in user-facing output.
Agent Prompt
## Issue description
`parse_automation_file` uses `open()` without closing the file handle and does not handle YAML/JSON parsing failures or I/O errors. This can leak resources and produce uncaught exceptions/tracebacks in the CLI.

## Issue Context
This logic runs in a CLI command; invalid user input (bad path, unreadable file, invalid YAML/JSON) is expected and should be handled gracefully with safe error messages.

## Fix Focus Areas
- src/prefect/events/cli/automations.py[511-535]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +536 to +538
# Ensure tags field is always set to empty list if not provided
if "tags" not in data:
data["tags"] = []
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action Required

2. data["tags"] assumes dict 📘 Rule Violation

• The new logic unconditionally treats data as a mutable mapping by doing if "tags" not in data
  then data["tags"] = [].
• If the YAML/JSON content parses to None (empty YAML) or a non-object type (e.g., list/string),
  this will raise before validation, violating the requirement to handle edge cases explicitly.
Agent Prompt
## Issue description
The code assumes parsed automation config `data` is always a dict and mutates it (`data["tags"] = []`) before validation. Non-dict or empty inputs can crash the CLI.

## Issue Context
YAML/JSON can parse to non-object types (e.g., `[]`, `"str"`, `null`/empty YAML). The CLI should detect and report this as an invalid automation config format.

## Fix Focus Areas
- src/prefect/events/cli/automations.py[536-543]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +536 to +538
# Ensure tags field is always set to empty list if not provided
if "tags" not in data:
data["tags"] = []
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Action Required

3. Tags cleared on update 🐞 Bug

• The CLI now injects tags: [] when the input omits tags, causing tags to be treated as
  explicitly-set.
• The orchestration client serializes updates with exclude_unset=True, so explicitly-set tags is
  sent to the server and can overwrite/clear existing tags.
• This causes silent data loss: updating an automation without specifying tags will clear tags in
  the backend.
Agent Prompt
### Issue description
The CLI update command injects `tags: []` when the input omits tags. Because the client uses `model_dump(..., exclude_unset=True)`, this makes `tags` appear explicitly set and forces `tags: []` into the PUT payload, clearing existing tags unexpectedly.

### Issue Context
The update API path applies `exclude_unset=True` updates server-side as well, so omitting fields is the way to preserve existing values. The current change breaks that behavior for tags specifically.

### Fix Focus Areas
- src/prefect/events/cli/automations.py[536-538]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines 556 to +557
await client.update_automation(automation_id, automation)
exit_with_success(f"Updated automation '{automation.name}' ({id})")
exit_with_success(f"Updated automation '{existing_automation.name}' ({id})")
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Advisory Comments

4. Misleading success name 🐞 Bug

• The success message prints existing_automation.name instead of the updated automation’s name.
• If the update changes the name, the CLI will report the old name, making it harder to confirm what
  was updated.
• This is an observability/usability regression in CLI output.
Agent Prompt
### Issue description
The CLI prints the pre-update automation name even if the update changed it.

### Issue Context
This is user-facing output; printing the requested updated name is generally more useful.

### Fix Focus Areas
- src/prefect/events/cli/automations.py[556-557]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Comment on lines +446 to +494
## `prefect automations update`



```command
prefect automations update [OPTIONS]
```



<Info>
Update an existing automation from a file or JSON string.
</Info>






<AccordionGroup>




<Accordion title="Options" defaultOpen>

<ResponseField name="--id">
The ID of the automation to update
</ResponseField>

<ResponseField name="--from-file">
Path to YAML or JSON file containing the updated automation
</ResponseField>

<ResponseField name="--from-json">
JSON string containing the updated automation
</ResponseField>

</Accordion>

</AccordionGroup>


<Note>
**Example:**

`$ prefect automation update --id "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" --from-file automation.yaml`
`$ prefect automation update --id "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" -f automation.json`
`$ prefect automation update --id "aaaaaaaa-aaaa-aaaa-aaaa-aaaaaaaaaaaa" --from-json '{"name": "updated-automation", "trigger": {...}, "actions": [...]}'`
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Advisory Comments

5. Docs plural example mismatch 🐞 Bug

• The prefect automations update docs section uses plural in the header/command block but the
  examples use the singular prefect automation update.
• Since both forms work via aliases, this won’t break execution, but it is confusing and
  inconsistent within the same section.
• Align the examples with the documented command form for clarity.
Agent Prompt
### Issue description
The plural-form docs page shows singular-form examples, which is inconsistent and confusing.

### Issue Context
The CLI supports both `automation` and `automations` via aliases, but docs should be internally consistent.

### Fix Focus Areas
- docs/v3/api-ref/cli/automations.mdx[446-494]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant