Commit Graph

54 Commits

Author SHA1 Message Date
bhursey b42700a943 fix(seed): one seat per role per instance
CI / build (push) Has been cancelled
The seed numbered seats by role position, so Livestream became seat 2 and
Slides seat 3. Existing instances number every role's first seat 1, so the
insert did not match them and added a duplicate Livestream and Slides seat to
every Sunday. Always use seat 1.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 22:11:21 +00:00
bhursey f71952f838 fix(seed): never run the demo seed as part of a deploy
CI / build (push) Has been cancelled
The migrate task chained db:seed, so every production deploy inserted demo
users, duplicate Sunday templates and 45 fake assignments, and its unconditional
assignment delete wiped real schedule data. Migrations now run alone, and the
seed aborts when the database already holds non-seed users unless SEED_FORCE=1
is set for a throwaway database.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 21:34:02 +00:00
bhursey ade21425d4 fix(schedule): use the instance title on every schedule surface
CI / build (push) Has been cancelled
One-off services hang off a shared parent template, so anything that printed the
template name showed "Special services (one-off)" instead of the real service.
Grid, coverage, run sheet, reminders, outbox mail, candidates and exports now
prefer the instance title override, which already existed but was ignored.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 18:21:09 +00:00
bhursey aaa3fd9ed1 feat(schedule): add one-off services with chosen positions
CI / build (push) Has been cancelled
Special services were impossible to schedule: every instance came from a
recurring template and opened seats for all three roles. Coordinators can now
add a dated one-off service that materializes only the positions it needs, and
optionally pick a photographer at the same time, which creates the matching
media event with them already assigned.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 18:08:59 +00:00
bhursey 7bad1e8293 merge: bring the host WIP branch together with the invite-link fix
CI / build (push) Has been cancelled
2026-11-22 17:43:19 +00:00
bhursey 55239ef1e9 wip: checkpoint host working tree
Login-page gate, notification outbox dispatcher and cron, assignment
proposals/responses, coverage and training-guide updates, plus the generated
training PDFs. Checkpointed from the host before merging the invite-link fix.
2026-11-22 17:42:51 +00:00
bhursey f75178de69 fix(auth): give invite links a lifetime that fits an inbox
CI / build (push) Has been cancelled
Invite and welcome emails signed a 10-minute sign-in token, so the link was
usually dead by the time someone opened the mail and could never reach the
set-password page. Invitations now use a 7-day single-use token, while
requested sign-in links stay at 10 minutes. Expired or already-used links also
explain themselves on the sign-in page and point at requesting a fresh one.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-22 17:38:15 +00:00
bhursey fac9b96cca feat(events): show every photo on the event page without folders
CI / build (push) Has been cancelled
Folders were an implementation detail leaking into the event workflow: every
upload needed a folder first and photos were split across pages. Uploads now
land in a single implicit "Photos" folder and the event page renders one
gallery with the uploader and an edited-only download.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 14:37:57 +00:00
bhursey ebe0c77f7e feat(editor): finish the quick/advanced editor handoff
CI / build (push) Has been cancelled
Reopen advanced edits from their saved recipe, seed or take over the quick
editor from them, refresh thumbnails after a save, and add an edited-only
download. Also fixes the Lumenroom library collapsing to slivers on large
shoots and documents deploying both containers on a new host.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 06:35:24 +00:00
bhursey ab4a07a40f fix(editor): decode camera raws to PNG so previews and thumbs render
CI / build (push) Has been cancelled
ImageMagick 7 in the app image refuses to write TIFF from its LibRaw coder
("no encode delegate for this image format `NEF'"), so every RAW thumbnail,
preview and bridge proxy returned 415. The editor showed "The preview could
not be prepared" and the advanced editor had no editable proxy to open.

