Resize notifications must integrate with fiber concurrency without OS-thread callbacks.
Console terminal events
Platform spec feature
Console terminal events
Spec standingStandard
-
Cross-fiber resize uses Channel; same-fiber uses OnResize hub.
Context
Decision
Rule Detail Cross-fiber PollResize→Channel<ConsoleMessage>Same-fiber OnResizeevent hubConsequences
No separate OS-thread callback API in v1.
Verification anchors
ConsoleMessageChannelTests.bd. -
Env size parsing is best-effort discrete table in v1.
Context
Not all hosts expose Winsize ioctl; env vars are a portable fallback.
Decision
Rule Detail Order Winsize ioctl then COLUMNS/LINESParse Discrete table, not full integer grammar in v1 Consequences
Odd env values may clamp or ignore per contracts article.
Verification anchors
Platform/Terminal.bdtests. -
Failed resize Channel Send is silent in v1 poll loops.
Context
UI loops should not crash when consumers drop resize messages.
Decision
Rule Detail EVT-002 Failed Sendon resize is silent in v1Future May gain diagnostics in a later ADR Consequences
Poll loops continue after dropped resize notifications.
Verification anchors
ConsoleMessageChannelTests.bd; EVT-002 traceability.
- Contracts and edge cases Resize polling and delivery requirements.
- Design model ConsoleMessage variants and resize notification surfaces.
- Examples Subscribing to resize via channel or event hub.
- Flow and algorithm PollResize and RunTick integration.
- Verification and traceability Resize channel tests and platform extern anchors.
0 revisions (git unavailable at build; counts may be empty)
No commits recorded for this path.
| Section id | Required | Found |
|---|---|---|
what-this-feature-specifies | yes | yes |
implementation-anchors | yes | yes |
Full tree: run pnpm verify:platform-spec-layout (writes src/generated/platform-spec-layout-report.json).
What this feature specifies
How the corelib observes terminal size changes and notifies UI code: Platform.Terminal.QuerySize, PollResize → Channel<ConsoleMessage>, and same-fiber OnResize event hubs. No new runtime builtins—only existing environment, ioctl externs, and fiber/channel primitives.
Contract statement
Console.ConsoleSizeuses character cells (columns,rowsasi32).QuerySizemust try platformWinsize(Linux, macOS, Windows) then fall back toCOLUMNS/LINESparsing.PollResizemustSendConsoleMessage::Resize(now)only when dimensions change.SubscribeOnResizemust invoke the handler synchronously once with the current size after subscription.- Resize delivery must not use a separate OS-thread callback API in v1.
Implementation anchors
compiler/corelib/packages/console/src/Platform/Terminal.bdcompiler/corelib/packages/console/src/Console.bdcompiler/corelib/packages/console/src/Console/ConsoleMessage.bd- Tests:
ConsoleMessageChannelTests.bd
Decisions
Section titled “Decisions”No open decisions. Closed choices are normative ADRs under adr/ (D-CORE-TERM-0050 … D-CORE-TERM-0052); use the reader ADRs tab for expandable detail.
Articles
- Channel vs OnResize deliveryCross-fiber resize uses Channel; same-fiber uses OnResize hub.
- Contracts and edge casesResize polling and delivery requirements.
- Design modelConsoleMessage variants and resize notification surfaces.
- ExamplesSubscribing to resize via channel or event hub.
- Flow and algorithmPollResize and RunTick integration.
- Verification and traceabilityResize channel tests and platform extern anchors.