test: fix @generation e2e (model → amazon.nova-lite-v1:0) - #3500
Closed
sarayev wants to merge 4 commits into
Closed
Conversation
7 tasks
…error/null guards) Two Gen2-cdk e2e suites (generation, conversation) were failing for reasons unrelated to product code. This change fixes the test fixtures and adds fail-fast hygiene guards. Test-side only; no product behavior changes. Model ids The fixtures invoked anthropic.claude-3-haiku-20240307-v1:0, a legacy Bedrock model that has been auto-revoked in the e2e account; invoking it returned ResourceNotFoundException, AppSync resolved null, and the tests crashed on a null-deref. - generation: the @generation transformer's AppSync->Bedrock IAM role grants bedrock:InvokeModel only on the foundation-model ARN, so a cross-region inference profile fails with AccessDenied. The generation fixture is switched to the active on-demand foundation model mistral.mistral-large-2407-v1:0, which the e2e account can invoke under the existing IAM and which satisfies the basic text/scalar assertions. - conversation: routes via @aws-amplify/ai-constructs, which handles inference-profile IAM, so the conversation fixture uses the active inference profile us.anthropic.claude-haiku-4-5-20251001-v1:0. Fail-fast guards generation.test.ts: assert the GraphQL response has no errors and that the generated recipe is not null before dereferencing, so a Bedrock/GraphQL error is printed instead of a TypeError. conversation.test.ts: replace the ineffective toBeDefined() check on the stream part with not.toBeNull(), guard the .length read when the part is null, and add a max-iteration / overall-timeout guard inside the subscription for-await loop so a non-streaming assistant fails fast with a descriptive message instead of cascading into the jest timeout. --- Prompt: Split the mixed e2e/CI branch into a clean draft PR off main containing only the generation/conversation e2e test fixes: switch the dead legacy claude-3-haiku model id to a working model (generation -> mistral plain on-demand FM, conversation -> working inference profile) and add the error/null fail-fast guards. tsc the construct-tests package and commit (no --no-verify).
sarayev
force-pushed
the
test/generation-conversation-e2e-fixes
branch
from
June 26, 2026 09:20
67b24f3 to
d3e8617
Compare
…ol-use/structured output)
7 tasks
…` assertions for haiku-4-5 The conversation happy-path e2e asserted every streamed ConversationMessageStreamPart had a non-null `p` and aggregated `p` into a non-empty string. That premise is wrong: `p` is optional stream padding, not response text. The ai-constructs Bedrock converse adapter only sets `p` when the underlying Bedrock contentBlockDelta carries a string padding field, and never sets it on control frames (contentBlockStop, the final stopReason chunk). claude-haiku-4-5 emits no `p` padding at all, so the subscription delivers `p: null` on every part, failing `expect(streamPart.p).not.toBeNull()` on the first frame and cascading the other cases into timeouts. Verified directly against us.anthropic.claude-haiku-4-5-20251001-v1:0 via Bedrock ConverseStream: the model returns the full pirate response (stopReason end_turn) with text delivered through contentBlockDelta/contentBlockText and no `p` padding on any frame. The assistant text is mapped correctly, so this is a test-assertion issue, not a resolver bug. Drop the contradictory not-null assertion, keep the `p` length check when padding is present, and assert the aggregate streamed contentBlockText is non-empty so the test still meaningfully verifies a real streaming response was received. --- Prompt: Gen2 PR #3500 conversation e2e shard failed at conversation.test.ts:136 expect(streamPart.p).not.toBeNull() with model us.anthropic.claude-haiku-4-5. Determine whether haiku-4-5 returns the pirate text interleaved with null-p control frames (assertion is wrong, fix it properly) or whether no assistant text arrives (real resolver bug, report it, do not loosen the test). Gather evidence from the CI log and the stream-part type/resolver, then fix or report. Commit to the branch with a conventional message, no --no-verify, follow CODING_GUIDELINES.md, and push.
Simone319
pushed a commit
that referenced
this pull request
Jun 28, 2026
…` assertions for haiku-4-5 The conversation happy-path e2e asserted every streamed ConversationMessageStreamPart had a non-null `p` and aggregated `p` into a non-empty string. That premise is wrong: `p` is optional stream padding, not response text. The ai-constructs Bedrock converse adapter only sets `p` when the underlying Bedrock contentBlockDelta carries a string padding field, and never sets it on control frames (contentBlockStop, the final stopReason chunk). claude-haiku-4-5 emits no `p` padding at all, so the subscription delivers `p: null` on every part, failing `expect(streamPart.p).not.toBeNull()` on the first frame and cascading the other cases into timeouts. Verified directly against us.anthropic.claude-haiku-4-5-20251001-v1:0 via Bedrock ConverseStream: the model returns the full pirate response (stopReason end_turn) with text delivered through contentBlockDelta/contentBlockText and no `p` padding on any frame. The assistant text is mapped correctly, so this is a test-assertion issue, not a resolver bug. Drop the contradictory not-null assertion, keep the `p` length check when padding is present, and assert the aggregate streamed contentBlockText is non-empty so the test still meaningfully verifies a real streaming response was received. --- Prompt: Gen2 PR #3500 conversation e2e shard failed at conversation.test.ts:136 expect(streamPart.p).not.toBeNull() with model us.anthropic.claude-haiku-4-5. Determine whether haiku-4-5 returns the pirate text interleaved with null-p control frames (assertion is wrong, fix it properly) or whether no assistant text arrives (real resolver bug, report it, do not loosen the test). Gather evidence from the CI log and the stream-part type/resolver, then fix or report. Commit to the branch with a conventional message, no --no-verify, follow CODING_GUIDELINES.md, and push. (cherry picked from commit 84331e7)
Revert the conversation e2e changes (conversation.test.ts and schema-conversation.graphql) back to their origin/main state so this PR contains only the @generation e2e fix. The conversation changes are owned by a separate PR and are removed here to avoid overlap. The remaining diff swaps the @generation aiModel to amazon.nova-lite-v1:0 and adds error/null guards to the generation test, which has passed two e2e runs. --- Prompt: Reduce PR #3500 to generation-only: revert the conversation-related changes back to origin/main, keep only the generation (nova-lite) changes, commit and push, and update the PR to be generation-only while keeping it draft.
sarayev
marked this pull request as ready for review
June 29, 2026 13:43
soberm
approved these changes
Jun 29, 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.
Description
Fixes the
@generatione2e test, which was failing because its directives referencedanthropic.claude-3-haiku-20240307-v1:0— a model that is no longer reliably available for these test accounts, causing generation requests to error.Model swap
All three
@generationdirectives inschema-generation.graphql(summarize,generateRecipe,solveEquation) now useamazon.nova-lite-v1:0, which supports the structured/tool-use output the generation route requires.Generation test guards
generation.test.tsnow assertserrorsis undefined and the generatedrecipeis not null before reading fields, so a model/route failure surfaces as a clear assertion rather than a downstreamundefinedaccess.E2E status
The generation e2e passed in two CodeBuild batches:
d7085183441e2caaThese runs confirm the change both fixes the
@generationtest and introduces no regression.How did you test this change?
E2E runs (batches above) — generation suite SUCCEEDED.
Checklist