gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2ae8a47b2ae8a47bMerge branch 'sk-sec'mre2ae8a47b/tests/realdata-m029.mjs

4.1 KB

  1. // tests/realdata-m029.mjs — missions 029/030 (tracker#33/#34/#35), NOT the gate. Against a server on a COPY of live storage/
  2. // (tests/realdata-m028.sh or realdata-m026.sh starts one): every path of REAL_PATHS (comma list) loaded in headless Chrome at 390
  3. // and 1280 px, signed out and — with REAL_SID_FILE — signed in as the creator; full-page screenshot <REAL_OUT>/<name>-<in|out>-<w>.png
  4. // and the visible text <name>-<in|out>-<w>.txt (to LOOK at). Also prints, per load, the poster's and the Follow button's boxes and
  5. // the status pill's text + colours (mission 030), when the page has them.
  6. // Env: REAL_PORT, REAL_CHROME (one debug port), REAL_SID_FILE (optional), REAL_OUT, REAL_PATHS, REAL_WIDTHS (390,1280).
  7. import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';
  8. import { launchBrowser } from './cdp.mjs';
  9. process.env.HL_CHROME ||= '/opt/google/chrome/chrome';
  10. const PORT = Number(process.env.REAL_PORT || 8730), BASE = `http://127.0.0.1:${PORT}`, OUT = process.env.REAL_OUT;
  11. const SID = process.env.REAL_SID_FILE ? readFileSync(process.env.REAL_SID_FILE, 'utf8').trim() : null;
  12. const PATHS = process.env.REAL_PATHS.split(','), WIDTHS = (process.env.REAL_WIDTHS || '390,1280').split(',').map(Number);
  13. mkdirSync(OUT, { recursive: true });
  14. const nameOf = (p) => p.slice(1).replace(/[^A-Za-z0-9-]+/g, '_');
  15. const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8729), Number(process.env.REAL_CHROME || 8729)] });
  16. try {
  17. for (const who of SID ? ['out', 'in'] : ['out']) {
  18. const page = await browser.newPage();
  19. if (who === 'in') await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  20. for (const w of WIDTHS) {
  21. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: 900, deviceScaleFactor: 1, mobile: w < 600 });
  22. for (const p of PATHS) {
  23. const t = Date.now();
  24. await page.goto(BASE + p, { timeout: 120000 });
  25. await page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 120000, label: 'hydrated' });
  26. // an incomplete title completes on open (skeleton → full): wait until no skeleton is left (max 60 s)
  27. await page.waitFor(`!document.querySelector('#showloading')`, { timeout: 60000, label: 'complete' }).catch(() => {});
  28. await page.waitFor(`Array.from(document.querySelectorAll('img')).every(i => i.complete)`, { timeout: 15000, label: 'images' }).catch(() => {});
  29. const ms = Date.now() - t;
  30. const info = await page.evaluate(`(() => {
  31. const box = (el) => { if (!el) return null; const r = el.getBoundingClientRect(); return { x: Math.round(r.x), y: Math.round(r.y), w: Math.round(r.width), h: Math.round(r.height) }; };
  32. const poster = document.querySelector('show-poster img, show-poster skeleton-poster');
  33. const follow = document.querySelector('#follow');
  34. const pill = document.querySelector('.status-pill');
  35. const cs = pill ? getComputedStyle(pill) : null;
  36. return JSON.stringify({ poster: box(poster), posterSrc: poster && poster.getAttribute('src'), follow: box(follow), followText: follow && follow.textContent.trim(),
  37. pill: pill ? { text: pill.textContent.trim(), bg: cs.backgroundColor, color: cs.color, border: cs.borderTopWidth + ' ' + cs.borderTopStyle, box: box(pill) } : null,
  38. h1: box(document.querySelector('h1')), scrollX: document.documentElement.scrollWidth > innerWidth });
  39. })()`);
  40. const name = `${nameOf(p)}-${who}-${w}`;
  41. writeFileSync(`${OUT}/${name}.txt`, await page.evaluate('document.body.innerText'));
  42. const m = await page.send('Page.getLayoutMetrics');
  43. const h = Math.min(Math.ceil(m.cssContentSize.height), 6000);
  44. const shot = await page.send('Page.captureScreenshot', { format: 'png', captureBeyondViewport: true, clip: { x: 0, y: 0, width: w, height: h, scale: 1 } });
  45. writeFileSync(`${OUT}/${name}.png`, Buffer.from(shot.data, 'base64'));
  46. console.log(`${name} ${ms} ms ${info}`);
  47. }
  48. }
  49. await page.close().catch(() => {});
  50. }
  51. } finally { await browser.close().catch(() => {}); }
  52. process.exit(0);

Branches

Latest commits

  • 2ae8a47bMerge branch 'sk-sec'mre
  • 8fee5d52sessions last 99 years (creator 2026-10-23: logins never expire; only sign out ends them)mre
  • 944ad51eSK: report reports/SK-sec.md, LOGsk
  • 415487c1SK: import budget per user + id type check, gate checkssk
  • 7b8a4f74security audit SK: nosniff + image sandbox headers, face id checks, adult follow, login budget + new session at login, guest-link budget, tests/security.mjssk
  • f0f26c5areports: T18 section (gates, boot-gate, 3x3 table, search + short-id compare)mre
  • 2a8682a1deploy.sh GATES: tests/warmstart.mjsmre
  • 3761338breports/T17-boot.md: handoff (phase table, fix, numbers so far, open proof)mre
  • 52e09eb2boot: sync window 1000 ms (the gates ask for a complete start), README boot-time sectionmre
  • c87149e8tests/warmstart.mjs: the progressive start proven over HTTP (note in the window, 503 short id, after: everything); bootBeginmre
  • 593a6350boot: resumable start-up scan, the server listens first (T17)mre
  • be4890a0reports: H2 hydration audit (no test change needed)mre
  • 1f9c8bf4re-vendor Hybriel 5406d146 (hl:web batches 9+10: #72 emits while the socket is closed delivered after reconnect, browser boot linear, faster list appends; contains int 6–14 + m406)mre
  • c1df88eddocker-compose: HL_GC_TABLE_LOAD=62 (tracker mission 048, T16 real-data numbers)mre
  • d0a82867mission 048: report, LOG (HL_GC_TABLE_LOAD=62 measured)mre
  • 2d4be66fre-vendor Hybriel 5df4eb7e (GC: HL_GC_TABLE_LOAD knob, mission 406)mre
  • 99e7c8b9tests: realdata-m035-radii, repro-t38, realdata-060-backfill ports from env (REAL_PORT, REAL_CHROME, REPRO_CHROME), defaults unchangedmre
  • 4625aa22re-vendor Hybriel 6f8a0689 (int 6–11: streaming cursors, #203 index heal + close() fix, fd403 listDir/cursor fds, hl:time browser side, hl:web batches 5+6)mre
  • a6dfd6ecdeploy: person-lookup gate (tracker#46)mre
  • 33ad4bd5Merge commit 'f57f64f'mre