fix(test): inspect wp-ai-client prompt slot in refinement context test#1809
Merged
fix(test): inspect wp-ai-client prompt slot in refinement context test#1809
Conversation
ImageGenerationPromptRefinementTest::test_refine_prompt_includes_post_context_when_provided walked $captured_request['messages'] looking for the user message it had just sent. As of #1784/#1791, RequestBuilder::wpAiClientPromptContext() lifts the latest user message into wp-ai-client's $request['prompt'] slot and routes earlier turns through with_history(); refine_prompt() only sends a single user message, so it lands in 'prompt' and never appears in 'messages'. The assertion was reading an empty string against 'Article context:'. Look at 'prompt' first, fall back to user-role history messages, so the test stays correct regardless of how many user turns the caller sends.
Contributor
Homeboy Results —
|
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.
Summary
ImageGenerationPromptRefinementTest::test_refine_prompt_includes_post_context_when_providedwas failing onmain.The assertion walked
$captured_request['messages']looking for the user message it had just sent. As of #1784 / #1791,RequestBuilder::wpAiClientPromptContext()lifts the latest user message into wp-ai-client's$request['prompt']slot and routes earlier turns throughwith_history().refine_prompt()only sends a single user message, so it lands inpromptand never appears inmessages— the assertion was reading an empty string against'Article context:'.This is a test-side staleness, not a production bug. The other test in the same file (
test_refine_prompt_uses_custom_style_guide) inspectssystemmessages, which still flow throughmessagesviasystem_instruction, so that one continued to pass.Fix
Look at
$captured_request['prompt']first (where the active user message ends up), fall back to user-role messages inhistory. The assertion stays correct regardless of how many user turns the caller sends.Test results
homeboy test data-machine --skip-lint:AI assistance
RequestBuilderbehavior, applying the test-side fix, and PR preparation. Chris remains responsible for review and merge.