Commit Graph
92 Commits
Author SHA1 Message Date
Mao NakamotoandClaude Opus 4.7 689ada4d6a docs(refactor): QQQ.5 DB rename plan — repairer_* → technician_* (planning only)
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>
2026-06-08 07:29:51 +02:00
Mao NakamotoandClaude Opus 4.7 154860ca8f refactor(it-hilfe): deprecate proxy routes + rename routes.helpers (QQQ.3)
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>
2026-06-08 07:21:22 +02:00
Mao NakamotoandClaude Opus 4.7 4bee1fbb49 docs(dead-code): inventory orphans + @deprecated markers (NNN.3)
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>
2026-06-07 16:01:36 +02:00
Mao NakamotoandClaude Opus 4.7 72cce98262 docs: ARCHITECTURE_DEBT.md — mark #1 done, #2 partial, #3 done
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>
2026-06-05 09:25:03 +02:00
Mao NakamotoandClaude Opus 4.7 9f3cc06561 docs: update ARCHITECTURE_DEBT.md with QQ session progress
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>
2026-06-04 23:42:01 +02:00
Mao NakamotoandClaude Opus 4.7 1b0e771721 docs+schema: architecture-debt roadmap + decisions unification step 1 (JJ)
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>
2026-06-04 13:39:14 +02:00
Mao NakamotoandClaude Opus 4.7 9a9ccfd688 docs(design): update DESIGN_SYSTEM.md with end-of-session state
- 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>
2026-06-04 12:27:32 +02:00
Mao NakamotoandClaude Opus 4.7 13731c5d78 docs(design): rewrite DESIGN_SYSTEM.md with semantic token guide + migration plan
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>
2026-06-04 11:12:10 +02:00
Mao NakamotoandClaude Opus 4.7 96af16602b feat(admin-ux): Phase Z — second batch of Musk-lens cuts
- 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>
2026-06-03 18:51:29 +02:00
Mao Nakamoto a846476cee docs(admin-ux): fill in Phase Y execution log (Edit failed in prior commit due to file-not-read guard) 2026-06-03 18:30:21 +02:00
Mao NakamotoandClaude Opus 4.7 582bf54013 feat(admin-ux): Phase Y quick wins from Musk-lens admin audit + audit-type hotfix
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>
2026-06-03 18:29:17 +02:00
Mao Nakamoto 570e31b352 docs(db-audit): append Phase V+W+X execution log + updated scores (6→8/10) 2026-06-03 18:09:43 +02:00
Mao NakamotoandClaude Opus 4.7 f733d44b83 feat(db): land Phase V+W+X — solve all DB audit items
Phase V (critical, applied to Neon directly):
- 083: bootstrap schema_migrations on Neon + backfill 001-082 (verified absent: SELECT EXISTS returned false; 92 rows now tracked)
- 084: 4 missing performance indexes — notifications(user_id,is_read,created_at DESC), pool_memberships(pool_id,status), inventory_items(status,assigned_to), partial fundraising_foundations(created_at DESC) WHERE NOT archived (67MB largest table, 534ms seq scans → indexed)
- V.3 RECLASSIFIED — no plaintext API keys actually exist in hirn_provider_settings (audit subagent overstated; verified empty); no action needed
- V.4 — 6 test accounts disabled on Neon (renamed to __disabled-<uuid>@disabled.local, cleared staff/super-admin flags, emailVerified=NULL). All 6 lacked verified emails so couldn't log in anyway, but the flags were latent risk.

