Skip to content

Add AdrPlus config, merge ADRs, and fix console I/O issues - #5

Merged
FRACerqueira merged 8 commits into
mainfrom
develop
Jul 28, 2026
Merged

Add AdrPlus config, merge ADRs, and fix console I/O issues#5
FRACerqueira merged 8 commits into
mainfrom
develop

Conversation

@FRACerqueira

Copy link
Copy Markdown
Owner

This pull request updates and reorganizes the Architecture Decision Records (ADRs) for the project, cleaning up document numbering, cross-references, and consolidating overlapping decisions. It also introduces a new ADR that documents the contract for redirected/headless console I/O, clarifying how the library behaves in these environments. The ADR index and navigation links are updated throughout to match the new structure.

ADR document cleanup and consolidation:

  • Renamed and renumbered ADR files to ensure a consistent, sequential order (e.g., ADR0012ADR0011, ADR0013ADR0012, etc.), and updated all cross-references and navigation links accordingly. [1] [2] [3] [4] [5]
  • Removed the obsolete ADR "Separation of ConsolePlus and PromptPlus" (ADR0011V01R01-SeparationFromPromptPlus.md) and merged its content into the revised ADR0001V01R02-SplitConsolePlusAndPromptPlus.md, clarifying that only one ADR records this architectural boundary. [1] [2]

Redirected/headless console I/O contract:

  • Added ADR0015V01R01-RedirectedConsoleIoContract.md, specifying that all presentation-only writes (e.g., Clear(), cursor setters) fail safe (no-op), while key-based reads fail loud with a predictable exception under redirection or in headless environments. This ensures consistent, documented behavior and prevents leaking platform exceptions. [1] [2]

Documentation and configuration updates:

  • Updated the ADR index (README.md) and navigation links in all ADRs to match the new file names and ordering. [1] [2] [3] [4] [5] [6]
  • Added a new adr-config.adrplus file to define ADR naming, versioning, and formatting conventions for the repository.

These changes improve the maintainability and clarity of the project's architectural documentation, and make the handling of redirected console I/O explicit and robust.

FRACerqueira and others added 8 commits July 25, 2026 16:00
docs/adr/adr-config.adrplus was absent, even though the existing ADR
files clearly follow the AdrPlus Nygard-template/profile-3 convention
(header fields, disclaimer text, and naming all match its defaults) and
PromptPlus's sibling repo already has this file. Without it, the
adrplus CLI has no way to manage this repo's ADRs.
Updated the package version in ConsolePlus.csproj from 1.0.0-Beta1 to 1.0.0-Beta2 to prepare for the next beta release.
Both records documented the same ConsolePlus/PromptPlus split decision;
ADR0011 restated it without adding a distinct decision, so it is folded
into ADR0001V01R02 per the project's revision-over-new-number policy.
Fixes cross-links in the ADR index and neighboring ADRs' nav.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
ADR0011 was folded into ADR0001V01R02 in the previous commit, leaving a
gap in the sequence. Shift ShutdownStateRestoration, EmojiShortcodeModel,
LowLevelAnsiAndAlternateScreen, and GeneratedApiDocsOffLimits down by one
(0012->0011, 0013->0012, 0014->0013, 0015->0014) so the ADR sequence is
contiguous again, fixing every cross-link accordingly.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
NoAnsiConsoleAdapter.Clear() and SetCursorPosition() called the raw
Console APIs unguarded, so any headless/redirected process (e.g. this
xUnit test host itself) crashed with IOException: "The handle is
invalid." Wrapped both in the same catch-IOException/PlatformNotSupportedException
"Safe" pattern already used by HideCursor/ShowCursor and
EnvironmentUtil's GetSafeWidth/GetSafeHeight/GetSafeTopCursor. CursorLeft/
CursorTop setters had the same bug (raw Console.SetCursorPosition call)
and now delegate to the fixed SetCursorPosition instead of duplicating it.

Added regression tests against the real ConsolePlus singleton (not the
VirtualTerminal mock, which never touches NoAnsiConsoleAdapter) —
verified they fail with the original bug and pass with the fix.
… redirected input

KeyAvailable and ReadKey(Async) in both AnsiConsoleAdapter and
NoAnsiConsoleAdapter only guarded against !_profile.Interactive, which
defaults to true outside a short list of known CI providers. A real
redirected input (file/pipe/SetIn) doesn't match any of them, so the raw
Console.KeyAvailable/ReadKey call was reached and threw .NET's own
InvalidOperationException uncaught.

Added an explicit Console.IsInputRedirected check alongside
_profile.Interactive: KeyAvailable now returns false instead of throwing
(matching its existing non-throwing contract), and ReadKey(Async) now
throws the same documented "Console is not interactive." exception
Read()/ReadLine() already use, instead of leaking the raw framework
message.

Added regression tests against the real ConsolePlus singleton, verified
they fail with the original bug and pass with the fix.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Fixes a stale reading-input.md callout that only mentioned
Profile.Interactive; ReadKey/ReadKeyAsync also check IsInputRedirected
directly, since the CI-provider heuristic alone misses plain
redirection. Adds a note to cursor-and-screen.md covering the
presentation-only members that fail safe instead.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@FRACerqueira
FRACerqueira merged commit fd8552f into main Jul 28, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant