gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit593a6350593a6350boot: resumable start-up scan, the server listens first (T17)mre593a6350/tests/realdata-068.mjs

4.5 KB

  1. // tests/realdata-068.mjs — tracker#20/#21 (mission 068), NOT the gate: on a COPY of live storage/ (STATUS.md has the procedure),
  2. // after the kind backfill. (1) SPOT CHECKS by name: what our search says each title is (Series / Show / Movie) and where it links.
  3. // (2) Signed in (cookie from .scratch/w068/real-sid) at 390 + 1280: every page kind's full load time (to hydrated), its typed
  4. // heading, no sideways scroll, a screenshot → $REAL_OUT. Env: REAL_PORT (8760), REAL_CHROME (8767), REAL_NAMES (comma list).
  5. import { writeFileSync, readFileSync, mkdirSync } from 'node:fs';
  6. import { launchBrowser } from './cdp.mjs';
  7. process.env.HL_CHROME ||= '/opt/google/chrome/chrome';
  8. const BASE = `http://127.0.0.1:${process.env.REAL_PORT || 8760}`, OUT = process.env.REAL_OUT || '/tmp/w068/real';
  9. const SID = readFileSync(process.env.REAL_SID_FILE || '.scratch/w068/real-sid', 'utf8').trim();
  10. mkdirSync(OUT, { recursive: true });
  11. // (1) spot checks: the search's row for the exact title (with its year), by the server's own render
  12. const names = (process.env.REAL_NAMES || 'Reacher,Saturday Night Live,The Tonight Show Starring Jimmy Fallon,Last Week Tonight with John Oliver,Foundation,Doctor Who,Jersey Shore,Chernobyl,Planet Earth,Hot Ones,The Late Show with Stephen Colbert,Severance').split(',');
  13. const spot = [];
  14. for (const n of names) {
  15. const h = await (await fetch(BASE + '/search/' + encodeURIComponent(n))).text();
  16. const rows = [...h.matchAll(/<search-row>[\s\S]*?class="search-title" href="([^"]*)">([^<]*)<\/a>[\s\S]*?<search-type class="([^"]*)">([^<]*)<\/search-type>/g)].map(m => ({ href: m[1], title: m[2], type: m[4] }));
  17. const hit = rows.filter(r => r.title.replace(/ \(\d{4}\)$/, '') === n);
  18. spot.push(n + ': ' + (hit.length ? hit.map(r => `${r.type} ${r.title} → ${r.href}`).join(' | ') : 'not in our data'));
  19. }
  20. console.log('SPOT CHECKS\n' + spot.join('\n'));
  21. // (2) pages, signed in
  22. const browser = await launchBrowser({ debugPortRange: [Number(process.env.REAL_CHROME || 8767), Number(process.env.REAL_CHROME || 8767)] });
  23. const page = await browser.newPage();
  24. const ev = (e) => page.evaluate(e);
  25. const hydrated = () => page.waitFor('!!window.__hl && window.__hl.socket && window.__hl.socket.readyState === 1 && document.readyState === "complete"', { timeout: 60000, label: 'hydrated' });
  26. const shot = async (n) => writeFileSync(`${OUT}/${n}.png`, Buffer.from((await page.send('Page.captureScreenshot', { format: 'png' })).data, 'base64'));
  27. const load = async (path) => { const t = Date.now(); await page.goto(BASE + path, { timeout: 60000 }); await hydrated(); return Date.now() - t; };
  28. await page.send('Network.setCookie', { name: 'trackersid', value: SID, url: BASE });
  29. // a movie the creator follows, and the first cast member of Reacher, from the pages themselves
  30. await load('/my/movies');
  31. const movie = await ev(`(document.querySelector('a.myshow-title') || {}).getAttribute ? document.querySelector('a.myshow-title').getAttribute('href') : '/movies'`);
  32. await load('/series/Reacher');
  33. const person = await ev(`(document.querySelector('a.artist-link') || {}).getAttribute ? document.querySelector('a.artist-link').getAttribute('href') : '/'`);
  34. const PAGES = [['home', '/'], ['series-list', '/series'], ['shows-list', '/shows'], ['movies-list', '/movies'], ['series', '/series/Reacher'], ['show', '/shows/Saturday-Night-Live'],
  35. ['movie', movie], ['genre', '/genres/Drama'], ['person', person], ['my-series', '/my/series'], ['my-shows', '/my/shows'], ['search', '/search/reacher']];
  36. const out = [];
  37. for (const [w, h, mobile] of [[390, 844, true], [1280, 900, false]]) {
  38. await page.send('Emulation.setDeviceMetricsOverride', { width: w, height: h, deviceScaleFactor: mobile ? 2 : 1, mobile });
  39. for (const [name, path] of PAGES) {
  40. const ms = await load(path);
  41. await page.waitFor(`Array.from(document.querySelectorAll('img')).filter(i => { const r = i.getBoundingClientRect(); return r.top < innerHeight && r.bottom > 0 }).every(i => i.complete)`, { timeout: 10000, label: 'images' }).catch(() => {});
  42. const info = await ev(`JSON.stringify({ h1: (document.querySelector('h1') || {}).innerText ? document.querySelector('h1').innerText.replace(/\\s+/g, ' ') : '', word: document.querySelector('h1 type-word') ? getComputedStyle(document.querySelector('h1 type-word')).color : '', sideways: document.documentElement.scrollWidth > ${w}, rows: document.querySelectorAll('my-show-row, a.tile, search-row, a.film-row').length })`);
  43. await shot(`${name}-${w}`);
  44. out.push(`${w} ${path} ${ms} ms ${info}`);
  45. }
  46. }
  47. console.log('PAGES\n' + out.join('\n'));
  48. console.log('problems', JSON.stringify(page.problems ? page.problems() : []));
  49. await browser.close();

Branches

Latest commits

  • 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
  • 7d38cec4docker-compose: nofile 65536 (default soft 1024 refused boot: errno 24 in fs.listDir, Hybriel 528bc89f)mre
  • f57f64f0mission 046: report, LOGmre
  • 5965963adeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
  • efe1b485mission 046: re-vendor Hybriel master 60b2817b (integration 8, #203): plugins mpackdb + web (bin/ git-ignored: hybriel, libhlrt.a, hlc.o, hlrt/ from native/zig-out)mre
  • 53099ffbmission 046: person page reads a slim per-title credit row cache (no whole-record fetch per credit); gate tests/person-lookup.mjsmre
  • 9b3828aemission 046a: report, LOGmre
  • 4b37356emission 046: franchise seed supersedeCollections reads the curated timelines once (10 s one-tick block at the end of boot)mre
  • ac6268e3mission 046a: re-vendor Hybriel 528bc89f (integration 6): plugins mpackdb/time/web (bin/ git-ignored)mre
  • 322b3293mission 046: photoQueue guard for non-row fetch results (damaged persons index)mre
  • e5b99aecmission 046: photoQueue in slices (people.hl photoQueueStart/Step, jobs.hl photoTick), tests/photoqueue.hlmre