PNG is decoded reliably by the same build and read back by sharp.
gold
2026-11-21 02:36:59 +00:00
bhursey 0cb315ea88 feat(editor): bridge the advanced photo editor into the event workflow
CI / build (push) Has been cancelled
Event photos can now be opened in Lumenroom, a WebGL2 develop module, from the
photo editor's Advanced button. The dashboard signs a short-lived token scoped
to one user and event; Lumenroom exchanges it, imports the event's photo list
and proxies bytes on demand, so nothing is copied and the temporary catalog
expires with the bridge session. Saving in Lumenroom renders the photo and
writes it back as the event's edited JPEG, with the advanced recipe kept in
event_photos.advanced_edit_json.

Lumenroom is vendored under lumenroom/ and built as a second compose service,
so one clone and `docker compose up -d --build` deploys both apps.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 01:34:20 +00:00
bhursey 982f9048e1 fix(media): refuse local disk when a NAS share is configured
CI / build (push) Has been cancelled
A bind-mounted host directory made the app report storage as ready while
media landed on the container host's local filesystem, so the NFS export was
never actually used. mediaStorage() now reads the mount table: a share written
as host:/export is only accepted when the media root is on a network
filesystem, otherwise uploads, edits and filing are blocked with the real
device and the fix. Settings and the Media page show the detected filesystem
and host-mount steps, README section 9 documents the OS-level mount (including
Docker-in-LXC) with docker-compose.nfs.yml as the alternative, and the E2E
suites use path-style shares for local test directories.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 00:45:36 +00:00
bhursey 2fc71883d7 feat(auth): sign out from the app header
The shell had no way to end a session on shared booth machines; the new
button signs out and returns to the login page.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 00:45:36 +00:00
bhursey 8601a6014f feat(training): captions under lesson images
Authors can now attach a caption to an image in the lesson editor; it is
sanitized as figure text and follows the image's alignment in the reader.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-21 00:45:32 +00:00
bhursey f7a0c8618f feat(media): primary media storage, growth goals, retention and delivery tools
CI / build (push) Has been cancelled
Event photos and videos are now stored only on the NFS/local share named in
Settings -> Media storage. Uploads, photo editing, video processing and the
per-event filing step refuse to run until that share is configured and
writable, so nothing is silently written inside the container. Video
originals, renditions, posters and sidecars share one folder on the share.

Also adds volunteer growth goals with a mentor queue, an admin retention and
storage sweep with a cron entry point, cached gallery thumbnails with
per-folder ZIP downloads, a server-rendered booth-sheet PDF, and in-app
confirm/release for every upcoming assignment.

Service reminders now ignore the one-off event reminder rule, which had been
queueing an extra bogus reminder for each published service.

Generated with Codebuff 🤖
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-20 23:21:34 +00:00
bhursey cb5976edb2 feat(training): rich-text lessons with inline images and 25 MB manuals
CI / build (push) Has been cancelled
Admins were authoring plain-text lessons, which made illustrated tutorials
and reordering images impossible. Lesson bodies are now sanitized HTML from a
Tiptap editor with alignment, sizing, drag-reorder and alt text, and inline
images reuse the training_resources table so no migration is needed.
Attachments grow to 25 MB, PDFs stream inline, and SVG is rejected because it
can execute as a document. Legacy plain-text bodies are normalized on read.

