tickets
All repositories: gitoria
2.2 KB
// reset-peer.mjs — mission 512. A TLS server that finishes the handshake and then// resets the connection must not kill the Hybriel program with SIGPIPE (exit 141,// which took the live tracker down every few minutes). The program has to see an// ordinary fetch error, catch it with `on Error`, and run to its end (exit 0).// Below what an .hl fixture can reach: it needs a raw TLS peer that resets.import { spawn, execFileSync } from 'node:child_process';import tls from 'node:tls';import fs from 'node:fs';import os from 'node:os';import path from 'node:path';import { fileURLToPath } from 'node:url';const HERE = path.dirname(fileURLToPath(import.meta.url));const ROOT = path.resolve(HERE, '../../..');const BIN = process.env.HL_BIN || path.resolve(ROOT, 'native/zig-out/bin/hybriel');const PORT = Number(process.env.HL_TEST_PORT || 14979);const dir = fs.mkdtempSync(path.join(process.env.TMPDIR || os.tmpdir(), 'reset-peer-'));const key = path.join(dir, 'k.pem'), cert = path.join(dir, 'c.pem');execFileSync('openssl', ['req', '-x509', '-newkey', 'rsa:2048', '-nodes', '-keyout', key, '-out', cert,'-days', '2', '-subj', '/CN=localhost', '-addext', 'subjectAltName=DNS:localhost,IP:127.0.0.1'], { stdio: 'ignore' });const server = tls.createServer({ key: fs.readFileSync(key), cert: fs.readFileSync(cert) }, (s) => {s.on('error', () => {});if (s.socket && s.socket.resetAndDestroy) s.socket.resetAndDestroy(); else s.destroy();});await new Promise((r) => server.listen(PORT, '127.0.0.1', r));const child = spawn(BIN, [path.join(HERE, 'reset_peer.hl')], {env: { ...process.env, HL_TEST_PORT: String(PORT), HL_TEST_CA: cert },stdio: ['ignore', 'pipe', 'pipe'],});let log = '';child.stdout.on('data', (d) => { log += d; });child.stderr.on('data', (d) => { log += d; });const timer = setTimeout(() => child.kill('SIGKILL'), 100000);const [code, sig] = await new Promise((r) => child.on('exit', (c, s) => r([c, s])));clearTimeout(timer);server.close();fs.rmSync(dir, { recursive: true, force: true });if (code === 0 && log.includes('survived 150')) { console.log('PASS survived 150 resets'); process.exit(0); }console.log(`FAIL exit code ${code} signal ${sig} (141 = SIGPIPE killed it)\n` + log.slice(-1500));process.exit(1);
Branches
Latest commits
- 0185d0b6Log PR 1 deploymre
- f5bf16e2Mission 031: deploy PR 1mre
- c69cd5f3Merge branch 'pr-flow' into mainTickets
- cc56798cLog gitoria PR-only requestmre
- d876d0b2|||PR README: changes land as PRsmre
- fd83ac1fconductor: caramboleyo is the user, not owner/creatorApollo
- 3b858c91Log backup hard-link fixmre
- 7f6b37a0deploy.sh backup: tar --hard-dereference (hard links broke mpackdb sidecars on restore)mre
- e93711d9Log E30 livemre
- 59c02e4dMerge e30: preserve edited state note labels in Markdownmre
- 30970796Log E30 deploy GOmre
- 7c8e6d83Limit edited state note fix to Markdown renderingmre
- 910536d0Log E30 reviewmre
- 36984386Preserve state transitions when their notes are editedmre
- d75cb946Log E30 startmre
- 0bf3fefaMission 030: edited state note labelmre
- 691565c6Log neutral-ticket rule checkmre
- bc3bdecerecords: day38b live, #94 purgedmre
- f6c5aa0dMerge main (records)mre
- e23d42acconnect gate: wait for hydration before clicking Disconnectmre