gitoria

calendar

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit6d0eb3b06d0eb3b0|||PR Calendar day add buttons only when signed in (Kunibert minor)Atlas6d0eb3b0/plugins/fetch/tests/try-fetch.mjs

2.8 KB

  1. import http from 'node:http';
  2. import net from 'node:net';
  3. import { spawn } from 'node:child_process';
  4. import { mkdir, writeFile, copyFile } from 'node:fs/promises';
  5. import path from 'node:path';
  6. import { fileURLToPath } from 'node:url';
  7. const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '../../..');
  8. const bin = process.env.HL_BIN || path.join(root, 'native/zig-out/bin/hybriel');
  9. const work = process.env.TMPDIR;
  10. if (!work) throw new Error('set TMPDIR to scratch');
  11. const sockets = new Set();
  12. const web = http.createServer((req, res) => {
  13. const code = Number(req.url.slice(1));
  14. res.writeHead(code, { 'content-type': 'application/json', date: 'fixed', connection: 'close' });
  15. res.end(JSON.stringify({ code }));
  16. });
  17. const slow = net.createServer(s => { sockets.add(s); s.on('close', () => sockets.delete(s)); });
  18. function listen(s, port) { return new Promise((r, j) => { s.once('error', j); s.listen(port, '127.0.0.1', r); }); }
  19. function run(args) {
  20. return new Promise((resolve, reject) => {
  21. const p = spawn(args[0], args.slice(1), { cwd: root, env: process.env });
  22. let out = '', err = '';
  23. p.stdout.on('data', s => out += s); p.stderr.on('data', s => err += s);
  24. p.on('error', reject); p.on('close', code => code ? reject(new Error(`${args.join(' ')} exit ${code}\n${out}${err}`)) : resolve(out));
  25. });
  26. }
  27. try {
  28. const probe = net.createServer(); await listen(probe, 32262); await new Promise(r => probe.close(r));
  29. await listen(web, 32260); await listen(slow, 32261);
  30. const fixture = path.join(root, 'plugins/fetch/tests/try_fetch.hl');
  31. const native = await run([bin, fixture]);
  32. await run([bin, '--native', fixture, '-o', path.join(work, 'try-fetch')]);
  33. const compiled = await run([path.join(work, 'try-fetch')]);
  34. const jsdir = path.join(work, 'try-fetch-js'); await mkdir(jsdir, { recursive: true });
  35. await writeFile(path.join(jsdir, 'package.json'), '{"type":"module"}');
  36. await run([bin, '--js', '--entry', fixture, '-o', path.join(jsdir, 'probe.mjs')]);
  37. await writeFile(path.join(jsdir, 'hl-runtime.js'), await run([bin, '--js-runtime']));
  38. await mkdir(path.join(jsdir, 'hl-modules'), { recursive: true });
  39. await copyFile(path.join(root, 'plugins/fetch/server.js'), path.join(jsdir, 'hl-modules/fetch.js'));
  40. const js = await run(['node', path.join(jsdir, 'probe.mjs')]);
  41. if (native !== compiled || native !== js) throw new Error(`different answers\nrun:${native}\nnative:${compiled}\njs:${js}`);
  42. if (!native.includes('connection refused') || !native.includes('timed out') || !native.includes('true true true true true true {"code":200} 200') || !native.includes('true true true true true true {"code":404} 404')) throw new Error(native);
  43. console.log('PASS 4 scenarios, identical run/native/JS answers\n' + native);
  44. } finally {
  45. for (const s of sockets) s.destroy();
  46. await Promise.all([web, slow].map(s => new Promise(r => s.listening ? s.close(r) : r())));
  47. }

Branches

Latest commits

  • 6d0eb3b0|||PR Calendar day add buttons only when signed in (Kunibert minor)Atlas
  • add4b499|||PR Make calendar day actions keyboard accessibleAtlas
  • 79e49b4dMerge branch 'hl-standard' into mainAtlas
  • e9fec7bb|||PR HL-STANDARD clean-up: typed parameters, plain locals, by-reference cacheAtlas
  • eff166a4Re-vendor complete Hybriel plugins and runtime to day44mre
  • cef81394Wait for the DST fixture page instead of an unused socketmre
  • 42434f47Check lazy-session cookies after login with a stored anonymous fixturemre
  • 728e84e3Re-vendor complete Hybriel day41 plugin directoriesmre
  • cbd7ff43Backup tar: --hard-dereference, so mpackdb sidecars are never stored as hard links (Tracker's finding)mre
  • 59d1da0acalendar: plain declarations instead of needless let in 9 files (calendar#17): 49 declarations that are never reassigned; reassigned ones and the timer closure's p stay letmre
  • f5415cf9calendar: the Style blocks in the language's nested form (calendar#16): rules named after the View's own elements with their children nested, pseudo-classes and @media nested, merged duplicate select rule; same CSS, shots identical in Chrome at 4 sizesmre
  • edb7c947calendar: the sign-in callback keeps the session it finds and signs it in (same cookie, nothing signed out; ident#28); security gate 56+4 failing → 60 passedmre
  • bf8cc0fcStyles move into their components: the shell's styles into main.hl, the events and the editors into the month view's Style block; styles.hl keeps only the theme inherit, the accent and the message line; .gitignore ignores a bin symlink too; tests/styles-shots.mjs for the before/after pixel comparemre
  • 5d8579d7README: login.js stays by caramboleyo's explicit rulemre
  • cc759328Merge sb3-standby: calendar deploys through its standbymre
  • f2fcdc6dcalendar: a standby container (port 45015, profile standby, reminder clock off) and a /health page; deploy hands over through standby-swap.sh without a gapmre
  • 229643f7Merge branch 'cal-14'mre
  • 1110b26fcalendar#14: the month name no longer breaks into two lines on a phone (Reminder settings drops to its own row when the header is too narrow), gate checks for one-line title and all header controls on screenmre
  • 490c658aident#31: the selector's sign-in returns to the page the user started on (return attribute = the login callback with next), gate checkmre
  • 18095868calendar: Reminder settings button opens its dialog again (the dialog's open handler still closed the removed user menu and stopped); old e2e and gate scripts use the new headermre