🤖 Generated with Codebuff
Co-Authored-By: Codebuff <noreply@codebuff.com>
2026-11-20 12:18:24 +00:00
bhursey e8759cdee8 docs: rebuild the migrate image before running it
CI / build (push) Has been cancelled
docker compose run reuses the previously built tools image, so an upgrade could execute stale seed code against a newer schema. Include the explicit build step in quick start, production deployment, and update commands.
2026-11-20 05:39:46 +00:00
bhursey 8018718487 deploy: harden Docker stack and add Ubuntu production guide
CI / build (push) Has been cancelled
Make the Compose stack safe and reproducible on a fresh host: parameterize database credentials, bind Postgres to loopback by default, add an app healthcheck and log rotation, and pass Postmark/archive settings through. Document the complete Ubuntu deployment path, including bootstrap, TLS, firewall, cron, NFS, backups, updates, and troubleshooting.
2026-11-20 05:32:28 +00:00
bhursey 3fd8ffb0f9 ci: target the main branch
CI / build (push) Has been cancelled
The repository moved from master to main, but the workflow still only triggered on master, so pushes and pull requests ran no CI. Update the trigger and the current-state docs to match.
2026-11-20 05:17:13 +00:00
bhursey 872d1cb29e docs: rewrite README for the shipped application
The old README still described the planning phase and a Cloudflare/Postmark/Twilio stack. Replace it with current setup, features, configuration, cron, backup, roles, testing, and known gaps so the repository is usable as-is.
2026-11-20 05:14:57 +00:00
Tiel Coder 5adf1cef1f push to maple-street 2026-11-20 04:07:02 +00:00
Tiel Coder 2cec220a24 docs(D8): mark D8 complete — all checks green 2026-11-18 22:09:18 +00:00
Tiel Coder d0a696167f fix(D8): grid slots render, per-cell optimistic revert, shared E2E helpers, admin reset endpoint
- src/db/grid.ts: key role map by ID (was slug, causing all cells to show '—')
- src/components/app/schedule-grid-editor.tsx: revert only failed cell, not entire grid
- src/db/audit.ts: fix import path ./db → @/db
- src/db/seed.ts: add resetAndSeed(), assign Audio only (leave Livestream/Slides open)
- src/auth/config.ts: carry id/email on JWT for audit actor
- e2e/dev.ts: shared signInAs + resetDb helpers
- e2e/schedule-grid.spec.ts: use shared helpers, reset DB beforeAll
- e2e/assign-mutations.spec.ts: E2E for assign/clear with optimistic update + rollback
- src/app/api/dev/reset/route.ts: admin-only DB reset endpoint
- playwright.config.ts: workers: 1 (serial, suites share one Postgres)
2026-11-18 21:51:04 +00:00
Tiel Coder 137a135a5e unit(D8): optimistic grid editor + toast (assign/clear reverts on failure) 2026-11-18 18:44:22 +00:00
Tiel Coder 71b993e663 unit(D8): assign/clear route (schedule.publish guard, rule-1 gate, audit) + active-assignment-in-instance query 2026-11-18 18:35:53 +00:00
Tiel Coder e47ef839a7 fix(uuid): place version nibble in byte 6 (RFC 9562) — was random, making uuidv7 ids non-compliant 2026-11-18 18:35:53 +00:00
Tiel Coder e1895079ff unit(D8): assign conflict gate (rule 1 duplicate-in-instance) 2026-11-18 18:26:04 +00:00
Tiel Coder b664de65f5 unit(D8): audit_log table + migration + audit-row builder (rule 12) 2026-11-18 18:25:30 +00:00
Tiel Coder 6982a8040d D7: read-only schedule grid UI (rows=instances, cols=positions, week nav)
Server-component schedule page backed by a pure data layer (src/db/grid.ts):
gridForWeek() returns positions + instances (->slots->assignments), and
defaultWeekStart() defaults to the earliest upcoming published instance so a
seeded DB shows data on first load. Week nav via ?week=YYYY-MM-DD (server
rendered, no client state).

Fixes two latent bugs that kept the grid empty/incorrect:
- tz: weekdayInTz()/nextSundaysInTz() built Date.UTC(y,mo-1,d) from a LOCAL
  date string and read its weekday; for America/New_York (UTC-5) UTC midnight
  lands the previous evening, so the seed materialized instances on Mondays and
  the default week was off by one. weekdayInTz now builds the local-midnight
  instant via utcOffsetMs; nextSundaysInTz uses weekdayInTz + addDaysISO.
- grid: occursOn (date mode) was run through dateInTimezone(), reinterpreting
  the UTC instant as wall-clock and shifting a day early; now extracts the UTC
  calendar date directly (occursOnISO).
- schedule-grid: <table className=... collapse ...> set visibility: collapse
  (Tailwind 'collapse'), hiding the whole grid server-rendered-but-invisible;
  changed to border-collapse.

