Commit Graph
176 Commits
Author SHA1 Message Date
Mao NakamotoandCursor 9aa982de60 feat(marketplace): add listing Q&A and buy CTA
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 19:36:11 +02:00
Mao Nakamoto ca322b00e3 ci(e2e): fix seeded journey drift 2026-07-04 13:04:02 +02:00
Mao Nakamoto 22117c0622 ci(e2e): add seeded local journey environment 2026-07-03 22:06:09 +02:00
Mao Nakamoto afe305d56c chore(db): retire dead medusa table and persist login lockouts 2026-07-03 21:48:44 +02:00
Mao NakamotoandClaude Fable 5 03fd3404f6 fix(ci): stop running mutating E2E journeys against production
The dual-persona job ran 13 journey specs (create/submit/approve real rows)
against prod, where fixture data doesn't exist — the service-appointment
journey needs the user persona to BE a technician and has been the standing
red. Prod keeps the read-only route inventory; the journeys move to the
seeded ephemeral e2e-local CI job (upcoming commit).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:46:43 +02:00
Mao NakamotoandClaude Fable 5 321c7269f1 chore(db): drop notifications type CHECK (110) + migration discipline policy
- 110: notifications_type_check dropped — recreated five times (039/040/069/
  093/108), caused two silent-insert-failure incidents; writers are exclusively
  internal services using NOTIFICATION_TYPES constants. Config + compiler are
  the validator; DB CHECKs stay reserved for true invariants.
- CLAUDE.md: schema changes only via migrations (drizzle-kit push forbidden),
  app-enum policy, local-replay-before-push rule
- npm run db:migrate → scripts/db/run-migration.sh
- delete scripts/deploy.sh + migrate-to-production.sh (pre-Hetzner relics
  invoking nonexistent migrate.js / docker-compose.prod machinery) + stale
  COMMANDS.md rows

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:20:08 +02:00
Mao NakamotoandClaude Fable 5 0984836dc8 chore(db): baseline the ten push-only tables (109)
Same disease as reviews/101b: created on prod via drizzle-kit push, present in
no migration — from-scratch replays lacked them. Two are actively written
(user_lockouts by the auth rate-limiter, activity_feed by logActivity);
location_approvals only survived CI replay because 085 guards on to_regclass.
Exact prod DDL, fully idempotent; re-attaches the 085 immutability trigger
that fresh replays skipped. Verified: full 96-migration local replay clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 20:15:55 +02:00
Mao NakamotoandClaude Fable 5 23afa14413 chore(admin): legacy cleanup + repair the silently-red CI pipeline
Legacy cleanup (access control verified — no prod user holds legacy keys):
- Delete /admin/products (+components/hooks/APIs with zero live callers),
  /admin/analytics (+orphaned service), /admin/timecards redirect stub
- Factsheet print view is a LIVE feature, not legacy: re-homed to
  /admin/erfassung/[id]/factsheet, "Factsheet drucken" restored on the
  erfassung success screen (routes.ts erfassungFactsheet)
- sections.ts: drop 'analytics' + duplicate 'finances' (finanzen stays);
  'timecards' + 'products' kept as live permission keys with repointed paths
- permissions.ts: remove migrateOldRole + dead aliases (finances→finanzen,
  it-hilfe→it-hilfe-admin); design aliases kept and documented
- TIME_OFF_REVIEW notifications now deep-link /admin/team/approvals

CI Pipeline (red since ≥1.7. while deploys stayed green):
- 101b_reviews_table_baseline.sql: `reviews` was Drizzle-pushed, never
  migrated — from-scratch replay died at 102. Baseline = exact prod DDL,
  idempotent, trigger guarded; full 94-migration replay verified locally
- 108_notification_types_membership_content.sql: CHECK constraint gains
  membership_payment_recorded + content_submission_status (drops orphaned
  membership_approved)
- /admin/workshops/proposals: quick action, routes.ts, /admin/workshops/new
  and proposal emails all deep-link an index that never existed → redirect
  stub to /admin/workshops
- E2E accounts recreated on prod (lost in Neon cutover) + AUTH_TEST_*
  secrets rotated; login lockout clears with this deploy's restart