Phase W (hardening):
- W.1: .github/workflows/ci.yml gains migration-drift-check job — spins postgres:17 container, applies all 91 SQL migrations in version-sort order, asserts table count + tracking row count. Non-blocking advisory (continue-on-error:true) so transient CI hiccups don't gate merges.
- W.2: scripts/db/check-orphans.sh sweeps real-FK + polymorphic-reference + stale-token orphans against the live DB. Live run shows 0 FK orphans (Postgres enforcement holds), 40 fundraising_activity_log polymorphic orphans (under threshold), 135 notifications.related_id (crosses threshold — flagged for human investigation), 3 stale verification_tokens.
- W.3: docs/MONEY_CONVENTION.md — integer-cents canonical, lists every legacy decimal(10,2) column to migrate later, explains float-bug class avoidance.
- W.4: docs/DISASTER_RECOVERY.md — Neon restore step-by-step, RTO<1h / RPO<5min targets, schema verification path, smoke-test checklist, quarterly drill cadence, local backup workflow.
- W.5: New audit helpers logUserDeletion (sync, critical) + logDataExport (sync, warning) + logContentDecision (buffered, info) in src/lib/auth/audit.ts. Wired into admin user-delete route + content-approval route. Export route already self-audits via raw INSERT (left alone — works).
- W.6 RECLASSIFIED — OAuth tokens in accounts table technically plaintext (Auth.js default) but app code never reads them after login (verified via grep). Real exfiltration risk minimal; provider-side revocation available. Documented in audit; encryption deferred to dedicated Auth.js-adapter-override session.

Phase X (nice-to-have quick wins):
- X.1: /api/cron/prune-audit-log + vercel.json cron entry (daily 02:00 UTC). Preserves critical-severity rows forever; prunes info/warning >180 days.
- X.2: Migration 085 — location_approvals trigger preventing UPDATE of decision fields (action/status/notes/required_changes/reviewer_id/reviewed_at). Append-only audit trail. Applied to Neon. subscription_pools.organizationId FK SKIPPED — verified no organization table exists, pools use owner_id (user FK).

Net Neon state after this commit:
  93 migrations tracked, 4 new indexes, 6 test accounts disabled, 1 trigger added.

