docs: mark C2 done and document the pi-web kill trap
Records the corrected app start procedure so a future session does not kill its own host process when the app looks stuck.
This commit is contained in:
+39
-1
@@ -297,4 +297,42 @@ Build log for Media Team Hub. One unit per commit, top to bottom. Append after e
|
||||
- **Composer endpoint returns a preview, writes nothing.** `POST /api/dev/skills/compose` returns `{ name, dedupeKey }` so the UI prefills the form; the edit-then-submit flow keeps slug + dedupe_key generation server-authoritative in `POST /api/dev/skills`.
|
||||
- **No skill/position seed yet.** Per ARCHITECTURE the only seeded artifact is `seed/catalog.json` (later unit). Tables start empty; this unit is the composition layer other units (C2 sliders, C3 matrix) consume.
|
||||
|
||||
**Next: C2 — volunteer `/profile/skills` sliders (self_comfort) with verified chip.****
|
||||
**Next: C2 — volunteer `/profile/skills` sliders (self_comfort) with verified chip.**
|
||||
|
||||
---
|
||||
|
||||
## C2 — Volunteer profile sliders (self_comfort; verified_level untouched) — DONE 2026-11-18
|
||||
|
||||
**Scope (from BUILD-PLAN.md):** `/profile/skills` sliders — a volunteer rates their own comfort per skill. Governing rule: **two numbers, one truth** — `self_comfort` is the volunteer's signal, `verified_level` is the gate. A slider save must never move `verified_level`, `verified_by`, or `verified_at` (those belong to C3's assessments).
|
||||
|
||||
**Delivered:**
|
||||
- `src/db/schema.ts` — `user_skills` table (ARCHITECTURE §4.3): `id, user_id (FK users, cascade), skill_id (FK skills, cascade), self_comfort (int, nullable), self_rated_at, verified_level (enum, default 'none'), verified_by, verified_at, mentor_opt_in, last_served_on, notes`. Unique index `(user_id, skill_id)`; index on `skill_id`. Excluded from `relations` (FK columns on a unique key trip Drizzle 0.45.4 typing — same as skills/position_skills).
|
||||
- `src/db/userSkills.ts` — `setSelfComfort(userId, skillId, value)` upserts on `(user_id, skill_id)` and writes **only** `self_comfort`/`self_rated_at`; on insert it seeds `verified_level: 'none'`. `getUserSkills(userId)` joins `skills` for display (name/slug), ordered by name.
|
||||
- `src/domain/userSkills.ts` — pure `validateSelfComfort(value)`: null (not yet rated) allowed; otherwise an integer 0–100. No DB imports.
|
||||
- `src/domain/userSkills.test.ts` — 5 tests named after the behaviors.
|
||||
- `src/app/api/dev/user-skills/route.ts` — `GET ?userId=` (records + skill name), `POST { userId, skillId, selfComfort }` (slider save; absent/null clears to "not rated"). Constraint mapping: 23505 → 409 (duplicate record), 23503 → 400 (dangling user/skill).
|
||||
- Migration `drizzle/0005_keen_lenny_balinger.sql`.
|
||||
|
||||
**Verification (all exit 0):**
|
||||
- `tsc --noEmit` ✓ · `eslint .` ✓ · `vitest run` ✓ (**55** total, +5 for C2) · `next build` ✓
|
||||
- `pnpm db:migrate` ✓ → `user_skills` present on :5433 with all 11 columns
|
||||
- Runtime smoke against live app + Postgres on :5433 (`/tmp/c2.sh`, **18 checks**):
|
||||
- save slider 60 → 200, persisted; `verified_level` = `none` ✓
|
||||
- set an existing `verified_level='verified'` + `verified_at`, then move slider to 85 → comfort updated, **verified level and `verified_at` unchanged** (the C2 rule) ✓
|
||||
- 101 and 60.5 → 400 (range/integer validation) ✓
|
||||
- POST with no `selfComfort` → 200, cleared to null ✓
|
||||
- dangling user/skill id → 400 (not 500) ✓
|
||||
- test rows cleaned up (catalog + `user_skills` back to 0)
|
||||
|
||||
**Session blocker — root cause + fix (recorded for future reference):**
|
||||
- **Reported** as "build/restart keeps killing the session" and "stale `next-server` won't die".
|
||||
- **Root cause:** the process being killed (`pkill -9 -f next-server`) was **pi-web — the agent's own UI host** (`node …/pi-web`, cwd `…/node_modules/@agegr/pi-web`, Next **v16.3.8**, port 30141). The project is Next **15.5.29**, and nothing from it was listening on :3000. Killing pi-web terminated the session; its supervisor respawned it with a new PID, which looked like "next-server keeps respawning". The build was never hanging — `next build` finishes in ~30s.
|
||||
- **Also:** `pnpm` is not on PATH for this shell, and `/tmp/start_app.sh` did not exist (fresh `/tmp`). Use `./node_modules/.bin/{next,tsc,vitest,eslint}` directly.
|
||||
- **Fix:** never blanket-kill `next-server`. Start the project app as a background process on :3000 (`DATABASE_URL=postgres://media:media@localhost:5433/media PORT=3000 ./node_modules/.bin/next start`); it reaches `Ready` in <1s and `/api/health` returns 200. If a port must be freed, find the PID via `ss -ltnp | grep :3000`, never by process name.
|
||||
|
||||
**Decisions:**
|
||||
- **Slider writes are narrow by construction.** `setSelfComfort`'s `onConflictDoUpdate` sets only `selfComfort`/`selfRatedAt`; the verified columns are not in the update set at all, so the rule holds without a read-then-write race.
|
||||
- **Null is the "not rated" state**, not 0. Omitting `selfComfort` clears the rating and its timestamp — it never invents a 0% score.
|
||||
- **Unique (user, skill), not a history table.** C2 keeps one current self-rating per pair; the append-only history for verification lives in C3's `skill_assessments`.
|
||||
|
||||
**Next: C3 — admin skills matrix + verify-level modal.**
|
||||
|
||||
Reference in New Issue
Block a user