Also: approvals hero singular fix ("1 Inhalt wartet").

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-03 19:31:25 +02:00
GandClaude Opus 4.8 5bfa69a0e6 fix: profile save validation (null fields) + timecard submit (DB constraints) + submit UX (#197)
Three user-reported issues:

1. **Profile "Validierungsfehler" on save.** GET /api/user/profile returns `null`
   for empty columns, but UpdateProfileSchema only accepted `string|undefined`, so
   loading a sparse profile and clicking Save failed validation on ~18 null fields.
   Schema fields are now `.nullish()` (null = empty) — the API accepts what it returns.

2. **Timecards with leave never submitted / never reached approvers (migration 107).**
   The timecard_entries CHECK constraints (migration 067) predated the config's Swiss
   absence categories (ferien/krank/unfall/feiertag/militaer/unbezahlt) and 0-minute
   unpaid markers, so ANY card containing a leave entry failed to INSERT → submit
   rolled back → status never became 'submitted' → the approvals queue was always
   empty, even for a superadmin. Migration realigns the constraints with the config
   SSOT (category list + duration_minutes >= 0). Must reach the prod Hetzner DB.

3. **Submit far from fill controls.** Save/Einreichen lived only in the top header
   while fill-from-plan + leave buttons are mid-page. Added a sticky bottom action
   bar so submit is always one tap away after filling.

typecheck clean.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 18:28:17 +02:00
GandClaude Opus 4.8 0c10de727b fix(db): ensure workshop_instances.current_participants exists (migration 106) (#192)
Found during P1 E2E testing of the paid-workshop flow. The paid-registration path
and the payment webhook read/increment `workshop_instances.current_participants`
for capacity checks, but that column was created by the legacy cms-api migration
system and is NOT in any scripts/db/migrations/ file — so a migration-built DB
(including prod) can lack it, which would 500 the paid-registration INSERT the
moment Payrexx goes live. (The dev DB was indeed missing it.)

Idempotent: ADD COLUMN IF NOT EXISTS + backfill from confirmed registrations.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 16:19:34 +02:00
GandClaude Opus 4.8 0a01a8727e fix(payments): make Payrexx truly plug-and-play (webhook signature, capture, partial-config guard) (#191)
Audit of the Payrexx integration found gaps that would break live payments the
moment real credentials are added. Closes them so go-live is config-only:

G1 (critical) — webhook signature header. The handler read `payrexx-signature`,
but Payrexx signs with `X-Webhook-Signature` (lowercase-hex SHA-256 HMAC of the
raw body, key as UTF-8 — which the code already computes correctly). With the
wrong header every live webhook was rejected (fail-closed) → customers charged
but orders never advance. One-line header fix.

G2 — capture for workshops/appointments. Gateways only RESERVE funds (authorize);
capture was wired only for marketplace. Non-escrow workshop/appointment payments
were authorized but never captured → the hold expires (~7 days) and the money is
never collected. The webhook now captures non-escrow generic payments immediately
on the reserved event (after the state commit, with loud logging on failure so a
user is never locked out of what they paid for). Escrow payments stay held.

G3 — escrow auto-release. The old `scripts/auto-release-escrow.js` was dead
frankenstein code (Stripe + retired Neon DB_* vars) — deleted. Replaced with a
real `GET /api/cron/release-escrow` that captures any escrow still held past its
deadline (Payrexx), + a `revampit-cron@release-escrow.timer` (daily 04:00). Tested.

G4 — partial-config guard. `isPayrexxConfigured()` ignores the webhook secret, so
a config with INSTANCE+SECRET but no WEBHOOK_SECRET silently charges customers
while rejecting every webhook. `createGateway` now logs a loud error in that exact
state (`isPayrexxPartiallyConfigured()`).

Also: `reservation` now sent as the documented `1` (the string "true" is coerced
to 0 by Payrexx's PHP backend → reservation silently disabled); removed dead
`getBaseUrl()`; rewrote docs/operations/PAYREXX_SETUP.md as the precise
plug-and-play go-live checklist.

Verified live behavior unchanged in mock mode; typecheck + lint + umlauts clean;
full suite 530/7688 green.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 15:52:58 +02:00
GandClaude Opus 4.8 f949e3fca4 ci: replace mutating prod E2E smoke with a read-only post-deploy smoke (#179)
The "Dual-persona inventory smoke" job had failed on every recent deploy — it
logs in as butaeff@gmail.com (a test account purged this session) and runs 14
journeys, several of which MUTATE production (it-hilfe/marketplace/workshops),
re-polluting prod with exactly the E2E data we cleaned. A perpetually-red,
prod-polluting check provides no signal.

Replace it with scripts/post-deploy-smoke.sh: read-only, no login, no mutation —
asserts the key public pages render (200) and the DB-backed public APIs return
"success":true (technicians, listings, workshops, services, stats, health). This
exercises the real queries (incl. the just-renamed technician_profiles), catching
a broken deploy/schema mismatch the page-render gate alone might miss. Fast
(curl-only; drops the Node/Playwright install), deterministic, 5-min timeout.

The heavier authenticated dual-persona journeys remain available for deliberate
runs via `npm run test:e2e:inventory:prod` (now requires an explicit real
AUTH_TEST_USER_EMAIL — the hardcoded purged-account default was removed).

Verified: the new smoke passes all 13 checks against prod.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 02:50:39 +02:00
GandClaude Opus 4.8 0447aa76bb fix(db): drop empty orphan technician_profiles before rename (migration 105) (#177)
The first deploy of migration 105 failed: prod has an empty orphan
`technician_profiles` table (created by 002b-simplified-auth, never adopted —
live data is in repairer_profiles), so the rename errored "relation already
exists". The page-render gate aborted cleanly (prod stayed on the prior release;
the failed migration rolled back atomically, never recorded).

Fix: DROP TABLE IF EXISTS technician_profiles (0 rows, no inbound FKs) before the
renames. Verified on prod with BEGIN…ROLLBACK — renames apply cleanly.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 02:01:08 +02:00
GandClaude Opus 4.8 64eef9b3d3 refactor(db): rename repairer_* tables to technician_* (debt #1) (#176)
"Repairer" and "technician" are the same concept; the API/service layer already
uses "technician" (/api/technicians SSOT, technician-service) but the DB tables
still carried the old name. This renames the tables so the schema matches.

- Migration 105: ALTER TABLE repairer_{profiles,services,availability,reviews,
  applications} RENAME TO technician_*. Postgres carries indexes + inbound FKs
  automatically (views/FKs track by OID). Idempotent (IF EXISTS).
- Drizzle pgTable() names + TABLE_NAMES values updated in lockstep, so every
  query (Drizzle + sql.raw(TABLE_NAMES.*)) targets the new names.

Scope (deliberately kept to bound risk — all separately riskier):
- the `repairer_id` / `repairer_profile_id` COLUMN names (data/SQL churn),
- the `'repairer'` user-role VALUE (stored data + every role check),
- the JS identifiers `repairerProfiles`/`REPAIRER_PROFILES` (cosmetic, internal,
  tsc-guarded — a follow-up cosmetic pass).
No production code hardcodes the table names outside TABLE_NAMES/Drizzle (verified
by grep), so there is no un-tsc-guarded raw-SQL risk.

typecheck + lint + umlauts clean; full suite identical 7-suite baseline failures,
zero new. Migration auto-applies after 104 on deploy.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 01:51:17 +02:00
GandClaude Opus 4.8 a69a3c22d7 refactor(profiles): nullable repairer contact + drop dead seller columns (debt #5 phase 4) (#175)
Phase 4, re-scoped after a per-field write-site audit found NO mirror duplication
— the role-profile contact/bio/avatar fields hold legitimately-distinct business
data (entered via separate forms), so the original "consolidate into user_profiles"
idea was dropped as contraindicated. Only the dead/placeholder columns are cleaned:

- Migration 104: repairer_profiles.phone/address NOT NULL → nullable; normalize
  the '' placeholders (self-service community techs, who never enter business
  contact) to NULL. Drop the dead seller_profiles.phone/address/postal_code
  columns (never written by any code path; the seller form only collects city).
- Schema: drop .notNull() on repairer phone/address; remove the seller columns.
- technician-service.upsertTechnicianProfile no longer writes the '' placeholders.

No readers of the dropped seller columns. typecheck + lint clean; full suite zero
new failures vs baseline. Docs: ARCHITECTURE_DEBT #5 Phase 4 (re-scoped, done).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 01:33:33 +02:00
GandClaude Opus 4.8 bf28d7a8f7 chore(ops): record E2E test org-content + account purge script (#168)
Companion to purge-demo-content.sql. Records the one-time prod cleanup (already
applied) that truncated E2E org content (blog/jobs/workshops/decisions/protocols/
tasks — all "E2E …" titled) and deleted all ~53 test accounts, keeping only the
two real staff users (georgy.butaev@, shop@), georgy's real membership
application, and the 3 physical locations. Prod is now a clean slate.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 21:31:29 +02:00
GandClaude Opus 4.8 f40453ddce fix(technicians): kill fabricated stats (SSOT), show avatars; purge demo data (#167)
The public technician profile showed fabricated data — "George" (a seeded test
account) with 80 reviews / 80 jobs / 5.0★ / verified / professional but ZERO
backing review rows. Root cause: aggregate columns were seeded with fake numbers
and `recomputeTechnicianAggregate` only updated technicians that HAD reviews
(inner join), so a 0-review tech kept stale/seeded values forever.

- recomputeTechnicianAggregate now LEFT JOINs a base row + COALESCE, so a
  technician with no published reviews is reset to 0/0.0 — fake aggregates can
  no longer survive a recompute.
- Technician profile now shows the real avatar (user_profiles.avatar_url, joined
  in getTechnicianById) with the initial-letter fallback. Avatar upload already
  works at /dashboard/profile → /api/uploads → Cloudflare R2 (storage was never
  missing — it's R2, verified live).
- scripts/ops/purge-demo-content.sql: the one-time prod cleanup (already applied)
  that TRUNCATEd the E2E/demo content (159 listings, 150 IT-Hilfe requests, 82
  appointments, 75 erfassung items, reviews, conversations) + removed the
  fabricated technician profiles, keeping all user accounts and org tables.

The profile's stats render was already guarded (>0), so with truthful data a
no-review technician simply shows no rating/jobs line.

typecheck + lint clean; full suite zero new failures vs baseline.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 21:02:37 +02:00
GandClaude Opus 4.8 1824bc83fd chore(marketplace): remove legacy marketplace_listings table + shop API/tab (#166)
`marketplace_listings` (RevampIT internal-shop table) and the /api/shop/inventory
routes were superseded by the unified `listings` table (RevampIT stock carries
is_revampit=true, published via publishRevampitListing). The table was dead for
writes (orphan rows only). Removed end-to-end:

- Repointed the 4 remaining readers off marketplace_listings to `listings`:
  - /api/stats/community  -> count active `listings`
  - /api/stats/impact     -> drop the separate shop-sold count, which DOUBLE-COUNTED
    RevampIT sold items (already present in `listings` via is_revampit). Bugfix.
  - /api/admin/search-index -> recent `listings`
  - /api/user/donations   -> derive the "listed" stage from inventory_items.marketplace_status
    (no marketplace_listings join); sold_at from inventory_items.updated_at.
- Removed the admin "Shop Produkte" tab: deleted /api/shop/inventory[/[id]] routes,
  useShopProducts hook, ShopProductsTable, ProductTabSwitcher, and the orphaned
  inventory-service (getInventoryProducts/getInventoryProductByUuid). Collapsed
  ProductManagement to the single Erfassung-inventory view; dropped the now-dead
  unpublish flow. /admin/products still works (inventory view + erfassung return-to).
- Schema/config: removed the marketplaceListings Drizzle table + MARKETPLACE_LISTINGS
  from TABLE_NAMES; archived the one-time backfill script.
- Migration 103 drops the table (must reach the Hetzner prod DB). No FK references it.
- Docs: .claude/CLAUDE.md + ARCHITECTURE_DEBT updated (storefront unified).

The /shop/* pages stay as redirects to /marketplace for legacy URLs.

typecheck + lint clean; full suite zero new failures vs baseline.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 20:03:33 +02:00
Mao NakamotoandClaude Opus 4.8 6c78580576 refactor(reviews): unify technician ratings into one source (#2)
Three stores held technician ratings but only `reviews` fed the displayed
aggregate, so service-appointment ratings (inline `customer_rating`) and the
legacy `repairer_reviews` table never counted, and the aggregate itself had an
overwrite bug (the IT-Hilfe and repairer recomputes each set only their own
slice). Now `reviews` is the single source:

- Service-appointment "rate" mirrors into `reviews` via createReview
  (target_type=repairer, booking_id=appointment) so it feeds the aggregate.
- New recomputeTechnicianAggregate() computes repairer_profiles.average_rating /
  total_reviews from ALL of a technician's reviews — IT-Hilfe (via accepted
  offer) + repairer (incl. mirrored appointment ratings) combined — replacing the
  two slice-specific updaters that overwrote each other. Verified end-to-end
  (IT-Hilfe 5 + repairer 3 → 4.00, count 2).
- Migration 102 backfills history from the inline ratings + repairer_reviews into
  `reviews` (idempotent), then recomputes every technician's aggregate. Legacy
  columns/table left in place (deprecated) for a later contract step.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 14:58:05 +02:00
Mao NakamotoandClaude Opus 4.8 a12034dd0d feat(it-hilfe): structured compensation on offers (record amount, not free text)
Offers carried only a free-text proposed_compensation ("CHF 40", "nach Absprache")
— unqueryable/unverifiable. Add a structured proposed_amount_cents (migration 101)
captured via a CHF field in the offer form, surfaced in the offers list, and
returned by the offers/my-offers APIs. The accepted offer's amount is now the
recorded agreed compensation (money may still settle off-platform for the
solidarity model; this records the figure). Labels added in all 8 locales.

Also fixes the offers-route test: the earlier A2 change wrapped the offer write +
count bump in db.transaction(), which the test's db mock didn't provide — added
transaction() to the mock (tx reuses the same builders) so the suite is green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 10:56:44 +02:00
Mao NakamotoandClaude Opus 4.8 a64fc52ba6 fix(it-hilfe): unblock community-tech matching + fix offer_count/SSOT bugs
- A1 (critical): the new-request match fan-out was gated on isVerified=true, so
  self-serve COMMUNITY technicians (the persona this feature targets, default
  is_verified=false with no self-serve verification) never got notified — the
  discovery loop silently failed for them. Notify all ACTIVE skill-matched techs;
  verified stays a trust badge, not a notification gate.
- A2: offer_count had two writers (DB trigger from migration 090 + the API),
  double-counting every fresh offer. Migration 100 drops the trigger fn CASCADE
  (app is now the sole writer; it handles insert/resurrect/withdraw) and
  reconciles existing counts; the offers POST now wraps the offer write + count
  bump in one transaction. Also fixes dev/prod parity (dev push has no triggers).
- A3: onboarding checklist linked to the non-existent /dashboard/repairer (404)
  → /dashboard/techniker.
- A4: repairer_profiles.profile_tier defaulted to 'professional' (opposite of the
  self-serve community model) → default 'community' (migration + schema).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-29 08:38:06 +02:00
Mao NakamotoandClaude Opus 4.8 4cd02c10a1 feat(i18n): complete es/it/ja/ko/ru/fr translations + staleness detection
Fills the ~3,500 previously-untranslated keys across the six non-DE locales
(es/it/ja/ko/ru fully; fr completed) — the gaps that made pages render in mixed
German. ICU placeholders and plural structures preserved (verified: zero
placeholder mismatches per locale); brand/product names kept verbatim; array
shapes unchanged (array-parity gate green); all translated pages render 200.

Adds a staleness detector (scripts/i18n-stale.mjs + messages/_source-baseline.json):
records a hash of the DE source each translation was made from, and flags
translations whose DE source later changed — catching the "locale shows the old
copy" class that nothing previously detected (e.g. the stale RU homepage CTA).
Workflow: edit DE → `npm run i18n:stale` lists what drifted → re-translate →
`npm run i18n:stale-update <locale>`. Wired into `npm run compliance`.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-28 06:46:52 +02:00
Mao NakamotoandClaude Opus 4.8 4f0455ba7a fix(i18n): remove stale hardcoded email from homepage CTA (6 locales)
home.finalCta.note in fr/es/it/ja/ko/ru still held an OLD version of the note
with a hardcoded, wrong email ("…napišite nam — info@revamp-it.ch"), while DE
was rewritten to "Geräte spenden bleibt möglich unter Mitmachen." The key wasn't
missing (so DE fallback never kicked in) — it had drifted. Updated all six to the
current meaning. Org contact data (the real address is empfang@revamp-it.ch in
org.ts) must never be baked into a translated string.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 20:47:12 +02:00
Mao NakamotoandClaude Opus 4.8 5801a38b23 refactor(services): dedupe the 3 bespoke services to a single source
hardware-recycling, linux-open-source and web-design-development were each
defined three times — a bespoke static page (the only one that renders, since
literal route segments shadow the [service] dynamic route), a service_types DB
row, and a servicePresentation entry. The DB row + presentation entry were dead:
getAllServiceSlugs() generated permanently-shadowed [service] routes for them,
and editing them changed nothing visible (a content trap).

- Migration 099 soft-deactivates the 3 service_types rows (is_active=false).
  Deactivate, not DELETE: service_appointments cascades on delete, so this
  preserves history, is reversible, and drops them from getAllServiceSlugsFromDb
  (which filters is_active=true).
- Removed the 3 servicePresentation entries (and now-dangling icon imports), so
  they no longer feed getAllServiceSlugs either.
- Dropped the misleading `slug` on linuxOpenSource in SERVICE_CONFIGS — it
  advertised online booking that the static page never offered.

The 3 services now live exactly once (their static page). Template services
(computer-repair-upgrades, data-recovery-transfer) are untouched.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-27 19:48:41 +02:00
Mao Nakamoto 9f73fd44da Harden selfhost release upload 2026-06-27 09:35:01 +02:00
Mao NakamotoandCursor 0a4bc822bc feat(hr): talent lifecycle — vacancies, applications, /karriere, hire bridge
Adds end-to-end HR pipeline from public job postings through admin review to
team_profiles on hire, with migrations, E2E journey, and runbook docs.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-26 09:01:30 +02:00
Mao NakamotoandCursor 58d80de1ca feat(e2e): CMS blog journey + IT-Hilfe rate-limit bypass for E2E accounts
Blog draft → publish → public view journey; exempt known prod test emails from IT-Hilfe create rate limit so inventory can run all journeys back-to-back.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 19:30:53 +02:00
Mao NakamotoandCursor 6146b2e830 feat(e2e): admin decisions staff journey (create → vote → close)
Deterministic sense_check flow with absolute quorum 1; wired into prod inventory script and feature inventory (#98, #99).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 19:08:48 +02:00
Mao NakamotoandCursor 672807fbdb feat(e2e): admin protocols staff journey (JSON import → finalize)
Exercise create, process-notes JSON import, review UI, and finalize without
depending on LLM availability on prod.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 18:24:15 +02:00
Mao NakamotoandCursor a83f7ef8ef feat(e2e): admin tasks staff journey (create → complete)
Add API + UI round-trip for one-time tasks and wire into prod inventory script.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 18:14:16 +02:00
Mao NakamotoandCursor 55ced0a326 feat(e2e): intake pipeline staff journey + fix published detail crash
Add admin create → checklist gate → publish E2E and coerce selling_price_chf
before toFixed so published intake detail no longer hits the error boundary.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:58:04 +02:00
Mao NakamotoandCursor 56343c3104 feat(e2e): timecard + preferred techniker journeys, dynamic IDs
Normalize Postgres TIME to HH:MM on timecard API reads so resubmit no longer
400s. Align preferred-technician selection with community visibility SSOT.
Add prod E2E for timecards, IT-Hilfe preferred flow, and richer dynamic
route discovery (orders, sellers, admin detail pages).

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 17:23:52 +02:00
Mao NakamotoandCursor 520e709256 fix(ci): track apply-migrations-ci.sh (was gitignored)
The migration drift job referenced a script excluded by *.sh; add an
exception so CI can replay migrations on fresh pgvector Postgres.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 16:22:16 +02:00
Mao NakamotoandCursor 199e686351 feat(e2e,ci): workshop proposal journey + migration drift gate
Add dual-persona E2E for workshop propose/approve/reject (#61–62) and wire it
into post-deploy inventory. CI now replays all migrations on pgvector Postgres
with idempotent guards so fresh-DB apply matches prod evolution.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 16:10:39 +02:00
Mao NakamotoandCursor 67531fe8c0 feat(e2e): Phase 4 cleanup, Payrexx SSOT, workshops + service journeys
Community technicians are public when active; Techniker terminology SSOT;
dynamic ID discovery and empty-state fallbacks; Payrexx setup doc; dual-persona
E2E for workshops registration and service appointment assign flow.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 15:37:07 +02:00
Mao NakamotoandCursor 7d7e7fa5ed test(e2e): marketplace checkout dual-persona journey
User lists, admin checks out; full Payrexx flow when configured, otherwise
verifies checkout UI + own-listing guard. Shared api-csrf helper extracted.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 14:24:15 +02:00
Mao NakamotoandCursor d5d09b1ad7 test(e2e): IT-Hilfe dual-persona journey + expanded route matrix
Admin creates request, user techniker offers/completes, admin accepts/reviews.
Post-deploy and CI inventory now include journey; add service repair and
upcycling routes to the inventory matrix.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 13:39:57 +02:00
Mao NakamotoandCursor d587644aa6 ci(deploy): run dual-persona inventory after every prod deploy
Post-deploy job hits 186 routes as user + admin when E2E passwords are
in GitHub secrets; CI also runs optional prod inventory on PRs/main.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 13:28:59 +02:00
Mao NakamotoandCursor e4411bfd4f fix(db): Hetzner-only DATABASE_URL SSOT and user/admin E2E smoke
Retire cloud DB and AUTH_DB_* split in code, env examples, and docs so
local dev uses Docker Postgres and prod ops use the Hetzner tunnel pattern.
Add Playwright user-admin-flows spec with locale-aware auth helper.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 13:04:46 +02:00
Mao NakamotoandCursor f2828b137d fix(auth): unblock unverified accounts and surface password-reset email failures
Password reset now verifies email; register resumes unverified accounts;
forgot-password returns 503 when SMTP fails for known users. Adds ops
unlock script, IT-Hilfe E2E refresh, and clearer login recovery UX.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 11:39:04 +02:00
Mao NakamotoandCursor 2f5fbdd4b7 feat: timecard approver notifications, href fixes, and Phase 4 E2E smoke
Notify staff on timecard submit and submitters on review; fix TIME HH:MM
submit validation and membership/marketplace bell deep links; add feature
inventory SSOT and Playwright smoke tests for appointments and notifications.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-25 10:58:36 +02:00
Mao NakamotoandCursor 5184b0cca0 feat(it-hilfe): preferred technician, browse filters, and technician SSOT cleanup
Unify technician profiles on repairer_profiles with backfill migration 095,
add completeness banner and owner preferred-technician sidebar, extend browse
filters (skill, service type, match my skills), and return 410 Gone for legacy
list APIs pointing callers to /api/technicians and successor routes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-23 21:09:23 +02:00
Mao NakamotoandClaude Opus 4.8 4417319789 chore: remove dead Vercel deploy artifacts
Vercel is retired (deploys run via GitHub Actions → Hetzner self-host). Removed
the now-dead Vercel deploy cluster: vercel.json, public/vercel.svg,
scripts/{add-vercel-env,deploy-to-vercel}.sh, and the whole tools/deployment/
dir (deploy.sh + its trigger/keybind/ship wrappers, all funneling into the
Vercel CLI deploy). Dropped the package.json deploy:vercel and setup-deploy
scripts that pointed into it. The 4 crons vercel.json defined are now systemd
timers on the box (previous commit). Nothing in CI/husky/the self-host deploy
referenced any of these.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 04:01:30 +02:00
Mao NakamotoandClaude Opus 4.8 84959214e4 feat(ops): restore the 4 Vercel crons as systemd timers (+ CRON_SECRET)
Retiring Vercel silently killed its 4 cron jobs (close-decisions,
close-it-hilfe-requests, prune-audit-log, wake-recurring-tasks) — nothing was
running them on the box. Re-created them as systemd timers (UTC schedules
matching the old vercel.json) driven by run-cron.sh, which calls the local
/api/cron/* endpoints with Authorization: Bearer $CRON_SECRET and fails non-zero
on any non-200. Also generated + set CRON_SECRET on the box (it was unset, so the
endpoints were publicly triggerable; now they return 401 without the bearer).
All four verified: HTTP 200 end-to-end. Docs in scripts/ops/README.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 04:01:29 +02:00
Mao NakamotoandClaude Opus 4.8 3c37586e25 feat(ops): nightly off-box DB + uploads backup to R2 (revampit-backups)
Prod Postgres lives only on the Hetzner box since Neon was retired, so this is
the single copy's safety net. pg_dump (custom format, as the postgres superuser
via peer auth — the app role lacks USAGE on the drizzle schema) + a tar of the
local uploads dir are pushed to the PRIVATE R2 bucket revampit-backups with
30-day retention. Reuses the app's bundled @aws-sdk and the same S3_* creds
already in app/.env (one R2 token covers all buckets) — nothing extra to
configure. systemd timer runs it nightly at 03:30 UTC; verified end-to-end.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 03:19:26 +02:00
Mao NakamotoandClaude Opus 4.8 ee14bc40e0 fix(storage): durable self-hosted uploads fallback + persistent dir
Prod image uploads were broken: the local-fs path was gated to dev only and S3
was never configured, so uploads returned an error in production. Make local-fs
the universal fallback (writes to public/uploads), and have the deploy symlink
each release's public/uploads → a persistent /opt/revampit/uploads store so
images survive deploys and are served by Next at /uploads/*.

Provider-agnostic: setting S3_* (R2/Hetzner/any S3) switches to object storage
with zero code change; absent S3_*, it falls back to this durable local store.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 01:47:24 +02:00
Mao NakamotoandClaude Opus 4.8 f80cb807e3 fix(devops): auto-apply migrations to prod on deploy + correct DB docs
Root-cause fix for prod schema drift. Prod runs its OWN Postgres on the Hetzner
box (localhost/revampit), NOT Neon — but migrations were only ever applied to
the dev Neon DB, so prod sat at 087 while the repo was at 091 and cart (089),
the IT-Hilfe trigger (090) and time-off (091) were 500ing in production.

- selfhost-deploy-revampit.sh now applies any not-yet-recorded
  scripts/db/migrations/*.sql to the prod DB (in a transaction, ON_ERROR_STOP)
  BEFORE activating the release, and aborts the deploy if one fails. Both deploy
  paths (local pre-push hook + GitHub Actions) use this script, so drift can't
  recur. The 4 missing migrations were applied to prod manually as the hotfix.
- .claude/CLAUDE.md: corrected the stale "this project uses Neon" section —
  prod = self-hosted Hetzner Postgres, dev = Neon, and auth is still mid-cutover
  on Neon (documented so it gets finished).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 17:36:04 +02:00
Mao NakamotoandClaude Opus 4.8 43cc49c489 feat(db): time_off_requests table (091) — applied to Neon
Schema for the upcoming self-service time-off request + approval cycle.
Recorded in schema_migrations; the table already exists on Neon so repo and
live DB stay in sync. Feature code (API/UI) lands in a follow-up.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 15:17:14 +02:00
Mao NakamotoandClaude Opus 4.8 924996a25c fix(images): persist uploads across deploys + backend-agnostic product image cleanup
Image-management investigation found two issues:
- Deploy orphaned ALL user uploads: /api/uploads writes to public/uploads at
  runtime, but the deploy replaces the whole app dir each release → every
  uploaded listing photo/avatar/IT-Hilfe image was lost on the next deploy.
  Copy public/uploads forward into each new release before the swap. INTERIM
  durability fix until images move to S3/object storage (needs Hetzner keys).
- updateProductImage cleaned up old images only if the URL matched the dead
  blob.vercel-storage.com host (Vercel Blob is gone). Replace with a
  backend-agnostic deleteImage() call guarded on a differing URL.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 10:28:02 +02:00
Mao NakamotoandClaude Opus 4.8 1baa623610 fix(it-hilfe): repair offer-count trigger that broke ALL offer submissions (migration 090)
CRITICAL prod bug found via E2E: submitting an offer on a repair request always
500'd. The trigger function update_peer_repair_offer_count() (fires on every
it_hilfe_offers INSERT/DELETE) still referenced peer_repair_requests — the table
was renamed to it_hilfe_requests but the function wasn't updated, so every offer
insert failed with "relation peer_repair_requests does not exist". The entire
"offer help on a repair request" flow was unusable.

Migration 090 repoints the function at it_hilfe_requests (applied to prod).
Verified end-to-end: request → offer → accept (conversation created) → complete
→ review (helper-rating update now runs cleanly via the earlier helper_id fix).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-18 09:43:17 +02:00