Repository navigation
Ignore legend clicks while a model pick is still rendering / 模型切换完成前图例暂不响应点击 - #1859
Merged
Merged
Conversation
…endering The model, sequence and precision selectors show a pick at once and render the chart for it as a React transition. Until that transition lands, the legend still shows the old scope, and a click there commits before the pick. When the pick lands, InferenceProvider resets the hardware to the new scope's defaults and the click is lost. This made agentic-detail-back-nav.cy.ts flaky, failing in soloLegendSeries with "Found '3', expected '1'" in the #1848 merge queue and on #1760. With 20x CPU throttling the spec's steps fail on every run. InferenceProvider now holds a scope pick until its hardware reset runs, together with any hardware the reader picks from the legend in between. The reset keeps that choice, limited to hardware the new scope has. A legend pick made before the scope pick still gives way to the new defaults. The spec also waited only for the selector label, so later steps could click a point on the old model's chart. selectTargetModel now waits for inference-page-heading, which renders from the committed model. 模型、序列长度和精度选择器会立即显示新的选项,再以 React transition 渲染对应的图表。在 transition 完成之前,图例仍然显示旧的筛选范围,这时在图例上的点击会先于切换生效。切换完成后,InferenceProvider 会把硬件重置为新范围的默认值,这次点击就被丢弃了。agentic-detail-back-nav.cy.ts 因此间歇失败,soloLegendSeries 报错 "Found '3', expected '1'",#1848 的 merge queue 和 #1760 都出现过。在 20 倍 CPU 节流下,这组测试步骤每次都会失败。 现在 InferenceProvider 会保留尚未执行硬件重置的范围切换,并记下读者在此期间从图例中选择的硬件。重置时保留这一选择,只去掉新范围中没有的硬件。在切换之前做出的图例选择仍会让位于新范围的默认值。 此外,测试之前只等待选择器标签更新,后续步骤可能点到旧模型图表上的数据点。selectTargetModel 现在改为等待 inference-page-heading,它根据已提交的模型渲染。
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
…ick does not carry over When a legend pick made during a pending model, sequence or precision pick shares no hardware with the new scope, the reset fell through to the defaults path. The click had already set bestPerSku to false and hardwareDefaultsOverridden to true, so the new scope selected every chip instead of its defaults. For Qwen 3.5 that kept H200 on, which its defaults leave off. Each scope pick now records the best-per-SKU choice and defaults flag it leaves. When the reader's legend pick does not carry over, the reset restores those flags and computes the defaults from them. A new test picks Qwen 3.5 and solos B200, which Qwen lacks, before the pick lands. It fails without this change. 当模型、序列长度或精度切换尚未完成时,读者在图例中做出的选择如果与新范围没有任何共同硬件,重置会走默认值分支。但这次点击已经把 bestPerSku 设为 false、把 hardwareDefaultsOverridden 设为 true,新范围因此会选中全部芯片,而不是它的默认硬件。以 Qwen 3.5 为例,默认应关闭的 H200 会保持开启。 现在每次范围切换都会记下它设定的 best-per-SKU 选择和默认值标记。读者的图例选择无法保留时,重置会恢复这两个值,并据此计算默认硬件。新增测试在 Qwen 3.5 切换完成前单独选择 Qwen 没有的 B200,未修复时该测试失败。
…ion or sequence pick follows A sequence or precision pick made while a model pick was still rendering overwrote the pending scope pick with the best-per-SKU choice and defaults flag from its own render, which predates the model pick. If a legend click then picked only hardware the new model lacks, the reset restored those stale flags. A reader who had set best per SKU before switching models got every chip of the new model instead of its defaults. Sequence and precision picks now keep the flags of a pick that is still pending and only clear its legend hardware. A new test sets best per SKU, then picks Qwen 3.5 and FP8 and solos B200 before either lands. It ends on Qwen 3.5's defaults and fails without this change. 模型切换尚未完成时,如果又切换了序列长度或精度,后者会用自身渲染时的 best-per-SKU 选择和默认值标记覆盖待处理的范围切换,而这些值早于模型切换。随后若读者在图例中只选择了新模型没有的硬件,重置就会恢复这些过时的标记。读者如果在切换模型前设置过 best per SKU,新模型就会选中全部芯片,而不是它的默认硬件。 现在序列长度和精度切换会保留仍在等待中的切换所记录的标记,只清除其中的图例硬件选择。新增测试先设置 best per SKU,再在切换完成前选择 Qwen 3.5 和 FP8 并单独选择 B200,最终应得到 Qwen 3.5 的默认硬件,未修复时该测试失败。
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 3 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 54fae76. Configure here.
…ll rendering Replace the record-and-replay handling of legend clicks made during a pending model, sequence or precision pick. Bugbot found five problems in it, all in how the recorded pick was merged, restored or cleared. InferenceProvider now exposes scopePickPending from useInferenceFilters. It is useOptimistic state set inside the pick's transition, so React clears it when that transition ends, including a pick that ends on the scope already shown. While it is true, legend toggle, remove, select all and best per SKU do nothing, and a ?preset= link waits. The inference, power timeline and historical trends legends render aria-busy and inert with no layout change. A click in that brief window now does nothing, instead of being applied and then undone. The pending-pick tests now check that actions made while a model pick is pending are ignored and the new model opens on its defaults, that the flag clears after a no-op or reverted pick, and that best per SKU and presets still apply once nothing is pending. The video history source pin is updated for the new filters field, which feeds no recorded entry. 用新的方式取代此前对切换期间图例点击的记录并重放逻辑。Bugbot 在这套逻辑中发现了五个问题,都出在记录的切换如何合并、恢复或清除上。 现在 InferenceProvider 通过 useInferenceFilters 提供 scopePickPending。它是在切换的 transition 中设置的 useOptimistic 状态,transition 结束时由 React 自动清除,即使切换最终停留在当前范围也一样。该值为 true 时,图例的单选、移除、全选和 best per SKU 都不会执行,?preset= 链接会等待。推理图表、功耗时间线和历史趋势的图例会带上 aria-busy 和 inert,布局不变。在这段短暂时间里点击图例不会有任何效果,而不是先生效再被撤销。 pending-pick 测试现在检查模型切换尚未完成时的操作会被忽略、新模型以默认硬件打开,检查无效切换或被撤回的切换之后标记会被清除,并检查没有待完成的切换时 best per SKU 和预设照常生效。视频历史的源文件哈希随新的 filters 字段更新,该字段不影响任何已记录的条目。
This branch was successfully deployed
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
Picking a model, sequence or precision shows the pick in its selector at once and renders the chart for it as a React transition. Until that transition lands, the legend still shows the old model's hardware. On main a click there commits first, and when the pick lands
InferenceProviderresets the hardware to the new model's defaults, so the click is applied and then undone.The same race made
agentic-detail-back-nav.cy.tsflaky. It failed in the #1848 merge queue (Firefox) and on #1760 (Chrome) withToo many elements found. Found '3', expected '1'insoloLegendSeries. The spec waited for the selector label, which changes before the chart does, and then clicked the stale legend.What changes
InferenceProviderexposesscopePickPendingfromuseInferenceFilters. Legend toggle, remove, select all and best per SKU do nothing while it is true, and a?preset=link waits until it clears.aria-busyandinertwhile a pick is pending, so they take no pointer or keyboard input. Nothing moves, as no class or size changes.scopePickPendingisuseOptimisticstate set inside the pick's transition, so React clears it when that transition ends. That includes a pick that ends on the scope already shown (the same value, or a pick reverted before it lands), so the flag cannot stick.selectTargetModelalso waits forinference-page-heading, which renders from the committed model, before it touches the chart. Without it, later steps could click a point on the old model's chart.docs/state-ownership.mddescribes the behaviour.Trade-off. A click on the legend in the brief window between a pick and its chart now does nothing, instead of being applied and then undone.
An earlier revision of this PR replayed the reader's click into the new scope instead. Bugbot found five problems in that record-and-replay logic, so it is gone.
Tests
InferenceContext.pending-pick.test.tsx(jsdom) replaces the earlier tests.?preset=link apply as before. These pass on main too and guard against the new checks blocking them.Local E2E runs against a fixture build pass. Details are below.
Validation details
Local fixture build (
E2E_FIXTURES=1,next start), Cypress 16.3.0, Chrome 158, Firefox 160.Reproduction of the original flake on main
Emulation.setCPUThrottlingRate), the spec's own steps (selectTargetModel, thensoloLegendSeries) failed 4 of 4 runs with the CI error. A probe that logged the page every few milliseconds showed the order of events. The selector read Kimi K3 while the page heading still read DeepSeek V4 Pro and the legend showed 3 of 3 checked. The click made it 1 of 3. The pick then landed and the legend went back to 3 of 3.With this revision
agentic-detail-back-nav.cy.ts,inference-chart.cy.tsandurl-params.cy.tspassed 3 times in Chrome and once in Firefox.AI model disclosure
PR checklist
inferencex-skillschanges (not applicable, no filter, view or data contract changes)/zhsibling (not applicable)docs/chinese-copy.md(not applicable, no UI copy changes)中文
模型、序列长度和精度选择器会立即显示新的选项,并以 React transition 渲染对应的图表。在 transition 完成之前,图例仍显示旧模型的硬件。在 main 上,此时的点击会先生效,等切换完成后,
InferenceProvider会把硬件重置为新模型的默认值,于是这次点击先被应用、随后又被撤销。agentic-detail-back-nav.cy.ts的间歇失败也是同一个原因。它在 #1848 的 merge queue(Firefox)和 #1760(Chrome)中失败,soloLegendSeries报错Too many elements found. Found '3', expected '1'。该测试只等待选择器标签更新,而标签会先于图表变化,随后点击的是尚未更新的图例。改动
InferenceProvider通过useInferenceFilters提供scopePickPending。该值为 true 时,图例的单选、移除、全选和 best per SKU 都不会执行,?preset=链接会等到它恢复为 false 再应用。aria-busy和inert,不接受鼠标或键盘输入。样式和尺寸都不变,因此布局不会移动。scopePickPending是在切换的 transition 中设置的useOptimistic状态,transition 结束时由 React 自动清除。即使切换最终停留在当前范围(选择了相同的值,或在完成前又切换回来),这个标记也会被清除,不会一直保持。selectTargetModel在操作图表之前还会等待inference-page-heading,它根据已提交的模型渲染。否则后续步骤可能点到旧模型图表上的数据点。docs/state-ownership.md记录了这一行为。取舍。 在切换开始到新图表出现之间的短暂时间里点击图例,现在不会有任何效果,而不是先生效再被撤销。
本 PR 的早期版本会把读者的点击带到新范围中重新应用。Bugbot 在这套记录并重放的逻辑中发现了五个问题,因此这部分已经删除。
测试
InferenceContext.pending-pick.test.tsx(jsdom)取代了之前的测试。?preset=链接照常生效。这两个用例在 main 上同样通过,用来防止新的检查误拦这些操作。验证
以下均为本地 fixture 构建上的 E2E 运行(Cypress 16.3.0,Chrome 158,Firefox 160)。
selectTargetModel和soloLegendSeries步骤 4 次全部失败,报错与 CI 相同。不节流时,在同一个任务中先点击模型选项、再点击图例标签,也每次都复现同样的错误。agentic-detail-back-nav.cy.ts、inference-chart.cy.ts和url-params.cy.ts在 Chrome 中运行 3 次、在 Firefox 中运行 1 次,全部通过。AI 模型使用说明
本 PR 由 anthropic/claude-opus-5-5 完成问题排查、复现、应用修复与测试,并撰写本说明。
Note
Medium Risk
Touches core inference filter state and legend interactivity during transitions; behavior change is intentional but could surprise users who click the legend mid-switch.
Overview
Fixes a race where model, sequence, or precision selectors update immediately but the chart and legend still reflect the previous scope until a React transition finishes. Clicks on the stale legend used to apply and then get undone when hardware reset to the new scope’s defaults—this also caused flaky Cypress runs that waited only on the selector label.
InferenceProvidernow exposesscopePickPending(useOptimistic, set when scope pick setters run inside a transition). While it is true,toggleHwType,removeHwType,selectAllHwTypes,setBestPerSku, and?preset=application are no-ops.ChartLegendgains abusyprop (aria-busy+inert) wired from inference scatter, power timeline, and historical trends legends.Trade-off: brief legend clicks during that window do nothing instead of applying then reverting.
agentic-detail-back-nav.cy.tswaits forinference-page-heading(committed model) before chart steps. NewInferenceContext.pending-pick.test.tsxcovers the behavior;docs/state-ownership.mddocuments it.Reviewed by Cursor Bugbot for commit 68dd4a8. Bugbot is set up for automated code reviews on this repo. Configure here.