E2E: new schedule-grid.spec.ts + shell.spec.ts grid assertion. Full suite green:
tsc, eslint, 178 unit tests, next build, 6/6 Playwright.
2026-11-18 16:19:17 +00:00
Tiel Coder 13aafc231f unit(D6): candidate ranking service (availability -> readiness -> score)
rankCandidates() implements ARCHITECTURE §5.8.4: availability-filtered
first, then ranked by readiness. Reuses computeReadiness (C4),
isUnavailable (D4), levelRank (C3). Pure — no DB, route, or migration.

Pipeline precedence: inactive -> away -> already_serving -> unqualified
-> eligible. Deterministic tie-break (score desc, name, id). Comfort
lowers rank but never blocks (§7 rule 14); never-served is not stale.

18 tests (away excluded; unqualified + reason code; deterministic
ordering; roster/instance gates; sort modes; picker signals).
tsc/eslint/vitest (178) / next build all green.
2026-11-18 11:53:54 +00:00
Tiel Coder 467f193389 unit(D5): conflict engine (pure function, hard vs soft)
classifyConflicts(input) encodes the 10 conflict rules from
ARCHITECTURE §5.3 / BUILD-SPEC §7 as pure hard/soft classifications:
- hard (block): inactive/unapproved, duplicate-in-instance,
  core-skill-below-required, shadow-mentor-not-ready
- soft (warn, override with note): blackout-overlap, monthly-cap,
  back-to-back, comfort-below-50, stale, readiness-below-threshold

Reuses the pure predicates it encodes: isUnavailable (D4),
isMentorReady (C5), levelRank (C3). No DB, no route, no migration.
hasHardConflict/hardConflicts/softConflicts let callers filter by
severity. Table-driven test: one case per rule + edges (20 tests).
2026-11-18 11:41:51 +00:00
Tiel Coder deb4f35fb8 unit(D4): blackout CRUD + isUnavailable(user, date)
Blackout / unavailability (ARCHITECTURE §4.7 / §5.3 rule 5 / §5.4):
- src/domain/availability.ts — pure isUnavailable(records, date); a record
  covers the date if active and its inclusive range [starts_on, ends_on]
  contains it OR its rrule matches. No DB imports.
- src/domain/availability.test.ts — 11 tests named after the rule, incl.
  the inclusive-end case (2026-11-21..2026-11-28 covers 11-28).
- src/db/schema.ts — unavailability table: CHECK ends_on >= starts_on,
  CHECK span <= 365 days, unique (user_id, starts_on, ends_on) WHERE active.
- src/db/unavailability.ts — list/get/create/update/cancel (soft-delete);
  range + rrule validated on write.
- src/app/api/dev/unavailability/route.ts — GET/POST/PATCH; bad range/rrule
  -> 400, cancel flips status=cancelled.
- drizzle/0008_needy_stryfe.sql + migration applied to DB on :5433.

date columns stored as strings (mode: string) to match the YYYY-MM-DD
domain; Postgres date is mode-agnostic so the migration is unchanged.
Constraints enforced twice: validateUnavailabilityRange at the API,
chk_unavailability_* at the DB.

.env added to .gitignore (real secret was not ignored; .env.* missed the
bare .env).
2026-11-18 11:25:43 +00:00
Tiel Coder 8ee339b235 unit(D3): slot materialization (headcount, call time)
Slot materialization (ARCHITECTURE §5.2): for each non-published
instance, plan the seats planSlots() computes and upsert them on
(service_instance_id, role_id, slot_index). onConflictDoNothing makes
it idempotent; published weeks are skipped (owned by the publish flow).

- src/domain/slots.ts: pure planSlots()/planSlotsForRole(); headcount
  fills slotIndex 1..N, call_time = start + offset (null if no offset).
- src/domain/slots.test.ts: 5 tests (Audio headcount 2 -> 2 slots with
  correct call_time, clamp to 1, null offset, multi-role flatten).
- src/db/slots.ts: materializeSlotsForInstance() + materializeSlots().
- src/app/api/dev/cron/slots/route.ts: GET drives the daily job.

