Skip to content

previewOf reads a stored fence's inline trace into the row (palette and sidebar) #1413

Closed as duplicate

Description

@Birfy

Written-by: Dev

Read off main 18d567bb (before #1399's merge; that PR does not touch text.js). Filed from #1395's PASS (6438688990, item ③) so this is not mistaken for fixed.

What happens

A stored line whose untrusted fence wraps a delegation trace keeps that trace in the row:

[Message from User (user@friend)]
<untrusted-message from="User">
Chief → 助手

Hi there
</untrusted-message>

previewOf returns "Chief → 助手 Hi there", and the ⌘K row shows the same text. The fence and the marker's words are gone (searching from / untrusted finds nothing, and a plain fenced line reads "B踢后测4") — only the inline trace survives, so a search for 助手 still hits that row.

Why #1395 does not close this

#1395 makes the palette read through previewOf, so the two surfaces agree; it does not change what previewOf does with a trace that sits inside a fence. #1394's expected behaviour says a flattened trace must not reach a row, and this shape does not meet that literally.

Where the fix belongs

core/src/client/text.js → previewOf. stripTrace only drops a trace at the start of the string, and the fence is unwrapped around it, so the trace survives mid-line. previewOf is the shared read for client/sidebar.js, host/channel.js and the palette, so a fix lands on every surface at once; fixing only the palette would fork the reading again — exactly what #1395 just removed.

Repro

import { previewOf } from '../src/client/text.js'
const raw = '[Message from User (user@friend)]\n<untrusted-message from="User">\nChief → 助手\n\nHi there\n</untrusted-message>'
const list = { projectionsBySession: { s1: { values: { turnOutline: [{ turn: 1, response: raw }] } } }, byId: {} }
console.log(JSON.stringify(previewOf(list, 's1')))   // "Chief → 助手 Hi there"

Run with cd core && DSH_HARNESS=<harness> node --import ./test/harness-resolve.mjs repro.mjs.

Wording follow-up (same review, no behaviour)

#1395's body still says "Unfenced lines are byte-for-byte unchanged". That only holds for lines that do not begin in trace shape: Chief → 助手\n\nHi…, a → b c and tom → jerry are here all change. It should read "except lines that begin in trace shape". The other wording item (the read chain written in reverse order) went away with the body rewrite at 09:55:59Z.

Not blocking anything: the fence and the marker words do not leak, and a row is one flattened line.

Activity

  1. added
    bugSomething isn't working
    area:uiWeb/desktop UI and copy
    on Oct 27, 2026
  2. Birfy commented on Oct 27, 2026

    @Birfy
    CollaboratorAuthor

    Written-by: Dev

    Closing as a duplicate of #1408 (Backend, opened 09:53:07Z, three minutes before this one).

    Same function (core/src/client/text.js → previewOf), same symptom (a stored fence that wraps a delegation trace reads Chief → 助手 Hi there in the row), same fix point — #1408 item 1 is this defect word for word. The difference I thought I had is not a difference: #1408 item 2 also names the same flatten regex (a → b c → c), which is the other half of the same expression.

    My extra measurements and the test-design note go to #1408 as a comment instead of living here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:uiWeb/desktop UI and copybugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions