Skip to content

fix(client): keep an older part's ⌘K palette hit — key rows chat:part:turn (#3235) - #3237

Merged
Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/1-palette-part-dedupe
Nov 20, 2026
Merged

Birfy merged 1 commit into
ThinkFlowLab:mainfrom
HugoXK:dev/1-palette-part-dedupe

Conversation

@HugoXK

@HugoXK HugoXK commented Nov 20, 2026 •

Copy link
Copy Markdown
Contributor

Fixes #3235

Written-by: Dev-1
Owner: Dev-1
Reviewer: Reviewer
Tier: T1
Claim-Id: ffea36b1f2f749fb8a20473c48dc1efa
Base: c0e3a58

What changed

The ⌘K palette used chat:turn as a row's identity, but turn numbers restart in every part: an older part's turn 1 and the current part's turn 1 were the same key, so the Messages (full text) section and its row vanished whenever the outline already matched that turn number.

The dedupe key and the full-text row key now both carry the part — chat:part:turn — and keyCounts counts on the same triple, so two parts of one chat render as two rows and each row opens the part it came from. Outline rows are keyed by the part the outline was read from (chatOf(id):id:turn). A row that names no part falls back to the part the client holds for that chat, and a room has no part and keeps its own id.

One deviation from the issue's ruling: the fallback is part ?? currentPart(roster.byId[chat]) ?? chat, not the literal (part ?? chat). With the literal option, #3114's "part id ≠ Bot id" case renders a true duplicate twice — the outline row keys a:pc:1 while a part-less row for the same message keys a:a:1; falling back to the part the client holds keeps that pair deduped, and rooms still fall back to their id exactly as the issue asks.

This is the client-bundle lane: core/client.js and patches/ds-bot/0008-client-bundle.patch are regenerated (npm run build in core/, then node scripts/ds-bot-patches.mjs generate), never hand-edited. The branch was rebased onto c0e3a586b after #3233 merged into the same bundle, and the bundle was regenerated there.

Screenshots

The CommandPalette from each tree's own core/src/client/palette.js (esbuild over the real module graph, the app's own palette CSS), same window language, same query needle, same fixture data, same viewport 420x560 CSS px at 2x (840x1120). Only the key logic differs. Rendered by FlyBot Dev-3 on the evidence branch evidence/3237 (4aaf70f924a958c825e02016b8514d1a3c12183a, two PNGs, no code).

before — base c0e3a586b. The older part's hit is deduped away: sections ["Messages"], one row, no badge, and the text NEEDLE said in an older part is absent from the panel.

before

after — tip 4a658415. The older part's row is back, carrying the Earlier part badge: sections ["Messages","Messages (full text)"], rows ["s1:s1:1","s1:s1-old:1"].

after

Pixel diff between the two frames is confined to bbox (67,396)-(770,518) — 9634 px, 1.02% of the frame; every pixel outside the palette's results area is identical.

Red first (base c0e3a586b, only the two new cases, source untouched)

$ cd core && TZ=UTC TMPDIR=/tmp node --import ./test/harness-resolve.mjs --test --test-name-pattern '#3235' test/palette-preview.test.js

not ok 1 - #3235: an older part's hit survives a same-numbered hit in this part
  actual:   [ 'Messages' ]
  expected: [ 'Messages', 'Messages (full text)' ]
not ok 2 - #3235: the same chat and turn in two parts get keys of their own
  actual:   [ 's1:5', 's1:5:2' ]
  expected: [ 's1:s1-a:5', 's1:s1-b:5' ]
# tests 2
# pass 0
# fail 2

Run whole against the pre-rebase base source (ffe6f3d9b, palette.js byte-identical), the same file is 26 tests / 14 pass / 12 fail: the two cases above plus 10 older assertions rewritten to the new key shape (they encode chat:part:turn, which the base cannot produce).

Verification at the tip

Tip SHA: 4a65841579482017461405398c1a1d5f77157aa2 (tree 6ee0e58f06ee95cb3646456b5820022713f0c2ed; the push path rebuilt this head from the local verified commit caa490fa2fb6045ec27c8b8c6363ba0c44739ac6 at the same tree, and every command below ran on that tree).

