gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit613ae0ec613ae0ecMerge branch 'bs3' into mainTracker613ae0ec/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

  • 613ae0ecMerge branch 'bs3' into mainTracker
  • 1383264b|||PR BS3: keep shared synchronous sorting fastTracker
  • 63e5ba1a|||PR BS3: guard boot imports and share resumable sort buffersTracker
  • 310613f1Merge branch 'records-dp72' into mainTracker
  • 6f7b61ba|||PR records: deploy-swap fix live, Kunibert findingsTracker
  • c41587d2Merge branch 'bs2' into mainTracker
  • 0dd538a6|||PR BS2: finish the boot index in slices so a booting instance keeps answeringTracker
  • 019d5cedMerge branch 'records-1110' into mainTracker
  • f88ae8b9|||PR records: day56 toggle live, reviewTracker
  • b6b3bb4dMerge branch 'ap56e' into mainTracker
  • 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
  • 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
  • 4b54f6f9Merge branch 'records-audit' into mainTracker
  • cab4a3bc|||PR records: branch audit, PR-onlyTracker
  • 641e1c4cMerge branch 'records-dp71' into mainTracker
  • 85a6e9f5|||PR records: DP71 checked in ChromeTracker
  • f5be5f18records: gitoria PR-only planTracker
  • 46a37036records: DP71 liveTracker
  • 3bcb7039Status/log: DP71 in progressTracker
  • 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker