Harden template-loader error handling and reduce duplication#50
Closed
zevorn wants to merge 1 commit intoPolyArch:mainfrom
Closed
Harden template-loader error handling and reduce duplication#50zevorn wants to merge 1 commit intoPolyArch:mainfrom
zevorn wants to merge 1 commit intoPolyArch:mainfrom
Conversation
- Remove spurious blank stderr line from load_template on missing files - Add awk exit code propagation in render_template to surface failures - Extract _emit_fallback helper to deduplicate load_and_render_safe - Prevent append_template from appending empty content on missing templates - Extend validate_template_dir to check all required subdirs (plan, pr-loop) - Bump version to 1.14.1 Signed-off-by: Chao Liu <chao.liu.zevorn@gmail.com>
SihaoLiu
added a commit
that referenced
this pull request
Mar 29, 2026
…ation - Remove spurious blank stderr line from load_template - Add awk exit code propagation in render_template - Extract _emit_fallback helper to eliminate duplicated fallback logic - Guard append_template against appending empty content - Extend validate_template_dir to check all 5 required subdirectories
Contributor
|
Merged into dev branch via local merge (commit 1862329). Template-loader hardening applied. |
Open
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.
Summary
load_templatewhen template file is missing (wasecho "" >&2before the warning message, polluting stderr output)render_template— if the awk substitution engine fails, the error is now surfaced to stderr and the function returns non-zero instead of silently producing empty output_emit_fallbackhelper to eliminate duplicated fallback emission logic inload_and_render_safe(same 5-line pattern was repeated twice)append_templateagainst appending empty content when the additional template is missing (previously appended an empty line unconditionally)validate_template_dirto check all 5 required subdirectories (block,codex,claude,plan,pr-loop) — previously only checked the first 3All existing tests pass (43/43 template-loader tests, 104/104 template-reference checks).
Test plan
bash tests/test-template-loader.sh— all 43 tests passbash tests/test-template-references.sh— all 104 checks pass, 0 failuresload_and_render_safefallback still works correctly in validators