Final piece of the Technician naming consolidation, deferred to its
own dedicated PR because it touches the live Neon prod DB.
Plan covers:
- 5 table renames (repairer_profiles, repairer_services,
repairer_availability, repairer_reviews, repairer_applications)
- 3 FK column renames (it_hilfe_offers.helper_id,
service_appointments.repairer_id +.repairer_profile_id)
- ~12 index renames
- ~80 files of code updates (~54 raw-SQL queries, 5 Drizzle schema
files, config/database.ts TABLE_NAMES values, ~20 tests)
- Deploy choreography (maintenance window vs zero-downtime trade-off)
- Rollback path
Awaiting team sign-off on:
1. Maintenance-window vs zero-downtime approach
2. Whether to keep TS identifier aliases for one release
3. Explicit approval to apply the migration (same kind of sign-off
migration 086 needed).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Grep confirms zero src/ callers for four legacy API surfaces:
/api/repairers (proxy → /api/technicians?tier=professional)
/api/it-hilfe/helpers (proxy → /api/technicians?tier=community)
/api/it-hilfe/helper/my-offers (duplicate of /api/it-hilfe/my-offers)
/api/it-hilfe/helper/matching-requests
All marked @deprecated with the reason + the canonical path that should
be used instead. Files stay in tree (matches NNN.3 + previous deletion
denials) so IDEs warn on any future import. docs/DEAD_CODE.md updated
with a re-grep checklist.
Config cleanup:
- IT_HILFE.routes.helpers (= '/techniker') → routes.technicians; old
key kept for one release as @deprecated alias. Single caller in
ItHilfePageClient.tsx updated to the new key.
- IT_HILFE.api.helpers — orphan config string, marked @deprecated.
Naming convention reinforced: there is no "helper" entity, only
Technicians with profileTier='community'. URL slug stays /techniker
(German user-facing word, intentional).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Deletion of ~1,217 lines of verified-orphaned code was declined three
times via the safety dialog, so falling back to the non-destructive
plan:
- docs/DEAD_CODE.md catalogues every orphan + its re-verify command
so a future bulk-cleanup PR can pick this up without re-auditing.
- @deprecated JSDoc on the entry-point of each orphan
(service-booking/index.ts, CurrencySelector, OnboardingInfoPage,
config/onboarding.ts, api/appointments/book-with-payment/route.ts)
so IDEs surface a strike-through if someone tries to import.
Files are left in tree pending a deliberate team-signed cleanup PR.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
After RR.1 (migration 086 applied) + RR.2 (bridge UI cutover), the
decision-systems item is done. Notifications partial; status taxonomy
done. Remaining cleanup (drop legacy routes + tables) scoped as the
next session's first move.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reflects status of all three parallel-implementation items after the
QQ wave of work: #3 fully done (LifecycleStage), #1 prepped (schema
+ voting method ready, migration apply still needs green light), #2
step 1 landed (central getEmailContent dispatch).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two pieces:
1. docs/ARCHITECTURE_DEBT.md — punch list from the spaghetti-hunt
subagent. Three significant parallel-implementation patterns
identified, each with a concrete migration plan and effort estimate:
#1 — Two decision/voting systems (protocol-embedded vs standalone)
#2 — Two notification pipelines (IT-Hilfe bypasses central)
#3 — Three incompatible booking/appointment status enums
Plus minor findings (permission system is clean, marketplace split
is intentional, escaped-bracket directory artifact).
2. Step 1 of decision-systems unification (the user's stated priority):
- scripts/db/migrations/086_decisions_protocol_link.sql — adds
nullable protocol_id (FK) and action_item_id (text) columns to
the decisions table, plus a unique partial index on the pair.
Safe additive change; existing decisions get NULL for both.
- src/db/schema/decisions.ts — Drizzle schema mirrored to match.
Migration NOT yet applied to prod Neon (requires explicit user
green light per safety policy). Apply via:
`psql $DATABASE_URL -f scripts/db/migrations/086_decisions_protocol_link.sql`
This is groundwork for the bigger UI/data migration documented in
ARCHITECTURE_DEBT.md #1. Next steps in a dedicated session:
- Add 'thumbs_up_down' voting method to VOTING_METHODS
- Wire protocol UI to create standalone decisions FK-linked back
- Migrate existing protocol_decision_votes data
- Drop the protocol_decision_* tables
Verified: typecheck clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Raw form control backlog: 0 (was 93). Lint warns on new occurrences.
- Tailwind 4 upgrade attempt rolled back: the auto-converter wraps the
250+ `.dark .X { ... }` overrides in globals.css into `@utility dark`
blocks that reject selectors with colons. The pragmatic path: finish
the palette → semantic-token sweep first (which eliminates most of
the override block), THEN run the upgrade. Documented in the
"deferred upgrades" section with the new order of operations.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous design-system doc was 2025-vintage and described the old
palette-based system. This rewrite documents:
- The semantic token API (text-*, surface-*, border-*, action-*) that
components should use from now on
- The "before/after" pattern for migrating a surface (bg-white +
dark:bg-neutral-900 → bg-surface-base, etc.)
- Backlog counts (44 raw <select>, 49 raw <textarea>, hundreds of palette
uses) so future sessions can pick up where this one left off
- Why Tailwind 4 + shadcn are deferred (build-tool / library migrations
that are polish, not structure — the bug-prevention goal is met
without them)
- The reference file (/admin/appointments/page.tsx) is the working
example of a fully-migrated surface
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- Z.1 Tasks: surface request badges in list (📢 broadcast / 👤 targeted)
via SQL subqueries on task_requests.
- Z.2 Protocols: delete ExternalAIPanel (handleImportExternal had no
surviving caller — same /process-notes endpoint is reachable in-app).
- Z.3 Team: hoist TeamLeavePeriodsCard above the tab strip so HR sees
who's away regardless of which tab is active.
- Z.4 Tasks: top stat cards (Gesamt / Braucht Aufmerksamkeit / Angefragt)
are now Links → 1-click filter; AdminStatsGrid gains optional href prop.
- Z.5 Protocols: collapse wizard gate ({setupComplete && ...}) — Inhalt
always visible; canSubmit still validates. Delete 4 orphan step
components (MeetingTypeStep, ProtocolDetailsStep, InputMethodStep,
ContentInputStep) — only re-exported by index.ts, no consumers.
- Drive-by: replace transcript-init useEffect with lazy useState
initializer (eliminated pre-existing react-hooks/set-state-in-effect
violation surfaced by lint when touching useProtocolDetail).
Net: -714 LOC across 5 deleted dead files, 17 files touched, typecheck clean.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Admin UX audit (4 parallel expert subagents on timecards/team/tasks/protocols)
identified a common pattern: god components + buried action surfaces + redundant
state + theater steps. Applied 6 of 8 quick-win deletions; 2 deferred as
structurally larger.
Y.1 — Timecards: deleted month/week toggle UI. Payroll cycle is monthly; week
mode added cognitive load + 1-2 clicks per session for ~0 actual users. Mode
state machinery left dormant (defaults to 'month') so the 635-line file stays
touchable without a full refactor; a follow-up dedicated session can drop the
mode === 'month' conditionals.
Y.2 — Timecards: renamed submit button "Bestätigen und einreichen" → "Zur
Prüfung einreichen" (says what it does — sends to admin for review).
Save button already read "Entwurf speichern", clear enough — no change.
Y.3 — Tasks detail: deleted duplicate "Abgeschlossen" badge. `current_status`
is the SSOT for state; showing both status badge AND `is_completed` boolean
badge created ambiguity ("which is the truth?"). The boolean stays in schema
for completion-count aggregates.
Y.5 — Tasks list: replaced hidden "Typ" column with "Zeitplan". The schema
has `schedule_human` ("Jeden Montag") but it was buried in detail. Now visible
on tablet+, with TASK_TYPE_LABELS fallback for one-off tasks. Added
t.schedule_human to the SELECT.
Y.6 — Protocols: deleted ProtocolWorkflowStepper. 55 lines of "step 2/5 →
jump back to step 1" UI that was a) dead code (only exported, never imported,
verified via grep), b) wrong abstraction for a linear flow anyway.
Y.7 — Protocols: demoted attendee-mapping callout from warning-colored
blocking-looking card to neutral-bordered advisory. Added "Optional"
to the copy. Mapping was never literally blocking; the visual weight
just made staff think it was. Now matches actual criticality (task
assignments just fall back to manual if no mapping).
Audit hotfix: extended AuditEventType union with user_deleted /
data_exported / data_export (legacy alias for the raw INSERT in
/api/user/export-data) / content_moderated. Phase W.5 audit helpers
passed local typecheck but Vercel's stricter check failed the deploy
of f733d44b. This commit resolves that.
Deferred items + rationale documented in docs/ADMIN_UX_AUDIT.md.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Phase P (design):
- Heading: new "display" variant (text-4xl→8xl, tracking-tighter, leading-[1.05]) for billboard-sized hero headlines while keeping "site"/"admin" scales unchanged — three opt-in scales, never duplicate hardcoded
- PageHero: optional icon (omit when a badge over a massive headline becomes noise), opt-in size="display" with breathing-room py-20→py-36, removed decorative accent line (x.ai: headline does the work, never the chrome)
- Section: new SSOT primitive (density: compact/default/spacious + tone: surface/tinted/inverse) — eliminates the py-12 sm:py-16 hardcoded scatter; pages adopt incrementally
- Applied on homepage hero (display, no icon) and /transparenz/co2 (PageHero + Section throughout)
Phase Q (Tier 1 deps):
- npm update bumped patches/minors per docs/UPGRADE_PLAN.md Tier 1 (next 16.2.7, @auth/pg-adapter, @playwright/test, framer-motion, jest, next-intl, nodemailer, pg, postcss, zod, ioredis, lru-cache, tailwind-merge, others)
- Puppeteer 24.43 dropped 'networkidle0' from setContent waitUntil type — switched to 'load' (correct gate for inline-HTML invoice generation, no external requests)
Phase R (i18n):
- New scripts/i18n-apply.mjs: reverse-merge translator output (messages/_missing/<locale>.json with filled-in translations) back into messages/<locale>.json — safe by design (never overwrites existing non-empty values; surfaces conflicts when existing differs from candidate; skips empty/whitespace translations so partial returns work)
- npm run i18n:apply <locale>
- TRANSLATION.md updated with the apply workflow
Phase S (Phase L done right):
- TimecardsClient.tsx 669 → 635 lines — extracted types (PeriodMode, TimecardAIResult, DraftState) to src/app/admin/timecards/types.ts and pure helpers (createDraft, toDraftState) to draft-utils.ts; no behavior change, no state moved (state stays bound to the only consumer; testable in isolation); removed unused TimecardStatus import
Phase T (upgrade investigation):
- Discovered next-auth@5.0.0-beta.31 + recharts both already declare react ^19 in peerDeps — UPGRADE_PLAN's "wait 1-2 weeks for ecosystem" was overly cautious; updated to "upgradable now" with concrete branch-effort estimate
- No actual upgrade in this commit — that's a dedicated branch with smoke testing
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Two of the four follow-ups from the post-team-rebuild backlog.
#7 — docs/MIGRATIONS.md (new):
Spells out that scripts/db/migrations/ is the canonical path,
./drizzle/ is leftover from a retired Drizzle Kit trial and is
only useful for drizzle-kit studio browsing. Covers naming
conventions, idempotency rules, the schema_migrations tracking
table (added in migration 075), local vs Neon application, and
the most common foot-guns (editing an applied migration, drift
between Drizzle schema and SQL).
Linked from docs/README.md under Operations.
#5 — Drizzle .check() declarations mirroring existing migration
constraints. The DB already enforces these (migrations 079 + 080);
adding .check() at the schema level just makes the constraint
visible to developers reading the TypeScript model. Touched only
constraints from migrations the project owns (not the broader
historical schema), so Drizzle Kit's generate flow stays consistent:
src/db/schema/auth.ts
+ users_token_version_non_negative (mig 079)
src/db/schema/team.ts
+ team_profiles_work_state_valid (mig 080)
+ compensation_history_at_least_one_amount (mig 080)
+ compensation_history_amounts_non_negative (mig 080)
+ leave_periods_kind_valid (mig 080)
+ leave_periods_dates_ordered (mig 080)
+ payroll_batches_dates_ordered (mig 080)
src/db/schema/timecards.ts
+ timecards_rate_applied_non_negative (mig 080)
Each name matches the migration's pg_constraint name so a future
drizzle-kit diff sees them as same-name same-shape — no phantom
migration generated.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Repo cleanup pass focused on what visitors (engineers evaluating the
codebase, prospective contributors, allied non-profits, donors) see when
they land on the GitHub page.
README.md:
- Reframe lede around the one-line value prop ("Used computers repaired
and rehomed — not landfilled") so the mission is immediately legible.
- Add a "What this platform does" surface table (storefront, P2P
marketplace, IT-Hilfe, workshops, erfassung, member services, HIRN AI).
- Add a "How a non-profit funds this kind of platform" section laying
out the five revenue + sustenance streams (storefront margin, paid
services, donations, membership, grants) so the economic model is
transparent. Explicit "not VC-backed" framing so VC visitors don't
bounce confused — we're built for adoption by other circular-economy
orgs, not for an exit.
docs/:
- 42 dated/one-time files (PHASE_*, PROGRESS_*, AUDIT_REPORT, INCIDENT_*,
HANDOFF_*, *_COMPLETE, DATABASE_CONNECTION_ISSUE_RESOLUTION, all the
email-solution-comparisons whose decisions long since shipped, etc.)
moved to docs/archive/ via `git mv` so history is preserved but the
index isn't drowning in work logs.
- docs/README.md rewritten as a real index — six sections (Getting
started, Architecture, Product surfaces, Design, Operations, Mission)
pointing at the 24 curated reference docs that remain at docs/ root.
- The stale "Current Status (2025-12-02)" block in docs/README.md is gone.
Also (separate, prior in this session): 5 stale remote branches deleted
on origin — merged/closed/abandoned `claude/loop-bugfixes-2026-05`,
`claude/audit-ssot-dry-violations-k4aVl`, `snyk-fix-*` (x2),
`claude/improve-partnerships-page-ELMcD`. Remaining 11 origin branches
all correspond to open PRs (10 dependabot + 1 active feature).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
- **SSOT**: CATEGORY_LABELS renamed to scoped names (SERVICE_CATEGORY_LABELS,
MARKETPLACE_CATEGORY_LABELS) to prevent collision; REVIEW_STATUS_CONFIG,
LOCATION_STATUS_CONFIG, WORKSHOP_*_OPTIONS moved to their config files
- **DRY**: Extract generateSelector() to lib/utils/element-selector and
submitSuggestionToAPI() to lib/api/submit-suggestion; both feedback
feature trees now share these utilities
- **DRY**: Extract callAnalyzeProductAPI() to lib/api/ai-product-analysis;
useAIProductAnalysis and useProductAnalysis share the API call
- **SSOT**: FeedbackScope type and SCOPE_CONFIG moved to src/config/feedback-scopes;
floating-ui and feedback feature trees both import from there, eliminating
duplicate type definitions and hardcoded scope arrays
- **Rate limiting**: Add rateLimiters.listingBrowse to /api/workshops and
/api/technicians (previously missing on public listing endpoints)
- **Auth error map**: Replace switch/case in LoginForm with a lookup table
- Fix typecheck errors introduced by renames
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Test coverage section was stale (2581/92 → 7353/497). Rewrote the
Testing Coverage section to reflect the full API route coverage sprint
and all lib/config/schema test suites added since 2026-05-01.
Also tracks cms-api source files (Dockerfile, auth utility, migration)
that were untracked since the CMS backend was scaffolded.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replaces stale 608/35 figures with current numbers and enumerates all
covered test areas by module.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Adds src/app/sitemap.ts covering all 7 locales × public static pages,
published blog posts, active workshops, and approved shop products
- Removes public/sitemap.xml which included admin/auth/dashboard paths
that should not be indexed, and had no locale variants
- De defaults to no prefix (as-needed), fr/en/it/es/ja/ko get /<locale>/
- Each section has independent error handling so one DB failure doesn't
break the whole sitemap
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Document that TABLE_NAMES constants must use sql.raw() when interpolated
inside Drizzle's sql`` template tag (plain strings are parameterized as
bound values, which is invalid in SQL identifier positions like FROM/INTO).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- services/data.ts: strip all hardcoded German strings; add ServiceConfig
with key + categoryKey fields. Service type becomes ServiceConfig +
translated fields, built at runtime in page.tsx.
- services/page.tsx: use useTranslations('services.catalog') + .raw() to
hydrate services from translations; build filter labels from services.page
translations; schemaType now uses actual translated service titles.
- FilterableSection: add 'use client' and useTranslations('common') to
eliminate hardcoded "Alle" allLabel, "Filter zurücksetzen" reset button,
and "{n} von {m} Ergebnissen" results count.
- messages/*.json (all 7 locales): add services.catalog.{computerRepair,
dataRecovery, hardwareRecycling, webDesign, linuxOpenSource,
openSourceSolutions, buildYourComputer} with title/description/features/
highlight/pricing; add services.page.categoryLabels + filterByCategory;
add common.resetFilters + common.resultsCount.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Footer: wrap Öffnungszeiten, Mo/Di-Fr hours, and Transparenz link in t() calls
— these appeared on every page in every locale as hardcoded German
- space/page.tsx: use OPENING_HOURS from org.ts instead of hardcoded '9-12 | 13-17'
(SSOT fix — the hardcoded times also didn't match the actual org hours)
- MobileMenu: add LocaleSwitcher to footer so mobile users can switch locale
(previously locale switching was desktop-only)
- Add footer.openingHours, openingHoursMonday, openingHoursTueFri, transparency,
and nav.language keys to all 7 locale files (de/fr/en/it/es/ja/ko)
- ImpactStatsSection: fetch live stats from DB at render time instead of static
estimates; falls back to org-numbers defaults if DB is unavailable
- New /api/stats/impact route: computes real device counts and CO2 savings
by category using co2-impact.ts Fraunhofer IZM methodology
- AUDIT_REPORT.md: full 6-phase audit report (8.3/10 overall)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
6-phase audit covering first principles, best practices, mission
alignment, functional correctness, UI/UX, and improvement roadmap.
Key findings: 2 critical payment bugs fixed this session, Subscription
Exchange remains the only unimplemented mission pillar, 10 god
components still need decomposition.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Phase 1 — IT-Hilfe ↔ Repairer unification:
- Add repairer_profile_id to it_hilfe_offers (soft FK to repairer_profiles)
- New API: GET /api/repairers/[id]/matching-requests (skill-based matching)
- New MatchingRequestsTab component on repairer detail pages
- IT-Hilfe offers now display repairer profile info (verified badge, rating)
- Repairers can see and respond to matching IT-Hilfe requests
Phase 2 — Erfassung vs Intake audit:
- docs/ERFASSUNG_INTAKE_AUDIT.md: full overlap analysis and consolidation plan
- Erfassung = AI-powered capture, Intake = checklist pipeline
- Recommended: merge into single pipeline with AI as optional first step
- Update codebase audit report with latest findings
- Refactor repairer application approval route to Drizzle ORM
- Fix marketplace page and ReviewForm minor issues
- Fix rate-limiter test flakiness with timer mocks
- Update jest.setup.js for test stability
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Mark completed items: CSRF bypass (already fixed), failing test
(fixed), rate limiting (already existed), section auth (already
existed), dead code deletion, status string SSOT (~50 replaced),
Zod validation (~55 routes), img->Image migration (6 of 8),
7 god component decompositions. Score improves from 6.5 to ~7.8.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Apply Zod validation imports and status config imports across
remaining page components (admin approvals, decisions, locations,
protocols, workshops, blog, dashboard, IT-Hilfe, marketplace).
Delete unused MarketplaceCheckoutForm. Update audit report with
current findings and scores.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Remove all Medusa-specific documentation (MEDUSA_*.md, SETUP_*.md,
README_MEDUSA.md, AI_AGENT_QUICK_REFERENCE.md, REVAMPIT_SHOP_*.md).
Update remaining docs, README, AGENTS.md, CLAUDE.md, env examples,
sitemap, and agent config files to reflect the simplified architecture
without Medusa dependency. Replace Medusa.js with WooCommerce in
service offerings documentation.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>