Forge
markdowndeeb25a2
1<!-- English translation of adr/0007-signals-coupling-and-ui-backpressure.md. Canonical Russian: ../../adr/0007-signals-coupling-and-ui-backpressure.md -->
2
3#ADR 0007: Signals, loose coupling and UI relief
4
5**Status:** Accepted (implementation - strangler)
6**Date:** 2026-04-02
7## Related ADRs
8
9| ADR | Role |
10|-----|------|
11| [0004](0004-ui-thread-marshaling.md) | Marshalling UI updates via IUiScheduler |
12
13### Outside ADR
14
15| Document | Role |
16|----------|------|
17| [architecture-migration.md](../architecture-migration.md) | phase 5 |
18
19---
20## Context
21
22The IDE has many sources and consumers of signals (assembly, diagnostics, MCP, LSP, etc.). Without rules, connectivity, chaotic calls between subsystems, and thread errors increase. Large streams of text can overload UI bindings.
23
24## Solution
25
26Implement it step by step (strangler), without necessarily changing all the code at once:
27
281. **Boundaries and notifications** - sources, if possible, only publish facts (event, narrow bus, narrow contract); consumers do not pull each other directly where a reaction to the fact is sufficient. Specific mechanics (event bus, IObservable, mediator) are local. Goal: loose coupling and predictable dependency graph.
29
302. **Marshaling to the UI thread** - see ADR 0004 (`IUiScheduler` / `UiScheduler.Default`), without Post/Invoke spread throughout the code.
31
323. **Queues and batching (pointwise)** - where the data flow overloads the UI (long assembly output, avalanche of diagnostics): channel or queue and batch update of the VM, so as not to pull bindings on each line.
33
34**Patterns:** listener/pub-sub for many-to-many topology; producer/consumer for areas with load; The dispatcher layer is primarily for marshaling to the UI thread and, if necessary, routing commands, and not replacing DI.
35
36## Consequences
37
38The step-by-step status is maintained in [architecture-migration.md](../architecture-migration.md).
39
40## Rejected alternatives
41
42- Introducing a heavy global event bus for the entire product at once was rejected in favor of point solutions and strangler migration.
View only · write via MCP/CIDE