No schema change (slots unique index predates this unit; position_skills
stays deferred to D5). Verified: draft instance + Audio headcount 2 ->
4 seats (Audio x2 + Livestream + Slides), Audio call_time 09:30 EST;
re-run creates 0 rows. Seed restored to canonical 4 instances / 12
slots after testing.
2026-11-18 05:27:36 +00:00
Tiel Coder 8fb6459b0d unit(D2): idempotent instance generator (16-week window) on cron route
Service instance generation (ARCHITECTURE §5.1): for each active
service, plan instances in the rolling window and upsert on
(service_id, starts_at). onConflictDoNothing makes the whole thing
idempotent — a re-run creates 0 rows, cancelled/published instances
are never touched, past instances are never deleted.

- src/domain/instances.ts: pure planInstances() + windowTarget();
  DST-safe instants via localToUtc, no DB imports.
- src/domain/instances.test.ts: 7 tests (window boundary, DST-safe
  instants, determinism, biweekly phase, monthly-nth, windowTarget).
- src/db/instances.ts: generateInstances() idempotent upsert;
  occurs_on stored as zoned midnight (no UTC-midnight shift).
- src/app/api/dev/cron/instances/route.ts: GET drives the daily job.

No schema change (service_instances unique index predates this unit;
slot materialization stays deferred to D3). Verified: run twice ->
0 created, count unchanged; published instances byte-identical;
generated instances stored as DST-safe UTC instants.
2026-11-18 05:17:11 +00:00
Tiel Coder 6a778aa2f6 unit(D1): service CRUD + expandRRULE()
Service template CRUD (create/read/update/deactivate) and the pure
expandRRULE() recurrence expander for the RFC 5545 subset (WEEKLY,
BIWEEKLY via INTERVAL=2, MONTHLY nth weekday).

- src/domain/recurrence.ts: expandRRULE, parseRecurrence,
  matchesRecurrence, validateRecurrence. Pure — no DB imports.
- src/domain/recurrence.test.ts: 13 tests, incl. the 5 required
  recurrence cases (spring-forward / fall-back Sunday, monthly-nth
  across a year boundary, cancelled instance not regenerated,
  biweekly phase stable).
- src/db/services.ts + src/app/api/dev/services/route.ts: list/get/
  create/update/deactivate; rrule validated on write; deactivate
  flips active (never delete); 409 on duplicate name.

