Strict ingredient schema: refuse unknown keys, pass MCP server config through - #12
Merged
Merged
Conversation
An unknown key in ingredient.yaml (top level or origin) now fails the Forge load, naming every key, instead of being stripped where forge unify cannot see it.
The server is checked against its declared keys and returned as-is, so undeclared keys, the source key order and __proto__ survive to .mcp.json; a type-first server now adopts.
fingerprintDir parses ingredient.yaml through IngredientSchema, so both sides of a comparison carry the same defaults. Fingerprints move only for hand-written metadata that omits defaulted fields; the golden unify plan is regenerated and only its two fingerprints change.
…gerprintDir The stage now hands fingerprintDir an overlay reader instead of carrying its own copy, so the second unvalidated ingredient.yaml parse is gone and both paths validate alike.
…ging it 0.2.4 wrote Forges no command could load (a numeric MCP env value, a name that is not slug-like); the import now refuses them naming the source, with the Forge untouched.
…nify Undeclared keys and the Forge's key order reach .mcp.json and the Kiro file, schema-ordered servers keep their 0.2.4 bytes, and a server difference only in headers keeps the variant.
Unknown ingredient keys are refused, MCP servers pass through verbatim, and the upgrade section lists the MCP updates, stale unify plans and the stricter import.
A cyclic ingredient.yaml was reported by absolute path while every other metadata error is relative to the working directory; spec 07 §6.1 wants one form.
…nc --check AC 1 was tested through forge variants only, and AC 5 through the update state only.
The import row cited a case the importer cannot hit and missed an existing Forge ingredient that no longer loads; the upgrade note now says to commit the fixed Forge.
…c round trip The parity check compares fingerprintDir through the stage with the flushed directory directly, and an imported MCP server with undeclared keys adopts and syncs byte for byte.
Error messages name files with path.relative, which uses backslashes on Windows; the new assertions expected POSIX separators and failed on windows-latest.
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
craftar@0.3.0to npm after approval in thenpmenvironment.ingredient.yaml(top level ororigin) fails the Forge load, naming the file and every unknown key at once, instead of being stripped whereforge unifycould resolve and delete a variant that differed only there.serverpasses through:command/args/url/env/typeare checked, and the server is returned as the very object the Forge holds, so undeclared keys (headers,timeout,disabled…), the source key order and__proto__reach.mcp.jsonand.kiro/settings/mcp.json.fingerprintDir(the importer's second, unvalidated copy is gone).envvalue, a name that is not slug-like) fails the whole import naming its source, with the Forge untouched; so does an existing Forge ingredient with an unknown key or a YAML syntax error.Emitted bytes — which workspaces see a change
.mcp.jsonand.kiro/settings/mcp.jsonshowupdateonce for workspaces whose Forge MCP servers have keys beyondcommand/args/url/env/type, or keys stored out of that order..mcp.jsonthat readcollisionbecause of undeclared keys ortypefirst now adopts.forge unifyplans go stale for hand-writteningredient.yamlthat omits defaulted fields (their fingerprint moves);--planrefuses them and--save-planregenerates. The golden unify plan was regenerated by its script: only its two fingerprint lines changed.Upgrade note
See README § Upgrading → to 0.3.0: rename or remove unknown keys and commit the Forge; expect one
updateon the MCP files; re-save stale unify plans;importis stricter and may reuse where it used to create a variant.Test plan
npm run typecheck— passesnpm run build— passesnpm test(Linux,--exclude test/ci.test.ts) — 19 files passed / 1 skipped; 350 passed / 5 skipped. Withci.test.tsincluded (pre-flight): 388 passed / 5 skippednode-cli-revieweranddocs-author: clean after one correction round (AC 1/AC 5 CLI tests, error path format, README cases, stage parity and import→sync round trip)