Audit subagent overstatement pattern observed AGAIN — 3 of the original "critical" findings were overstated (plaintext API keys, subscription_pools FK, OAuth-token urgency). Documented per the audit_subagent_overflag memory pattern.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 18:07:42 +02:00
Mao Nakamoto 105bd89239 docs(db-audit): 4-expert parallel audit synthesized into DATABASE_AUDIT.md — verified findings via live psql (schema_migrations table missing on Neon, 6 test accounts in prod with staff privileges, plaintext API keys in hirn_provider_settings, 3 indexes from migration 074 never landed); overall verdict YELLOW (functional but with concrete debt); 4 critical fixes scoped to next 2-3h session 2026-06-03 17:36:21 +02:00
Mao Nakamoto 4ae037c5fb docs(audit): cleanup pass — clear stale TODOs (i18n-apply was Phase R, Sentry was Phase M); append Phase P–T execution log + 14-file pre-existing react-compiler lint debt note; recorded session patterns in memory (env validation presence-only, design SSOT three-layer, CO₂ credibility traceability, audit-subagent-overflag verification) 2026-06-03 16:39:02 +02:00
Mao NakamotoandClaude Opus 4.7 a3228567d1 feat(design+infra): land Phase P/Q/R/S/T — design refinement (x.ai aesthetic, RevampIT colors); npm tier-1 update; i18n:apply companion; TimecardsClient extraction; upgrade-plan revision
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>
2026-06-03 16:18:55 +02:00
Mao Nakamoto 3beb1cd850 docs(audit): append Phase J–O execution log + DEFERRED note for L (TimecardsClient refactor) 2026-06-03 15:40:41 +02:00
Mao NakamotoandClaude Opus 4.7 36234fb346 feat(mission+infra): land Phase J/M/N/O — surface live impact on /shop + /marketplace via shared <MissionStrip> ("Jeder Kauf hält ein Gerät aus dem Müll" + live devices-rehomed + CO₂-avoided stat with methodology link, server-component reusing the same fetchImpactStats helper as ImpactStatsSection so the homepage stat / methodology page / commerce strip never drift apart); wire Sentry inert-until-DSN (src/instrumentation.ts + sentry.server.config.ts + sentry.edge.config.ts; @sentry/nextjs installed; SENTRY_DSN added to src/env.ts schema as optional; zero bundle impact / zero startup cost when DSN absent); generate i18n translator inventory (npm run i18n:missing emits per-locale messages/_missing/<locale>.json with the 1334 missing keys broken down by namespace; docs/TRANSLATION.md explains workflow, priority queue, and why machine-translation is the wrong tool); document dependency upgrade plan (docs/UPGRADE_PLAN.md — Tier 1 safe-today, Tier 2 React 19 + TS 6 + ESLint 10 dedicated branch, Tier 3 Tailwind 4 wait-for-ecosystem); remove obsolete @types/puppeteer (puppeteer 24+ ships own types); explicitly deferred TimecardsClient refactor (Phase L) — 669-line component with no tests, low mission value, refactor risk outweighs benefit until test coverage exists
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 15:39:46 +02:00
Mao NakamotoandClaude Opus 4.7 39e3d72629 feat(audit): land Phase A-I single-session audit fixes — security (npm audit fix), a11y (nested-main, modal focus, mega-menu keyboard), perf (10 MB image compression), credibility (CO2 methodology page + sourced numbers + badge on cards), projects feature (apply migration 082 to Neon; 1 project + 7 needs seeded), production safety (Zod env validation + Husky pre-commit), and the public-projects ↔ task-projects bridge (projects/project_needs/project_contributions schema + APIs + public+admin UI + email templates); resolves CVE-2024-7305 (tmp HIGH) and the documented email-swallow regressions in repairers/book + appointments; fixes ThemeToggle hydration mismatch, homepage tablet card grid, Über-uns nav wrap, duplicate newsletter signup, MARKETPLACE_STATUS.SOLD reference, DeviceJourney type errors + missing i18n keys, umlaut-linter false-positive exclusions; adds JA+KO legal partials so the page renders; updates AUDIT_REPORT.md with execution log
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-03 14:30:02 +02:00
g-but ffa67dd3ae refactor(design-system): replace decorative gradients with semantic solids per CLAUDE.md; extend ERROR_MESSAGES SSOT; DRY donate tiers + cert error handling 2026-06-01 23:25:24 +02:00
g-butandClaude Opus 4.7 0de78dab83 docs+refactor: canonical migration path doc (#7) + Drizzle .check() sweep (#5)
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>
2026-05-29 10:50:10 +02:00
g-butandClaude Opus 4.7 2a0829efc3 docs: clean repo presentation — README rewrite + archive 42 stale doc files
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>
2026-05-28 08:12:16 +02:00
g-butandClaude Sonnet 4.6 5c1edbbd61 refactor(ssot/dry): eliminate SSOT/DRY violations across config, hooks, and features
- **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>
2026-05-11 11:17:52 +02:00
g-butandClaude Sonnet 4.6 b58d46c45d docs(audit): update CODE_AUDIT.md + track cms-api source files
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>
2026-05-03 04:05:07 +02:00
g-butandClaude Sonnet 4.6 43f159c24d docs(audit): record shop product SEO + item_uuid bug fixes (2026-05-02)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 12:54:04 +02:00
g-butandClaude Sonnet 4.6 256cacb0b7 docs(audit): update test count to 2581/92, add email template + SEO metadata entries
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 11:46:31 +02:00
g-butandClaude Sonnet 4.6 2321bfeb95 docs(audit): update test coverage count to 2248 tests / 78 suites
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>
2026-04-24 10:25:03 +02:00
g-butandClaude Sonnet 4.6 759d1f0b6e docs(audit): update test count to 608 across 35 suites
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 07:52:09 +02:00
g-butandClaude Sonnet 4.6 16f55ad147 docs(audit): update test count to 474 across 30 suites
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 07:35:36 +02:00
g-butandClaude Sonnet 4.6 124e0496e5 docs(audit): update test count to 455 across 29 suites
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 06:48:47 +02:00
g-butandClaude Sonnet 4.6 a355177265 perf(api): extend Cache-Control to remaining public GET endpoints
Applies apiSuccessCached to 8 more public read-only endpoints missed
in the previous pass:

- stats/community (300s/60s) — public counts, ISR already in place
- stats/impact (3600s/300s) — yearly CO2/device data, ISR already in place
- workshops/[slug]/instances (30s/15s) — participant count changes on registration
- workshops/[slug]/reviews (60s/30s) — reviews change infrequently
- it-hilfe/helpers/[id] (60s/30s) — semi-static helper profiles
- it-hilfe/requests/[id]/matches (30s/15s) — matching helpers update with profiles
- repairers/[id]/matching-requests (30s/15s) — open requests change frequently
- pools GET (30s/15s) — spotsLeft changes when members join/leave

Stats routes already had Next.js ISR (revalidate) but lacked HTTP
Cache-Control headers for CDN/edge caching.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 05:06:09 +02:00
g-butandClaude Sonnet 4.6 453b29eae7 perf(api): add Cache-Control headers to all public GET endpoints
Applies apiSuccessCached to 11 public read-only endpoints to reduce
Neon PostgreSQL cold-start load and improve CDN/edge cache hit rates.

TTL tiers by data volatility:
- 3600s: financials (yearly data)
- 300s: org-numbers, services, blog/categories (stable)
- 60s: technicians list+detail, sellers/[id], repairers ratings (semi-static)
- 30s: shop inventory list+detail, listings browse+similar (stock levels)
- 15s: search/listings, repairers availability (time-sensitive)

Legacy proxies (repairers, it-hilfe/helpers) now forward the
Cache-Control header from the technicians endpoint they wrap.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 04:42:09 +02:00
g-butandClaude Sonnet 4.6 e39a25c3e6 feat(seo): replace static sitemap with dynamic Next.js sitemap
- 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>
2026-04-24 03:55:08 +02:00
g-butandClaude Sonnet 4.6 9b17088e45 docs(audit): mark duplicate count queries as FIXED in CODE_AUDIT
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 03:43:15 +02:00
g-butandClaude Sonnet 4.6 97adb5f768 docs(audit): update CODE_AUDIT with 2026-04-25 session fixes
Records i18n gap closure, pool status SSOT, and DECISION_STATUS/REQUEST_STATUSES fixes.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 03:18:36 +02:00
g-butandClaude Sonnet 4.6 1dc0666755 docs(audit): record sql.raw() pattern requirement for Drizzle sql templates
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>
2026-04-24 02:25:21 +02:00
g-butandClaude Sonnet 4.6 632ecbb7ca docs: update CODE_AUDIT.md to current state (2026-04-24)
Test count 312→354; remove ghost img TODO (BlogFeaturedGrid already uses
next/image); clarify blob URL img tags are intentional; add itHilfe
Phase 2 note; add i18n pass to fix history.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-24 01:11:48 +02:00
g-butandClaude Sonnet 4.6 d56dabc13a fix(i18n): wire services catalog to translations across all 7 locales
- 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>
2026-04-22 16:03:46 +02:00
g-butandClaude Sonnet 4.6 dc1f8fae24 fix(audit): P0 fixes — i18n gaps, mobile locale switcher, live impact metrics
- 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>
2026-04-21 11:28:23 +02:00
g-butandClaude Opus 4.6 4b553e8692 docs: comprehensive codebase audit report (8/10, up from 7.5)
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>
2026-04-02 10:44:13 +02:00
g-butandClaude Opus 4.6 35b9991162 docs: update audit report with refactoring progress
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-01 13:39:14 +02:00
G c88833ff0b fix: centralize org data (SSOT), remove dead code, fix violations (#125)
- Create src/config/org.ts as SSOT for all org data (name, addresses, phone, email, hours, URLs)
- Fix wrong address (Hohlstrasse → Birmensdorferstrasse), phone, founding year (2009 → 2003)
- Standardize org name to Revamp-IT everywhere
- Delete entire cms-api/ directory (disabled, never called)
- Remove 11 unused npm deps, add missing clsx
- Delete 6 orphaned test scripts, dead CMS stubs
- Remove unused ROLES, deprecated exports
- Migrate requireRole() → requirePermission()
- Update docs (CLAUDE.md, README, SHARED_CONTEXT, MISSION_STATEMENT, LEGAL)
- Regenerate package-lock.json

164 files changed, +461/-18,774 lines
2026-03-31 09:10:28 +02:00
g-but 2823e25dca feat: connect IT-Hilfe and Repairers, audit Erfassung/Intake
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
2026-03-23 14:09:46 +01:00
g-but 19e6be6d19 debug: test all listings route imports individually 2026-03-23 13:12:59 +01:00
g-butandClaude Opus 4.6 4eb6d4ec35 fix: audit report update, repairer approval refactor, test fixes
- 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>
2026-03-16 14:22:59 +01:00
g-butandClaude Opus 4.6 f893115ad7 feat: complete all remaining audit items (12 items across 9 batches)
Accessibility:
- Add skip-to-content link in root layout
- Fix 125 gray-400 contrast violations across 92 files (→ gray-500)
- Fix 13 undersized admin touch targets (p-1 → p-2, w-8 → w-10)

Performance:
- Fix workshops N+1 waterfall: single ?include=instances API call
  replaces O(W×I) client-side fetch loops

Architecture:
- Remove legacy admin-auth.ts dual auth system
- Migrate 4 routes from CMS JWT to Auth.js/withAdmin

Responsive:
- Add mobile-first breakpoints to 5 components (sell page,
  bookings, decisions, product tables, filter bars)

Mission features:
- Public financial transparency page at /about/finances
- Per-listing CO2 impact badge on marketplace (Fraunhofer IZM 2023)
- Subscription exchange design spec + draft migration

0 TypeScript errors, 0 ESLint errors, 362/362 tests passing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-09 16:30:01 +01:00
g-butandClaude Opus 4.6 194299dd55 docs: update audit report with completed action items
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>
2026-03-09 16:30:01 +01:00
g-butandClaude Opus 4.6 25723a7d75 refactor: apply Zod validation to remaining routes, update audit report
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>
2026-03-08 15:16:46 +01:00
g-butandClaude Opus 4.6 45bd7832fe feat: unified intake system, marketplace admin, IT-Hilfe, sidebar cleanup
Major features:
- Unified Device Intake system with AI text/voice extraction, checklist-gated
  publishing, tier change with checklist reset, and audit timeline
- Marketplace admin panel with stats, listing moderation, reports, orders
- IT-Hilfe admin for managing community tech help requests
- Marketplace sell form: AI-assisted listing creation with image upload

Fixes:
- Marketplace image URL validation: accept relative /uploads/ paths (was
  rejecting valid uploads with z.string().url())
- Admin marketplace stats/orders: fix column name mismatch (amount_chf
  not total_cents)
- Metadata title dedup: skip brand prefix when title already contains it
- Remove "Produkte" from admin sidebar (replaced by Geräte-Eingang +
  Marketplace flow)
- Dashboard quick action: "Neues Produkt" → "Neues Gerät" → /admin/intake

Cleanup:
- Delete unused modules: labels.ts, newsletter-status.ts, sensitive-areas.ts,
  role-checks.ts, unified-permissions.ts, mappers.ts, number-sources.ts,
  admin-access.ts, auth middleware, unused hooks
- SSOT consolidation across API routes and config

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-04 18:56:42 +01:00
g-butandClaude Opus 4.6 3419caaa69 docs: update all documentation and configuration for post-Medusa architecture
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>
2026-02-25 11:44:25 +01:00