Propagate YAML loader errors and implement fault-tolerant editors - #1818
Closed
google-labs-jules[bot] wants to merge 1 commit into
Closed
Conversation
Contributor
Author
|
[CI/CD Fix Attempt 1] We investigated the CI failure on pull request #1818. Cause of FailureThe
Actions Taken
|
Contributor
Author
|
[CI/CD Fix Attempt 2] Cause of CI FailureThe
Actions Taken & Local Verification
The complete and verified fix consists of adding [tool.pytest.ini_options]
testpaths = ["tests", "tools/tools/scripts"]
norecursedirs = ["experimental", "workshop", "workshops", "draft", "drafts", "temp_drafts"]
addopts = "--ignore=experimental --ignore=workshop --ignore=workshops --ignore=draft --ignore=drafts --ignore=temp_drafts"
pythonpath = "." |
fderuiter
deleted the
jules/fix-yaml-error-propagation-js0-cc4078af-3f7c-47b2-aeea-176f438ae503
branch
August 6, 2026 15:50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why This Change is Necessary
Previously, the low-level
load_yamlparser swallowed all formatting, syntax, and system IO exceptions, silently returning an empty dictionary ({}) on failure. This created several critical issues across the application ecosystem:inject_test_data.pythat read, modify, and write back configuration assets would interpret loading failures as an empty asset. They would then write this empty state back to disk, silently wiping out existing configurations.By propagating loading exceptions to the application layer, we enable the calling environments (both the Streamlit web UI and CLI scripts) to make informed, context-aware decisions about error handling.
Key Rationale & Architecture Decisions
load_yamlto throw parser-level exceptions (such asYAMLErrorand template compilation errors) by default. Removing the blankettry-exceptblocks aligns our parsing layer with standard, fail-fast software practices.st.stop()or letting the exception crash the Streamlit runtime, we catch the propagated exceptions in the page controllers. We render an error diagnostic container (st.error) directly under the asset selector, describing exactly what failed (e.g., syntax/indentation errors) while preserving page navigation, sidebars, and the application layout.sys.exit(1)) upon encountering invalid YAML. This prevents passive data truncation.Detailed Changes
1. Core Parsing Utilities
promptops/promptops/utils.py: Removed the outer broadtry-exceptstructure fromload_yamlso formatting, Jinja compilation, and syntax errors propagate to callers.studio/studio/helpers.py: Updatedload_asset_datato allow core parser and IO errors to bubble up naturally.2. Streamlit Web Editors
studio/studio/pages/1_📝_Prompt_Editor.py&2_🔄_Workflow_Editor.py:try-exceptblocks.3. CLI Script Safeguards
tools/tools/scripts/inject_test_data.py: Added validation logic to ensure that if a read operation fails, the script prints the traceback and exits immediately rather than attempting a write action.4. Testing & Validation