gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb8dac822b8dac822log: hybriel#309mreb8dac822/tests/person-lookup.mjs

1.7 KB

  1. // tracker#46 gate: the person page's per-request code (components/person.hl, people.hl `filmographyOf`, `personInfoOf`) must not
  2. // fetch a title's whole record per credit (showsTable.fetch / showById / liveShowOf: 311 decoded records for Tom Hanks per
  3. // request, which fed the byte-triggered GC) nor scan a table (find / iterate). It reads the slim `creditRowLive` cache.
  4. // usage: node tests/person-lookup.mjs [tree] (default: the tree of this file)
  5. import { readFileSync } from 'node:fs';
  6. import { dirname, resolve } from 'node:path';
  7. import { fileURLToPath } from 'node:url';
  8. const root = resolve(process.argv[2] ?? resolve(dirname(fileURLToPath(import.meta.url)), '..'));
  9. const people = readFileSync(root + '/lib/people.hl', 'utf8');
  10. const comp = readFileSync(root + '/components/person.hl', 'utf8');
  11. const body = (src, name) => {
  12. const i = src.indexOf('static ' + name + ' = ');
  13. if (i < 0) throw new Error('no ' + name);
  14. const m = src.indexOf('\nstatic ', i + 10);
  15. return src.slice(i, m < 0 ? undefined : m);
  16. };
  17. const banned = /showsTable\.(fetch|find|iterate)|showById\(|liveShowOf\(|\.find\(|\.iterate\(/;
  18. let bad = 0;
  19. for (const [label, text] of [['people.hl filmographyOf', body(people, 'filmographyOf')], ['people.hl personInfoOf', body(people, 'personInfoOf')],
  20. ['people.hl personBySlug', body(people, 'personBySlug')], ['components/person.hl', comp.split('\n').filter(l => !l.trim().startsWith('//')).join('\n')]]) {
  21. const m = text.match(banned);
  22. if (m) { bad++; console.log('FAIL ' + label + ': ' + m[0]); } else console.log('ok ' + label);
  23. }
  24. if (!/creditRowLive\(/.test(body(people, 'filmographyOf'))) { bad++; console.log('FAIL filmographyOf does not use creditRowLive'); }
  25. console.log(bad ? 'person-lookup: FAILED' : 'person-lookup: passed');
  26. process.exit(bad ? 1 : 0);

Branches

Latest commits

  • b8dac822log: hybriel#309mre
  • bf676d9elog: GC1 startedmre
  • c7828541mission GC1mre
  • ef949994conductor: neutral ticket rulemre
  • 89e91ef3log: RV39 livemre
  • ee2b677alog: RV39 deployingmre
  • c1c4178cMerge branch 'rv39'mre
  • a016e9abReapply "Merge branch 'rv39'"mre
  • f29e2502log: RV39 gate fixmre
  • d9fce111browser gate #26: exact frame count incl. SL1 people step (hybriel#308)mre
  • ad529ac1log: m572 verdictmre
  • 1b37d404RV39 on hold: hybriel#308mre
  • f9127c68Revert "Merge branch 'rv39'"mre
  • cd39f3d3log: hybriel#308mre
  • 51341d6elog: RV39 deploy startedmre
  • c9e29e06Merge branch 'rv39'mre
  • 0f8d1fdclog: RV39 report, browser 387/2mre
  • 50249b0bRV39: reportmre
  • 10ed9581compose: HL_GC_STATS=1mre
  • 955da19bRV39: re-vendor Hybriel set day39 (source 51e921d7, bin 6b481aa7)mre