gitoria
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
- f1-broken-json
- f2-api-bugs
- gp-gate-ports
- heap-revert
- hl25-records
- ident-chooser-selector
- mainmain branch
- p51-public-pr-reads
- records-1112
- s25-no-session-on-login-error
- v59
- w52-person-approval
- w52b-approval-followup
- w52c-header-phone
- w53-pulls-speed-pr
- w54-repo-rename-pr
- w55-rename-org
- w56-owner-members
- w62-pr-close
- w63-force-push
- w64-org-slash
Latest commits
- 01b71c2edocs: neutral wording in missions, reports and logmre
- 3eeea733log: 2026-11-09 PR flow plan and membersmre
- e7c2ff1fdocs: neutral name for the apps-api reviewmre
- 120b7abdlog: step 3 queuedmre
- 358474bflog: P50 livemre
- 477d7bdcMerge branch 'p50'mre
- 00efc06fP50 reportmre
- e3f85afblog: commit mention slipmre
- 4d1a4cf4log: #25 numbersmre
- 1af0a60ddocs: H25 run() correctionmre
- eefa2dbcRepo setting: refuse direct pushes to the main branch (pre-receive over HTTPS and ssh)mre
- 8c8ba2f1log: PR flow announcedmre
- fa00cd35log: Kunibert pings provenmre
- 3a68cfaclog: components decisionmre
- 87de8e31log: Kunibert connected to 9 app reposmre
- c22aff69log: PR-only rollout startedmre
- 25309981log: STOP and paused workers 2026-11-08mre
- 5286803alog: worker briefs and reports of 2026-11-08mre
- 85c86605log: 2026-11-08 Arachne on list shapemre
- cb634512log: 2026-11-08 keyed lists livemre