prometeu-studio/discussion/lessons/DSC-0001-studio-docs-import/LSN-0002-bank-composition-editor-legacy.md

48 lines
2.6 KiB
Markdown

---
id: LSN-0002
ticket: studio-docs-import
title: Bank composition editor legacy lesson
created: 2026-03-26
tags:
- studio
- legacy-import
- bank-composition
- staged-editing
---
## Context
Legacy import from `docs/studio/learn/bank-composition-editor.md`.
This lesson captures the first-wave `Bank Composition` model as a didactic Studio pattern inside `Asset Details`, with direct relevance to `docs/studio/specs/4. Assets Workspace Specification.md` and packer-facing integration boundaries.
## Key Decisions
### Bank composition should use a Studio DTO boundary and staged session coordinator
**What:** `Bank Composition` should operate through Studio-owned DTOs, intentionally dumb visual components, one section-scoped coordinator built around `StudioFormSession<BankCompositionDraft>`, minimal public workspace-bus notifications, and a persistence path that goes through packer rather than direct Studio writes.
**Why:** Direct binding to raw packer/runtime shapes, rule-heavy generic controls, and direct `asset.json` writes would collapse family-specific rules into the wrong layer and duplicate authority that belongs to packer.
**Trade-offs:** The section needs a dedicated coordinator and DTO projection layer, but that cost keeps component boundaries honest and makes family-specific capacity and transfer semantics easier to control.
## Patterns and Algorithms
- Keep `available` and `selected` state in Studio-owned DTOs rather than raw packer objects.
- Land the section shell early and follow the existing staged-edit rhythm: `change`, `apply`, `reset`, `cancel`.
- Keep `StudioDualListView<T>` and `StudioAssetCapacityMeter` state-driven rather than rule-driven.
- Let the section-scoped coordinator own draft lifecycle, transfer/reorder effects, blockers, hints, and apply handling.
- Submit ordered selected files to packer, then rebind from refreshed persisted state after apply.
## Pitfalls
- Binding the section UI directly to raw snapshot rows or manifest shape.
- Hiding bank-family rules inside the dual list or capacity meter.
- Creating a second staged-edit model parallel to `StudioFormSession`.
- Turning every local action into a public workspace-bus event.
- Writing `asset.json` directly from Studio.
## Takeaways
- The lasting lesson is not the specific first-wave editor controls; it is the ownership boundary between projection, orchestration, dumb components, and packer persistence.
- Section-scoped coordinators are the right place for family-specific editing semantics in Studio.
- Legacy source attribution: `docs/studio/learn/bank-composition-editor.md`.