feat: make validate() own every shape emit() reads#28
Merged
Conversation
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.
Closes the validate/emit seam. Several structural shapes that
graph/healthcheck/emitread were never checked byvalidate(), so a malformed document crashed with a rawAttributeError/ValueError(the CLI'sexcept UnsupportedComposeErrormisses those) or was silently mis-emitted. Now the shape-reading functions refuse malformed input andvalidate()exercises them, so every bad document is refused loudly at the gate.Robust readers (
UnsupportedComposeError, own their contract):graph.depends_on— reject a non-list/non-mappingdepends_onand a mapping entry whose value isn't a mapping.graph.hostnames(via_host_names) — reject non-stringhostname/container_nameand a per-servicenetworksthat isn't a list or mapping (long-form values that aren't mappings still contribute no aliases — lenient, matching{default: null}).healthcheck.interval_seconds— refuse an unparseable, non-finite, or overflowinginterval("1h30m",.inf,.nan,"1e400") instead of raisingValueError/OverflowError. Supported forms:30s,2m,500ms, bare seconds (no grammar expansion).Gate (
parsing.py): rejects a non-mappinghealthcheckand a non-string/listtmpfs;validate()now callshostnames(services)and the per-serviceinterval_secondsso all six holes surface at the gate.Behavior-preserving for valid input (existing tests unmodified). Design/rationale:
planning/changes/2026-07-10.01-validate-owns-emit-shapes.md; promoted intoarchitecture/supported-subset.md.Tests: 216 passing at 100% line coverage;
just lint-ciclean.🤖 Generated with Claude Code