Source Physical Topology From GRCAN.CANdo, Remove can_topology.json - #13
Open
coderask wants to merge 1 commit into
Open
Source Physical Topology From GRCAN.CANdo, Remove can_topology.json#13coderask wants to merge 1 commit into
GRCAN.CANdo, Remove can_topology.json#13coderask wants to merge 1 commit into
Conversation
The physical bus wiring now lives in the physical topology section of GRCAN.CANdo (Firmware), which is the single source of truth. Teach GrcanDocument to parse that section and expose getPhysicalTopology(), repoint PhysicalTopology at the document instead of fetching the JSON, refresh it on each ref load, and delete the now-duplicate can_topology.json.
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.
Source Physical Topology From
GRCAN.CANdoProblem and Scope
Physical bus wiring — which devices are wired to which CAN bus — lived in this repo's standalone
Web/can_topology.json, duplicating information that now belongs inGRCAN.CANdo. Firmware#532 adds a hand-editablephysical topologysection toGRCAN.CANdoas the single source of truth, leavingcan_topology.jsona stale duplicate.Description
Repoints the viewer at the CANdo's own
physical topologysection and deletes the duplicate JSON:candoDocument.js: parses thephysical topology:section (already preserved verbatim in the Bus ID span) into_physicalTopologyand exposesgetPhysicalTopology()returningMap<bus, Set<node>>.physicalTopology.js:load()now reads fromGrcanDocument.getPhysicalTopology()instead of fetchingcan_topology.json. Public API (isOnBus,getNodesForBus,isLoaded,validate) and theDebugger/ALLexemptions are unchanged.viewer.js: refreshes topology insiderenderHierarchy(andreRenderLocal) once the ref's CANdo is loaded, so the Graph View tracks the viewed ref.Web/can_topology.jsonand updatesREADME.md.Gotchas and Limitations
Topology now tracks whichever ref is loaded rather than a single static file — a net improvement, but it means an old ref whose CANdo predates the
physical topologysection will report no topology (enforcement fails open, same as a missing file today). Bus and node names must still match theBus IDandGR IDsections by hand;validate()warns on drift.Testing
Testing Details
node --checkpasses on allWeb/*.js.GRCAN.CANdothroughGrcanDocument.getPhysicalTopology():Primary(13),Data(20),Charger(5) match the file;Testingcorrectly absent; returned map is a defensive copy.PhysicalTopologyend-to-end:isOnBustrue for wired nodes, false for unwired, always true forDebugger;getNodesForBuscorrect; unlisted bus returns[];validate()runs clean against the device registry.Larger Impact
One source of truth for CAN configuration. Physical wiring is edited alongside the logical bus and routing definitions in
GRCAN.CANdo, and the viewer no longer carries a separate data file to keep in sync.Additional Context and Ticket
Companion to Firmware#532, which introduced the
physical topologysection. Realizes the follow-up noted there. Original migration of web out of Firmware: Firmware#521.