tickets
All repositories: gitoria
7.0 KB
# 027 — Build: ticket delta + push subscriptions (tickets#51)TASK (his words, unchanged): "we will also change the information you get to a delta like we have in conductor-hub asvinzenz the conductors should get their ticket updates directly as a push from tickets via a similar subscriber as gitoriabuilds it now. you don't need to know every detail of all projects its enough if you keep the overview." ('you' = Apollo)and "do the tickets delta and push subscription first to get it away from you" and "implement it as you see fit i will askdetails tomorrow". Ticket: https://tickets.worldapi.org/tickets.worldapi.org/51 (do not write to it).## Read first- /media/STORAGE/projects/WorldAPI/worldapi-conductor/archive/2026-10-31/WORKER-RULES.md (all).- /media/STORAGE/projects/hybriel/docs/HL-PRIMER.md, /media/STORAGE/projects/hybriel/docs/CODE-ORDER.md; the plugin READMEsyou use (plugins/fetch, plugins/time, plugins/crypto). Copy a working shape from the docs and from lib/stream.hl /lib/connections.hl; DOCS line in the report.- The evaluation: /media/STORAGE/claude-scratch/tickets/P51/REPORT.md (facts about /api/events, stream rows, HC /api/wake,Apollo's subscriber). Its option C with a separate public receiver is NOT what is built (see design).- README "API", "Event stream for programs (ticket #26)", "Test"; lib/stream.hl, lib/tickets.hl, lib/api.hl, project.hl.- HyperConductor API: /media/STORAGE/projects/hyper-conductor/README.md "API" (POST /api/wake {project,text},POST /api/chats/<id>/messages {text}).## Design (NOT HIS: Apollo's direction 2026-11-01 + Tickets' simplification; Apollo decides changes)1. Subscription (new table): id, owner (tickets user id), projects (list of project ids, or all), wake target{instance, wakeProject} or {instance, chat}, cursor (= last delivered stream row id), wakePending flag, created.Created by POST /api/subscriptions with a tickets token: for yourself (owner = token user), or for another user ifyou are admin of EVERY listed project. "all projects" only for yourself. GET /api/subscriptions (own + those youadminister), POST /api/subscriptions/:id/remove. Instance must be a name from the server config (below). Baseline:cursor = current stream high-water at creation (no history flood).2. The delta is COMPUTED from the existing numbered stream rows (lib/stream.hl) after the cursor; no second journal:- only the subscription's projects; never events whose actor is the owner (stable user id, not display name);- merged per ticket: first → last state, created, title/summary edited, assignee old → new, N comments (+ the lastcomment's first 200 chars), links; one line per ticket;- relevance marks per line: assigned (to owner, now or before), own (owner created it), mention (owner's name/handlein a comment/summary text of this delta — document the exact rule);- JSON {subscription, from, upTo, tickets:[{project, number, ref, subject, href, changes:{…}, relevance:[…], actors,lastAt}], more} and a text rendering (Accept: text/markdown) capped at 4 KB: relevant tickets first, at the cap onesummary line "… and N more tickets in P1 (a), P2 (b)" (Vinzenz: summarise, never a second digest).- GET /api/subscriptions/:id/delta (owner's token only) returns it AND marks it delivered (cursor = upTo,wakePending = false), as Apollo ruled. `?peek=1` returns without marking.3. Wake: after each stream write (never blocking the write: async fetchStart), every matching subscription whosewakePending is false and that has a non-own matching event gets wakePending = true and ONE wake to its HC instance:POST <instance url>/api/wake {project: wakeProject, text} or POST …/api/chats/<chat>/messages {text}. The text iscontent-free and self-explanatory: "tickets: new changes for you. Read them: curl -s -A <you> -H 'Authorization:Bearer <your tickets token>' -H 'Accept: text/markdown' https://tickets.worldapi.org/api/subscriptions/<id>/delta".No further wakes until the subscriber fetches. Failed wake (non-2xx/timeout 10 s): retry after 1, 5, 30, 120 min,then mark failed (visible in GET /api/subscriptions); on server start re-wake every subscription with pendingundelivered changes. The standby swap must not double-send (document how).4. Instances in the server config (.env on byrodin, never in git, never logged): TICKETS_WAKE_<NAME>_URL andTICKETS_WAKE_<NAME>_TOKEN for loreana (http://100.77.141.84:8100), byrodin (http://127.0.0.1:45010), lisbeth(ask nothing: leave it unset if unknown). The container runs with network_mode host. The tokens: Apollo providesthem for the live .env (ask the conductor; never copy them from Apollo's files yourself).5. Unchanged: /api/events (fields, cursor, filters), the Markdown views, cookies, the connect flow. Additive only.No gitoria-style signed POST to outside apps in this build (later, shared with gitoria).## Tests (gates)- New tests/subscriptions.mjs against a local fake HC (records wakes): create/list/remove + rights (other user 403,non-admin for another user 403, unknown instance 400); baseline (no old events); own events never wake or show; onewake per pending episode, none until fetch, wake again after fetch + new event; merge per ticket (open → review → done= one line); relevance marks; 4 KB cap + summary line; peek does not mark; fake HC down → retries → failed, restartre-wakes; JSON + Markdown shapes. Each new check must fail on old code where meaningful (no route = fail).- Existing gates 0 failed: node tests/browser.mjs, tests/events.mjs (legacy stream unchanged), tests/security.mjs,tests/connect.mjs, node theme/check-theme.mjs . (2 day35 flakes were fixed in b7ca093).- README: new section "Subscriptions (ticket #51)" for conductors (how to subscribe, read, what a wake looks like).## Path to live and live proof- STOP after gates and REPORT; the conductor reviews the diff. Then on his word: deploy with/media/STORAGE/projects/WorldAPI/worldapi-conductor/deploy-init.sh tickets (backup on /media/STORAGE; rc=0, 0 FAILED,curl loop 0 × 5xx, push after rc=0, main = origin/main), the conductor puts the wake tokens into the live .env.- Live proof (test data only in the test project the conductor names, never in his projects): a subscription for oneparked conductor (Jukebox, loreana, wakeProject jukebox) on that test project; a ticket event there by another user →the parked chat wakes with the wake text (session_read shows it) → its delta fetch returns that ticket, marksdelivered, a second fetch is empty. Then remove the subscription.## Environment- Worktree + all files under /media/STORAGE/claude-scratch/tickets/S51/ (REPORT.md there). Branch s51-subscriptions from main.- Ports 8740–8759 (check ss first). Stop and list every process you started. No attribution lines in commits.- Model Sol (codex|gpt-6.1-sol), Sol at most 3 % of the Codex week (hard cap set by the conductor). Cap ~70 requests.## ReportCommits, design deviations (with reasons), gate numbers old vs new, test list, DOCS line, processes, open points.
Branches
Latest commits
- 1c10857bTickets conductor: P51 eval, brief 027mre
- e725969dTickets conductor: #51 directionmre
- 1b5c63ddTickets conductor: P51 startedmre
- 9f13fbdaTickets conductor: brief 026 prioritymre
- acc477d9Tickets conductor: brief 026 + Vinzenz recommendationsmre
- 9233a734Tickets conductor: brief 026 completemre
- 5da589fdTickets conductor: brief 026 + Gitoria's answermre
- a3cd5329Tickets conductor: tickets#51 opened, brief 026 draftmre
- 6f6e5797Tickets conductor: STATUS wordingmre
- 957de51fTickets conductor: T36 live, #36 review, #50 donemre
- bc2fde32Merge branch 'main' into t36-stylemre
- b7ca093atests: wait for the new row and normalize editor marker spacesmre
- 41da3525Tickets conductor: flake cause, T36 deploy stepmre
- 64c477e6Tickets conductor: deploy waits for Arachnemre
- 467d7286Tickets conductor: T36 done, deploy questionmre
- fed5ca81ticket_list: remove repeated selected-state coloursmre
- 8542fc8aTickets conductor: T36 proof reviewedmre
- 35980936inbox: preserve desktop columns after list styles were scopedmre
- 2a5b8b91Tickets conductor: T36 cap stop, resumed for proofmre
- c077a5cbstyles: format Style with nested language rulesmre