Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Aug 26, 2025

This PR adds support for the new stage field in the JobError model to align with changes made in Home Assistant Supervisor PR #5784.

The Supervisor now includes a stage field in job error responses to indicate what stage of a job an error occurred in. This allows for better error tracking and diagnostics, particularly useful for distinguishing between errors that occur during different phases of operations like backup creation vs. copying to additional locations.

Changes Made

  • Added stage: str | None = None field to the JobError dataclass
  • Updated test fixtures to include the stage field in error objects
  • Added test assertions to verify the stage field is properly parsed
  • Created backward compatibility test to ensure the client works with legacy error responses that don't include the stage field

Backward Compatibility

The stage field is optional with a default value of None, ensuring full backward compatibility with existing Supervisor versions that don't include this field in error responses.

Example usage:

# New format with stage information
error = JobError(
    type="BackupError", 
    message="Could not copy backup", 
    stage="copy_additional_locations"
)

# Legacy format still works (stage defaults to None)
error = JobError(type="BackupError", message="Could not copy backup")

Fixes #166.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copy link
Contributor Author

Copilot AI commented Aug 26, 2025

@agners 👋 This repository doesn't have Copilot instructions. With Copilot instructions, I can understand the repository better, work faster and produce higher quality PRs.

I can generate a .github/copilot-instructions.md file for you automatically. Click here to open a pre-filled issue and assign it to me. I'll write the instructions, and then tag you for review.

Copilot AI changed the title [WIP] Add stage field to JobError model Add stage field to JobError model Aug 26, 2025
Copilot finished work on behalf of agners August 26, 2025 14:26
Copilot AI requested a review from agners August 26, 2025 14:26
@agners agners added the new-feature New features or options. label Aug 26, 2025
@agners agners marked this pull request as ready for review August 26, 2025 14:33
@agners agners merged commit a28b55d into main Aug 26, 2025
12 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Aug 28, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

new-feature New features or options.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add stage field to JobError model

3 participants