The monolithic open-questions.md (1310 lines, 47 OQs) was large enough to be unmanageable, with high size variance (OQ-42 at 220 lines next to OQ-06 at 8). Decomposed into one file per OQ under docs/architecture/questions/ (NNN-slug.md, mirroring the ADR convention), with open-questions.md retained as the index: theme-grouped tables plus a cross-theme Deferred/Blocked section that surfaces the 6 deferred OQs with their Blocked-on conditions inline (the safe-exit visibility surface). Per-OQ content moved verbatim; all 62 inbound links stay valid (none used anchors). README's curated OQ summary dropped (now redundant with the index tables). Also seeds tasks/architecture/ with this task plus two follow-ups found during the decompose: OQ-09/10 missing structured Blocked-on fields, and the tasks/architecture/ blocker-task half of the Safe Exit protocol being unenforced.
28 lines
1.5 KiB
Markdown
28 lines
1.5 KiB
Markdown
# OQ-43: `TtyControl` as a `Clone` trait object
|
|
|
|
- **Origin**: [crates/tty/tty-backend.md](crates/tty/tty-backend.md)
|
|
(the `TtyHandle.control` field shape);
|
|
`docs/research/alknet-tty/phase-0-findings.md` OQ-TTY-01 (the trait-
|
|
shape open question the local-PTY POC resolved).
|
|
- **Status**: resolved
|
|
- **Door type**: One-way (the `TtyControl` trait shape is part of the
|
|
`TtyBackend` API surface — ADR-053), two-way (the concrete `Clone`
|
|
newtype mechanism)
|
|
- **Priority**: medium
|
|
- **Resolution**: `TtyHandle.control` is
|
|
`Option<Box<dyn TtyControl + Send + Unpin + Clone>>`. The `Clone`
|
|
trait-object bound is satisfied via an `Arc`-backed `Clone` newtype: a
|
|
small struct holding `Arc<dyn TtyControlInner>` where `TtyControlInner:
|
|
Send + Sync` has the `resize`/`signal` methods, and the public
|
|
`TtyControl` newtype implements `Clone` by cloning the `Arc`. The
|
|
local-PTY POC used a concrete `PtyControl` struct (inherently `Clone` —
|
|
it held `Arc<Mutex<...>>` fields); the trait-object form generalizes it
|
|
so a backend can produce its own control type without the adapter
|
|
knowing the concrete shape. The `Clone` constraint exists because the
|
|
adapter's control-chunk dispatcher needs to be handed off to the
|
|
spawned pump task (the POC's `session::drive_session` clones
|
|
`pty.control` for the client→backend pump). See ADR-053 and
|
|
`tty-backend.md`.
|
|
- **Cross-references**: ADR-053, [tty-backend.md](crates/tty/tty-backend.md),
|
|
`/workspace/alknet-tty-poc/src/local_pty.rs` (`PtyControl`)
|