gitoria

gitoria

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Main branchmainfe209ffeMerge branch 'w56-owner-members' into mainGitoriamain/tests/pull-numbers.mjs

19.8 KB

  1. import { requiredPort } from './gate-ports.mjs';
  2. // tests/pull-numbers.mjs — THE GATE OF PULL REQUEST NUMBERS (gitoria#40). Its own gitoria server and storage, the REAL git binary over HTTP:
  3. // numbers per repo (never reused, in commit-time order for the old ones), the changes syncPulls finds (opened, synchronize with forced,
  4. // closed, reopened, merged with mergeCommit), refs/pull/N/head fetchable and NOT pushable, the contract's pull object, wasHeadOf, "#N" on /pulls.
  5. // node tests/pull-numbers.mjs (GITORIA_PULLS_PORT required)
  6. import { spawn, execFileSync, spawnSync } from 'node:child_process';
  7. import { request as httpRequest } from 'node:http';
  8. import { rmSync, mkdirSync, writeFileSync, readFileSync, existsSync } from 'node:fs';
  9. import { dirname, join, resolve } from 'node:path';
  10. import { fileURLToPath } from 'node:url';
  11. const HERE = dirname(fileURLToPath(import.meta.url));
  12. const APP = resolve(HERE, '..');
  13. const PORT = requiredPort('GITORIA_PULLS_PORT');
  14. const STORE = join(APP, '.scratch', 'pulls-store');
  15. const DB = join(STORE, 'db'), GIT = join(STORE, 'git'), WORK = join(STORE, 'work');
  16. const LOG = join(DB, 'pull-changes.log');
  17. const trace = () => existsSync(join(STORE, 'git-trace')) ? readFileSync(join(STORE, 'git-trace'), 'utf8') : '';
  18. const logCalls = () => trace().split('\n').filter(l => /built-in: git (?:.* )?log /.test(l)).length;
  19. const HOST = (slug) => `${slug}.gitoria.test`;
  20. let failures = 0, passes = 0;
  21. function check(label, ok, detail = '') { console.log(`${ok ? 'ok ' : 'FAIL'} ${label}${ok ? '' : ' — ' + String(detail).slice(0, 400)}`); if (ok) passes++; else failures++; }
  22. const sleep = (ms) => new Promise(r => setTimeout(r, ms));
  23. const FAIL = join(STORE, 'fail'), WRAP = join(STORE, 'bin');
  24. const env = { ...process.env, PATH: WRAP + ':' + process.env.PATH, W53_FAIL_DIR: FAIL, GIT_TRACE: join(STORE, 'git-trace'), GITORIA_STORAGE: DB, GITORIA_GIT: GIT, GITORIA_PORT: String(PORT), GITORIA_WATCH: '0', GITORIA_PUBLIC_URL: `http://gitoria.test:${PORT}`, GITORIA_TICKETS_URL: 'http://127.0.0.1:1' };
  25. const BIN = join(APP, 'bin/hybriel');
  26. function raw(path, host) {
  27. return new Promise((res, rej) => {
  28. const r = httpRequest({ host: '127.0.0.1', port: PORT, path, headers: { host } }, (x) => { let b = ''; x.setEncoding('utf8'); x.on('data', d => b += d); x.on('end', () => res({ status: x.statusCode, body: b })); });
  29. r.on('error', rej); r.end();
  30. });
  31. }
  32. const gitEnv = { ...process.env, GIT_TERMINAL_PROMPT: '0', GIT_AUTHOR_NAME: 'Dev', GIT_AUTHOR_EMAIL: '[email protected]', GIT_COMMITTER_NAME: 'Dev', GIT_COMMITTER_EMAIL: '[email protected]' };
  33. function git(cwd, args, extra = {}) {
  34. const r = spawnSync('git', args, { cwd, encoding: 'utf8', env: { ...gitEnv, ...extra } });
  35. return { ok: r.status === 0, out: (r.stdout || '').trim(), err: (r.stderr || '').trim() };
  36. }
  37. const must = (cwd, args, extra) => { const r = git(cwd, args, extra); if (!r.ok) throw new Error('git ' + args.join(' ') + ': ' + r.err); return r.out; };
  38. const bare = (slug) => join(GIT, slug + '.git');
  39. const refOf = (slug, ref) => git(bare(slug), ['rev-parse', '--verify', '-q', ref]).out;
  40. const changes = () => existsSync(LOG) ? readFileSync(LOG, 'utf8').split('\n').filter(Boolean).map(l => JSON.parse(l)) : [];
  41. let seen = 0;
  42. const newChanges = () => { const all = changes(); const out = all.slice(seen); seen = all.length; return out; };
  43. let server = null, slog = '';
  44. const cleanup = () => { try { server && server.kill('SIGTERM'); } catch {} };
  45. process.on('exit', cleanup);
  46. try {
  47. if (!existsSync(BIN)) throw new Error('bin/hybriel missing');
  48. rmSync(STORE, { recursive: true, force: true }); mkdirSync(DB, { recursive: true }); mkdirSync(GIT, { recursive: true }); mkdirSync(WORK, { recursive: true });
  49. mkdirSync(FAIL); mkdirSync(WRAP);
  50. // One-shot failures affect only this server's git child, never the real git client or another gate.
  51. writeFileSync(join(WRAP, 'git'), `#!/bin/sh
  52. kind="$4"
  53. case "$4 $5" in
  54. 'for-each-ref --contains') kind=source ;;
  55. 'for-each-ref --format=%(refname)%09%(objectname)') kind=fingerprint ;;
  56. 'for-each-ref --format=%(refname:short)') kind=branches ;;
  57. 'merge-base --is-ancestor')
  58. kind=ancestor
  59. if [ "\${#7}" = 40 ]; then kind=source-ancestor; fi ;;
  60. esac
  61. if [ -f "$W53_FAIL_DIR/$kind" ]; then
  62. rm "$W53_FAIL_DIR/$kind"
  63. exit 128
  64. fi
  65. exec /usr/bin/git "$@"
  66. `, { mode: 0o700 });
  67. // ---- seed: a user, two repos, a token (cold compile: a minute)
  68. const seed = (slug) => spawnSync(BIN, ['tests/pulls-seed.hl', slug], { cwd: APP, env, encoding: 'utf8' });
  69. const s1 = seed('pr-test');
  70. const TOKEN = (/TOKEN (gtr_[0-9a-f]{40})/.exec(s1.stdout) || [])[1];
  71. check('seed made a token', !!TOKEN, s1.stdout + s1.stderr);
  72. if (!TOKEN) throw new Error('no seed');
  73. const s2 = seed('old-prs');
  74. check('seed made the second repo', s2.status === 0, s2.stdout + s2.stderr);
  75. // ---- old-prs: PRs that exist BEFORE gitoria numbers them (pushed to the bare repo directly), with distinct commit times
  76. const OLD = join(WORK, 'old');
  77. mkdirSync(OLD);
  78. must(OLD, ['init', '-q', '-b', 'main']);
  79. const at = (d) => ({ GIT_AUTHOR_DATE: d, GIT_COMMITTER_DATE: d });
  80. writeFileSync(join(OLD, 'a.txt'), 'a\n'); must(OLD, ['add', '.']); must(OLD, ['commit', '-q', '-m', 'base'], at('2026-01-01T10:00:00Z'));
  81. // the NEWER PR branch is created first: numbers must follow the commit time, not the creation order
  82. must(OLD, ['checkout', '-q', '-b', 'newer', 'main']); writeFileSync(join(OLD, 'n.txt'), 'n\n'); must(OLD, ['add', '.']); must(OLD, ['commit', '-q', '-m', '|||PR newer one'], at('2026-03-01T10:00:00Z'));
  83. must(OLD, ['checkout', '-q', '-b', 'older', 'main']); writeFileSync(join(OLD, 'o.txt'), 'o\n'); must(OLD, ['add', '.']); must(OLD, ['commit', '-q', '-m', '|||PR older one'], at('2026-02-01T10:00:00Z'));
  84. must(OLD, ['push', '-q', bare('old-prs'), 'main', 'newer', 'older']);
  85. // ---- start the server
  86. server = spawn(BIN, ['project.hl'], { cwd: APP, env, stdio: ['ignore', 'pipe', 'pipe'] });
  87. server.stdout.on('data', d => slog += d); server.stderr.on('data', d => slog += d);
  88. for (let i = 0; i < 960; i++) { try { if ((await raw('/api/repos', 'gitoria.test')).status === 200) break; } catch {} await sleep(250); if (i === 959) throw new Error('server did not come up\n' + slog); }
  89. const URL = (slug) => `http://app:${TOKEN}@${HOST(slug)}:${PORT}/${slug}.git`;
  90. const RES = (slug) => ['-c', `http.curloptResolve=${HOST(slug)}:${PORT}:127.0.0.1`];
  91. const push = (cwd, slug, refs, extra = []) => { const t0 = Date.now(); const r = git(cwd, [...RES(slug), 'push', ...extra, URL(slug), ...refs]); return { ...r, ms: Date.now() - t0 }; };
  92. // ---- backfill: /pulls numbers the old ones, oldest commit first, and logs no change
  93. const page = await raw('/pulls', HOST('old-prs'));
  94. const numOf = (html, word) => { const m = new RegExp('class="number"[^>]*>#(\\d+)</span>[\\s\\S]{0,600}?' + word).exec(html); return m ? Number(m[1]) : null; };
  95. check('/pulls of old PRs: the older commit is #1', numOf(page.body, 'older one') === 1, String(numOf(page.body, 'older one')));
  96. check('/pulls of old PRs: the newer commit is #2', numOf(page.body, 'newer one') === 2, String(numOf(page.body, 'newer one')));
  97. check('backfill logs no change', changes().length === 0);
  98. check('backfill made refs/pull/1/head and /2/head', refOf('old-prs', 'refs/pull/1/head') === refOf('old-prs', 'refs/heads/older') && refOf('old-prs', 'refs/pull/2/head') === refOf('old-prs', 'refs/heads/newer'));
  99. // Recover after failures in each git read of a scan without changing the fingerprint again.
  100. const oldHead = refOf('old-prs', 'refs/heads/older');
  101. const tree = must(OLD, ['rev-parse', oldHead + '^{tree}']);
  102. const advanced = must(OLD, ['commit-tree', tree, '-p', oldHead, '-m', 'later source head']);
  103. for (const kind of ['fingerprint', 'branches', 'log', 'source', 'ancestor', 'source-ancestor']) {
  104. if (kind === 'source-ancestor') {
  105. must(OLD, ['push', '-q', bare('old-prs'), advanced + ':refs/heads/cache-source']);
  106. must(bare('old-prs'), ['update-ref', '-d', 'refs/heads/older']);
  107. } else {
  108. must(bare('old-prs'), ['update-ref', 'refs/heads/cache-' + kind, refOf('old-prs', 'refs/heads/main')]);
  109. }
  110. writeFileSync(join(FAIL, kind), 'fail once');
  111. await raw('/pulls', HOST('old-prs'));
  112. check(kind + ' fault was injected into the scan', !existsSync(join(FAIL, kind)));
  113. const beforeRecovery = logCalls();
  114. const recovered = await raw('/pulls', HOST('old-prs'));
  115. check(kind + ' failure is not cached: next view rescans and recovers', logCalls() > beforeRecovery && numOf(recovered.body, 'older one') === 1 && numOf(recovered.body, 'newer one') === 2);
  116. const afterRecovery = logCalls();
  117. await raw('/pulls', HOST('old-prs'));
  118. check(kind + ' recovered scan is cached (exit 1 means not an ancestor)', logCalls() === afterRecovery);
  119. if (kind === 'source-ancestor') {
  120. must(bare('old-prs'), ['update-ref', 'refs/heads/older', oldHead]);
  121. must(bare('old-prs'), ['update-ref', '-d', 'refs/heads/cache-source']);
  122. } else { must(bare('old-prs'), ['update-ref', '-d', 'refs/heads/cache-' + kind]); }
  123. }
  124. // ---- pr-test: first push (main only), then PRs
  125. const W = join(WORK, 'w');
  126. mkdirSync(W);
  127. must(W, ['init', '-q', '-b', 'main']);
  128. writeFileSync(join(W, 'a.txt'), 'a\n'); must(W, ['add', '.']); must(W, ['commit', '-q', '-m', 'base']);
  129. let r = push(W, 'pr-test', ['main']);
  130. check('first push (no PR) works', r.ok, r.err);
  131. check('no PR → no change', newChanges().length === 0);
  132. await raw('/pulls', HOST('pr-test')); // warm the pre-push list
  133. must(W, ['checkout', '-q', '-b', 'f1']); writeFileSync(join(W, 'f1.txt'), '1\n'); must(W, ['add', '.']);
  134. must(W, ['commit', '-q', '-m', '|||PR first thing', '-m', 'Body line one.\n\nFixes other-proj#7 and bare #12.']);
  135. const f1a = must(W, ['rev-parse', 'HEAD']);
  136. r = push(W, 'pr-test', ['f1']);
  137. check('push of a |||PR branch works', r.ok, r.err);
  138. const firstView = await raw('/pulls', HOST('pr-test'));
  139. check('HTTPS push appears on the next /pulls view', firstView.status === 200 && firstView.body.includes('first thing'));
  140. const afterFirst = logCalls();
  141. check('git trace observed the initial log calls', afterFirst > 0);
  142. const secondView = await raw('/pulls', HOST('pr-test'));
  143. check('second /pulls view makes no git log call', logCalls() === afterFirst);
  144. check('warm list preserves the first HTML', secondView.body.match(/<ol id="pulllist"[\s\S]*?<\/ol>/)?.[0] === firstView.body.match(/<ol id="pulllist"[\s\S]*?<\/ol>/)?.[0]);
  145. let ch = newChanges();
  146. check('opened #1', ch.length === 1 && ch[0].action === 'opened' && ch[0].number === 1 && ch[0].after === f1a && ch[0].before === null && ch[0].repoId, JSON.stringify(ch));
  147. check('sender is the pusher', ch.length === 1 && ch[0].sender && ch[0].sender.name === 'Gate Pusher', JSON.stringify(ch));
  148. check('refs/pull/1/head = the head when the change is logged', refOf('pr-test', 'refs/pull/1/head') === f1a);
  149. must(W, ['checkout', '-q', 'main']); must(W, ['checkout', '-q', '-b', 'f2']); writeFileSync(join(W, 'f2.txt'), '2\n'); must(W, ['add', '.']); must(W, ['commit', '-q', '-m', '|||PR|main] second thing']);
  150. const f2a = must(W, ['rev-parse', 'HEAD']);
  151. push(W, 'pr-test', ['f2']);
  152. ch = newChanges();
  153. check('second PR is #2', ch.length === 1 && ch[0].action === 'opened' && ch[0].number === 2, JSON.stringify(ch));
  154. // synchronize (new commit, not forced)
  155. must(W, ['checkout', '-q', 'f1']); writeFileSync(join(W, 'f1b.txt'), 'b\n'); must(W, ['add', '.']); must(W, ['commit', '-q', '-m', 'more']);
  156. const f1b = must(W, ['rev-parse', 'HEAD']);
  157. push(W, 'pr-test', ['f1']);
  158. ch = newChanges();
  159. check('synchronize: before/after, forced false', ch.length === 1 && ch[0].action === 'synchronize' && ch[0].number === 1 && ch[0].before === f1a && ch[0].after === f1b && ch[0].forced === false, JSON.stringify(ch));
  160. check('ref follows the new head', refOf('pr-test', 'refs/pull/1/head') === f1b);
  161. // force push (amend the second commit)
  162. must(W, ['commit', '-q', '--amend', '-m', 'more, amended']);
  163. const f1c = must(W, ['rev-parse', 'HEAD']);
  164. r = push(W, 'pr-test', ['f1'], ['--force']);
  165. check('force push works', r.ok, r.err);
  166. ch = newChanges();
  167. check('synchronize forced true', ch.length === 1 && ch[0].action === 'synchronize' && ch[0].forced === true && ch[0].before === f1b && ch[0].after === f1c, JSON.stringify(ch));
  168. // every earlier head stays referenced (refs/pull/N/heads/<sha>): git gc --prune=now must not drop the heads f1a and f1b (both replaced, f1b by a force-push)
  169. const gc = git(bare('pr-test'), ['gc', '-q', '--prune=now']);
  170. check('git gc --prune=now ran', gc.ok, gc.err);
  171. check('after gc the replaced heads still resolve (f1a, f1b)', git(bare('pr-test'), ['cat-file', '-e', f1a + '^{commit}']).ok && git(bare('pr-test'), ['cat-file', '-e', f1b + '^{commit}']).ok);
  172. check('refs/pull/1/heads/<sha> exist for every head', [f1a, f1b, f1c].every(h => refOf('pr-test', `refs/pull/1/heads/${h}`) === h));
  173. r = push(W, 'pr-test', [`main:refs/pull/1/heads/${'a'.repeat(40)}`]);
  174. check('a push to refs/pull/N/heads/* is refused too', !r.ok, r.err);
  175. // refs/pull/* cannot be pushed (create, update, delete), and the ref stays
  176. const before1 = refOf('pr-test', 'refs/pull/1/head');
  177. for (const [what, refspec] of [['update', 'main:refs/pull/1/head'], ['create', 'main:refs/pull/99/head'], ['create (+force)', '+main:refs/pull/98/head'], ['delete', ':refs/pull/1/head']]) {
  178. r = push(W, 'pr-test', [refspec]);
  179. check(`push refused: ${what} ${refspec}`, !r.ok && /refs\/pull|hidden|deny|refus|rejected/i.test(r.err), r.err);
  180. }
  181. check('refs/pull/1/head unchanged after the attempts', refOf('pr-test', 'refs/pull/1/head') === before1 && refOf('pr-test', 'refs/pull/99/head') === '' && refOf('pr-test', 'refs/pull/98/head') === '');
  182. check('refused pushes made no change', newChanges().length === 0);
  183. // fetch of the head over HTTPS works, and clone does not make branches of it
  184. const F = join(WORK, 'f'); mkdirSync(F); must(F, ['init', '-q']);
  185. r = git(F, [...RES('pr-test'), 'fetch', '-q', URL('pr-test'), 'refs/pull/1/head']);
  186. check('fetch refs/pull/1/head over HTTPS', r.ok && must(F, ['rev-parse', 'FETCH_HEAD']) === f1c, r.err);
  187. // close: delete the branch; reopen: push it again; the number stays
  188. r = push(W, 'pr-test', [':f2']);
  189. ch = newChanges();
  190. check('branch deleted → closed #2', ch.length === 1 && ch[0].action === 'closed' && ch[0].number === 2, JSON.stringify(ch));
  191. push(W, 'pr-test', ['f2']);
  192. ch = newChanges();
  193. check('branch back → reopened #2 (same number)', ch.length === 1 && ch[0].action === 'reopened' && ch[0].number === 2 && ch[0].after === f2a, JSON.stringify(ch));
  194. // the |||PR commit gone from the branch (force-push of f2 to main's commit)
  195. push(W, 'pr-test', ['+main:f2']);
  196. check('force push removing a marker removes its list row on the next view', !(await raw('/pulls', HOST('pr-test'))).body.includes('second thing'));
  197. ch = newChanges();
  198. check('|||PR commit gone from the branch → closed #2', ch.length === 1 && ch[0].action === 'closed' && ch[0].number === 2, JSON.stringify(ch));
  199. // merged: main takes f1 with a merge commit
  200. must(W, ['checkout', '-q', 'main']); must(W, ['merge', '-q', '--no-ff', 'f1', '-m', 'merge f1']);
  201. const mc = must(W, ['rev-parse', 'HEAD']);
  202. await raw('/pulls', HOST('pr-test')); // cached open state
  203. push(W, 'pr-test', ['main']);
  204. const mergedPage = await raw('/pulls', HOST('pr-test'));
  205. check('merged state appears on the next view', /class="merged"[^>]*>merged/.test(mergedPage.body));
  206. ch = newChanges();
  207. check('push into the target → merged #1 with mergeCommit', ch.length === 1 && ch[0].action === 'merged' && ch[0].number === 1 && ch[0].mergeCommit === mc, JSON.stringify(ch));
  208. push(W, 'pr-test', ['main']);
  209. check('merged is final: a second push changes nothing', newChanges().length === 0);
  210. // a new PR gets #3, never a reused number
  211. must(W, ['checkout', '-q', '-b', 'f3']); writeFileSync(join(W, 'f3.txt'), '3\n'); must(W, ['add', '.']); must(W, ['commit', '-q', '-m', '|||PR third']);
  212. const f3a = must(W, ['rev-parse', 'HEAD']);
  213. const t3 = push(W, 'pr-test', ['f3']);
  214. ch = newChanges();
  215. check('next PR is #3 (numbers are never reused)', ch.length === 1 && ch[0].action === 'opened' && ch[0].number === 3, JSON.stringify(ch));
  216. console.log(` (a push that opens a PR took ${t3.ms} ms)`);
  217. // old-prs: a live PR after the backfill is #3
  218. const O2 = join(WORK, 'o2'); must(WORK, ['clone', '-q', bare('old-prs'), O2]);
  219. must(O2, ['checkout', '-q', '-b', 'live', 'main']); writeFileSync(join(O2, 'l.txt'), 'l\n'); must(O2, ['add', '.']); must(O2, ['commit', '-q', '-m', '|||PR live']);
  220. push(O2, 'old-prs', ['live']);
  221. ch = newChanges();
  222. check('old-prs: a new PR after the backfill is #3 and opened', ch.length === 1 && ch[0].number === 3 && ch[0].action === 'opened', JSON.stringify(ch));
  223. // ---- the page: "#N" on every row, no refs/pull anywhere as a branch
  224. const pg = await raw('/pulls', HOST('pr-test'));
  225. check('/pulls shows #1 (merged) and #3 next to their titles (a closed PR is no longer found in git: not listed)', numOf(pg.body, 'first thing') === 1 && numOf(pg.body, 'third') === 3, `${numOf(pg.body, 'first thing')} ${numOf(pg.body, 'third')}`);
  226. const code = await raw('/code', HOST('pr-test'));
  227. const br = await raw('/branch/f1', HOST('pr-test'));
  228. check('no refs/pull in the code and branch pages', !/refs\/pull|pull\/\d+\/head/.test(code.body + br.body + pg.body));
  229. check('the branch list has no pull entries', !/>\s*pull\/|href="[^"]*\/branch\/pull/.test(code.body));
  230. check('git branch -a of the bare repo has no pull ref', !/pull/.test(must(bare('pr-test'), ['for-each-ref', '--format=%(refname)', 'refs/heads', 'refs/remotes'])));
  231. // ---- the contract's pull object + wasHeadOf (a second process on the same tables)
  232. const pr = spawnSync(BIN, ['tests/pulls-probe.hl', 'pr-test', '3', `1:${f1a}`, `1:${f1b}`, `1:${f1c}`, `1:${'0'.repeat(40)}`, `2:${f2a}`, `3:${f1a}`], { cwd: APP, env, encoding: 'utf8' });
  233. const pulls = (pr.stdout.match(/^PULL .*$/gm) || []).map(l => JSON.parse(l.slice(5)));
  234. const was = Object.fromEntries((pr.stdout.match(/^WAS .*$/gm) || []).map(l => { const p = l.split(' '); return [p[1], p[2]]; }));
  235. check('pullObject: 3 pulls and none for number 4', pulls.length === 4 && pulls[3] === null, pr.stdout + pr.stderr);
  236. const p1 = pulls[0] || {}, p3 = pulls[2] || {};
  237. check('pull #1 title/body/state', p1.number === 1 && p1.title === 'first thing' && /Body line one\./.test(p1.body) && p1.state === 'merged' && p1.draft === false, JSON.stringify(p1));
  238. check('pull #1 refs and shas', p1.source === 'f1' && p1.target === 'main' && p1.head === f1c && p1.ref === 'refs/pull/1/head' && p1.baseRef === 'refs/heads/main' && p1.base === mc && /^[0-9a-f]{40}$/.test(p1.mergeBase), JSON.stringify(p1));
  239. check('pull #1 author, url, times', p1.author && p1.author.name === 'Gate Pusher' && /^[0-9a-z]{12}$/.test(p1.author.id || '') && p1.url === `http://pr-test.gitoria.test:${PORT}/pulls/1` && /^\d{4}-\d\d-\d\dT/.test(p1.created) && /^\d{4}-\d\d-\d\dT/.test(p1.updated), JSON.stringify(p1));
  240. check('pull #1 tickets: explicit project#n only (repo not connected)', JSON.stringify(p1.tickets) === JSON.stringify(['other-proj#7']), JSON.stringify(p1.tickets));
  241. check('pull #3 open, source f3, head', p3.state === 'open' && p3.source === 'f3' && p3.head === f3a && p3.title === 'third', JSON.stringify(p3));
  242. check('wasHeadOf: every head #1 had is true', was[`1:${f1a}`] === 'true' && was[`1:${f1b}`] === 'true' && was[`1:${f1c}`] === 'true', JSON.stringify(was));
  243. check('wasHeadOf: a sha that never was one is false (also another PR\'s head)', was[`1:${'0'.repeat(40)}`] === 'false' && was[`3:${f1a}`] === 'false', JSON.stringify(was));
  244. check('wasHeadOf: #2 knows its head', was[`2:${f2a}`] === 'true', JSON.stringify(was));
  245. } catch (e) {
  246. check('gate ran to the end', false, String(e && e.stack || e));
  247. } finally {
  248. cleanup();
  249. }
  250. if (failures) console.log('--- server log (tail) ---\n' + slog.split('\n').slice(-40).join('\n'));
  251. console.log(`\n${passes} passed, ${failures} failed`);
  252. process.exit(failures ? 1 : 0);

