docs: Add release notes for 3.6.10#117
Conversation
Co-Authored-By: unknown <>
…move integration-only items Co-Authored-By: unknown <>
Code Review by Qodo (Alpha)
1. `parse_automation_file` leaks errors
|
| 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) |
There was a problem hiding this comment.
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
| # Ensure tags field is always set to empty list if not provided | ||
| if "tags" not in data: | ||
| data["tags"] = [] |
There was a problem hiding this comment.
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
| # Ensure tags field is always set to empty list if not provided | ||
| if "tags" not in data: | ||
| data["tags"] = [] |
There was a problem hiding this comment.
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
| 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})") |
There was a problem hiding this comment.
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
| ## `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": [...]}'` |
There was a problem hiding this comment.
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
Benchmark PR from qodo-benchmark#377