fix(adapters): use bool data_type for MegaSquirt MIL channel - #2
Merged
Merged
Conversation
The mil channel declared data_type: boolean, which is not in the AdapterChannelSchema enum (float | int | bool | string | enum). Zod rejected the whole file, so adapters.get.ts skipped megasquirt from GET /api/adapters and logged the validation error on every request.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR fixes a Zod validation failure that caused the MegaSquirt adapter YAML to be rejected and omitted from GET /api/adapters, by aligning the adapter channel data_type value with the server’s AdapterChannelSchema.
Changes:
- Update MegaSquirt
milchanneldata_typefrombooleantoboolto matchz.enum(['float','int','bool','string','enum']). - Ensure the MegaSquirt adapter YAML can pass schema validation and be included in the adapters listing.
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
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.
Problem
GET /api/adapterslogged a Zod validation error on every request and silently omitted the MegaSquirt adapter from the response:Cause
specs/adapters/megasquirt/megasquirt-tunerstudio.adapter.yamldeclareddata_type: booleanon themilchannel (index 19).AdapterChannelSchemainserver/schemas/adapter.tsacceptsfloat | int | bool | string | enum—booleanis not a member.Because
safeParsefails the whole document,server/api/adapters.get.ts:46logged the error and returnednullfor that adapter, so MegaSquirt never reached the listing or the marketplace UI.Fix
One line:
boolean→bool. This was the onlybooleaninspecs/; the two other bool-typed channels in the repo already usedbool.Verification
1. Live
GET /api/adapterson this PR's Vercel preview deployment — HTTP 200, 9 adapters, MegaSquirt present:{ "id": "megasquirt-tunerstudio", "name": "MegaSquirt TunerStudio Datalog", "version": "1.0.0", "vendor": "megasquirt", "channelCount": 21, "categories": ["engine","electrical","pressure","fuel","ignition","temperature","speed","drivetrain","diagnostics"], "fileFormat": "csv", "extensions": [".csv"] }Vendors returned:
aim, ecumaster, emerald, haltech, link, megasquirt, romraider, rusefi, speeduino— all 9, none dropped.2. All nine adapter YAMLs parsed against the project's own
AdapterYamlSchema:Channel 19 now parses as
{"id":"mil", ..., "data_type":"bool", ...}.