fix(validate-k9): drop premature continue so pedigree.metadata.name resolves#6
Closed
hyperpolymath wants to merge 1 commit into
Closed
fix(validate-k9): drop premature continue so pedigree.metadata.name resolves#6hyperpolymath wants to merge 1 commit into
hyperpolymath wants to merge 1 commit into
Conversation
… resolves
The pedigree block opener (`pedigree = {`) was matched, `in_pedigree=true`
was set, then `continue` skipped the brace-counting block below for *that
same line*. Result: the opening `{` on the pedigree-opener line is never
added to `pedigree_depth`. When the FIRST nested block closes (e.g.
`security = { … },`), `pedigree_depth` drops to 0 and the end-of-pedigree
check fires — even though we are still inside the pedigree block. Any field
declared in a later sibling block (e.g. `metadata = { name = … }`) is
therefore never scanned, and every K9 file that puts `name` under
`pedigree.metadata` is flagged `Missing 'name' field`.
Removing the `continue` lets the brace counter on lines 156-160 process the
pedigree-opener line normally, so depth tracks correctly:
* `pedigree = {` → depth 0 → 1
* `security = {` → depth 1 → 2
* `},` (close security) → depth 2 → 1
* `metadata = {` → depth 1 → 2 ← (was already 0, used to exit here)
* `name = "…"` → matches name field
* `},` (close metadata) → depth 2 → 1
* `},` (close pedigree) → depth 1 → 0, in_pedigree=false
Without this fix, `Validate K9 contracts` is red on every estate consumer
that uses the standard K9 templates (template-yard.k9.ncl,
template-kennel.k9.ncl, template-hunt.k9.ncl, examples/*).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
3 tasks
Owner
Author
|
Superseded — the fix (drop premature |
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.
Single-line fix for a brace-depth tracking bug in
validate-k9.sh.Symptom
Validate K9 contractsfails on every consumer that uses the canonical K9 templates withnameunderpedigree.metadata:even though the file has
pedigree.metadata.name = "…".Root cause
In the scanner loop (around line 148), the pedigree-opener line is detected and
in_pedigree=trueis set, thencontinueskips the brace-counting code below for that same line. So the{onpedigree = {is never added topedigree_depth. When the first inner block (e.g.security = { … }) closes,pedigree_depthdrops to 0 andin_pedigreeflips back to false — even though we are still nested insidepedigree. Anything declared after that (metadata = { name = … }) is never scanned.Fix
Delete the orphan
continue. The block immediately below (if [[ "" == "true" ]]) then processes the pedigree-opener line, counts its{, and depth tracking stays consistent.Test plan
template-yard.k9.ncl/template-kennel.k9.ncl/template-hunt.k9.nclfrom the canonical K9 set: should pass.