calendar
All repositories: gitoria
3.1 KB
// tests/e2e-reminder-place-app.mjs — the app half of tests/e2e-reminder-place.mjs (C13; start it OUTSIDE the lisbeth lock, kill it by its PID after):// node tests/e2e-reminder-place-app.mjs <port> <dir> <dir>/storage = a COPY of a deploy backup's storage (push table removed: no real device)// A session of the creator's copy user is made in <dir>/sessions (sid → <dir>/sid), a FAKE push service listens on <port>+2 (answers 201, logs// every POST to <dir>/push.log), the app gets a fresh VAPID pair and CALENDAR_PUSH_ALLOW_HTTP. <dir>/pids = "launcher server", <dir>/ready when up.import { spawn } from 'node:child_process';import { writeFileSync, mkdirSync, appendFileSync } from 'node:fs';import { createServer } from 'node:http';import { createHash, generateKeyPairSync, randomBytes } from 'node:crypto';import { dirname, join, resolve } from 'node:path';import { fileURLToPath } from 'node:url';const APP = resolve(dirname(fileURLToPath(import.meta.url)), '..');const PORT = Number(process.argv[2]), DIR = resolve(process.argv[3]);const b64 = (b) => Buffer.from(b).toString('base64url');const k = generateKeyPairSync('ec', { namedCurve: 'P-256' }); const jwk = k.privateKey.export({ format: 'jwk' });const PUB = b64(Buffer.concat([Buffer.from([4]), Buffer.from(jwk.x, 'base64url'), Buffer.from(jwk.y, 'base64url')]));const sid = randomBytes(16).toString('hex'), now = Date.now();mkdirSync(join(DIR, 'sessions'), { recursive: true });writeFileSync(join(DIR, 'sessions', createHash('sha256').update(sid).digest('hex')), JSON.stringify({ created: now, data: { tag: 'a3tag' }, handled: [], id: sid, seen: now, user: { id: '0muh8y8myb5z' } }), { mode: 0o600 });writeFileSync(join(DIR, 'sid'), sid);const fake = createServer((q, r) => { const c = []; q.on('data', d => c.push(d)); q.on('end', () => { appendFileSync(join(DIR, 'push.log'), `${Date.now()} ${q.method} ${q.url} ${Buffer.concat(c).length}\n`); r.statusCode = 201; r.end(''); }); }).listen(PORT + 2, '127.0.0.1');const server = spawn(join(APP, 'bin/hybriel'), ['project.hl'], { cwd: APP, env: { ...process.env, CALENDAR_PORT: String(PORT), HL_HOST: '127.0.0.1', CALENDAR_SESSIONS: join(DIR, 'sessions') + '/', CALENDAR_STORAGE: join(DIR, 'storage', 'mpackdb'),CALENDAR_WATCH: '0', CALENDAR_PUBLIC_URL: `http://127.0.0.1:${PORT}`, IDENT_URL: 'http://127.0.0.1:9', IDENT_EXCHANGE_URL: 'http://127.0.0.1:9', IDENT_API_KEY: 'pk_c13', IDENT_API_SECRET: 'sk_c13',CALENDAR_PUSH_PUBLIC: PUB, CALENDAR_PUSH_PRIVATE: jwk.d, CALENDAR_PUSH_SUBJECT: 'mailto:[email protected]', CALENDAR_PUSH_EVERY: '5', CALENDAR_PUSH_ALLOW_HTTP: '1' }, stdio: ['ignore', 'pipe', 'pipe'] });server.stdout.on('data', d => appendFileSync(join(DIR, 'server.log'), d)); server.stderr.on('data', d => appendFileSync(join(DIR, 'server.log'), d));writeFileSync(join(DIR, 'pids'), `${process.pid} ${server.pid}\n`);for (let i = 0; ; i++) { try { if ((await fetch(`http://127.0.0.1:${PORT}/`)).ok) break; } catch {} if (i > 800) throw new Error('no start'); await new Promise(r => setTimeout(r, 250)); }writeFileSync(join(DIR, 'ready'), String(PORT));process.on('SIGTERM', () => { try { server.kill('SIGTERM'); } catch {} process.exit(0); });
Branches
Latest commits
- 2dd53dccP1: one reminder shows once: arm() one at a time, the page skips reminders the server already pushed; push-twice gatemre
- 3a29760aC13 report (handoff)mre
- 33ab66ffCalendar: notification controls move from the month view into Reminder settings (user menu), one consistent state, state read when the dialog opensmre
- 682a5b43reports: calendar gate countsmre
- 876d22b2reports/H1-hydrate.mdmre
- ef0cae45tests/dst.mjs: wait for hydration instead of a fixed 2.5 s sleep before clicking #gomre
- d9cadecatests/cdp.mjs: HL_CPU_THROTTLE=<rate> optional CPU throttling for gate runsmre
- efa61227re-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
- 7808adbecalendar#12: report 011, LOG, STATUS, push-shots-testmre
- df2e4fa0calendar#12: test push rate limit (1 per 30 s per device), owner-only gate checksmre
- acb957cfcalendar#12: Send a test notification on a subscribed device (one push in ~10 s, owner's own device), push gate part 4mre
- 0b222eb8tests: e2e-theme CDP port default from E2E_THEME_CDP_PORT (8756 unchanged)mre
- 8b8a5abare-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
- a69b27f9docker-compose: nofile 65536 (Hybriel int 6+ boot opened >1024 files in the tracker)mre
- 1a97edfdcalendar mission 010: reminder rows at 390 px (the 7-column month grid no longer catches the reminder lists), gate checks, settings-shots, reportmre
- 61b21404calendar mission 009: reminder times on hl:time in the browser (lib/push-plan.hl and the Intl code removed), DST gate tests/dst.mjs, E2E script, reportmre
- 875353c1calendar mission 009: re-vendor Hybriel master 022a3ac1 (int 6 6b396322 hl:time browser side, int 7 65e8ec21; bin sha256 6e0f77d7, plugins whole)mre
- ce16a4efdeploy: backup copies index files first and *.mpack data last (hot-copy skew, hybriel #203)mre
- f490bc8cdeploy: Web Push gate tests/push.mjs (PUSH_GATE_PORT)mre
- 3af29fc8calendar mission 008 (A8): report, README, LOG, push-shots.mjsmre