chore(cli): async and predicate-based CliIoHost message listeners#1679
Open
mrgrain wants to merge 1 commit into
Open
chore(cli): async and predicate-based CliIoHost message listeners#1679mrgrain wants to merge 1 commit into
mrgrain wants to merge 1 commit into
Conversation
Contributor
Dependency Review✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.Scanned FilesNone |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1679 +/- ##
==========================================
+ Coverage 89.14% 89.29% +0.14%
==========================================
Files 77 77
Lines 11539 11716 +177
Branches 1605 1620 +15
==========================================
+ Hits 10287 10462 +175
- Misses 1221 1223 +2
Partials 31 31
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Internal only, with no user-facing CLI behavior changes.
CliIoHostandIoHostRecorderare CLI-internal (the recorder is a test helper, and the.isaddition lives in toolkit-lib'sprivatepath). This is groundwork for rerouting CLI commands throughtoolkit-lib, plus a more robust IO snapshot harness.on/oncelisteners may now be async (awaited in registration order) and may select messages by a custom predicate, such as a maker's.is, in addition to a code. Request makers gain the same.isguard.matchAnycomposes selectors, andremoveAllListenersresets user listeners while keeping the host's internal ones.respondandpreventDefaultare now orthogonal.preventDefaultmeans the listener handled it: a notification is not written, and a request skips its prompt silently and resolves with the default. Arespondvalue is folded into the request's default response and skips the prompt, but still surfaces the question unlesspreventDefaultis also set;respond/respondOnceexpose this via asuppressQuestionflag. Separating the two lets a listener suppress output, answer, or both, without one implying the other.IoHostRecordernow captures the stream viaobserveMessagesinstead of spying on the host. The spy approach was neutralised by thejest.resetAllMocks()in command tests, which stopped the realnotify/requestResponsefrom running and caused order-dependent failures unless each test re-established pass-through by hand. Observing removes that entirely, so tests answer prompts throughrespondOncewith no boilerplate. Destroy snapshots are re-baselined to tag every line with thedestroyaction the real command emits.Checklist
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license