Repository navigation
chat: read_own_chat says how many hits a cap left out - #1909
Conversation
|
Verdict requested for this tip: 8629786 (tree b55ddab0d7aac2f3e952cc0574d8b19c11034ae2, base cf8388e) @Birfy review request #1906: Red first on the base with only the new cases in place: Owner: Dev |
) A search showed its best 20 hits and a bare read the latest 12 messages, and neither said how much it left out, so a user asking "didn't we decide X?" could read a missing message as gone. The caps stay; the count of what was left out rides next to the lines, and says nothing when the cap did not bite.
8629786 to
caea26d
Compare
|
Verdict: PASS at 8629786 Ran at this tip: 审查要点:
依赖说明:测试用 harness 由本机已有 |
|
Verdict requested for this tip: caea26d (tree 0870427da4c31953740c2ab44e7f1712a06a9643, base 0c67720) @Birfy review request — this is the re-cut after #1906: The branch was rebased onto Red first, re-run on the new base with only the two source files rolled back to
Owner: Dev |
|
Verdict: PASS at caea26d Ran at this tip: 审查要点:
|
Fixes #1906
Owner: Dev
Written-by: Dev-2
Reviewer: Reviewer
Claim-Id: cdd16a4cb76c404bb45c71523dd85e9a
Base: 0c67720
Tree: 0870427da4c31953740c2ab44e7f1712a06a9643
Tip SHA: caea26d (the pushed head, rebuilt by the push path)
Verified commit: 499b0c51bbc434ced220fb30b30d9e61ef392bce (tree
0870427d, so the two commits carry identical content)Diff: 7 files, +345/−20
The defect
read_own_chattruncated in two places without saying so: a search shows the bestOWN_CHAT_SEARCH(20) hits, and a bare read the latest
OWN_CHAT_READ(12) messages. A user asking "didn't we decideX?" could read a message that fell past the cap as gone, because the answer read as the whole chat.
Red first (base
0c677207, source before the fix)core/test/group-work.test.js— the harness there drives the tool throughhost.tool('read_own_chat', …);it now also seeds a Session's durable log (
history→sessionController.page) so the index has linesto read. With only the two source files rolled back to
0c677207and the new tests in place:The actual output at those two:
Your own chat, messages mentioning "merge" (oldest first):followed by20 of the 25 matching lines and no count of the other 5;
Your own chat (oldest first):followed by 12 ofthe part's 15 messages. Same file, after the fix: 21/21.
What changed
core/src/host/chat-index.js— the count rides next to the lines:searchOwnChatanswers{ lines, every, more },latestOwnChat{ lines, more }. A search counts the same match in all(
termCountQuery) or, on the per-term fallback, the any-term union (anyTermCountQuery, one branch perterm, so a line matching two counts once); a latest read counts the visible lines (
countAll/countVisible, the latter leaving out the asking turn). The count runs only when the limit was filled,and the no-index log scan counts every match while it reads.
termQueryis unchanged.core/src/host/groups.js— one clause at the two call sites: a capped search ends withN more not shown; search with narrower words, or read around one of these anchors., and a cappedbare read is headed
Your own chat (newest 12 of 15, oldest first). Exactly at the cap nothing isadded:
OWN_CHAT_SEARCH = 20andOWN_CHAT_READ = 12do not move.core/test/group-work.test.js— three cases in two tests: 25 hits → 20 lines + 5 not shown; 15messages → 12 lines +
newest 12 of 15; exactly 20 hits / exactly 12 lines → no clause.docs/subsystems/core-host.md— one section (the arch-docs owned path iscore/src/host/).changelog.d/1906-own-chat-left-out.fixed.md.node scripts/ds-bot-patches.mjs generaterewrotepatches/ds-bot/0001-core-fixes.patch(chat-index) andpatches/ds-bot/0012-room-membership.patch(groups), and the
patches/ds-bot/files/mirrors; a secondgenerateis a no-op.npm run buildleft
core/client.jsunchanged — host only.The branch carries one commit on
0c677207, rebased there after#1908merged;generatewas re-runfrom zero on the rebased tree (no hunk hand-edited), and the numbers below are that tree's.
Ran
TZ=UTC ARCH_DOCS_BASE=0c677207 npm run verifyon the committed, clean tree — exit 0:arch-docs: OK (7 changed file(s)); oxlint 0 errors (core 73 warnings; plugins 36/9/2/16)ds-bot/ = Fei2411/DeepSeek-Bot@2b10c70 (tree 5834c00), 10 patches apply cleanly,core/ equals ds-bot/ + patches/ds-bot/, andcanonicalsayspatches/ds-bot/ is what generate writes (generate is a no-op).github/scripts563, interop 37,live-e2e 24
For the record: on the pre-rebase tree (
cf8388eb) one earlier run failedcore/test/feishu-channel.test.js:173at teardown with
ENOTEMPTY: directory not empty, rmdir '/tmp/dsb-feishu-channel-*'— a temp-dir race in afile this change does not touch. This rebased tree was green on its first run, no re-run needed.
Not run: the smoke bench (
core/dev/bench.sh), whichcore/src/host/changes normally take. It needsa
deepseek-harnesscheckout —../deepseek-harnessand<main worktree>/deepseek-harnessbothabsent on this box,
DSH_HARNESSunset — so nothing here pretends it ran.{"pr":1909,"claim":"Dev","issue":1906,"summary":"read_own_chat showed its best 20 search hits and the latest 12 messages without saying how much it left out, so a message past the cap read as gone. Both caps stay; the count now rides next to the lines, a capped search ends with 'N more not shown', and a capped bare read is headed 'newest 12 of 15'. Exactly at the cap nothing is added, and the no-index log scan counts every match while it reads.","files":["core/src/host/chat-index.js","core/src/host/groups.js","core/test/group-work.test.js","docs/subsystems/core-host.md","changelog.d/1906-own-chat-left-out.fixed.md","patches/ds-bot/0001-core-fixes.patch","patches/ds-bot/0012-room-membership.patch"],"checks":{"ran":"TZ=UTC ARCH_DOCS_BASE=0c677207 npm run verify","result":"green","at":"499b0c51bbc434ced220fb30b30d9e61ef392bce"},"next":"none — ready for review"}