test(amazonq): address review findings on the access-blocked observer - #2801
Open
ashishrp-aws wants to merge 1 commit into
Open
test(amazonq): address review findings on the access-blocked observer#2801ashishrp-aws wants to merge 1 commit into
ashishrp-aws wants to merge 1 commit into
Conversation
Three review follow-ups, no behaviour change for users. Name the streaming client's middleware, matching the token client. Without a name a second registration stacks another observer rather than replacing the first, which would report the same block twice, and the middleware is anonymous in SDK stack introspection. Assert the server-name uniqueness against the real exported servers rather than the two constants. Comparing constants cannot catch the same name being passed to both factory calls, which is the mistake that actually shipped. Verified the test bites: making the names identical fails it (7 passing/2 failing vs 8/1). Add two tests for the streaming observer. They assert the wiring rather than the callback because the existing harness stubs CodeWhispererStreaming.prototype.sendMessage, which bypasses the middleware stack entirely -- a behavioural test there would pass even if the middleware did not exist. shared group: 337 passing / 45 failing, against 334 / 45 before, so the 3 new tests and no new failures.
laileni-aws
approved these changes
Aug 13, 2026
hezelin-work
approved these changes
Aug 13, 2026
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.
Targets
feature/qdev-signup-message, so #2800 picks these up automatically.Follow-ups from the review of #2800. No behaviour change for users — one wiring fix and two test improvements.
1. Name the streaming client's middleware
The token client registers its observer with
name: 'detectQDevPluginAccessBlocked'; the streaming client did not. Without a name, a second registration stacks another observer instead of replacing the first, which would report the same block twice, and the middleware is anonymous in SDK stack introspection.2. Assert name uniqueness against the real servers, not the constants
The previous test compared
AMAZON_Q_SERVICE_SERVER_IAM_NAMEand..._TOKEN_NAME. That guards the constants but cannot catch the same name being passed to both factory calls — which is exactly the mistake that shipped and causedDuplicate servers defined.The test now invokes both real exported servers' initializers and asserts the names they actually report are distinct. Verified it bites: making the two names identical fails it (7 passing / 2 failing, versus 8 / 1 with the fix).
Reviewers asked for a composition-level test that walks every server registered by
agent-standalone. That is the stronger form and I agree with it, but it belongs in the runtimes app package rather than here, since that is where the composition lives. Raising it separately rather than stretching this PR.3. Two tests for the streaming observer
These assert the wiring, deliberately not the callback: the existing harness stubs
CodeWhispererStreaming.prototype.sendMessage, which bypasses the middleware stack entirely, so a behavioural test written there would pass even if the middleware did not exist. Rather than write a test that proves nothing, they assert what is actually verifiable at this level — that exactly one named middleware is registered on theinitializestep, and that the observer property is settable after construction (it must be, since the service manager assigns it later).Testing
sharedgroup: 337 passing / 45 failing, against 334 / 45 before — the three new tests, no new failures. The 45 are pre-existing and unchanged (utils.test.tsand theonUpdateConfigurationcase).tscand prettier clean.Review findings deliberately not addressed here
debug. Two reviewers suggestedwarn. Left alone for symmetry with the token client, which has shipped that way; changing one and not the other would be worse. Worth doing to both, separately.showNotificationlogs at info when it drops a notification for want of a router. This is in the runtimes package and was one of the three silent failures behind fix(amazonq): pass notification feature to the Q service manager #2796/fix(amazonq): declare serverInfo so notifications reach the client #2797. Belongs in a runtimes change.