fix(skills): validate project metadata at build time#488
Open
Sk-Azraf-Sami wants to merge 1 commit into
Open
Conversation
The default (no --review) Phase 6 validator only checked nodes, edges,
layers, and tour — never graph.project. A graph missing a required
project field (e.g. description) passed the build clean, but the
dashboard rejected it on load with "Missing or invalid project
metadata" (ProjectMetaSchema in packages/core/src/schema.ts).
- Extract the inline ua-inline-validate.cjs from SKILL.md into a bundled
validate-graph.mjs (mirrors the generate-ignore.mjs extraction),
preserving its {issues, warnings, stats} output contract.
- Add a graph.project check covering the six required fields (name,
description, languages, frameworks, analyzedAt, gitCommitHash), so a
graph that would be rejected on dashboard load is now caught at build
time.
- Clarify Phase 6 assembly that project fields come from scan-result's
name/description keys, and have step 5 repopulate them on failure.
- Add test_validate_graph.test.mjs (10 cases).
Bump 2.8.1 -> 2.8.2.
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
The default (no
--review) Phase 6 graph validator in/understandonly checkednodes,edges,layers, andtour— it never validatedgraph.project. A graph missing a required project field (in my casedescription) passed the build clean ("0 issues"), but the dashboard rejected it on load with "Missing or invalid project metadata", because the dashboard runs the stricterProjectMetaSchema(packages/core/src/schema.ts) which treats missing project metadata as fatal. So the build-time validator was a weaker subset of the load-time one — and the exact field the dashboard requires was the field the build never checked.This PR closes that gap and hardens the assembly step:
ua-inline-validate.cjsthat SKILL.md wrote to the project tmp dir on every run into a bundledskills/understand/validate-graph.mjs(same pattern as the earliergenerate-ignore.mjsextraction in a0155c5), preserving its exact{ issues, warnings, stats }output contract so Phase 6 step 5 and the Phase 7 report are unchanged.graph.projectcheck to the validator covering the six required fields (name,description,languages,frameworks,analyzedAt,gitCommitHash), mirroringProjectMetaSchema. A graph that would be rejected on dashboard load is now flagged at build time.scan-result.json's literalname/descriptionkeys (notprojectName/projectDescription), and step 5 now repopulates them on failure instead of shipping invalid metadata.Linked issue(s)
How I tested this
Reproduced the original failure: a knowledge graph with
project.descriptiondropped passes the old inline validator but the dashboard shows "Missing or invalid project metadata". With this change,validate-graph.mjsreports the issue at build time.Added
tests/skill/understand/test_validate_graph.test.mjs(10 cases): valid graph passes; missing / empty-string / missing-object / non-array project fields each flagged; regression coverage for dangling edges, file-node-not-in-layer, node-in-multiple-layers, orphan warning, and malformed-JSON exit.pnpm lintpnpm --filter @understand-anything/core test(753 passed)pnpm test(217 passed, incl. the 10 new cases)Manual smoke test (described above)
Versioning
/understandvalidation🤖 Generated with Claude Code