Client-only hook die de SSE-stream van /api/realtime/solo opent en
voor de UI twee statussen exposed:
- status: 'connecting' | 'open' | 'disconnected'
- showConnectingIndicator: pas true als status !== 'open' >2s duurt
(ST-805 animatie B — voorkomt flikker bij microscopische
disconnects)
Lifecycle-gedrag:
- Reconnect met exponential backoff start 1s, plafond 30s, reset op
'ready'-event
- Page Visibility API: bij hidden sluit de hook de connectie en stopt
reconnect-pogingen; bij visible reopent direct
- onerror van EventSource wordt onderschept zodat we eigen backoff
kunnen voeren ipv de browser-default
- Volledige cleanup op unmount
Voert events naar useSoloStore.getState().handleRealtimeEvent — de
echte dispatch-logica met pendingOps en gedifferentieerde
apply{Task,Story}{Update,Create,Delete} landt in ST-804. Hier is dat
nog een stub zodat dit zelf-staand kan compileren.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Node.js-runtime route handler die een dedicated pg-Client opent op
DIRECT_URL en LISTEN't op het scrum4me_changes-kanaal. Per inkomende
NOTIFY-payload filtert het server-side op product (uit query-param),
sprint (active sprint van het product) en persoonlijke relevantie
(assignee_id == userId, of assignee_id IS NULL voor stories voor de
claim-lijst).
Auth via iron-session cookie:
- 401 als sessie ontbreekt
- 400 als product_id query-param ontbreekt
- 403 als de user geen toegang heeft tot het product
- demo-tokens mogen lezen (geen write-tools op deze route)
Stream-bouw:
- text/event-stream met juiste headers (no-cache, no-transform,
X-Accel-Buffering: no voor proxy-vrije buffering)
- ready-event bij connect met product_id en active sprint_id
- heartbeat (SSE-comment) elke 25s
- hard-close na 240s als safety-net onder Vercel maxDuration; client
herconnect via EventSource
- cleanup op request.signal abort (tab dicht / refresh)
Cleanup-pad sluit de pg-client en de stream-controller idempotent.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Add notify_task_change() and notify_story_change() PL/pgSQL functions
plus AFTER INSERT/UPDATE/DELETE triggers on tasks and stories. Each
write emits a JSONB payload on the 'scrum4me_changes' channel with
op, entity, id, product_id, sprint_id, assignee_id and (for UPDATE)
the list of changed columns. Tasks resolve product/sprint/assignee
via their parent story so the SSE handler can filter without an extra
DB roundtrip.
The migration is a side-effect-only change (no Prisma model/schema
diff) so the Prisma Client and TypeScript types are unaffected.
Verified locally with a node-pg LISTEN client: both task and story
mutations produce the expected payload within milliseconds.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Een herbruikbaar script dat één milestone (PBI + stories + tasks) uit
docs/scrum4me-backlog.md leest en idempotent toevoegt aan de DB,
zonder bestaande data of sprint-toewijzingen te raken.
npm run db:insert-milestone -- M8 # standaard SCRUM4ME
npm run db:insert-milestone -- M8 --product CODE # ander product
npm run db:insert-milestone -- M8 --dry-run # niets schrijven
Parser-uitbreiding (parse-backlog.ts):
- M7 en M8 toegevoegd aan priority/goal/sprint_status maps
- Onbekende milestones krijgen defaults (priority 4, sprint COMPLETED,
goal = header-titel) zodat M9..M∞ vanzelf werken
- Optionele { strict: false } skipt de "≥ 8 milestones / ≥ 60 stories"
asserts; de bestaande seed-flow behoudt strict: true (default)
Idempotency:
- Pbi upsert by (product_id, code = milestone.key)
- Story upsert by (product_id, code = ST-XXX)
- Tasks alleen aangemaakt als de story op dit moment 0 tasks heeft
Sprint-toewijzing wordt expliciet niet meegenomen — stories landen in
de backlog en moeten via Sprint Planning in een sprint geplaatst worden.
Geverifieerd: M8 inserted (PBI + 6 stories + 6 tasks), tweede run laat
zien "PBI reused, 0 created" — geen duplicaten.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Plan voor live updates in het Solo Paneel: Server-Sent Events op een
Node.js-runtime route die luistert naar Postgres NOTIFY's op tasks/
stories. Eén bron van waarheid (DB) — werkt onafhankelijk of een
mutatie van de web-UI, REST API of MCP-server komt.
Zes stories:
- ST-801 trigger-functie + triggers
- ST-802 SSE-route /api/realtime/solo
- ST-803 useSoloRealtime hook
- ST-804 solo-store realtime-acties
- ST-805 wire-up + UI-indicator
- ST-806 documentatie + acceptatie
Volledig plan in .Plans/2026-04-27-m8-realtime-solo.md (lokaal).
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Plan files written by Claude Code/agents during planning sessions
live in `.Plans/<descriptive-name>.md` at the repo root. They are
local scratch — never shared, never committed.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Update agent-facing docs to match the workflow that actually shipped
in ST-509/511/512/513 and M7 (scrum4me-mcp).
CLAUDE.md
- Spec-tabel: link toegevoegd naar de scrum4me-mcp repo
- Waar te beginnen: dual-track — Track A via mcp__scrum4me__implement_
next_story (aanbevolen), Track B is de bestaande manuele 7-stappen
loop voor Codex/zonder MCP
- Implementatiepatronen: rijen voor lib/task-status.ts mappers en
client/server module-boundary (bv. lib/code.ts vs lib/code-server.ts)
- Conventies: entity codes in commit-titles, lowercase API-status,
400/422 error-code split, verplichte test-pariteit bij contract-
wijziging
- Nieuwe sectie "MCP-integratie" — alle 9 tools + prompt +
schema-drift cron (trig_015FFUnxjz9WMuhhWNGBQKFD, ma 08:00 Amsterdam)
- Definition of Done expliciet als MVP; M7 is post-MVP
agent-instruction-audit.md
- Round 2 (2026-04-27) sectie met aanleiding, gecontroleerde
wijzigingen en nieuwe preventieve regels (test-pariteit,
status-enum boundary, error-code split, module-boundary)
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The MCP server for Claude Code shipped as a separate private repo,
madhura68/scrum4me-mcp. Document the milestone here so the backlog
stays the canonical source. All ten stories already complete and
covered by an e2e smoke-test against the live DB.
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(ST-511): add backlog entry for entity codes feature
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ST-511): add createWithCodeRetry helper to handle P2002 race on auto codes
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ST-511): retry on auto-code unique conflict in story and pbi create
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ST-511): surface field errors for code and title in PBI dialog
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ST-511): read create-state errors in Story dialog fieldError
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(ST-512): add backlog entry for REST API code/description/implementation_plan extensions; mark ST-511 done
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(ST-512): extend REST API with code, description and implementation_plan
- GET /api/products returns code, description and definition_of_done
- GET /api/products/:id/next-story returns story.code and per-task code + implementation_plan
- GET /api/sprints/:id/tasks returns description, implementation_plan, story_code and derived per-task code
- POST /api/todos accepts and returns optional description (max 2000)
All changes are additive — existing clients ignore unknown keys.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(ST-512): mark ST-512 as done
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(ST-513): add backlog entry for API hardening for Claude Code
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(ST-513): add task and story status mappers for API boundary
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(ST-513): expose lowercase status on API and accept lowercase in PATCH /api/tasks
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(ST-513): add metadata JSONB column to StoryLog
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(ST-513): accept optional metadata in story log and switch validation errors to 422
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(ST-513): add GET /api/health endpoint with optional db ping
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(ST-513): add GET /api/products/:id/claude-context bundled endpoint
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(ST-513): add docs/API.md and link from CLAUDE.md specs table
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* docs(ST-513): mark ST-513 as done
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* fix(ST-513): split 400 (malformed JSON) from 422 (validation), reject 'review'
Codex review on PR #2:
- P2.1: routes treated JSON parse failures as 422 instead of 400, breaking
the contract in docs/API.md. Replace `request.json().catch(() => null)`
with try/catch in 4 routes (tasks, reorder, todos, story-log) so a
malformed body returns 400 and only well-formed-but-invalid bodies
return 422.
- P2.2: PATCH /api/tasks/:id accepted `status: "review"`, but the sprint
task list UI does not render REVIEW (no label/color, the cycle helper
falls back to TO_DO). Reject `review` at the API until the sprint UI
is extended; document the subset in docs/API.md.
Tests in __tests__/api updated for the new contract (29 assertions:
zod-failures now expect 422, status payloads use lowercase API values,
sprint-tasks mocks include the new story relation).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Add REVIEW to TaskStatus enum
- Fix stores list: remove phantom files, add solo-store and product-store
- Fix SelectionStore method names (selectPbi/selectStory)
- Add solo board route and product layout to file tree
- Mark sprint/planning as redirect, not a full page
- Update Zustand store count from 3 to 5
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Three-section layout (flex-1 left, center, flex-1 right) keeps
the product name truly centered regardless of sidebar content.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Sub-layout sets product in Zustand store; NavBar reads it.
getAccessibleProduct wrapped with React cache to avoid double DB call.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Cookies can only be written in Server Actions or Route Handlers.
Moved the write to proxy.ts where NextResponse.cookies.set is allowed.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaced owner-only query (user_id = session.userId) with
getAccessibleProduct which also accepts product members.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All M0–M6 implementation tasks are done. Build passes, all 7 API
route handlers verified present, accessibility fixes applied.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>