feat(engineer): simulate the real firmware and check the whole system fits - #41
Merged
Merged
Conversation
…whole system fits The simulator ran a hand-written sketch.js that had nothing to do with the generated src/main.cpp, imported schematics had no internals to simulate against, and nothing ever asked whether the stages agreed with each other. - translate a supported Arduino C++ subset so firmware is the sim source - carry declarative part internals on the circuit doc, with UNMODELLED parts named rather than silently inert - add a cross-stage fit check (schematic/PCB/firmware/BOM/CAD + a simulated run) as a copilot tool and a Verify panel - run CAD and schematic generation in parallel in the copilot prompt Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Three gaps closed, all versions of the same problem — the stages produced artifacts that were never checked against each other.
1. The simulator runs the firmware, not a parallel sketch.
lib/sim/arduino.tstranslates a supported Arduino C++ subset into the existing JS runtime, sosrc/main.cppis the simulation source and there is nothing to keep in sync by hand. It is a subset on purpose: unsupported constructs are refused rather than approximated, because a sim that quietly ignoresServo.his worse than one that says it cannot run.2. Schematic parts can carry internals.
PartSpec(data, never model-authored code) compiles to thePartModelthe engine already consumes — drives, shorts, indicator, analog, interactivity — and is stored onCircuitDoc.models, validated on the way in. A part with neither a built-in model nor a spec is inert and named:"Hall (UNMODELLED)", surfaced in the canvas and the fit check, instead of silently doing nothing.save_circuit/import_wokwi_diagramnow returnpartsWithoutSimulationModel, and a newdefine_part_modelstool fills them in.3. A fit check that actually runs the thing.
evaluateFit(input)compares schematic ↔ PCB ↔ firmware ↔ BOM ↔ CAD and then executes the firmware against the schematic. Pin usage is recorded at the simulator boundary rather than parsed out of the source, so a pin reached through a variable or a helper still counts:Exposed as
verify.fitCheck(read-only query), the copilot toolcheck_integration, and a Verify panel labelledSIMULATED— behavioural, not compiled firmware on hardware.Prompt. CAD and schematic were serialised behind each other for no reason; a Zoo generation takes ~5 minutes. They now go in the same step, with PCB/firmware after the schematic and
check_integrationas a mandatory final step that must be re-run after any cross-stage change.Testing
test/part-spec.test.ts(10) andtest/fit-check.test.ts(9) added, alongside the existingtest/arduino-translate.test.ts. Full suite 466 passing; prettier, eslint andtsc --noEmitclean. Not exercised in a browser — the Verify panel and canvas changes are untested end-to-end.Link to Devin session: https://app.devin.ai/sessions/27a2860693d444f8a9a37442a83762d7
Requested by: @alanshen27