Uh oh!
There was an error while loading. Please reload this page.
test(ui): give the answer-identity guards teeth - #2950
Merged
Conversation
The identity regression tests asserted only on `.maka-assistant-answer`, the segment article whose key the fix stabilized. The merged AssistantAnswerBubble — the single component type that keeps the inner bubble mounted, and the node a Selection actually lives in — was unguarded: splitting it back into streaming and historical component types left every test green. Pin the bubble node too; verified red under that split. Correct the steered-turn docstring, which claimed to catch a key collision it cannot. React reconciles duplicate-key siblings of one component type by position, so the collision-prone key leaves all three tests green. State what the test really pins: two segments, each keeping its element across a settle. Point the streaming-drag fixme at the contract that is broken. Asserting the quote bar is visible passes from two different worlds — the Selection survived, or the hook's 350ms read beat the stream close and left a stale bar over erased text — so the body passed 6 of 7 runs with the bug fully present. Wait for the close, then require the Selection to still be uncollapsed: fails 3 of 3 today, and can only go green on a real upstream fix. Generated-by: Claude Code
Astro-Han
commented
Aug 13, 2026
ContributorAuthor
Fast-path rationale Test-layer only, two files, no product code — none of the protected areas, no user-visible behavior, and the reworked test stays Tests are a fast-path candidate rather than a free pass, so each guard was falsified rather than assumed:
All required checks green. The fast path waives independent review, not the contributor of record's own review of the final diff. |
Astro-Han
marked this pull request as ready for review
August 13, 2026 09:39
Uh oh!
There was an error while loading. Please reload this page.
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 freeto 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
Follow-up to #2946. Three test-layer findings from an adversarial review of that PR; no product code changes.
The regression tests guarded only half the fix. Both identity assertions read
container.querySelector('.maka-assistant-answer')— the segment-level article, which pins the key half of the fix. The mergedAssistantAnswerBubblerenders a descendant carrying.maka-chat-message-bubble-assistant, and that is the node a text Selection actually lives in. Splitting the bubble back into separate streaming and historical component types remounts it while the article stays identical, so every test stayed green. The narrowed e2e now deliberately selects from a settled answer, so it does not cover that transition either. Test 1 now retains and asserts the bubble node as well.The steered-turn docstring overclaimed. It said the test catches "an identity that is constant across segments — the sentinel-vs-real-id collision". It cannot: React reconciles duplicate-key siblings of the same component type by position, so
isSameNodestill holds and regressing the key to the collision-prone form leaves all three tests green. Corrected to state what the test really pins — two segments exist and each keeps its element across a settle.The
test.fixmecould go green with the bug fully present. It asserted.maka-quote-actionsis visible, and that state is reachable from two worlds: the Selection survived, or the quote hook's 350ms read won the race against the stream close and left a stale bar standing over text whose highlight the browser had already erased — verbatim the outcome the comment above the test calls unacceptable. Instrumented runs reproduced the underlying bug 7/7 while the body passed 6/7. It now asserts the contract that is actually broken: wait for the stream to close, then requirewindow.getSelection()to still be uncollapsed. Withretries: 0, un-fixme-ing the old body would have yielded either a false "gap closed" or a ~1-in-6 CI flake.Refs #2946
Verification
npm --workspace @maka/ui run test— 136 passing, 0 failing.TurnTimelineEntrycall site, rebuilt, re-ran — the new bubble assertion fails (the answer bubble survives the turn settling) while the pre-existing article assertion still passes, confirming the old test could not see the split. Reverted.test.fixmetotest, ranplaywright test e2e/quote-selection.spec.ts --repeat-each=3against a freshbuild:with-deps— the streaming-drag test failed 3/3, every failure at the post-close poll (not the pre-close one), i.e. the Selection is present right aftermouse.up()and gone once the stream closes. The pointer-capture test passed 3/3. Restored totest.fixme.npm --workspace @maka/ui run typecheck,npm run format:check— clean.apps/desktop/e2e/slash-command-menu.spec.tsis a known pre-existing flake tracked as flaky e2e: slash-command-menu inline menu shows the 命令 group for a non-leading slash #2948 and was not exercised here.Review focus
Whether the two teeth checks are the right falsification for each guard — a test that stays green under the regression it names is worse than no test.
Checklist
Does this PR entail a change in behavior?
Generated-by: Claude Code (Opus 5). Authored under human direction; the human contributor reviews the final diff and owns the merge decision.