Skip to content

Commit c4e71c3

Browse files
committed
Message text is never cut: no "Read rest of message" on any client; the desktop app loads its UI when the hub has no in-app browser
Task 1 (user, via Bub): the thin view sent only a message's first 512-byte block and a 'Read rest of message' control. Messages now go whole (thin.bend Row.preview/Row.partial: only activity rows fold), the live stream shows the whole reply (thin-live Stream.preview, never partial), reports stored cut short read whole in the window (thin-view State.window.rows over Message.whole), and a wake on a thread carries the last reply whole (hub.bend Wake.thread.text; Lr.cut stays only for Lr.whole). Web (thin-continuations.js), iOS and Android drop the message continuation controls; activity output may still fold. Task 2: desktop/main.cjs no longer throws 'Direct Browser service unavailable'; the UI always loads and the in-app browser reads as unavailable with Reconnect (browser-present answers phase error). The hub's default stays BACKPLANE_DESKTOP_BROWSER=0 (release lead's choice (b)). Test: desktop/test/no-browser-hub.test.cjs.
1 parent 4f728f1 commit c4e71c3

18 files changed

Lines changed: 173 additions & 157 deletions

‎desktop/main.cjs‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ async function connect(ses) {
5757
// Credential material stays in main and the service's HttpOnly cookie.
5858
const response = await ses.fetch(`${origin}/auth/pair`, { method: 'POST', credentials: 'include', headers: { Authorization: `Bearer ${await service.token()}` }, redirect: 'error' });
5959
if (!response.ok) throw new Error('Could not authenticate with the service');
60-
if(directBrowser){await connectBrowser(ses);if(desktopBrowser.state().phase!=='ready')throw new Error('Direct Browser service unavailable');}
60+
// The in-app browser is optional: a hub that does not serve it (one
61+
// started by systemd, --headless or an older install) still gets the
62+
// whole UI. The browser only reads as unavailable, and Reconnect
63+
// (desktop:browser-reconnect) tries it again.
64+
if(directBrowser)await connectBrowser(ses).catch(()=>{});
6165
if (!quitting && window && !window.isDestroyed()) await window.loadURL(origin);
6266
} catch (error) {
6367
status('error', error.message);
@@ -103,13 +107,14 @@ function start() {
103107
return result.canceled ? null : result.filePaths[0];
104108
});
105109
ipcMain.handle('desktop:browser-present',(event,value)=>{
106-
if(!trusted(event)||!directBrowser||!desktopBrowser)throw new Error('Invalid Browser sender');
110+
if(!trusted(event)||!directBrowser)throw new Error('Invalid Browser sender');
107111
exactObject(value,['owner','bounds']);exactObject(value.bounds,['x','y','width','height']);
108112
if(typeof value.owner!=='string'||!value.owner.length||value.owner.length>512||/[\x00-\x1f]/.test(value.owner))throw new Error('Invalid Browser owner');
109113
if(Object.values(value.bounds).some(v=>!Number.isFinite(v)||Math.abs(v)>1000000)||value.bounds.width<1||value.bounds.height<1)throw new Error('Invalid Browser geometry');
110114
const zoom=window.webContents.getZoomFactor(),box=window.getContentBounds();
111115
const x=Math.max(0,Math.min(box.width,Math.round(value.bounds.x*zoom))),y=Math.max(0,Math.min(box.height,Math.round(value.bounds.y*zoom)));
112116
const width=Math.min(box.width-x,Math.round(value.bounds.width*zoom)),height=Math.min(box.height-y,Math.round(value.bounds.height*zoom));
117+
if(!desktopBrowser||desktopBrowser.isClosed())return{shown:false,phase:'error',message:'Browser unavailable'};
113118
if(width<1||height<1){desktopBrowser.hide();return{shown:false,message:'Browser panel is hidden'};}
114119
return desktopBrowser.present({owner:value.owner,bounds:{x,y,width,height}}).then(result=>({shown:result.shown===true,...(result.message?{message:result.message}:{} )}));
115120
});

‎desktop/qualification/cut-report-inline.cjs‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎desktop/qualification/cut-report-reader.test.cjs‎

Lines changed: 0 additions & 44 deletions
This file was deleted.

‎desktop/qualification/thin-continuations.test.cjs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ test('RED generic server footer groups indistinguishable More controls; GREEN at
3636
const p = await project(timeline([memo('a'), memo('b', 'act'), button('a'), button('b')]), ['a', 'b']);
3737
assert.equal(kids(p.original).slice(-2).every(n => textOf(n) === 'More'), true);
3838
const a = all(p.result).find(n => attrs(n)['data-id'] === 'a'), b = all(p.result).find(n => attrs(n)['data-id'] === 'b');
39-
assert.equal(textOf(controls(a)[0]), 'Read rest of message');assert.equal(textOf(controls(b)[0]), 'Read full activity text');
39+
assert.equal(controls(a).length, 0, 'message text is whole: no read-more');assert.equal(textOf(controls(b)[0]), 'Read full activity text');
4040
assert.equal(kids(p.result).filter(n => n.tag === 'button').length, 0);assert.equal(JSON.stringify(p.original), p.frozen);
4141
for (const memoValue of p.cache.values()) assert.equal(controls(memoValue).length, 0);
4242
});
@@ -45,7 +45,7 @@ test('folded and outgoing entries add no orphan Additional message text panel; u
4545
assert.equal(all(p.result).find(n => n.tag === 'details'), undefined);assert.equal(controls(p.result).length, 0);
4646
assert(!textOf(p.result).includes('Additional message text'));
4747
assert.equal(kids(p.result)[0].kids.head.text, 'outgoing');
48-
const shown = p.c.project(p.node(timeline([memo('hidden'), button('hidden'), button('linked')])), p.expand);
48+
const shown = p.c.project(p.node(timeline([memo('hidden', 'act'), button('hidden'), button('linked')])), p.expand);
4949
const row = all(shown).find(n => attrs(n)['data-id'] === 'hidden');assert.equal(controls(row).length, 1);assert.equal(controls(shown).length, 1);
5050
assert.equal(p.c.partial.size, 2);assert.equal(p.c.readers.size, 0);
5151
});
@@ -57,21 +57,21 @@ test('earlier history is separately labelled and no longer inherits hidden one-p
5757
const p = await project(timeline([el('button', '', [at('class', 'earlier'), { event: 'click', action: 'view-page' }, at('data-value', '')], [txt('More')])]), []);
5858
const b = kids(p.result)[0];assert.equal(textOf(b), 'Load earlier messages');assert.equal(attrs(b).class, 'thin-earlier');assert.equal(attrs(b)['on:click'], 'view-page');
5959
});
60-
test('explicit assembled plain Unicode text replaces preview body inline; next cursor retained and no auto-read occurs', async () => {
61-
const p = await project(timeline([memo('a'), button('a')]), ['a']);
60+
test('explicit assembled plain Unicode activity text shows inline; next cursor retained and no auto-read occurs', async () => {
61+
const p = await project(timeline([memo('a', 'act'), button('a')]), ['a']);
6262
assert(p.c.accept({ id: 'a', version: '1', text: '<script>日本語 👩‍💻</script>', hasMore: true, cursor: 'opaque-next', fromStart: true, complete: false }));
6363
const out = p.c.project(p.original, p.expand), row = all(out).find(n => attrs(n)['data-id'] === 'a'), pre = all(row).find(n => n.tag === 'pre');
6464
assert.equal(textOf(pre), '<script>日本語 👩‍💻</script>');assert.equal(kids(pre)[0].tag, undefined);
65-
assert(!all(row).some(n => attrs(n).class === 'body'));assert.equal(textOf(controls(row)[0]), 'Read next part');
65+
assert.equal(textOf(controls(row)[0]), 'Read next part');
6666
assert.deepEqual(JSON.parse(attrs(controls(row)[0])['data-value']), { entryId: 'a', cursor: 'opaque-next' });
6767
assert.equal(p.c.readers.size, 1);assert.equal(JSON.stringify(p.original), p.frozen);
6868
});
6969
test('complete reader removes continuation and unchanged current refresh retains text', async () => {
70-
const p = await project(timeline([memo('a'), button('a')]), ['a']);p.c.accept({ id: 'a', version: '1', text: 'whole', hasMore: false, cursor: '', complete: true, fromStart: true });
70+
const p = await project(timeline([memo('a', 'act'), button('a')]), ['a']);p.c.accept({ id: 'a', version: '1', text: 'whole', hasMore: false, cursor: '', complete: true, fromStart: true });
7171
p.c.bind('https://fixture', detail(['a']));const out = p.c.project(p.original, p.expand);assert.equal(controls(out).length, 0);assert.match(textOf(out), /whole/);
7272
});
7373
test('current version change/removal retires only affected reader and rejects stale response without reading', async () => {
74-
const p = await project(timeline([memo('a'), memo('b'), button('a'), button('b')]), ['a', 'b']);
74+
const p = await project(timeline([memo('a', 'act'), memo('b', 'act'), button('a'), button('b')]), ['a', 'b']);
7575
for (const id of ['a', 'b']) p.c.accept({ id, version: '1', text: id, hasMore: false });
7676
const d = detail(['a', 'b']);d.window.partial[0].version = '2';p.c.bind('https://fixture', d);assert(!p.c.readers.has('a'));assert(p.c.readers.has('b'));assert(!p.c.accept({ id: 'a', version: '1', text: 'stale' }));
7777
p.c.bind('https://fixture', detail([]));assert.equal(p.c.readers.size, 0);

0 commit comments

Comments
 (0)