gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commiteb7aeeb9eb7aeeb9mission brief 016mreeb7aeeb9/tests/connect.mjs

19.8 KB

  1. // tests/connect.mjs — THE CONNECT GATE (ticket #21): an app (gitoria) is connected to ONE project. A small ident STUB (only POST /api/exchange: one-time code → short ident id, like ident#23) and its own tickets server on a fresh store; alice (admin of her projects), bob (a member)
  2. // and carol (logged in, no role) log in; then over HTTP: the request refusals (return address), the one-time code, the
  3. // exchange, the key's reach (its project only; create / comment / state; roles apply to the NAMED person; no
  4. // settings / members / other project / relations), the disconnect; and in a real headless Chrome: the connect page
  5. // (log-in hint, project choice, a new project, confirm, the link back), the project page's line and its Disconnect.
  6. // Ports: TICKETS_CONNECT_PORT (8700), TICKETS_CONNECT_IDENT_PORT (8701), the app's URL TICKETS_CONNECT_APP_PORT (8702, nothing
  7. // listens), Chrome debug TICKETS_CONNECT_CHROME (8703-8709). TICKETS_COLD_MS: how long a cold start may take (120 s, hybriel#148).
  8. // node tests/connect.mjs
  9. import { spawn } from 'node:child_process';
  10. import { rmSync, mkdirSync, existsSync } from 'node:fs';
  11. import { dirname, join, resolve } from 'node:path';
  12. import { fileURLToPath } from 'node:url';
  13. import { launchBrowser } from './cdp.mjs';
  14. import http from 'node:http';
  15. if (!process.env.HL_CHROME && existsSync('/opt/google/chrome/chrome')) process.env.HL_CHROME = '/opt/google/chrome/chrome';
  16. const HERE = dirname(fileURLToPath(import.meta.url));
  17. const APP = resolve(HERE, '..');
  18. const BIN = join(APP, 'bin/hybriel');
  19. const PORT = Number(process.env.TICKETS_CONNECT_PORT || 8700);
  20. const IDENT_PORT = Number(process.env.TICKETS_CONNECT_IDENT_PORT || 8701);
  21. const BASE = `http://127.0.0.1:${PORT}`;
  22. const APP_PORT = Number(process.env.TICKETS_CONNECT_APP_PORT || 8702);
  23. const GITORIA = `http://127.0.0.1:${APP_PORT}`; // the "app": only its URL is used (listed in TICKETS_CONNECT_ORIGINS)
  24. const WORK = join(APP, '.scratch/connect-gate');
  25. const STORE = join(WORK, 'store');
  26. const J = JSON.stringify;
  27. const sleep = (ms) => new Promise(r => setTimeout(r, ms));
  28. const COLD_MS = Number(process.env.TICKETS_COLD_MS || 120000);
  29. rmSync(WORK, { recursive: true, force: true });
  30. mkdirSync(join(STORE, 'mpackdb'), { recursive: true });
  31. let passes = 0, failures = 0;
  32. const check = (label, ok, detail = '') => { console.log(`${ok ? 'ok ' : 'FAIL'} ${label}${ok ? '' : ' — ' + detail}`); if (ok) passes++; else failures++; };
  33. let log = '', server = null, ident = null, browser = null;
  34. async function main() {
  35. // the ident stub: a one-time code → the identity it was minted for (5-character ids, as ident#23)
  36. const codes = new Map();
  37. let codeN = 0;
  38. const mint = (identity) => { const c = (++codeN).toString(16).padStart(8, '0').repeat(3); codes.set(c, identity); return c; };
  39. ident = http.createServer((req, res) => {
  40. let body = ''; req.on('data', d => body += d);
  41. req.on('end', () => {
  42. if (req.url === '/api/exchange' && req.method === 'POST') {
  43. const b = JSON.parse(body || '{}'); const id = codes.get(b.code); codes.delete(b.code);
  44. res.writeHead(id && b.secret === 'sk_stub' ? 200 : 400, { 'content-type': 'application/json' });
  45. return res.end(J(id ? { identity: id } : { error: 'unknown code' }));
  46. }
  47. res.writeHead(404); res.end('');
  48. });
  49. });
  50. await new Promise(ok => ident.listen(IDENT_PORT, '127.0.0.1', ok));
  51. ident.base = `http://127.0.0.1:${IDENT_PORT}`;
  52. ident.stop = () => new Promise(ok => ident.close(ok));
  53. const app = { key: 'pk_stub', secret: 'sk_stub' };
  54. const alice0 = { id: 'a2b3c' }, bob0 = { id: 'b4c5d' }, carol0 = { id: 'c6d7e' };
  55. server = spawn(BIN, ['project.hl'], { cwd: APP, stdio: ['ignore', 'pipe', 'pipe'], env: { ...process.env, TICKETS_PORT: String(PORT), TICKETS_STORAGE: join(STORE, 'mpackdb'), TICKETS_SESSIONS: join(STORE, 'sessions'),
  56. IDENT_URL: ident.base, IDENT_EXCHANGE_URL: ident.base, TICKETS_PUBLIC_URL: BASE, IDENT_API_KEY: app.key, IDENT_API_SECRET: app.secret, TICKETS_CREATOR_IDENTITY: '', TICKETS_WATCH: '0', HL_HOST: '127.0.0.1', TICKETS_CONNECT_ORIGINS: GITORIA } });
  57. server.stdout.on('data', d => log += d); server.stderr.on('data', d => log += d);
  58. for (const end = Date.now() + COLD_MS; Date.now() < end;) { try { if ((await fetch(BASE + '/')).ok) break; } catch {} await sleep(250); }
  59. let emitI = 0;
  60. const temit = async (event, payload, cookie) => {
  61. const r = await fetch(BASE + '/__hl/emit', { method: 'POST', headers: { 'content-type': 'application/json', ...(cookie ? { cookie } : {}) }, body: J({ t: 'emit', i: ++emitI, event, payload }) });
  62. const raw = await r.text(); let j = null; try { j = JSON.parse(raw); } catch {}
  63. return j ? j.value : undefined;
  64. };
  65. const call = async (method, path, body, headers = {}) => {
  66. const r = await fetch(BASE + path, { method, headers: { ...(body ? { 'content-type': 'application/json' } : {}), ...headers }, body: body ? J(body) : undefined, redirect: 'manual' });
  67. let json = null; const t = await r.text(); try { json = JSON.parse(t); } catch {}
  68. return { status: r.status, json, text: t, headers: r.headers };
  69. };
  70. const login = async (who, name) => {
  71. const code = mint(who.id);
  72. const identity = who.id;
  73. const r = await fetch(BASE + '/login/callback?ident_code=' + code, { redirect: 'manual' });
  74. const cookie = (r.headers.get('set-cookie') || '').split(';')[0];
  75. if (name) await temit('saveDisplayName', [name], cookie);
  76. return { cookie, identity };
  77. };
  78. const alice = await login(alice0, 'alice'), bob = await login(bob0, 'bob'), carol = await login(carol0, 'carol');
  79. const tok = async (u) => (await temit('tokenCreate', ['gate'], u.cookie)).token;
  80. alice.token = await tok(alice); bob.token = await tok(bob);
  81. const auth = (t, extra = {}) => ({ authorization: 'Bearer ' + t, ...extra });
  82. // ---- projects: alice admins "gitoria-tickets" and "other"; bob is a member (edit) of gitoria-tickets, carol nothing
  83. let r = await call('POST', '/api/projects', { title: 'Gitoria tickets', slug: 'gt' }, auth(alice.token));
  84. check('setup: alice opens project gt', r.status === 201, J(r.json));
  85. r = await call('POST', '/api/projects', { title: 'Other', slug: 'other' }, auth(alice.token));
  86. check('setup: alice opens project other', r.status === 201, J(r.json));
  87. r = await call('POST', '/api/projects/gt/members', { user: bob.identity, role: 'edit' }, auth(alice.token));
  88. check('setup: bob is edit in gt', r.status === 200, J(r.json));
  89. const bobUse = await call('POST', '/api/projects', { title: 'Bobs', slug: 'bobs' }, auth(bob.token));
  90. await call('POST', '/api/projects/bobs/members', { user: alice.identity, role: 'use' }, auth(bob.token));
  91. // ---- the request
  92. const good = `/connect?app=gitoria&label=${encodeURIComponent('anton/repo')}&return=${encodeURIComponent(GITORIA + '/connect/back')}&state=abc123`;
  93. r = await call('GET', good);
  94. const nonce = (r.headers.get('location') || '').replace('/connect/', '');
  95. check('request: a valid request redirects to /connect/<nonce>', r.status === 302 && /^[0-9a-f]{32}$/.test(nonce), r.status + ' ' + r.headers.get('location'));
  96. for (const [what, q] of [
  97. ['a return address on another host', `app=x&return=${encodeURIComponent('https://evil.example.com/x')}`],
  98. ['a worldapi.org lookalike', `app=x&return=${encodeURIComponent('https://worldapi.org.evil.com/x')}`],
  99. ['userinfo in the return address', `app=x&return=${encodeURIComponent('https://[email protected]/x')}`],
  100. ['http on worldapi.org', `app=x&return=${encodeURIComponent('http://gitoria.worldapi.org/x')}`],
  101. ['no return address', 'app=x'],
  102. ['no app name', `return=${encodeURIComponent('https://gitoria.worldapi.org/x')}`],
  103. ]) { r = await call('GET', '/connect?' + q); check('request refused: ' + what, r.status === 400 && !r.headers.get('location'), r.status + ' ' + r.text.slice(0, 200)); }
  104. r = await call('GET', `/connect?app=x&return=${encodeURIComponent('https://gitoria.worldapi.org/back?x=1')}`);
  105. check('request: a subdomain of worldapi.org is allowed', r.status === 302, String(r.status));
  106. // ---- the confirmation (face): only a named user, only an admin project, once
  107. const page = await call('GET', '/connect/' + nonce);
  108. check('page: the connect page names the app, its label and its host', page.status === 200 && page.text.includes('gitoria') && page.text.includes('anton/repo') && page.text.includes('127.0.0.1:' + APP_PORT), page.text.slice(0, 200));
  109. check('page: an unknown request says used up or expired', (await call('GET', '/connect/' + '0'.repeat(32))).text.includes('used up or expired'));
  110. let v = await temit('connectConfirm', [nonce, '', 'x'], null);
  111. check('confirm: signed out → refused', v && v.error, J(v));
  112. const gtId = (await call('GET', '/api/projects/gt')).json.project.id;
  113. const otherId = (await call('GET', '/api/projects/other')).json.project.id;
  114. v = await temit('connectConfirm', [nonce, gtId, ''], carol.cookie);
  115. check('confirm: carol (no role in gt) → refused, request still open', v && v.error && v.error.includes('only an admin'), J(v));
  116. v = await temit('connectConfirm', [nonce, gtId, ''], bob.cookie);
  117. check('confirm: bob (edit, not admin) → refused', v && v.error && v.error.includes('only an admin'), J(v));
  118. v = await temit('connectConfirm', [nonce, gtId, ''], alice.cookie);
  119. check('confirm: alice (admin) → a link back with a one-time code and the state', v && v.url && v.url.startsWith(GITORIA + '/connect/back?code=') && v.url.endsWith('&state=abc123'), J(v));
  120. const code = v.url.match(/code=([0-9a-f]+)/)[1];
  121. v = await temit('connectConfirm', [nonce, gtId, ''], alice.cookie);
  122. check('confirm: the same request twice → refused', v && v.error && v.error.includes('used up'), J(v));
  123. // ---- the exchange
  124. r = await call('POST', '/api/connect/exchange', { code: 'ab'.repeat(24) });
  125. check('exchange: a wrong code → 400', r.status === 400, r.status + ' ' + r.text);
  126. r = await call('POST', '/api/connect/exchange', { code });
  127. const key = r.json && r.json.key;
  128. check('exchange: the code gives a key for gt (shown once)', r.status === 200 && /^tktc_[0-9a-f]{48}$/.test(key) && r.json.project === 'gt', r.status + ' ' + r.text);
  129. r = await call('POST', '/api/connect/exchange', { code });
  130. check('exchange: the code works once only', r.status === 400, r.status + ' ' + r.text);
  131. check('exchange: the key is not stored in clear', !(await call('GET', '/api/projects/gt/connections')).text.includes(key));
  132. // ---- the key's reach
  133. const named = (who) => auth(key, { 'x-tickets-identity': who.identity });
  134. r = await call('POST', '/api/projects/gt/tickets', { subject: 'from the app' }, named(bob));
  135. check('key: creates a ticket as the named person (bob, role edit)', r.status === 201 && r.json.ticket.subject === 'from the app', r.status + ' ' + r.text);
  136. const num = r.json && r.json.ticket && r.json.ticket.number;
  137. r = await call('GET', '/api/projects/gt/tickets/' + num);
  138. check('key: the ticket is created BY bob (event author, same ident id)', r.json.events[0].author === 'bob' && r.json.events[0].userId !== '', J(r.json.events && r.json.events[0]));
  139. r = await call('POST', '/api/tickets', { project: 'gt', subject: 'via the global route' }, named(alice));
  140. check('key: POST /api/tickets with project gt works too (alice)', r.status === 201, r.status + ' ' + r.text);
  141. r = await call('POST', `/api/projects/gt/tickets/${num}/comments`, { text: 'mentioned in PR #7' }, named(bob));
  142. check('key: posts a comment "mentioned in PR" as bob', r.status === 201 && r.json.event.author === 'bob', r.status + ' ' + r.text);
  143. r = await call('POST', `/api/projects/gt/tickets/${num}/state`, { state: 'review', text: 'fixed by commit abc' }, named(bob));
  144. check('key: changes the state (fixed by commit → review)', r.status === 201 && r.json.ticket.state === 'review', r.status + ' ' + r.text);
  145. r = await call('POST', '/api/projects/gt/tickets', { subject: 'no person' }, auth(key));
  146. check('key: without X-Tickets-Identity → 403 naming the header', r.status === 403 && r.text.includes('X-Tickets-Identity'), r.status + ' ' + r.text);
  147. r = await call('POST', '/api/projects/gt/tickets', { subject: 'carol' }, named(carol));
  148. check('key: a person with no role in the project → 403 (roles apply)', r.status === 403, r.status + ' ' + r.text);
  149. r = await call('POST', '/api/projects/gt/tickets', { subject: 'nobody' }, auth(key, { 'x-tickets-identity': 'zzzzz' }));
  150. check('key: an identity that never logged in → 403', r.status === 403, r.status + ' ' + r.text);
  151. r = await call('POST', '/api/projects/other/tickets', { subject: 'wrong project' }, named(alice));
  152. check('key: another project → 403', r.status === 403 && r.text.includes('another project'), r.status + ' ' + r.text);
  153. r = await call('POST', '/api/tickets', { project: 'other', subject: 'wrong project' }, named(alice));
  154. check('key: POST /api/tickets naming another project → 403', r.status === 403, r.status + ' ' + r.text);
  155. const oth = (await call('POST', '/api/projects/other/tickets', { subject: 'in other' }, auth(alice.token))).json.ticket.number;
  156. r = await call('POST', `/api/projects/other/tickets/${oth}/comments`, { text: 'token still works' }, auth(alice.token));
  157. check('token: a user token still comments and changes state as before', r.status === 201 && (await call('POST', `/api/projects/other/tickets/${oth}/state`, { state: 'progress' }, auth(alice.token))).status === 201, r.status + ' ' + r.text);
  158. r = await call('POST', `/api/projects/other/tickets/${oth}/comments`, { text: 'x' }, named(alice));
  159. check('key: a comment on a ticket of another project → 403', r.status === 403, r.status + ' ' + r.text);
  160. r = await call('POST', `/api/tickets/${(await call('GET', '/api/projects/other/tickets/' + oth)).json.ticket.id}/state`, { state: 'review' }, named(alice));
  161. check('key: a state change by ticket id in another project → 403', r.status === 403, r.status + ' ' + r.text);
  162. for (const [what, m, p, b] of [
  163. ['project settings', 'POST', '/api/projects/gt', { title: 'hacked' }],
  164. ['members', 'POST', '/api/projects/gt/members', { user: carol.identity, role: 'admin' }],
  165. ['invites', 'POST', '/api/projects/gt/invites', { role: 'use' }],
  166. ['a new project', 'POST', '/api/projects', { title: 'nope' }],
  167. ['editing a ticket', 'POST', `/api/projects/gt/tickets/${num}/edit`, { subject: 'x' }],
  168. ['assigning', 'POST', `/api/projects/gt/tickets/${num}/assign`, { assignee: 'bob' }],
  169. ['the parent link', 'POST', `/api/projects/gt/tickets/${num}/parent`, { parent: '' }],
  170. ['disconnecting', 'POST', '/api/projects/gt/connections/remove', { id: 'x' }],
  171. ['the inbox', 'GET', '/api/inbox', null],
  172. ]) { r = await call(m, p, b, named(alice)); check('key cannot use: ' + what, r.status === 401, r.status + ' ' + r.text.slice(0, 120)); }
  173. check('key: the project settings did not change', (await call('GET', '/api/projects/gt')).json.project.title === 'Gitoria tickets');
  174. r = await call('POST', '/api/projects/gt/tickets', { subject: 'bad key' }, auth('tktc_' + '0'.repeat(48), { 'x-tickets-identity': alice.identity }));
  175. check('key: a wrong key → 401', r.status === 401, String(r.status));
  176. r = await call('GET', '/api/projects/gt/connections');
  177. check('list: gt shows the connection "gitoria: anton/repo" (public)', r.json.connections.length === 1 && r.json.connections[0].text === 'gitoria: anton/repo' && r.json.connections[0].by === 'alice', J(r.json));
  178. check('list: the project other shows none', (await call('GET', '/api/projects/other/connections')).json.connections.length === 0);
  179. // ---- disconnect through the API: only an admin; the key dies at once
  180. const cid = r.json.connections[0].id;
  181. r = await call('POST', '/api/projects/gt/connections/remove', { id: cid }, auth(bob.token));
  182. check('disconnect: bob (edit) → 403', r.status === 403, r.status + ' ' + r.text);
  183. r = await call('POST', '/api/projects/gt/connections/remove', { id: cid }, auth(alice.token));
  184. check('disconnect: alice (admin) → connection gone', r.status === 200 && r.json.connections.length === 0, r.status + ' ' + r.text);
  185. r = await call('POST', '/api/projects/gt/tickets', { subject: 'after' }, named(alice));
  186. check('disconnect: the key is dead at once → 401', r.status === 401, String(r.status));
  187. // ---- the browser: log in, connect a new project, see it on the project page, disconnect
  188. browser = await launchBrowser({ debugPortRange: (process.env.TICKETS_CONNECT_CHROME || '8703-8709').split('-').map(Number) });
  189. const p = await browser.newPage();
  190. const nonce2 = ((await call('GET', good.replace('abc123', 'st2'))).headers.get('location') || '').replace('/connect/', '');
  191. await p.goto(BASE + '/connect/' + nonce2);
  192. await p.waitForSelector('#connecttitle');
  193. check('browser: signed out → the login hint, no form', (await p.evaluate('!!document.querySelector("#loginhint") && !document.querySelector("#connectform")')));
  194. const cookieName = alice.cookie.split('=')[0];
  195. await p.send('Network.setCookie', { name: cookieName, value: alice.cookie.slice(cookieName.length + 1), url: BASE });
  196. await p.goto(BASE + '/connect/' + nonce2);
  197. await p.waitForSelector('#connectform');
  198. check('browser: alice logged in → the project choice lists her admin projects and "A new project"',
  199. J(await p.evaluate('Array.from(document.querySelectorAll("#connectproject option")).map(o => o.textContent.trim())')) === J(['Gitoria tickets', 'Other', 'A new project']));
  200. check('browser: it says which app and host asks', (await p.evaluate('document.querySelector("#connectwho").textContent')).includes('anton/repo'));
  201. await p.evaluate('(() => { const s = document.querySelector("#connectproject"); s.value = ""; s.dispatchEvent(new Event("change", { bubbles: true })); })()');
  202. await p.waitForSelector('#connecttitleinput');
  203. await p.type('#connecttitleinput', 'Repo tickets');
  204. await p.click('#connectconfirm');
  205. await p.waitForSelector('#connectcontinue');
  206. const back = await p.evaluate('document.querySelector("#connectcontinue").href');
  207. check('browser: after confirming, the page links back to the app with code and state', back.startsWith(GITORIA + '/connect/back?code=') && back.endsWith('&state=st2'), back);
  208. r = await call('POST', '/api/connect/exchange', { code: back.match(/code=([0-9a-f]+)/)[1] });
  209. const key2 = r.json.key;
  210. check('browser: the exchange gives a key for the NEW project', r.status === 200 && r.json.project === 'repo-tickets', r.status + ' ' + r.text);
  211. await p.goto(BASE + '/repo-tickets');
  212. await p.waitForSelector('#connections');
  213. check('browser: the project page shows "Connected to gitoria: anton/repo" and an admin sees Disconnect',
  214. (await p.evaluate('document.querySelector("#connections").textContent')).includes('Connected to gitoria: anton/repo') && await p.evaluate('!!document.querySelector("#connections .disconnect")'));
  215. await p.click('#connections .disconnect');
  216. await p.waitFor('!document.querySelector("#connections")', { label: 'connection line gone' });
  217. r = await call('POST', '/api/projects/repo-tickets/tickets', { subject: 'x' }, auth(key2, { 'x-tickets-identity': alice.identity }));
  218. check('browser: after Disconnect the key is dead (401)', r.status === 401, String(r.status));
  219. // a reader (not logged in) sees the line but no button
  220. r = await call('POST', '/api/projects/gt/connections/remove', { id: 'x' }, auth(alice.token));
  221. const p2 = await browser.newPage();
  222. await p2.goto(BASE + '/other');
  223. await p2.waitForSelector('#heading');
  224. check('browser: a project without a connection shows no line', await p2.evaluate('!document.querySelector("#connections")'));
  225. check('server log: no absorbed errors from the connect code', !/error absorbed/.test(log), log.split('\n').filter(l => /error absorbed/.test(l)).slice(0, 3).join(' | '));
  226. }
  227. try { await main(); } catch (e) { failures++; console.log('FAIL gate crashed — ' + (e && e.stack || e)); console.log(log.slice(-2500)); }
  228. finally {
  229. try { if (browser) await browser.close(); } catch {}
  230. try { if (server) server.kill('SIGTERM'); } catch {}
  231. try { if (ident) await ident.stop(); } catch {}
  232. console.log(`\n${passes} passed, ${failures} failed`);
  233. process.exit(failures ? 1 : 0);
  234. }