No schema change (services table predates this unit). DST stays in
the caller's localToUtc; interval phase anchored to a fixed epoch so
biweekly never drifts.
2026-11-18 05:07:42 +00:00
Tiel Coder 995b88e5ec docs: record C4-C6 units as done
C4 readiness scoring, C5 per-skill mentor designation, C6 growth goals +
shadow pairing validation — with verification results and the .freebuff/
removal that was blocking eslint.
2026-11-18 04:44:02 +00:00
Tiel Coder 676751c489 unit(C6): growth goals + shadow pairing validation
Adds the growth_goals table (ARCHITECTURE §4.3, §5.8.6) with its migration and a
pure nextGoalStatus() state machine (requested -> mentor_assigned -> in_progress
-> achieved, with pause/resume and decline). Adds validateShadowPairing()
(src/domain/shadows.ts): a shadow/trainee slot requires a paired mentor in the
same instance who is mentor-ready for that exact skill (C5) — rejects a shadow
with no paired mentor, enforced by the pure rule and the chk_shadow_paired CHECK
constraint on slots. Verified the migration applies and the CHECK rejects a
trainee slot without a paired mentor. 22 tests named after each rule.
2026-11-18 04:43:07 +00:00
Tiel Coder 371524b33e unit(C5): per-skill mentor designation
Pure isMentorReady (src/domain/mentor.ts): verified_level >= skill.mentor_min_level
AND mentor_opt_in AND admin-approved. Expertise alone does not volunteer someone —
an expert who never opted in, or an admin has not approved, is not mentor-ready.
The shadow validation (C6) calls this predicate. 6 tests named after each rule.
2026-11-18 04:43:02 +00:00
Tiel Coder a09705e83a unit(C4): readiness scoring
Pure computeReadiness (src/domain/readiness.ts) implementing the ARCHITECTURE
§5.8.3 derivation: core skills below required_level block and are listed in
missing[], otherwise a weight-averaged level score (§5.4) blends 0.7 level /
0.3 self comfort, null-safe. The single most reused function in the app —
picker, auto-fill, matrix, dashboard — takes its data in and touches no DB.
13 tests named after each rule.
2026-11-18 04:42:57 +00:00
Tiel Coder 47b847e89f docs: remove third-party auth vendor mention from Auth row 2026-11-18 04:26:00 +00:00
Tiel Coder 50cb9b6044 docs: record C3 matrix + verify-level unit as done
Captures the 42-check smoke result and why the assessment row serves as
the audit trail for level changes.
2026-11-18 04:19:07 +00:00
Tiel Coder bc1dc91e35 C3 — Admin skills matrix + verify-level modal
Adds the append-only skill_assessments history and the verify path, so a
level can only move together with the row recording who moved it, from
what level, and the comfort they saw.
2026-11-18 04:19:04 +00:00
Tiel Coder a915e4236c 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.
2026-11-18 04:14:10 +00:00
Tiel Coder a77f47d5bd C2 — Volunteer profile sliders (self_comfort; verified_level untouched)
Adds the user_skills record and slider save path so a volunteer can rate
their own comfort without ever moving the verified level, which stays
C3's to write.
2026-11-18 04:14:06 +00:00
Tiel Coder d74232de60 docs: C2 session handoff (app down, C2 written-not-committed, next C3) 2026-11-18 04:04:39 +00:00
Tiel Coder e9168def6c C1 — Skills composer (name composition + dedupe_key preview)
Skills composer: category (required) + optional technology + optional
function -> composed name prefill + dedupe_key. Governing rule: a null
technology yields a generic (technology-agnostic) skill; a duplicate
(category, tech, function) is rejected.
Delivered:
- src/domain/skills.ts — pure composeSkillName (no DB, no src/db imports).
  Rule: function+technology -> '<fn> on <tech>'; function only -> '<fn>';
  technology only -> '<tech>'; neither -> category. Null technology ->
  generic skill (name never names a specific piece of gear).
- src/domain/skills.test.ts — 6 tests named after the composition
  behaviors.
- src/app/api/dev/skills/compose/route.ts — POST /api/dev/skills/compose
  returns { name, dedupeKey } for prefilling the form; writes no row.
  The admin edits the name, then submits to POST /api/dev/skills, which
  generates slug + dedupe_key and enforces the unique constraint (409 on
  duplicate).
No schema change, no migration: the skills table, data-layer CRUD, and
dedupeKey were delivered in B4; C1 adds only the composition rule +
composer endpoint (matching the isPublishable/validateRequirements
domain pattern).
Verification: typecheck lint test (50, +6) build all green; runtime
smoke /tmp/c1.sh (13 checks): compose fn+tech -> '<fn> on <tech>',
compose function-only -> generic, create composed skill (slug frozen,
dedupe_key persisted), duplicate -> 409, null-tech generic skill,
dangling FK -> 400.
2026-11-18 03:08:25 +00:00
Tiel Coder 5c789f63cc B4 — Positions + skills + requirements editor
Positions (schedulable seats) CRUD + requirements editor. Governing rule:
a position with no is_core skill refuses to save as publishable.
Schema (src/db/schema.ts):
- skills table (B4 prerequisite of position_skills): id, slug (unique),
  name, category_id/technology_id/function_id FKs, dedupe_key
  (category|technology|function, NULLs -> ''), mentor_min_level (default
  'expert'), stale_after_days (default 120), recert_required, sort_order,
  active, created_at, updated_at. All FKs ON DELETE RESTRICT.
- position_skills join: position_id, skill_id, weight, required_level,
  is_core; PK (position_id, skill_id).
- roles (positions) gained active (default true) + updated_at for
  soft-delete/pickers/audit.
Data layer (src/db/positions.ts): list/create/update/deactivate for
positions and skills; getPositionSkills (skills merged into
position_skills in JS); setPositionSkills (replaces the whole set);
dedupeKey() helper.
Domain (src/domain/positions.ts + .test.ts): pure publishability rule —
isPublishable(skills) = has >=1 is_core skill. 8 tests named after the
rule.
API:
- src/app/api/dev/skills/route.ts — GET/POST/PATCH (slug + dedupe_key
  generated at create; slug frozen on update).
