4.1 KiB
PR-01 - StudioEventBus Foundation
Briefing
The Studio now has a normative event model in spec, but prometeu-studio still relies on direct UI wiring.
This PR introduces the generic StudioEventBus foundation that later Studio code will use for:
- shell-level observation,
- workspace-local activity,
- workspace-to-global propagation,
- project launcher and shell interactions.
The implementation should be based conceptually on the C# event system located at:
/Users/niltonconstantino/personal/workspace.personal/unity/My-Local-Packages/Packages/intrepid-general-utilities/Runtime/SimpleEvents
The generic bus machinery should live in shared infrastructure, not in the Studio components module.
The bus must be thread-safe because background work such as asset recognition, tree refresh triggers, diagnostics updates, and other asynchronous Studio tasks may publish events from outside the UI thread.
Objective
Implement the typed Studio event infrastructure so future Studio work can publish and observe events without string routing or ad hoc direct coupling.
The generic event bus core should be introduced in prometeu-infra, while Studio-specific bus composition remains in Studio code.
Dependencies
../specs/2. Studio UI Foundations Specification.md../specs/3. Studio Components Module Specification.mdfor downstream UI implications
Scope
- introduce a generic typed event bus foundation in
prometeu-infra - introduce Studio-specific global and workspace bus composition on top of that foundation
- introduce a workspace-local bus model
- support automatic workspace-to-global propagation
- introduce DTO-style event payload contracts
- add the minimum initial event set needed by the shell wave
- add tests for propagation and subscription behavior
Non-Goals
- implementing every future Studio event now
- integrating the full packer event lane now
- redesigning the whole shell in this PR
- moving visual controls into
prometeu-studio-components - placing the generic bus core inside
prometeu-studio-components
Execution Method
- Use
/Users/niltonconstantino/personal/workspace.personal/unity/My-Local-Packages/Packages/intrepid-general-utilities/Runtime/SimpleEventsas the architectural reference point. - Port the useful baseline ideas into Java rather than copying Unity-specific structure literally.
- Introduce the generic event bus machinery in
prometeu-infra. - Keep the generic layer unaware of Studio shell semantics.
- Introduce the Studio-specific event contract and bus composition above that generic layer.
- Use typed DTO events, preferably immutable.
- Make subscription and unsubscription explicit and safe.
- Implement one global bus and one workspace bus type for Studio.
- Ensure every workspace event is automatically republished to the global bus.
- Keep propagation one-way: workspace to global.
- Make publication and subscription management thread-safe.
- Add tests for:
- typed subscription
- unsubscription
- workspace-to-global propagation
- no accidental global-to-workspace rebroadcast
- concurrent publication and subscription safety
Acceptance Criteria
prometeu-infrahas a generic typed event bus foundation- Studio code has a global and workspace bus composition built on top of that foundation
- workspace buses exist and can be attached to the global bus
- every workspace-published event is observable on the global bus
- callers do not need to publish the same event twice manually
- event payloads are DTO-style and not string-based
- publication and subscription handling are safe under concurrent access
- automated tests cover the propagation baseline
Validation
- unit tests for bus behavior
- basic smoke coverage for publish/subscribe and nested propagation
- concurrent test coverage for thread-safe event publication
Affected Artifacts
prometeu-infraprometeu-studioapplication infrastructure- future shell integration points
- tests for Studio UI foundation code