tickets
All repositories: gitoria
4.2 KB
# Report 012 (w091): tickets#25 API part — a project by its id**Where:** one commit on main in loreana:/media/STORAGE/projects/tickets.worldapi.org (on top of 7538b03).Not pushed, not deployed. No `.env` read. Ports used: 8760–8764 and 8767–8769 (8765/8766 not touched). Every server Istarted was stopped by its PID; nothing of mine is still running (checked with `ss -ltn` and `ps … hl-browser-tier`).## What changed- **Every `/api/projects/<x>/…` route takes the slug OR the project's id** (all 16 routes: the project itself, members,members/remove, invites, connections, connections/remove, tickets, tickets/<n> and its comments / state / edit / assign /parent / blocked-by). GET and POST.- **The id format:** projects had no short id, so it is the existing record id: hl:mpackdb's `@id`, **12 characters`[0-9a-z]`** (time-based), e.g. `0mufbw18nsuj` = tickets.worldapi.org. Shown as `id` in `GET /api/projects` (`details`)and `GET /api/projects/<x>` (`project`). It stays the same when the slug changes (checked in the gate).- **Tickets stay under their project:** `/api/projects/<id or slug>/tickets/<n>`. **No new global `/api/tickets/<x>`.**The old `/api/tickets/<old number | ticket UUID>` is unchanged; `/api/tickets/<project id>` → 404 as before.- **How:** `lib/projects.hl slugOfRef` — a slug (also an old one) stays as it is; else a project id gives its CURRENT slug;else unchanged (names nothing → 404 as before). `lib/api.hl slugOf(route)` uses it in `byNumber` and in the 7 routefunctions that read `route.params.slug`. Everything after that runs as with the slug, so the id form answers byte forbyte what the slug form answers. A slug is tried first: it would win if a slug ever equalled another project's id.- **Not changed:** pages (`/<slug>`, `/projects/<slug>` … take slugs only), every existing API path and answer.## Tests| test | result ||---|---|| gate `tests/browser.mjs` (`.scratch/w091/gate.sh`) | **315 passed, 0 failed** (293 before + 22 new "ids (#25)") || control: the same gate on the OLD code (`.scratch/w091/old`) | 286 passed, **13 failed — exactly the id checks**, then it stops || `tests/connect.mjs` (`.scratch/w091/connect.sh`) | **60 passed, 0 failed**, twice. A first run stopped once at "#connecttitleinput" (the connect page's UI, not touched) — a flake || real-data copy, new `tests/projectids-realdata.py` (old :8763 vs new :8764) | **0 FAILED** (see below) || `tests/letcount.py` | never-reassigned `let` = 0 |**The new gate checks:**- 9 reads by id equal the slug form byte for byte: the project, its tickets (+ `?state=open`, `?state=bogus`, Markdown), ticket 1(JSON + Markdown), a missing ticket, the connections.- An unknown id → 404 on 4 routes.- `/api/tickets/<project id>` → 404.- Every write route by id:- a new project `delta`: POST tickets → 201 #1;- comments, state, edit, assign, parent, blocked-by → 201 each, and the slug form reads what they wrote;- the project POST, members, members/remove → 200;- invites with a bad role and connections/remove of an unknown key → 400 (the project's own checks, not 404);- POST to an unknown id → refused.- After a slug change, the id, the new slug and the old slug answer the same ticket.- The PWA count is now TOTAL + 1, because of the ticket made by id.**Real-data copy:** taken from Byrodin on 2026-10-04 around 05:00 and deleted after the run.- **Data:** 11 projects, 309 tickets.- **Old vs new code, 1,484 answers:** every API read as JSON and as Markdown, and the refusals. All byte-identical, including status and content type.- **On the new code, 772 slug-vs-id answers:** every project route, plus every ticket by id, as JSON and as Markdown. All identical.- **404s:** an unknown id, and `/api/tickets/<project id>` for all 11 projects.- **The ticket's own case:** `/api/projects/0mufbw18nsuj/tickets/25` returns the Markdown of tickets.worldapi.org #25. The old code returns 404 for `/api/projects/0mufbw18nsuj`.## Not done / open- **Not deployed:** deploying is the architect's job (`./deploy.sh`). There is no data change.- **Tools:** t.py, watch.py and the connected apps keep working unchanged. They can switch to ids whenever that is wanted.- **Scratch (gitignored) in `.scratch/w091/`:** `gate.sh`, `connect.sh`, the gate logs and the old tree.
Branches
Latest commits
- d083535bticket_list: nest Style rules and bare media queriesmre
- c24608ebmarkdown: format Style with nested language rulesmre
- de964b3bsettings: format Style with nested language rulesmre
- 03c1de05new_project: format Style with nested language rulesmre
- bd76cfa6connect: format Style with nested language rulesmre
- 01fad593inbox: format Style with nested language rulesmre
- 79dc9392you: format Style with nested language rulesmre
- 78073baamain: format Style with nested language rulesmre
- 5499c290Sync theme unchanged from layouts 17e0f03mre
- fd33ee21Sync reviewed components from 8176eb1mre
- 93348453Re-vendor tickets to Hybriel set day35mre
- a4123831tickets#42: the /connect and /login/callback error pages are app pages: the function routes redirect to /connect/failed/<code> and /login/failed/<code> (components/problem.hl, sentences in lib/problems.hl), htmlPage and its hand-written stylesheet are gone; gate tests/error-pages.mjsmre
- cefc7b4atickets: a startup error prints its message before exit 1 (hybriel#247)mre
- 99bd6570tickets: lib/migrate.hl writes no table of another topic any more: projects.hl rewriteSlug / addProjectNamed / hasMembers, tickets.hl moveToProject / ticketRecords / ticketRecordsOf, events.hl renameStates / eventRecords / eventRecordsOf; the migration calls them (tickets#47)mre
- b57161e3tickets: the markup names its own rules (Style.pMessage, Style.olTickets, ...) instead of hand-written class strings that copy a stylesheet rule; the shared bodies sit in lib/looks.hl (tickets#38)mre
- f767b24dtickets: 111 needless let became plain declarations (3 in ticket.hl, ticket_list.hl, comments.hl and 108 never-reassigned, not captured loop-body ones); the 212 really reassigned lets stay (tickets#44)mre
- 16c0d3b5tickets: the modal window is phone first: the full-screen sheet is the base rule, the centred window sits in the min-width 60rem block (tickets#39)mre
- 090ee809tickets: every component's styles in its own nested Style {} block; styles.hl keeps only the theme inherit, the accent and the site-wide rules (tickets#36)mre
- d395763ftickets: ident-access gate ports 8769/8768 (8797 is taken on loreana)mre
- afb9a403tickets: an ident access key (Authorization: Bearer idt_…) works in the API (ident#27 app side): lib/ident-access.hl copied from components, read keys GET only, ident down 503; gate tests/ident-access-tickets.mjsmre