- src/app/api/dev/positions/route.ts — GET/POST/PATCH (rename/edit or
  deactivate via active:false).
- src/app/api/dev/positions/requirements/route.ts — GET (list a
  position's requirements) + POST (set requirements; enforces the
  publishability gate: published:true with no core skill -> 400).
Migration drizzle/0004_hesitant_ezekiel.sql.
Verification: typecheck ✓ lint ✓ test ✓ (44, +8) build ✓ db:migrate ✓;
runtime smoke /tmp/b4.sh (24 checks) — publish-with-core 200,
publish-without-core 400, weight-out-of-range 400, rename slug frozen,
deactivate hides from picker but row persists.
Decisions: skills table is a B4 prerequisite; requirements editor takes
positionId in the body (Next 15.5.29 rejects an explicitly-typed
{ params: { id } } route-handler second arg); publishability gate lives
in the domain and is enforced in the route; join resolved in JS
(drizzle 0.45.4 exports no join).
2026-11-18 01:34:24 +00:00
Tiel Coder 9f7a65b136 B3: catalog taxonomy CRUD (categories, vendors, technologies, functions)
Create/rename/deactivate for the four taxonomy tables. Deactivate not
delete; slug frozen after creation; FKs ON DELETE RESTRICT.
- src/db/schema.ts: four tables + relations (ON DELETE RESTRICT FKs)
- src/lib/slug.ts: slugify (lowercase, ASCII-fold, collapse runs) + 6 tests
- src/db/catalog.ts: listCatalog (active filter), deactivateCatalog (soft
  delete), per-entity create*/update* (slug generated at create, frozen on
  update; update patches only present fields)
- src/app/api/dev/catalog/route.ts: GET/POST/PATCH; Zod per entity; DB
  constraint errors mapped to 409 (dup slug) / 400 (dangling FK) via cause
  chain
- drizzle/0003_whole_crystal.sql
Verification: typecheck, lint, 36 unit tests (+6), build, db:migrate all
exit 0. Runtime smoke: create -> rename keeps slug -> deactivate hides from
pickers but row persists (all four types); partial PATCH preserves omitted
fields; validation 400/400/400/409.
2026-11-18 01:00:10 +00:00
Tiel Coder 26b31978e2 B2: profile + notification_preferences + SMS consent capture (TCPA)
- notification_preferences table (user_id PK->users, email/sms toggles,
  sms_consent_at/source/ip evidence, quiet hours, digest) + migration 0002
- src/domain/consent.ts: pure TCPA rule (phoneChanged/buildConsent/resetConsent)
- src/db/profile.ts: updateProfile (partial update; resets consent on phone
  change) + setSmsConsent (opt-in) + getProfile
- PATCH/POST /api/dev/profile routes
- seed: per-user prefs row (email on, SMS off)
- 6 unit tests named after the rules
2026-11-18 00:09:05 +00:00
Tiel Coder 5f0b94af6a unit(B1): invite -> pending -> approve/deny with console outbox
Admin-invite lifecycle (BUILD-PLAN Phase B, depends A3):
- src/auth/invites.ts: pure nextUserStatus() rule (invite->pending_approval,
  approve->active, deny->denied) + isSignInEligible() mirroring the Auth.js
  authorize guard; thin DB wrappers inviteUser/approveUser/denyUser;
  enqueueOutbox() console transport (launch, ARCHITECTURE 3.4).
- Routes: /api/dev/invite, /api/dev/approve, /api/dev/deny.
- src/auth/invites.test.ts: 7 tests named after the rules.
- magic-link.ts exports APP_ORIGIN.
No migration: users.status already carries the enum (A2).
Verify: typecheck, lint, 24 unit tests (+7), build, 4 e2e all green; runtime
smoke test confirms invite->pending, approve->active signs in, deny->denied
gets no session.
2026-11-17 23:46:07 +00:00