[nolte-linux] Validate image declarations deterministically and fail closed without a validator
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 68/100
- Issue type
- Feature
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- json, markdown, python, yaml
- Domain
- developer-experience, tooling
Research direction
Start by reading scripts/validate_schemas.py for the exit-code and install-hint convention, then schemas/image-declaration-v1.0.schema.yaml for the schema itself and plugins/nolte-linux/skills/linux-image-audit/SKILL.md step 3 for the three §F conditional rules. Write plugins/nolte-linux/skills/linux-image-audit/scripts/validate_declaration.py, mirroring the bundled-script layout under plugins/nolte-media/skills/image-generate/scripts/, and drive it with tests/test_validate_declaration.py using the seven mutation cases in the issue. Done means exit 0/1/2 as specified, both schema examples valid, and the fallback prose removed from linux-image-scanner.md:45 and linux-image-developer.md:41.
Written by the indexing model from the issue text.
Description
Summary
The image-declaration.yaml validation used by the linux-image-scanner and linux-image-developer agents is not deterministic and not fail-closed. When jsonschema/PyYAML are missing, both agents fall back to "validate by reading the schema", i.e. an LLM eyeballing the file, and still report the declaration as valid. Independently of that, the three §F conditional rules whose violation the audit classifies as Critical are not encoded in the schema at all and are enforced only by prose.
Context
spec/project/yaml-json-schema/ §Validation contract (spec/project/yaml-json-schema/en.md:110) says: "MUST NOT treat absence of a validator as a passing gate. If the chosen validator isn't installed, the gate fails with an install hint; silent skip is forbidden." The repository's own scripts/validate_schemas.py honours this (exit 2 when the validator is missing). The nolte-linux agents don't.
The declaration is the root of every later decision: update_model decides whether the §F mandatory pillar applies at all, so a mis-validated declaration silently changes the audit verdict.
Evidence (revision 605926fb)
-
plugins/nolte-linux/agents/linux-image-scanner.md:45and:88: fallback to "a careful read (required fields, enums,schema_versionas the string "1.0", no extra keys …)". The fallback list omitstype,minLength,minimum, nestedadditionalPropertiesvia$ref: "#/$defs/HostSwitch". -
plugins/nolte-linux/agents/linux-image-developer.md:41: same fallback for declarations it writes. -
schemas/image-declaration-v1.0.schema.yaml:10-17: the conditional rules (field-updated⇒update+health.failure_switch;reflash-only⇒ noupdate) are deliberately not in the schema. -
plugins/nolte-linux/skills/linux-image-audit/SKILL.mdstep 3: a violated conditional rule is a §F Critical. -
Reproduced with
jsonschema4.26.0 against the schema's own first example, mutated:REJECTED max_boot_attempts=0 (fallback read list doesn't name `minimum`) REJECTED empty image.name (fallback read list doesn't name `minLength`) REJECTED extra key in $ref HostSwitch (nested via $ref) REJECTED max_boot_attempts as string ACCEPTED field-updated WITHOUT update block (Critical per audit, schema-valid) ACCEPTED field-updated WITHOUT failure_switch ACCEPTED reflash-only WITH update block -
On the audit host,
python3 -I -c "import yaml"fails (modules only in user site-packages), so the fallback path is realistic, not hypothetical.
Expected behavior
- One deterministic validator decides both the JSON Schema and the three §F conditional rules, with stable exit codes.
- When the validator dependencies are missing, the result is explicitly
not-decidable(or a failed precondition), nevervalid. - Agents and skills consume the validator's output; no LLM-only schema judgement remains.
Proposed implementation
- Add a bundled script, e.g.
plugins/nolte-linux/skills/linux-image-audit/scripts/validate_declaration.py(bundled-script convention as inplugins/nolte-media/skills/image-generate/scripts/; invoked via${CLAUDE_PLUGIN_ROOT}), that:- loads the declaration and the schema (path argument; repo copy first, installed
nolte-sharedcopy second, same lookup the skills already describe), - validates with
jsonschemaDraft 2020-12, - checks the three §F conditional rules,
- prints machine-readable JSON (
{"result": "valid|invalid|not-decidable", "violations": [{"rule", "path", "message"}]}), - exits
0valid,1invalid,2validator unavailable (mirrorsscripts/validate_schemas.py).
- loads the declaration and the schema (path argument; repo copy first, installed
- Replace the "validate by reading" fallback in
linux-image-scanner.md(line 45, Phase 2) andlinux-image-developer.md(line 41) with: run the script; on exit2report the declaration schema check asnot-decidablewith the install hint, and never asvalid. - Update
linux-image-audittriage so anot-decidabledeclaration check is blocking (the §F applicability depends on it), and define its severity explicitly. - Keep the schema unchanged (v1.0); the conditional rules stay out of the schema per
spec/project/yaml-json-schema/§Document skeleton.
Acceptance criteria
- A script exists that validates an
image-declaration.yamlagainstschemas/image-declaration-v1.0.schema.yamland the three §F conditional rules, emitting JSON withresultandviolations. - Exit codes:
0valid,1invalid,2validator dependencies missing; exit2prints an install hint to stderr. - Each of the seven mutation cases above is reported
invalidwith a rule identifier naming the violated constraint. - Both schema
examplesvalidate asvalid. linux-image-scanner.mdandlinux-image-developer.mdno longer contain a "validate by reading the schema" fallback; on exit2they reportnot-decidablewith the install hint.linux-image-audit/SKILL.mdstates the severity and blocking behaviour of anot-decidabledeclaration check, and never yieldsPASSfor an image whose declaration couldn't be validated.task testandtask lintpass;python3 scripts/validate_skills.pyreports no new error for nolte-linux.
Tests
tests/test_validate_declaration.py(pytest): valid examples; one negative case per schema constraint class (required,enum,const,type,minLength,minimum,additionalPropertiestop-level and via$ref); the three conditional-rule negatives; unparseable YAML; missing file.- Negative dependency test: run the script with
jsonschemaimport made unavailable (e.g.monkeypatchofsys.modules/ subprocess with-Iand emptyPYTHONPATH) and assert exit2and novalidin stdout.
Dependencies
- Prerequisite for the scanner tool-surface issue (removing
Bashfromlinux-image-scanner), which moves this call into the skill.
Autonomy
A coding agent can implement this independently. No architectural decision needed beyond the severity choice in AC 6, for which "blocking, like resolvable" is the default consistent with spec §J.
Priority
P2. Real correctness gap with a reproducible false valid, but it needs either a missing dependency or an LLM misread to change a verdict; it does not by itself make the plugin unsafe.
Refs spec/project/linux-image-best-practices/, spec/project/yaml-json-schema/
- Dominant language
- Python
- Stars
- 0
- Forks
- 0
- Avg merge
- 1d 10h
- Merged PRs (30d)
- 25
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nolte/claude-shared
-
agents nolte-linux security skills
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
nolte/claude-shared#732 · 1 comment ·
Maintainers usually reply within 1 day
-
audit chore
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
nolte/claude-shared#676 ·
Maintainers usually reply within 1 day
-
enhancement nolte-linux spec
Difficulty 5/5 Over a week Newbie friendliness 15/100
nolte/claude-shared#740 · 1 comment ·
Maintainers usually reply within 1 day
-
agents nolte-linux skills test
Difficulty 4/5 3-5 days Newbie friendliness 35/100
nolte/claude-shared#739 ·
Maintainers usually reply within 1 day
-
enhancement nolte-linux spec
Difficulty 5/5 Over a week Newbie friendliness 20/100
nolte/claude-shared#738 · 1 comment ·
Maintainers usually reply within 1 day
All issues in nolte/claude-shared
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
ida-arbeitszeit/workers-control#1578 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
aws-samples/sample-per-model-bedrock#898 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Maintainers usually reply within 1 day
-
intake mcp-intake needs-human-review priority:high
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Ikalus1988/MisakaNet#5041 · 3 comments ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100