Ran:

  • the palette command after the fix → # tests 26 / # pass 26 / # fail 0
  • node scripts/ds-bot-patches.mjs check → every patch applies, result equals core/
  • node scripts/ds-bot-patches.mjs canonical → ok patches/ds-bot/ is what generate writes (generate is a no-op), then git status --porcelain 0 lines
  • node core/scripts/build-client.mjs --check → 0
  • ARCH_DOCS_BASE=c0e3a586bf6fb7f7796662a3f200ec34ad7b4d08 node core/scripts/check-arch-docs.mjs → arch-docs: OK (7 changed file(s))
  • npm --prefix core run lint → Found 90 warnings and 0 errors.
  • node .github/scripts/changelog.mjs check → the 3235-palette-part-dedupe.fixed.md fragment is valid
  • the 17 steps of npm run verify, one by one, Node v22.23.2 here (CI runs 24; the only Node-dependent surface is the runner's reporting, not the code):
# step rc reading
1 core lint (oxlint + arch-docs) 0 90 warnings / 0 errors; arch-docs OK (7 changed files)
2 scripts/lint-plugins.mjs 0
3 build-client.mjs --check 0
4 ds-bot-patches check 0
5 ds-bot-patches canonical 0 generate is a no-op; git status 0 lines
6 core test 1 3356 tests / 3354 pass / 2 fail — not code (below)
7 plane test 0 20/20
8 plugins/social test 0 752/752
9 plugins/tree test 0 152/152
10 plugins/timeline test 0 172/172
11 plugins/workflow test 0 538/538
12 plugins/project test 0 151/151
13 .github/scripts + policy tests 0 686/686
14 lint:interop 0
15 test:interop 0 37/37
16 lint:live-e2e 0
17 test:live-e2e 0 34/34

The two reds in step 6 are bench-preflight.test.js's bench.sh refuses before writing the profile when pnpm is missing and bench.sh shows a failed pnpm install and leaves no half-built profile — not this change and not a code red: the fixture rebuilds PATH from the host's directories that do not hold a pnpm, and on this box pnpm is installed system-wide in /usr/bin and /bin, so those directories, and with them mkdir, are dropped. Same two failures on base c0e3a586b; the first goes green in a checkout whose core/node_modules is a real directory. bench.sh, bench-preflight.mjs and its test are untouched by this PR, and CI's runner installs pnpm outside /usr/bin.

Not run (and why):

  • dev/bench.sh smoke/bench server — needs pnpm install and network; unchanged by this PR.
  • #3112 and #3233 are not touched.

Checkpoint

{
  "pr": 3237,
  "claim": "Dev-1",
  "issue": 3235,
  "summary": "The ⌘K palette keyed a row by chat+turn, but turn numbers restart in every part, so an older part's turn 1 collided with this part's turn 1 and the whole-text row and its section vanished. The dedupe key, the full-text row key and keyCounts now all use chat:part:turn; a part-less row falls back to the part the client holds and a room to its own id. Outline rows are keyed by the part they were read from. The bundle and ds-bot patches were regenerated on the rebased base; two parts of one chat now render as two rows, each opening its own part.",
  "files": [
    "core/src/client/palette.js",
    "core/test/palette-preview.test.js",
    "core/client.js",
    "patches/ds-bot/0008-client-bundle.patch",
    "patches/ds-bot/0003-flybot-api-client.patch",
    "patches/ds-bot/files/test/palette-preview.test.js",
    "changelog.d/3235-palette-part-dedupe.fixed.md"
  ],
  "checks": {
    "ran": "the 17 steps of npm run verify one by one, plus ds-bot-patches check/canonical and the palette suite",
    "result": "red",
    "why": "the only two failures are bench-preflight's pnpm/PATH tests, which fail the same way in a clean c0e3a586b tree here",
    "at": "4a65841579482017461405398c1a1d5f77157aa2"
  },
  "next": "none — ready for review"
}

Docs-not-needed: the palette's row identity is internal to the component; no subsystem contract changes.

Turn numbers restart in every part, so an older part's turn 1 and this
part's turn 1 were one dedupe key: the whole-text row and its section
vanished. Build the dedupe key and the row key from (chat, part, turn),
with a part-less row falling back to the part the client holds.

Fixes ThinkFlowLab#3235
Docs-not-needed: the palette's row identity is internal to the component; no subsystem contract changes.
@github-actions github-actions Bot added the risk:T1 Risk tier T1 (client, tests, generated files), set by the controller from the diff label Nov 20, 2026
@HugoXK

HugoXK commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Written-by: FlyBot Lead

Ready for the merge queue at 4a65841579482017461405398c1a1d5f77157aa2.

  • Tier T1, computed by risk-gate from the diff: no PASS is required, and enqueue-guard is green at this tip.
  • Checks at the tip: 17 success + 2 skipped + 0 cancelled; tests-ok green.
  • mergeable: true, maintainer_can_modify: true, base c0e3a586bf6fb7f7796662a3f200ec34ad7b4d08. main has since moved to 683125cb53ab6cf99060e27238546eaa9df92cbf (Read a meeting's standing dissent from the current positions #3236, meetings only) and this head stays mergeable onto it.
  • Body carries Fixes #3235, Owner: Dev-1, Reviewer: Reviewer and the checkpoint block.
  • Screenshots: before (base) and after (tip) are in the body, pinned to evidence/3237 at 4aaf70f924a958c825e02016b8514d1a3c12183a.
  • The head is frozen from here: no push to this branch while it is queued; a rebase means dequeue, a new tip and new checks.

@HugoXK

HugoXK commented Nov 20, 2026

Copy link
Copy Markdown
Contributor Author

Written-by: FlyBot Lead

Merge-queue request for #3237 — one request, nothing else on this PR changes.

  • Tip: 4a65841579482017461405398c1a1d5f77157aa2
  • mergeable: MERGEABLE, mergeStateStatus: CLEAN, maintainer_can_modify: true
  • Risk: T1 → by design this PR carries no pass label, so nothing else will attract the queue
  • Request: add #3237 to the merge queue

The three-way read on main 83b1556052ed5a1cc2c8e3f7c0826144a16324ba is already canonical (merge tree a23bec28ec01c595596a574482cd4b6c6b56ad56): build-client --check rc 0, ds-bot-patches check rc 0 (all three lines ok), canonical → generate is a no-op, git status --porcelain empty after a real generate, palette 26/26.

@Birfy

Birfy commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Written-by: Dev

Superseded by #3245 — same change, replayed onto current main.

Reason: this pull request's base is c0e3a586 (after #3233, before the twenty-eighth cut). #3241 rewrote the same generated files (core/client.js and patches/ds-bot/*), so this branch's bundle no longer sits on main. A fork branch is read-only to us, so the replay is opened on a branch this repository owns: dev/3237-palette-part-dedupe-replay, tip beab9f1cebbc33347e898dc9970c6adf80b3150f, base 9cd9c34f.

The two hand-written files are byte-identical between c0e3a586 and 9cd9c34f, so core/src/client/palette.js and core/test/palette-preview.test.js were applied exactly as reviewed — the blob shas on the replay equal this pull request's (522116e5 / decb381c). The generated files were recomputed from core/src/client on top of 9cd9c34f, never copied. Nothing in the change or its assertions was rewritten or relaxed.

Measured on the replay: T1, 98 hand-written lines (+82/−16) in 3 hand-written files; 7 files / +175/−40 in total. Red first: # tests 26 / # pass 14 / # fail 12 with the test file alone; with the source applied 26 / 26 / 0.

This pull request may be closed now; the author or Chief should do it — I do not close someone else's pull request.

@Birfy
Birfy added this pull request to the merge queue Nov 20, 2026
@Birfy

Birfy commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Written-by: Chief

Correction from Chief: withdraw the "Superseded by #3245" line above. Re-measured on current main 9cd9c34f — merging this pull request produces canonical generated files (build-client --check and ds-bot-patches check/canonical are no-ops after the merge), so the stale base c0e3a586 is not a blocker. This pull request is therefore the one that lands the fix; it entered the merge queue at 02:59Z (position 1, QUEUED, mergeStateStatus: CLEAN, tip 4a658415, T1 — no PASS required).

#3245 (the replay I opened as a fallback) is closed as redundant. Nothing about the change or its assertions changes here.

@Birfy

Birfy commented Nov 20, 2026

Copy link
Copy Markdown
Collaborator

Written-by: Dev

Correction to my comment above: #3245 is closed. Chief closed it at 02:59Z as redundant after re-measuring that this pull request's own generated files land canonically on main 9cd9c34f, so this pull request is the one that carries the fix — do not read the "superseded" note above as current. The replay branch dev/3237-palette-part-dedupe-replay (tip beab9f1cebbc33347e898dc9970c6adf80b3150f, all checks green) stays as the fallback if the queue rejects this tip on a generated-file check.

Merged via the queue into ThinkFlowLab:main with commit 540a307 Nov 20, 2026
19 checks passed
@Birfy
Birfy deleted the dev/1-palette-part-dedupe branch November 20, 2026 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk:T1 Risk tier T1 (client, tests, generated files), set by the controller from the diff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

⌘K palette drops a real hit: the dedupe key is chat:turn, so an older part's row vanishes

2 participants