Skip to content
This repository was archived by the owner on Mar 23, 2026. It is now read-only.

feat: Implement validation for taskweaver_config.json - #511

Merged
Liqun Li (liqul) merged 2 commits into
microsoft:mainfrom
om051105:feature/config-validation
Jan 7, 2026
Merged

Liqun Li (liqul) merged 2 commits into
microsoft:mainfrom
om051105:feature/config-validation

Conversation

@om051105

Copy link
Copy Markdown
Contributor

Description

This PR addresses the TODO in taskweaver/utils/app_utils.py by implementing validation logic for the taskweaver_config.json file.

Changes

  • Implemented json.load to verify the configuration file contains valid JSON.
  • Added a check to ensure the root element is a dictionary (dict), as expected for configuration files.
  • Added error handling for json.JSONDecodeError and OSError to prevent crashes when reading the file.

Related Issues

Resolves TODO in taskweaver/utils/app_utils.py

@liqul Liqun Li (liqul) left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the contribution.

@liqul
Liqun Li (liqul) merged commit 5de27a6 into microsoft:main Jan 7, 2026
2 checks passed
Liqun Li (liqul) added a commit to liqul/TaskWeaver-Plus that referenced this pull request Feb 3, 2026
### Description
This PR addresses the `TODO` in
[taskweaver/utils/app_utils.py](cci:7://file:///c:/Users/singh/OneDrive/Documents/Open%20Source/TaskWeaver/taskweaver/utils/app_utils.py:0:0-0:0)
by implementing validation logic for the `taskweaver_config.json` file.

### Changes
- Implemented `json.load` to verify the configuration file contains
valid JSON.
- Added a check to ensure the root element is a dictionary
([dict](cci:1://file:///c:/Users/singh/OneDrive/Documents/Open%20Source/TaskWeaver/taskweaver/session/session.py:357:4-362:9)),
as expected for configuration files.
- Added error handling for `json.JSONDecodeError` and `OSError` to
prevent crashes when reading the file.

### Related Issues
Resolves TODO in `taskweaver/utils/app_utils.py`
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants