gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit2a8682a12a8682a1deploy.sh GATES: tests/warmstart.mjsmre2a8682a1/tests/tmdbcheck.mjs

3.1 KB

  1. // tests/tmdbcheck.mjs — tools/tmdb-check.hl against a tiny fake TMDB (mission 039, tracker#36): a dropped connection does not end the
  2. // run (asked again at the end, `failed …` line when it still fails), --from N resumes. No real token, no real TMDB.
  3. // COPY=/abs/copy/of/storage/mpackdb TOOL=tools/tmdb-check.hl PORT=8700 node tests/tmdbcheck.mjs (COPY: a copy, never live data)
  4. import http from 'node:http';
  5. import { spawn } from 'node:child_process';
  6. const PORT = Number(process.env.PORT || 8700), COPY = process.env.COPY, TOOL = process.env.TOOL || 'tools/tmdb-check.hl';
  7. if (!COPY) { console.log('set COPY'); process.exit(2); }
  8. let seen = [], dropAlways = null, dropOnce = null, onceDone = false;
  9. const server = http.createServer((req, res) => {
  10. const m = /^\/3\/(movie|tv)\/(\d+)/.exec(req.url); const id = m && m[2];
  11. seen.push(id);
  12. if (id === dropAlways || (id === dropOnce && !onceDone && (onceDone = true))) { req.socket.destroy(); return; }
  13. res.writeHead(200, { 'content-type': 'application/json' });
  14. res.end(JSON.stringify({ id: Number(id), title: 'x', name: 'x', original_title: 'x', original_name: 'x', release_date: '1999-01-01', first_air_date: '1999-01-01' }));
  15. });
  16. await new Promise(r => server.listen(PORT, '127.0.0.1', r));
  17. const run = (args) => new Promise((resolve) => {
  18. seen = []; onceDone = false; let out = '';
  19. const p = spawn('./bin/hybriel', [TOOL, ...args], { env: { ...process.env, TMDB_READ_TOKEN: 'fake-token', TMDB_BASE_URL: `http://127.0.0.1:${PORT}/3`, TRACKER_STORAGE: COPY } });
  20. p.stdout.on('data', d => out += d); p.stderr.on('data', d => out += d);
  21. p.on('close', code => resolve({ code, out, seen: [...seen] }));
  22. });
  23. let pass = 0, fail = 0;
  24. const check = (name, ok, extra = '') => { ok ? pass++ : fail++; console.log((ok ? 'PASS ' : 'FAIL ') + name + (ok ? '' : ' — ' + extra)); };
  25. const base = await run(['--limit', '6', '--all']);
  26. const ids = base.seen;
  27. check('baseline: 6 asked, exit 0', ids.length == 6 && base.code == 0, base.out.slice(-300));
  28. dropAlways = ids[1]; dropOnce = ids[2];
  29. const r1 = await run(['--limit', '6', '--all']);
  30. const cnt = (id) => r1.seen.filter(x => x === id).length;
  31. check('run goes on after dropped connections (exit 0, done line)', r1.code == 0 && /tmdb check done: asked=6/.test(r1.out), r1.out.slice(-400));
  32. check('dropped-once title asked again, then ok', cnt(ids[2]) == 2 && cnt(ids[1]) == 2 && ids.slice(3).every(i => cnt(i) == 1), JSON.stringify(r1.seen));
  33. const failedLines = r1.out.split('\n').filter(l => l.startsWith('failed '));
  34. check('exactly one `failed` line, with the reason, for the title that kept failing', failedLines.length == 1 && failedLines[0].includes('tmdb ' + ids[1] + ':') && /no answer/.test(failedLines[0]), r1.out);
  35. check('totals: clear=5 failed=1 retried=2', /clear=5 errors=0 failed=1 retried=2/.test(r1.out), r1.out.slice(-300));
  36. dropAlways = null;
  37. const r2 = await run(['--from', '4', '--limit', '2']);
  38. check('--from 4 --limit 2 asks exactly titles 5 and 6 of the same order', JSON.stringify(r2.seen) == JSON.stringify(ids.slice(4, 6)), JSON.stringify(r2.seen));
  39. server.close(); console.log(`tmdbcheck: ${pass} pass, ${fail} fail`); process.exit(fail ? 1 : 0);

Branches

Latest commits

  • 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
  • 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