Repository navigation
Conversation
…routing The Bot exchange drew `entry.text` as stored: a leading delegation trace and an untrusted fence reached the bubble, and the message tools' copy carried the same markers. `exchangeText` now reads the line once — unwrap a complete `<untrusted-message …>` wrap, drop a leading trace, strip leftover fragments — and `ExchangeLine` gives that one string to the bubble and to the copy. The paragraph breaks stay: a reply is not a sidebar row and is never folded.
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.
Fixes #1423
Owner: Dev4
Reviewer: Reviewer
Written-by: Dev-4
Tip: d595d20
Base: 26657c8
Tree: 9d01171ab2ed323d79bd82b0490bb449bb39a9d9
Base note:
mainmoved from7a4fa61eto26657c8a(#1411 workflow reap) while this branch was in review; rebased onto it, re-ranbuild+generate(no drift) and every check below on the new base. #1411 touches onlyplugins/workflow/**anddocs/subsystems/workflow.md, no file of this PR.What was wrong
core/src/client/exchange.jsdrew a stored turn withh(Bubbles, { texts: [entry.text] })and handed the same raw string toMessageTools. A stored line carries its routing, not only its words: a leadingChief → 助手delegation trace and, for a remote writer, an<untrusted-message …>fence. So the exchange sheet showed and copied the envelope as if the writer had typed it.Fix (read side only)
exchangeText(text)is the one reader, and both the bubble and the message tools' Copy receive its result:<untrusted-message …>…</untrusted-message>(repeatedly, so a nested wrap converges), keeping the inner text with its line breaks and any prose that stood before or after the wrap;stripTrace— this also covers a trace that sits inside the fence, right after the fence's newline;stripFenceto take the leftover fragments (from="…">, half a tag) and trim only the ends.ExchangeLine(new, exported) passes that single string toBubblesand toactions, so the displayed text and the copied text cannot drift.visibleTextis not used anywhere on this path: it folds\s+, which would destroy a multi-paragraph reply. The write side, the other tabs, andentry.textin storage are untouched.Two read-side limits, stated plainly:
<untrusted-message …>(someone quoting a fence in their reply) is treated as a marker and loses the marker text — the same trade-offstripFencealready makes elsewhere in the client.stripTracesemantics, shared with the sidebar).Tests
New
core/test/exchange-read.test.js(2 tests, 6 stored shapes plus a real render): a standalone leading trace, a complete wrap, afrom="…">fragment, a half tag, a three-paragraph reply, and ordinary prose byte-for-byte unchanged. The render test mountsExchangeLine, records whatBubblesis given through aMarkdownTextstub, opensMore message actions → Copy, and asserts thenavigator.clipboard.writeTextstring equals the displayed one.Red/green, one command (
core/):On base
7a4fa61e(test file only, source unfixed) — 0/2, the read side does not exist yet:At this tip — 2/2:
Two knives, both returned to this tip afterwards (
core/src/client/exchange.jssha256a2696b4b3f7e927ed4f28ad50abafa7cd0def7c8e500eeec9a8eaa01370e4e04before and after,git status --shortempty):Knife A —
texts: [entry.text](the reported defect). Red 1/2 with the stored line verbatim:Knife B —
visibleText(stripFence(stripTrace(…))), i.e. the fold this PR refuses. Red 2/2 with the paragraphs collapsed:What I ran
TZ=UTC npm run verify— exit 0: core 1825 · social 525 · tree 125 · timeline 125 · workflow 31 · scripts 545 · interop 37 · live-e2e 24;lint0 errors; arch-docsOK (8).node scripts/ds-bot-patches.mjs check— three linesok(ds-bot/tree match, 10 patches apply in order,core/equalsds-bot/+patches/ds-bot/).9d01171a: the pushed head isd595d205on top of26657c8a, same tree as the rebased local tip.Files (8, +1932 −1387)
core/src/client/exchange.jscore/test/exchange-read.test.jsdocs/subsystems/core-client.mdcore/client.jspatches/ds-bot/0003-flybot-api-client.patchpatches/ds-bot/0008-client-bundle.patchpatches/ds-bot/files/test/exchange-read.test.jspatches/ds-bot/topics.jsonGenerated, not hand-merged:
core/client.jsfromnpm --prefix core run build, the fourpatches/ds-bot/*fromnode scripts/ds-bot-patches.mjs generate(replaying build + generate on the tip tree leavesgit statusempty;0008is the bundle mirror ofcore/client.js). One metadata edit:topics.jsonmapssrc/client/exchange.jsto0003-flybot-api-client— this is the first time we change that upstream file, andgeneraterefuses an edited upstream file with no topic.Docs:
docs/subsystems/core-client.mdgains thecore/src/client/exchange.jsrow.{"pr":1426,"claim":"Dev4","issue":1423,"summary":"The exchange sheet drew and copied a stored turn verbatim, so a leading delegation trace and an untrusted-message fence reached the reader. A new exported exchangeText() unwraps the fence, strips the leading trace and the fence fragments, and keeps paragraph breaks; visibleText is not used because it folds whitespace. ExchangeLine hands that one string to the bubble and to MessageTools, so what is shown and what is copied are the same text. Read side only: the write side, the other tabs and the stored entry.text are untouched.","files":["core/src/client/exchange.js","core/test/exchange-read.test.js","docs/subsystems/core-client.md","core/client.js","patches/ds-bot/0003-flybot-api-client.patch","patches/ds-bot/0008-client-bundle.patch","patches/ds-bot/files/test/exchange-read.test.js","patches/ds-bot/topics.json"],"checks":{"ran":"TZ=UTC npm run verify (exit 0; core 1825, social 525, tree 125, timeline 125, workflow 31, scripts 545, interop 37, live-e2e 24); ds-bot-patches check (3x ok)","result":"green","at":"d595d20572fa73da9e93033185a6d2da1ff7eefa"},"next":"review: exchangeText against the sheet and the copy path; then Test"}