Give each tool one address derived at build time, and have core mint and release its bus handle - #422
Draft
CarsonDavis wants to merge 7 commits into
Draft
Conversation
…and release its bus handle A tool's address comes from its binding name in the generated manifest, so there is nothing to declare and nothing to collide. The modern tool controller mints the tool's bus handle before its own code runs, injects it, releases it after destroy, and announces each teardown on the bus. The public accessor for minting a handle by name is gone, the classic controller's unused mint is deleted, and layer variable lookup keys on the address.
…ature/350-tool-identity-v2 # Conflicts: # docs/pages/APIs/JavaScript/Main/Event-Bus-API.md # src/essence/Tools/FetchStats/FetchStatsTool.js
…' into feature/350-tool-identity-v2
…ature/350-tool-identity-v2
…ature/350-tool-identity-v2
This was referenced Sep 10, 2026
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.
A tool's bus address now comes from its binding at build time, and the core, not the tool, mints, injects and releases the tool's handle.
Closes #350
Two of the issue's acceptance items, closing a tool's popup on its own teardown and on full teardown, land in the popup service PR stacked on this one, which is the first subscriber to the teardown events this PR adds.
A tool's address is generated from its binding
Previously each modern tool invented its own bus id in its own source, and nothing caught two tools claiming the same id. The fix: the manifest generator derives the address from each binding (
AOIToolgivesaoi,FetchStatsToolgivesfetchstats) into the generated registry, the frontend derives it identically, and two bindings deriving the same address fail the build. A tool declares nothing. Demo mission: yes, every tool loads through it.Core mints the handle, injects it, releases it, and announces teardown
Previously a tool called
forPlugin()inside its ownmake(), so its registrations outlived it and any script could mint any plugin's handle by name. The fix: the modern tool controller mints the handle and setstool.apibeforeinitialize(), releases it afterdestroy()and on a mid-load throw, then emitsplugins:destroyed { pluginId: 'aoi' }per tool and oneplugins:allDestroyedper teardown.window.mmgisAPI.forPluginis gone; in the console it is undefined. Demo mission: yes, closing AOI or Chart exercises it.What still resolves and what changed on the wire
Nothing inbound broke:
panelTools: ["Title", "Card"]andplugins:show:AOIToolstill land, because every controller entry point resolves a display name, binding or address down to the address. Layer variable lookup now keys on the address with the lowercased display name as fallback, which is whyfetch-statsused to silently miss its configured variables. The unusedL_.hasToolhelper is deleted with it. Outbound, FetchStats' address isfetchstats(wasfetch-stats) so its events readplugin:fetchstats:analysisReady, tool cards carrydata-tool="aoi"with ids ending-tool-aoi, andpanels:getAll().toolIdsandplugins:getAll()report addresses. Demo mission: yes, the AOI to FetchStats to Chart chain; variable lookup is covered by tests only.Classic Layout Stuff
Classic tools get no handle
The classic layout minted a handle nothing consumed, so that mint is deleted. A classic FetchStats now completes an analysis and emits to nobody. Demo mission: no, the demo runs the modern layout.
React tools and the e2e block
React tools are unchanged: they call
window.mmgisAPIdirectly through the shared adapter, so their requests carry no caller and LayerManager's unprefixed providers survive release. An e2e block that minted handles from the page was deleted; injection is covered by the unit specs.Behaviour changes to note
plugin:fetch-stats:*becameplugin:fetchstats:*and listing ids went fromAOITooltoaoi, with no alias, rather than picking addresses matching the already public strings. Inbound still takes the old names, outbound does not, so an out-of-tree subscriber to the old FetchStats events breaks silently.forPluginis off the public surface andmintHandleonly reachable by importing the core module, which stops one plugin minting another's address. The cost: anything the modern controller does not load gets no scoped handle, meaning classic tools and external plugins until a bridge hands one across.Decisions to review