prometeu-studio/docs/studio/pull-requests/PR-08-assets-workspace-panel-package-boundaries-and-local-subscriptions.md
2026-03-24 13:42:44 +00:00

118 lines
6.1 KiB
Markdown

# PR-08 Assets Workspace Panel Package Boundaries and Local Subscriptions
Domain owner: `docs/studio`
## Briefing
The current `Assets` workspace still keeps too much control logic concentrated in top-level workspace-area classes.
That leaves package boundaries flatter than they should be and still weakens the intended Studio model:
- every panel should own its own workspace-bus subscriptions;
- `AssetWorkspace` should stay as composition root and orchestration layer;
- the asset list should live in its own package area;
- the full right-hand details side should be split into package-owned panels with direct lifecycle-managed subscriptions.
This refactor is a structural follow-up to the `PR-07` family.
It does not redefine the event-driven direction; it completes it by enforcing package topology and subscription ownership at the panel level.
## Objective
Reorganize the `Assets` workspace into explicit package areas so that every list or details panel consumes the workspace event bus directly and subscribes only to the state it needs.
After this PR:
- `AssetWorkspace` composes package-scoped controls instead of hosting panel logic directly;
- all asset-list controls live under an `asset list` package area;
- the right-hand details side is organized under `details/...` package areas;
- `summary`, `actions`, `contract`, `preview`, and `diagnostics` each manage their own subscriptions;
- the package layout itself teaches the correct Studio workspace architecture.
## Dependencies
- [`./PR-07a-assets-event-topology-and-lifecycle-foundation.md`](./PR-07a-assets-event-topology-and-lifecycle-foundation.md)
- [`./PR-07b-asset-navigator-and-row-subscriptions.md`](./PR-07b-asset-navigator-and-row-subscriptions.md)
- [`./PR-07c-asset-details-and-form-lifecycle.md`](./PR-07c-asset-details-and-form-lifecycle.md)
- [`./PR-07e-assets-refactor-cleanup-and-regression-coverage.md`](./PR-07e-assets-refactor-cleanup-and-regression-coverage.md)
- [`../specs/4. Assets Workspace Specification.md`](../specs/4.%20Assets%20Workspace%20Specification.md)
## Scope
- create an `asset list` package area under the `Assets` workspace implementation
- move the asset-list host and asset-list item control into that package area
- require both asset-list host and asset-list item to receive `StudioWorkspaceEventBus`
- require both asset-list host and asset-list item to own their own lifecycle-managed subscriptions
- create a `details` package area for the full right-hand side of the workspace
- split details internals into package-owned subareas such as:
- `details/summary`
- `details/actions`
- `details/contract`
- `details/preview`
- `details/diagnostics`
- require each details panel to subscribe directly to the event stream it consumes
- reduce coordinator-style pass-through logic where a child panel can consume the workspace bus directly
- keep shared details support code only where it removes real duplication without re-centralizing subscriptions
## Non-Goals
- no new mutation semantics
- no new global event-bus abstraction
- no visual redesign of the workspace
- no cross-workspace extraction unless a primitive is already justified by this refactor
- no return to top-level refresh orchestration as the normal update model
## Execution Method
1. Define the target package topology.
The package tree should reflect workspace areas, not arbitrary implementation convenience.
2. Move asset-list code into a dedicated package area.
The list host and list item should be colocated and should consume the workspace bus directly.
3. Normalize asset-list subscriptions.
The asset-list host should subscribe to list-level projection state.
The asset-list item should subscribe to item-local concerns such as selection and asset patch events.
4. Move the full right-hand details side into a dedicated `details` package area.
The top-level details host should stay thin and should mount panel controls by workspace area.
5. Split details panels by concern.
`summary`, `actions`, `contract`, `preview`, and `diagnostics` should each live in package-owned subareas and subscribe for themselves.
6. Remove parent-owned update routing where it is only forwarding state to children.
If a child panel can subscribe to the workspace bus safely, it should do so directly.
7. Re-check constructor contracts.
Every event-consuming panel should receive the `StudioWorkspaceEventBus` explicitly, plus only the interaction ports it truly needs.
8. Clean naming and file layout.
Class names, package names, and placement should make the `Assets` workspace structure obvious to a new maintainer.
## Acceptance Criteria
- there is a dedicated package area for the asset list inside the `Assets` workspace
- asset-list host and asset-list item both receive `StudioWorkspaceEventBus`
- asset-list host and asset-list item both subscribe directly to the events they need
- there is a dedicated `details` package area for the right-hand workspace side
- `summary`, `actions`, `contract`, `preview`, and `diagnostics` each live in their own package-owned area
- each details panel owns its own lifecycle-managed subscriptions
- `AssetWorkspace` no longer acts as the effective subscriber for panel-internal state
- package structure and constructor boundaries make the lifecycle model explicit
## Validation
- unit tests for lifecycle subscribe/unsubscribe on moved controls
- unit tests or focused integration tests proving list item and details panels react from their own subscriptions
- regression validation that asset selection and local patch flows still update without workspace-wide refresh
- package-level review that no event-consuming panel is left without direct bus access
## Affected Artifacts
- `prometeu-studio/src/main/java/p/studio/workspaces/assets/AssetWorkspace.java`
- `prometeu-studio/src/main/java/p/studio/workspaces/assets/...` moved into list/details package areas
- asset-list controls under a dedicated list package
- details controls under `details/...` packages
- tests for workspace lifecycle and subscription ownership
- `docs/studio/specs/4. Assets Workspace Specification.md` if package/lifecycle wording needs tightening after the refactor