utopia-ia/elffuss-code public
Changesets · Branches · Tags · Compare
| Changeset | cc9d7422202d081ada63f0b060f849b19fa14dfb018afb75221898fcfc3032f5 |
|---|---|
| Author | KikoCis <kikocisneros@gmail.com> · 2026-10-10 19:28 +02:00 |
| Committer | KikoCis <kikocisneros@gmail.com> · 2026-10-11 14:15 +02:00 |
| Parents | 5bde40f10cb4 |
2 files changed
modified tests/telemetry.mjs +15 −0
| @@ -63,6 +63,21 @@ | ||
| 63 | 63 | ok('tras mandar el feedback manual, el automático sigue apagado', await p.evaluate(async () => (await import('/js/telemetry.js')).isEnabled()) === false); |
| 64 | 64 | ok('el textarea se limpia tras enviar', await p.locator('#tel-feedback').inputValue() === ''); |
| 65 | 65 | |
| 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 | + | |
| 66 | 81 | console.log(fails ? `\n❌ ${fails} FALLO(S)` : '\n✅ TELEMETRÍA/FEEDBACK: opt-in real, nunca automático sin permiso, manual siempre disponible'); |
| 67 | 82 | await b.close(); |
| 68 | 83 | process.exit(fails ? 1 : 0); |
modified web/js/telemetry.js +4 −1
| @@ -35,7 +35,10 @@ | ||
| 35 | 35 | body: JSON.stringify({ |
| 36 | 36 | app: appName, kind, message: String(message ?? '').slice(0, 2000), |
| 37 | 37 | 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, | |
| 39 | 42 | extra: String(opts.extra || '').slice(0, 2000), |
| 40 | 43 | }), |
| 41 | 44 | }); |