Branches

Latest commits

  • fe209ffeMerge branch 'w56-owner-members' into mainGitoria
  • fa0754c8|||PR repository owner transfer and members API (#55)mre
  • 8862e537Merge branch 'w55-rename-org' into mainGitoria
  • 014d2b7fOne immutable readers snapshot per move for the left-organization event (#53)mre
  • 1859d506Decide who hears a repo left its organization by its readers before the move (#53)mre
  • 499f25f2Review fixes for the Settings organization move (#53)mre
  • ed3b922b|||PR move a repository into an organization in Settings (#53)mre
  • 74ec2af8Merge branch 'w54-repo-rename-pr' into mainGitoria
  • 9f7ce8d8Preserve rename compatibility and live page titlesmre
  • c3d95b6e|||PR separate names and addresses, rename repositories in Settings (#53)mre
  • ce08920dMerge branch 'w52c-header-phone' into mainGitoria
  • 0bab9e46|||PR header: ident status wraps on phones instead of clippingmre
  • e7af3eceMerge branch 'w52b-approval-followup' into mainGitoria
  • c01e66c6|||PR approvals follow-up: live Merge after status writes, helpers (#52)mre
  • 841da497Merge branch 'w53-pulls-speed-pr' into mainGitoria
  • 80307ae2|||PR pulls page cache: live PR numbers, complete scans onlymre
  • 69141f65|||PR pulls page: cache the git part per repo by branch tipsmre
  • 155861f6Merge branch 'w52-person-approval' into mainGitoria
  • b5435de8|||PR person approvals: second Kunibert round (#52)mre
  • 3a8b2fb8|||PR person approvals: Kunibert review fixes (#52)mre