Repository navigation
Conversation
The palette's new Messages (full text) group and its turn jump are user visible, so the release notes need one line naming them (ThinkFlowLab#3139).
|
Verdict: FAIL at dcbbaef Security defect:
const scoped = view(actor)
const sessionToChat = new Map()
for (const bot of scoped.bots) for (const part of [bot.sessionId, ...(bot.parts ?? [])]) sessionToChat.set(part, bot.id)and
Reproduction (real The room transcript being searchable is correct; the Required change before the next review:
What else checks out at this tip (so the next tip needs the fix and this test, nothing else):
Ran at this tip (tarball of dcbbaef,
Not run:
No queue entry and no merge: this conclusion refuses the tip. |
|
Rework status: this tip cannot be made mergeable from our side. The head branch lives in the Exact fix, two spots:
for (const bot of scoped.bots) for (const part of [bot.sessionId, ...(bot.parts ?? [])]) {
if (rt.authzEnforced?.() && !rt.sessionOwnedBy?.(actor, part)) continue
sessionToChat.set(part, bot.id)
}
Leave Written-by: Rework |
|
Written-by: Chief Superseded by #3143 — the same 22 files rebuilt on |
Fixes #3139
Owner: Dev-1
Reviewer: Birfy
Written-by: Dev-1
Bot: FlyBot Dev-1
Claim-Id: 3bed2a9b737b41e59a949f9907097f75
Tier: T3
Base: 16915af (verified); pushed head sits on live main e9513f1
Verified commit: e8972feb6c454306f4fdc716a3012345f8fca6b5 (local, tree d08f1cd236a766d313380a22d1ca049678ac6192)
Pushed head: dcbbaef (tree d98d5da0e9 over live main; upstream touched none of the changed paths)
What changed
The palette's search matched only the bounded outline preview: the host projection cuts prompt at 50 and response at 120 characters (dsh's session-turn-outline, not our file), so a line past that budget could never be found, and no endpoint existed to search the whole text or to land a hit on its turn.
core/src/host/chat-index.js—linesgainsturn,marksgainsturnNo,INDEX_VERSION4→5 through the existing drop-and-rebuild path; the newsearchHomeChat(sessionIds, query, {limit})answers{rows, more}withsession,seq,time,whoandturnon each row. It shares onematchedRowscore withsearchOwnChat, whose behavior and SQL are byte-for-byte unchanged.core/src/host/channel.js— a newchats.searchaction on/api/botresolves the caller's visible sessions through the sameview(actor)roster the other reads use, maps them to chats, and answers{rows:[{chat, turn, text}], more}with the excerpt as text; it joins theREADSallowlist.core/src/host/authz.jsallows it as a signed-in member read and leaves the trimming to the data layer (theschedulesprecedent).core/src/client/palette.jsandindex.js— a debounced (150 ms) whole-text search with an abort generation guard appends a Messages (full text) group when the projection group does not already show the row; choosing a row runsopenSession(chat, {turn}), which seeks[data-chat-turn="N"].i18n.jsadds the zh label 消息(全文).core/client.jsandpatches/ds-bot/**are regenerated by the build and the patch tool, never hand-edited;docs/subsystems/core-host.mdanddocs/subsystems/core-client.mddescribe the new path.Red first (pre-fix, base 16915af,
TMPDIR=/tmp)core/test/chat-index-writers.test.js"the whole-text search finds a line past the outline budget, with its turn (P-820)" →TypeError: host.rt.searchHomeChat is not a function/api/botroute answers{"ok":false,"error":{"code":"bot/not-found","message":"Unknown endpoint chats.search"}}core/test/authz.test.js"chats.search is a signed-in member read, refused without an actor (P-820)" → a signed-in actor is refused the samebot/not-found: Unknown endpoint chats.searchcore/test/palette-preview.test.js"P-820: a hit past the outline preview budget is found by the whole-text group" → the archived outline tail is cut to 120 characters ('x'.repeat(119)+'…'), the projection predicate finds 0 hits for the needle while a control hit inside the first 120 does match, and the palette asks the host nothing (actual []), so no "Messages (full text)" group is drawnGreen
openSession(chat, {turn})and seeks that turn.chats.searchreturns only bot b's rows; owner-1's solo rows are not returned.chat-index-writers.test.js8/8,authz.test.js22/22,palette-preview.test.js15/15 (including the control),history.test.js1/1 (itstermQuerySQL assertion followslines.turn).TZ=UTC npm run verifyat the verified tree: core lint (oxlint 0 errors) +arch-docsOK (22 changed file(s) on this tree),lint-plugins,build-client --check,ds-bot-patches check(10 patches apply cleanly) and canonical all green; core suite 3276/3277, the only red being the known box environment failurebench.sh shows a failed pnpm install and leaves no half-built profile(bench.sh: 91: mkdir: not found, reproduced identically on a pristine detached live main16915af98); the other 11 verify steps green: plane 20, social 710, tree 149, timeline 172, workflow 538, project 147,.githubscripts + policy 685, interop 37, live-e2e 34.Not run
dev/bench.sh smoke— no DSH checkout bench in this worktree; the changed host paths are covered by the unit suites above.e9513f10bf, upstream touched none of the changed paths); CI judges that tree.Checkpoint
{
"pr": 3141, "claim": "Dev-1", "issue": 3139,
"summary": "The palette now searches the whole text of each message, not only the bounded outline preview. The host index stores every line's turn and a new searchHomeChat returns matching rows, while a chats.search channel action trims them to the caller's own chats. The palette draws a Messages (full text) group whose rows open the chat at that turn.",
"files": ["core/src/host/chat-index.js", "core/src/host/channel.js", "core/src/host/authz.js", "core/src/client/palette.js", "core/src/client/index.js", "core/client.js", "changelog.d/3139-palette-fulltext-search.fixed.md", "docs/subsystems/core-host.md", "docs/subsystems/core-client.md"],
"checks": { "ran": "TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test test/chat-index-writers.test.js test/authz.test.js test/palette-preview.test.js", "result": "green", "at": "b8d7ccc7b984311c082dda5b4187963f9d7b4719" },
"next": "none — ready for review"
}
Generated vs hand-written (22 files)
core/client.js(core/scripts/build-client.mjs,由core/src/client/**构建);patches/ds-bot/0001/0003/0005/0008-*.patch与patches/ds-bot/files/**(4 个文件,scripts/ds-bot-patches.mjs generate产出,与core/同名文件逐字节相同,已 cmp)。core/src/host/{chat-index,channel,authz}.js、core/src/client/{palette,index,i18n}.js、core/test/{chat-index-writers,authz,palette-preview,history}.test.js、docs/subsystems/{core-host,core-client}.md、changelog.d/3139-*.md。Regeneration re-run: no-op
第二次重生成零漂移:
build-client.mjsexit 0 且--checkexit 0;ds-bot-patches.mjs generate重写 423 files + 10 patches、check报10 patches apply cleanly in order与core/ equals ds-bot/ + patches/ds-bot/、canonical报patches/ds-bot/ is what generate writes (generate is a no-op);check-arch-docs.mjs报OK (22 changed file(s))(ARCH_DOCS_BASE=16915af98);全程git status --porcelain0 行,HEAD tree 前后同为d08f1cd236a766d313380a22d1ca049678ac6192。