Branches

Latest commits

  • eb7aeeb9mission brief 016mre
  • e4c34759paths: projects moved into /media/STORAGE/projects/WorldAPI/mre
  • 26efb23freport w6-events (events test)mre
  • c6bfab04mission 015: re-vendor Hybriel 0f396652 (static build), reportmre
  • b7ec5981mission brief 015mre
  • 5dc68731docker-compose: init: true (hybriel#156, PID 1 ignored SIGTERM, every restart waited 10 s)mre
  • 8a460b16mission 014: Apollo's 'stream opened right after the start gets no live events' is not a tickets bug — events.mjs checks early streamsmre
  • 6309ca81mission brief 014mre
  • c1161469mission 013: GitHub pipe tables on ticket pages (lib/markdown.hl + View + CSS) and re-vendor hybriel master a832f73bmre
  • a30b5d12mission brief (w13)mre
  • b50a6f93w9 (tickets): re-vendor hybriel 9f912f3b (#146 emit in a lib static, #147) — the 12 live-push emits in lib/api.hl compile as they are; cold start (#148): tests wait TICKETS_COLD_MS for every start, deploy.sh gates browser + events and waits up to 120 s for the URL, container /tmp tmpfs + hybriel-cache volume; events-client stops at EVENTS_MAX inside a chunk; connect.mjs ports by env. bin/hybriel sha256 7421907868ac07d8a7d08296b083c6f8b20407d0e099ce4bebbf7ae053d9060a. Gates (8720–8739): browser 315/0 (+ all-cold 315/0), events 48/0 cold, connect 60/0, short-id 19/0; real-data copy old 0e8a41c vs new: 2,425 reads + 72 writes identical after masking ?v hashes, offline at, route order; event stream on the copy delivers. Not deployed.mre
  • 43be6578w9: re-vendor hybriel master edfd400a; event stream imports sseStart/sseSend/sseAlive from hl:http1 (hybriel#144), useTransport gone; tools/import.hl plain declarations. BLOCKED: hybriel-native refuses `emit client` in a static (lib/api.hl) — the server does not compile on edfd400a, gates fail at start; scratch copy without those emits: events 48/0, gate 254 ok up to the first live pushmre
  • 0e8a41caw6 (ticket #26): event stream for programs — GET /api/events (Server-Sent Events)mre
  • bb64d57cmission 012 (ticket #25 API part): every /api/projects/<x>/… route takes the project's id (12-char record id) as well as its slug, same answers byte for byte; tickets stay under their project, no global /api/tickets/<x>. gate 315/0 (old code: the 13 id checks fail), connect 60/0, live-data copy old vs new 1,484 identical, slug vs id 772 identicalmre
  • 7538b034mission 011 (ticket #25 web part): short page URLs /<slug> and /<slug>/<number>; /projects/<slug>, /projects/<slug>/<n>, /projects/<slug>/tickets/<n> and /tickets/<ref> answer 301 (current slug); slug pages moved behind hl:web's own routes after construction (they answered /__hl/* and /components/*.hl); reserved slugs refused; API paths unchanged. gate 293/0, connect 60/0, live-data copy 187/0, API old vs new: only page links differmre
  • 0369106emission 010 (code order) 4/4: README file map + import order + 'Same output' test, STATUS (entry, lessons, how to verify), LOG, report; tests/realdata-baseline.mjs + realdata-compare*.py (a cleanup answers the same on live data), tests/letcount.pymre
  • a75e0279mission 010 (code order) 3/4: let only where a variable is reassigned or re-bound in a loop body (456 lets → plain declarations; Hybriel refuses a plain declaration inside a loop on its 2nd pass). gate 249/0, connect 60/0, real-data reads identical, a 50-step write sequence (API + faces) identical to the old codemre
  • e9d5c618mission 010 (code order) 2/4: one lib/ file per topic — store.hl split into projects / tickets (+ relations) / events / tickets-helpers, util.hl shared helpers (env, storage dir, URLs, sorts, Vienna time), the function routes out of project.hl into lib/api.hl (thin; auth/filters/Accept in api-helpers.hl), invite + member-removal logic out of the faces/routes into invites.hl / tickets.hl; project.hl is the map. /login/callback gets req + the session store by reference. gate 249/0, connect 60/0, real-data reads identicalmre
  • 97e269b5mission 010 (code order) 1/4: .hl files out of the root — lib/ (store, users, connections, invites, migrate, markdown, mdview, import = ticketfile, util = localtime, jsoncheck, api-helpers = api), tools/import.hl, components/styles.hl; import paths only. gate 249/0, connect 60/0, real-data reads identicalmre
  • 38f9d10ftickets: Hybriel master 06617221 (plugin allocators 3a781359 + 413f60e4, mpackdb 2cb7ae5e, http1 773de63e); gate 249/0, connect 60/0mre