Skip to content

fix: skip corrupted run state files in list_runs - #3814

Open
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/workflow-runstate-json-error
Open

fix: skip corrupted run state files in list_runs#3814
Quratulain-bilal wants to merge 1 commit into
github:mainfrom
Quratulain-bilal:fix/workflow-runstate-json-error

Conversation

@Quratulain-bilal

Copy link
Copy Markdown
Contributor

Wrap json.load() in workflows/engine.py list_runs with ry/except (json.JSONDecodeError, OSError) so a single corrupted state.json doesn't crash the entire listing. Corrupted runs are silently skipped.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Improves workflow run listing resilience by skipping unreadable or malformed state files.

Changes:

  • Catches JSON parsing and file I/O errors in list_runs().
  • Skips affected workflow runs instead of aborting the listing.
Show a summary per file
File Description
src/specify_cli/workflows/engine.py Adds error handling when loading run state files.

Review details

Tip

Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

  • Files reviewed: 1/1 changed files
  • Comments generated: 2
  • Review effort level: Medium

Comment on lines +1586 to +1590
try:
with open(state_path, encoding="utf-8") as f:
state_data = json.load(f)
except (json.JSONDecodeError, OSError):
continue
Comment on lines +1589 to +1590
except (json.JSONDecodeError, OSError):
continue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants