gitoria

tickets

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitb487b05ab487b05aRecord verified direct push protocol handoffmreb487b05a/reports/027-push-subscriptions-build.md

11.6 KB

  1. # S51 — direct HyperConductor chat pushes and ticket deltas
  2. The revised build is complete at the STOP point. Apollo's binding CHANGE 2026-11-01 replaces the original waker design. All required local gates pass. No deployment, push, live ticket write, message to another chat, or real HC delivery was performed. The conductor reviews before deployment; the parked-chat live proof waits for Hermes' endpoint.
  3. Worktree: `/media/STORAGE/claude-scratch/tickets/S51/wt`. Branch: `s51-subscriptions`, from main at `c5d28fb`. The main checkout's source was never edited.
  4. ## Final implementation
  5. Subscriptions store owner, projects (stable IDs or `all`), label, baseline cursor, wakePending/attempt status, created, pushUrl and an encrypted secret. Creation/list/removal rights are unchanged: own subscription, or admin of every listed project for another owner; `all` is self only. Delta is owner-only. Only tickets user bearer tokens authenticate these routes. Explicit scopes allow up to 100 project IDs. Public subscription responses use an explicit whitelist, including the creation response: no secret, ciphertext, nonce or internal signing body is returned.
  6. Deltas still compute from existing numbered stream rows and referenced history, with stable actor-ID self exclusion before per-ticket merging. JSON contains all coalesced tickets; Markdown orders relevance first and stays within 4096 UTF-8 bytes. Overflow uses project counts in the same delivered digest; if project names alone exceed 2000 bytes, the remaining names are grouped as `K other projects (N)`. Fetch marks the captured upTo snapshot delivered and clears wakePending; peek does not. No second journal, receipt, acknowledgement endpoint or extra digest was added. Existing stream omissions (comment edits/deletes/likes and member-removal unassignment) remain outside deltas. Mention matching is documented case-insensitive literal display-name substring matching in contributing comments/new summaries, including code/quotes and word substrings. Creation summary is reconstructed from the earliest edit's oldSummary if necessary.
  7. `lib/subscription-push.hl` validates the destination and seals/opens its secret. pushUrl must match a complete base from comma-separated TICKETS_PUSH_ALLOWED, followed by `/api/push/<chatId>` where chatId is nonempty digits/hyphens. Other origins, prefix lookalikes, userinfo, query/fragment and other paths are refused with 400. An omitted pushUrl allows delta-only use.
  8. Pushes go directly to HC, without any intermediary service or instance control token. The exact body is `{source:"tickets",delivery,text}`; text is the self-explanatory delta curl command and is capped at 500 characters. Headers are X-Push-Delivery and X-Push-Signature-256 (`sha256=<HMAC-SHA256(chat secret, raw body)>`). fetchStart never waits on network inside the ticket write. Redirects are disabled, timeout is 10 seconds. A 2xx or 409 marks the push sent, while the delta stays pending until fetch. Other responses, including 429, retry after 1, 5, 30, 120 minutes, then show failed. Retries/startup reuse the exact delivery ID and body. Main alone dispatches; docker-compose explicitly disables standby dispatch, and main reconciles standby-written numbered rows. The overlap test proves one main push for a standby write.
  9. Chat secrets are encrypted at rest with the documented AES-128-GCM plugin: fresh random 12-byte nonce, destination URL as authenticated data, and a 16-byte key derived by HKDF-SHA256 from private TICKETS_PUSH_KEY (minimum 32 characters; README recommends 32 random bytes rendered as 64 hex characters). Creation of push-enabled subscriptions fails if the storage key is absent. There is no plaintext fallback. The operator must keep/back up that key separately; loss/change prevents decryption and requires recreating affected subscriptions with their chat secrets. README documents configuration and cutover; no key or real secret was read or installed by this worker.
  10. All tools/waker files were removed in commit d662ad2; the final git tree contains no tools/waker directory. No Python service or installation dependency remains. The earlier service remains only in superseded commit history as explicitly permitted by the requested removal commit.
  11. ## Gates and old-code proof
  12. Evidence paths below are relative to the worktree.
  13. | Check | Passed | Failed | Evidence |
  14. | --- | ---: | ---: | --- |
  15. | Revised `node tests/subscriptions.mjs` | 51 | 0 | `.scratch/direct-subscriptions.log` |
  16. | Revised gate against previous waker build ff2e870 | 11 | 8 | `.scratch/direct-prior.log` |
  17. | Initial delta gate against original main | 0 | 8 | `.scratch/subscriptions-old.log` |
  18. | AES-GCM secrets fixture | 3 | 0 | `.scratch/direct-secrets.log` |
  19. | `node tests/browser.mjs` | 453 | 0 | `.scratch/direct-browser.log` |
  20. | `node tests/events.mjs` (full idle window) | 53 | 0 | `.scratch/direct-events.log` |
  21. | `node tests/security.mjs` | 309 | 0 | `.scratch/direct-security.log` |
  22. | `node tests/connect.mjs` | 60 | 0 | `.scratch/direct-connect.log` |
  23. | `node theme/check-theme.mjs .` | 62 files | 0 problems | `.scratch/direct-theme.log` |
  24. | Large project-overflow fixture (prior unchanged formatter) | 4009 bytes | 0 | `.scratch/cap.log` |
  25. The fake HC implements `/api/push/[0-9-]+`: constant-time signature verification, header/body delivery agreement, body/text validation, 202 acceptance, 409 duplicate delivery, and a 10-second per-chat rate limit with 429. A controlled fake clock advances that rate window. Tests cover the existing delta/rights/baseline/self-exclusion/relevance/merge/peek/drain/overflow behavior plus allowlist refusal, missing secrets, wrong/missing fake-HC signatures, exact direct-push fields, encrypted storage, no secret in creation/list/Markdown/logs, 409 success, 429 retry, restart same-delivery reuse, failed-after-five recovery, delta-only operation and standby ownership. Retry due times are accelerated only by the test helper after it records the actual production delays; production has no fast-retry switch.
  26. HMAC's known answer remains `sha256=f7bc83f430538424b13298e6aa6fb143ef4d59a14946175997479dbc2d1a3cd8` for key `key` and message `The quick brown fox jumps over the lazy dog`. The AES fixture proves fresh nonce/ciphertext for repeated plaintext, successful decryption and refusal after URL tampering.
  27. The revised gate fails on ff2e870 because that build rejects pushUrl/secret and cannot create the required subscription shape. It stops on the missing usable delta shape, so later dependent checks were not individually run on old code. The initial new-route proof on original main similarly fails because routes fall through to HTML. Legacy gates were not separately rerun on old main.
  28. A revision test initially stopped after 24 passes because it guessed subscriptions.db; MPackDB's actual data file is subscriptions.mpack. The corrected at-rest check reads that file. The earlier connect gate initially raced hydration; its existing fix waits for the client socket before changing the SSR form and remains 60/0. The sequential gate shell exited with signal 143 after events printed 53/0, before starting browser; browser was therefore run separately and exited 0 with 453/0. No source behavior was relaxed to pass a gate.
  29. ## Real Chrome proof
  30. The revised API lifecycle passed in lisbeth's existing Chrome under the lisbeth lock, using one own plain default-context tab and unique host s51.localhost. It created a push-enabled subscription without leaking secret/ciphertext, added bob's local test comment, produced a signature-valid fake-HC POST `/api/push/123` with matching delivery header/body, previewed/fetched the delta, verified an empty next fetch and removed the subscription. No real HC call was made. Evidence: `.scratch/direct-chrome-proof.json`, `.scratch/direct-chrome-proof.log`, `.scratch/direct-chrome-push.json`, `.scratch/direct-real-chrome.mjs`.
  31. All four screenshots were opened and inspected: `.scratch/direct-chrome-phone.png` (390×844), `direct-chrome-tablet-portrait.png` (800×1280), `direct-chrome-tablet-landscape.png` (1280×800), `direct-chrome-desktop.png` (1280×900). The unchanged test ticket and its comments remain readable without sideways clipping. No UI source changed.
  32. Before/after/third inventories are `.scratch/direct-chrome-before.json`, `.scratch/direct-chrome-after.json`, `.scratch/direct-chrome-final.json`. The proof tab closed. His pre-existing day36-sort tab was untouched; its owner closed it later. Final page list: `[{"id":"2B36106C7AF83C7D196B54C5C499429C","url":"about:blank"}]`. No session was signed out, cleared or changed.
  33. ## Processes, docs, resources and limits
  34. Ports 8740–8759 were checked before starting. Revision test server/standby/retry PIDs are recorded in `.scratch/direct-subscriptions.log`. Process inventories are `.scratch/direct-process-snapshot.json` and `.scratch/direct-browser-processes.json`. Real-proof server PID 2476258 and SSH PID 2476259 had already exited at the final numeric-PID/cwd check; fake HC PID 2476796 was explicitly stopped after verifying its cwd. Gates stopped their own servers/clients/Chromes. Final inventory contains no retained S51 process and final ss has no listener on 8740–8759. Earlier exited gate-child PIDs were not all captured individually. Supplied helpers used their default shared compile cache and temporary Chrome profiles; no shared cache was deleted.
  35. DOCS: the complete amended mission, WORKER-RULES/RULINGS, HL-PRIMER (imports/statics/hybrids/copies/references/events/Bytes), CODE-ORDER (map/thin wrappers/topic files), stream.hl and connections.hl working shapes, full P51 report, README API/Event stream/Test, tickets.hl/api.hl/project.hl, HC README API, fetch README/server.hl (fetchStart/completions/timeouts/redirects), time README/server.hl (now/every/tick), crypto README/server.hl (HMAC through hkdfExtract and AES-GCM key/nonce/Bytes calls), fs and native HTTP server docs were read. The earlier generic constant-time-comparator gap is irrelevant after removing the receiver; this build signs outgoing requests with documented Hybriel crypto. No application JavaScript workaround or subagent was used.
  36. The original build used approximately 60 model/tool turns; the binding protocol replacement required approximately 20–25 additional turns for implementation, old-code proof, crypto tests, all gate reruns and real Chrome verification. This exceeds the original approximate request target because the finished transport was explicitly replaced after handoff. Exact dollar spend is not exposed; no external paid API was used. Small commits/current reports preserved state throughout.
  37. Limits: no benchmark of very large production backlogs and no exhaustive cross-process cursor fault injection. One enabled main dispatcher per store is required. Delivered-on-GET retains the specified response-loss semantics without fetch receipts. Local tests prove the signed protocol against a fake HC, not Hermes' actual receiver or a parked live chat. These limits do not authorize deployment by this worker.
  38. ## Commits and handoff
  39. Initial checkpoints: fd23726, 8d8e205, 54bc5fe, ff2e870. Revision commits:
  40. - d662ad2 — Remove superseded waker service for direct chat push protocol.
  41. - a1ac5cd — Push subscription notices directly to signed HyperConductor chat endpoints.
  42. - 74e34cc — Verify encrypted push secrets and direct push retry semantics.
  43. - Final report/verification commit follows; its identifier is appended to the scratch report after commit.
  44. Review the final diff. After review, tickets may be deployed without configured push destinations while Hermes finishes the HC endpoint. Configure TICKETS_PUSH_ALLOWED/TICKETS_PUSH_KEY and create push-test subscriptions with per-chat secrets when ready, then perform the prescribed parked-chat live proof. STOP reached before deployment or any live write.

Branches

Latest commits

  • b487b05aRecord verified direct push protocol handoffmre
  • 74e34cc3Verify encrypted push secrets and direct push retry semanticsmre
  • a1ac5cd0Push subscription notices directly to signed HyperConductor chat endpointsmre
  • d662ad27Remove superseded waker service for direct chat push protocolmre
  • ff2e8701Finalize subscription build verification and handoff reportmre
  • 54bc5fe1Harden delta relevance, overflow caps and retry verificationmre
  • 8d8e2053Document subscription contract and exercise delta deliverymre
  • fd23726aAdd subscription delta API and signed wake bridgemre
  • c5d28fb5Tickets conductor: S51 startedmre
  • fd6ca1e6Tickets conductor: brief 027 waker design, push-test projectmre
  • e448e656Tickets conductor: STATUS #51mre
  • 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