You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by "orangeCatDeveloper (via GitHub)" <gi...@apache.org> on 2026/09/06 10:14:39 UTC
[PR] fix(ui): bookmark the anchor a wheel pages from [maka]
orangeCatDeveloper opened a new pull request, #4911:
URL: https://github.com/apache/maka/pull/4911
## Summary
Paging back through history stalls at the top edge: the transcript keeps
loading earlier ranges but the mounted range snaps back to the one the reader
just left, so `transcript-scroll-cost.spec.ts` times out waiting for the first
Turn to change (`Timeout 10000ms exceeded while waiting on the predicate`,
3 runs in a five-hour window on main).
Root cause: `useChatScroll` reads the first visible Turn as the load anchor but
never refreshes the reading bookmark on that path. At the edge the scroller
cannot move, so no scroll event fires, and `releasePin()` publishes nothing
because the authority is already unpinned and away from the tail. The bookmark
therefore still names a Turn the previous range evicted, and the restore effect
answers the freshly published range with `loadAround(stale)` — the earlier load
succeeds, then gets overwritten.
The fix reports the reading anchor through the existing reporter as the first
thing `requestEarlier` does, after the pin has been released, so the bookmark
and the load anchor are the same Turn and the restore effect has nothing to
correct. Reusing the reporter keeps its session check, its deduplication and
its guard against in-flight navigation, instead of writing the bookmark a
second way.
This is the paging-back half of the same anchor-versus-navigation family as
#4883; that PR fixed return-to-latest and is unaffected here.
## Verification
`packages/ui`: 371 tests pass; `biome lint` clean on both changed files. The new
unit fails without the one-line source change:
```
$ node --test packages/ui/dist/__tests__/paging-reading-anchor.test.js # without the fix
✖ a wheel at the top edge reports its anchor before it loads earlier history
actual: { anchorTurnId: 'turn-earlier', anchorWhenAsked: 'turn-0' }
expected: { anchorTurnId: 'turn-earlier', anchorWhenAsked: 'turn-earlier' }
ℹ pass 0
ℹ fail 1
$ node --test "packages/ui/dist/__tests__/*.test.js" # with the fix
ℹ tests 371
ℹ pass 371
ℹ fail 0
```
`apps/desktop/e2e/transcript-scroll-cost.spec.ts` is running locally; result
follows in a comment.
## AI use
Select exactly one:
- [ ] No generative tool made a substantive contribution
- [x] Generative tooling made a substantive contribution
Tool(s) and scope: Claude Code (Opus 5) — traced the anchor/restore
interaction, wrote the source change and the regression test. Reviewed and run
locally by a human.
## Checklist
- [x] Tests cover the change and fail without it
- [x] Lint, format, typecheck and the affected suites pass locally
Does this PR entail a change in behavior?
- [x] Yes — described under Summary above
- [ ] No
https://claude.ai/code/session_01YW92WDHxJ5T2x79XYp5c2w
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): bookmark the anchor a wheel pages from [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han commented on code in PR #4911:
URL: https://github.com/apache/maka/pull/4911#discussion_r3949851636
##########
packages/ui/src/__tests__/paging-reading-anchor.test.tsx:
##########
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * A bookmark left on a Turn the last range evicted makes the restore effect
+ * load around it over the range paging just published, and the transcript
+ * stops advancing — the stall the E2E paging guard sees as a timeout.
+ */
+
+import assert from 'node:assert/strict';
+import { afterEach, test } from 'node:test';
+import { act, useRef } from 'react';
+import { createRoot } from 'react-dom/client';
+import { parseHTML } from 'linkedom';
+import type { StoredMessage } from '@maka/core/session';
+import { TranscriptScrollAuthorityProvider } from '../transcript-scroll-authority.js';
+import { useChatScroll } from '../use-chat-scroll.js';
+
+const originalGlobals = {
Review Comment:
**[P3] Reuse the existing scroll-test setup for this regression**
The regression is valuable, but this standalone file repeats the global save/restore, React root lifecycle, LinkeDOM setup and much of the scroll geometry already present in `use-chat-scroll.test.tsx`. Maintaining two versions makes future environment changes unnecessarily repetitive. Could we move this case alongside the existing scroll tests and share the common setup locally, deleting the duplicated scaffolding? Keep the case-specific no-scroll-event behavior, the real `useChatScroll`/`TranscriptScrollAuthorityProvider` composition, and the assertion that the newly visible anchor is reported **before** `onLoadEarlierHistory` runs; deleting the production fix should still fail that assertion. A small consolidation is sufficient—no new generic test framework is needed. This is optional P3 cleanup because the current test works and protects a demonstrated regression.
<details>
<summary>中文</summary>
这条回归有价值,但独立文件重复了 use-chat-scroll.test.tsx 中已有的全局变量保存/恢复、React root 生命周期、LinkeDOM 和大量滚动几何设置。建议把用例放回已有滚动测试文件,在文件内复用共同设置并删除重复部分。保留本场景“不触发 scroll 事件”的条件、真实 useChatScroll/TranscriptScrollAuthorityProvider 组合,以及“调用 onLoadEarlierHistory 前已上报新可见书签”的核心断言;删掉生产修复后仍应失败。小范围合并夹具即可,不要另建通用测试框架。当前测试有效,因此按可选维护性 P3 处理。
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): bookmark the anchor a wheel pages from [maka]
Posted by "orangeCatDeveloper (via GitHub)" <gi...@apache.org>.
orangeCatDeveloper commented on code in PR #4911:
URL: https://github.com/apache/maka/pull/4911#discussion_r3951793033
##########
packages/ui/src/__tests__/paging-reading-anchor.test.tsx:
##########
@@ -0,0 +1,179 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+/**
+ * A bookmark left on a Turn the last range evicted makes the restore effect
+ * load around it over the range paging just published, and the transcript
+ * stops advancing — the stall the E2E paging guard sees as a timeout.
+ */
+
+import assert from 'node:assert/strict';
+import { afterEach, test } from 'node:test';
+import { act, useRef } from 'react';
+import { createRoot } from 'react-dom/client';
+import { parseHTML } from 'linkedom';
+import type { StoredMessage } from '@maka/core/session';
+import { TranscriptScrollAuthorityProvider } from '../transcript-scroll-authority.js';
+import { useChatScroll } from '../use-chat-scroll.js';
+
+const originalGlobals = {
Review Comment:
Done in f501a2f75 (branch also rebased onto current `main`): the case now runs in `use-chat-scroll.test.tsx` under a shared file-local environment installer (`installScrollTestEnvironment`), and the standalone file is deleted. Kept the no-scroll-event edge, the real `useChatScroll`/`TranscriptScrollAuthorityProvider` composition, and the ordering assertion that the anchor is reported before `onLoadEarlierHistory` runs — removing the production fix still fails it (re-verified). `packages/ui` suite is 399/399 and the paging E2E re-ran 5/5 on the new head.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org
Re: [PR] fix(ui): bookmark the anchor a wheel pages from [maka]
Posted by "Astro-Han (via GitHub)" <gi...@apache.org>.
Astro-Han merged PR #4911:
URL: https://github.com/apache/maka/pull/4911
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org