Elffuss BraidHub

utopia-ia/elffuss-code public

Telemetry: reports carry the page, not the project file in the URL

530ef0a added #/file/<path>:<line> links for files mentioned in the chat.
Opening one in a new tab, reloading or bookmarking keeps that fragment in
location.href, and every error report and manual feedback sent
location.href. Reports then included project file names and lines,
although Settings promises that project content is never included.

post() now sends location.origin + location.pathname: no query, no
fragment.

telemetry.mjs: with #/file/src/clientes-secretos.js:2 in the URL, both an
error report and a feedback carry only the page URL. Fails on the
previous tree.
Changesetcc9d7422202d081ada63f0b060f849b19fa14dfb018afb75221898fcfc3032f5
AuthorKikoCis <kikocisneros@gmail.com> · 2026-10-10 19:28 +02:00
CommitterKikoCis <kikocisneros@gmail.com> · 2026-10-11 14:15 +02:00
Parents5bde40f10cb4

Browse the files at this changeset

2 files changed

modified tests/telemetry.mjs +15 −0
@@ -63,6 +63,21 @@
6363 ok('tras mandar el feedback manual, el automático sigue apagado', await p.evaluate(async () => (await import('/js/telemetry.js')).isEnabled()) === false);
6464 ok('el textarea se limpia tras enviar', await p.locator('#tel-feedback').inputValue() === '');
6565
66+// 6) el informe no lleva la ruta de un fichero del proyecto (#/file/<ruta>:<línea>)
67+await p.evaluate(async () => {
68+ location.hash = '#/file/src/clientes-secretos.js:2';
69+ await new Promise(r => setTimeout(r, 200));
70+ const t = await import('/js/telemetry.js');
71+ t.setEnabled(true);
72+ await t.reportError('fallo con un fichero abierto');
73+ await t.sendFeedback('feedback con un fichero abierto');
74+ t.setEnabled(false);
75+});
76+await p.waitForTimeout(300);
77+const conFichero = reports.filter(r => /con un fichero abierto/.test(r.message));
78+ok('ni un error ni el feedback llevan la ruta del fichero (sin # ni búsqueda en url)', conFichero.length === 2
79+ && conFichero.every(r => r.url === new URL(BASE).origin + '/' && !/clientes-secretos|#|\?/.test(r.url)), JSON.stringify(conFichero.map(r => r.url)));
80+
6681 console.log(fails ? `\n❌ ${fails} FALLO(S)` : '\n✅ TELEMETRÍA/FEEDBACK: opt-in real, nunca automático sin permiso, manual siempre disponible');
6782 await b.close();
6883 process.exit(fails ? 1 : 0);
modified web/js/telemetry.js +4 −1
@@ -35,7 +35,10 @@
3535 body: JSON.stringify({
3636 app: appName, kind, message: String(message ?? '').slice(0, 2000),
3737 stack: String(opts.stack || '').slice(0, 4000),
38- url: location.href, userAgent: navigator.userAgent,
38+ // Solo la página, sin búsqueda ni fragmento: #/file/<ruta>:<línea> (los
39+ // enlaces a ficheros del chat) metía nombres de ficheros del proyecto en
40+ // cada informe, y Ajustes promete que el proyecto nunca sale.
41+ url: location.origin + location.pathname, userAgent: navigator.userAgent,
3942 extra: String(opts.extra || '').slice(0, 2000),
4043 }),
4144 });