build(aircraft): validate the configs before publishing them - #16
Draft
nabeelio wants to merge 1 commit into
Draft
build(aircraft): validate the configs before publishing them#16nabeelio wants to merge 1 commit into
nabeelio wants to merge 1 commit into
Conversation
These documents used to be TypeScript classes, so the compiler caught a typo'd feature name or a missing field. As JSON they have nothing in front of them, and this repo has no test runner, so a broken document would publish to every VA and then fail quietly: the client skips a feature key it does not recognise and logs a warning nobody reads. The bundle task already parses all 36 documents and CI already runs the build, so the check goes there rather than behind a new test runner and its dependencies. A bad document now fails the build instead of shipping. Checks meta's required fields, that sim is one the client understands, that ids are unique, that match is an array, and that every features and disabled key exists in this repo's AircraftFeature enum. Problems are collected so one build reports all of them. The vocabulary is parsed out of defs.ts rather than imported, because the gulpfile runs before any TypeScript is compiled and defs.js is an artifact that can lag its source. Parsing zero members throws instead of returning an empty set, which would turn every check into a no-op.
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.
Aircraft configs used to be TypeScript classes, so the compiler caught a typo'd feature name or a missing field. As JSON they have nothing in front of them, and a broken document publishes to every VA and then fails quietly - the client skips a feature key it doesn't recognise and logs a warning nobody reads.
npm run build, so a bad document now fails there instead of shipping.simis one the client understands, thatmeta.idis unique across documents, thatmatchis an array, and that everyfeatures/disabledkey exists in this repo'sAircraftFeatureenum. Problems are collected rather than thrown one at a time, so one build reports all of them.defs.tsinstead of imported, because the gulpfile runs before any TypeScript is compiled anddefs.jsis a build artifact that can lag its source. Parsing zero members throws rather than returning an empty set, which would quietly turn every check into a no-op.corpus.test.tsused to validate all 35 documents against the engine on every CI run; it now guards the four examples that stayed behind, and nothing was checking these.Verified against the real corpus: a clean build passes all 36, and each failure mode was injected and confirmed to fail the build with the offending file named - typo'd feature key, unknown
sim, missingmeta.author, duplicatemeta.id, non-arraymatch, non-objectdisabled.