Commit Graph
234 Commits
Author SHA1 Message Date
d2662cfe22 chore(pnpm): convert to pnpm 11 (#446)
* chore: pnpm — the fleet has one package manager

- packageManager pnpm@11.25.0; lockfile via pnpm import, package-lock.json gone
- npm overrides moved to pnpm-workspace.yaml overrides (pnpm ignores
  package.json overrides); allowBuilds for @parcel/watcher, @sentry/cli,
  @swc/core, esbuild, puppeteer, unrs-resolver, and the ai-forms git dep
  (pnpm requires the exact resolved URL for git-dep prepare builds)
- @tiptap/core added as a direct dependency: RichTextEditor.tsx augments
  'module @tiptap/core' and tiptap-markdown's Storage augmentation rides on
  it — a phantom dependency npm's hoisting hid and pnpm's isolation exposed
- all workflows: pnpm/action-setup@v6 before setup-node, cache: pnpm,
  store-dir pinned, pnpm install --frozen-lockfile; Next cache key now
  hashes pnpm-lock.yaml
- scripts/ci/dependency-audit.sh: pnpm audit --prod (parses both npm-v2
  'vulnerabilities' and pnpm's v1 'advisories' shapes)
- selfhost-deploy-evig.sh, ship.sh, start-all.sh, e2e-inventory-prod.sh,
  husky pre-commit, Dockerfile.prod (node 24 + corepack) converted
- engines: node >=22.13

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

* fix(deps): declare espree — eslint.config.mjs imports it directly

npm's hoisting provided it as a phantom; pnpm's isolated node_modules
exposed ERR_MODULE_NOT_FOUND in CI. Verified in a true clean room
(parent node_modules masked): full verify green, 7783 tests.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

* fix(deps): declare tsx — npx fetched it on demand, pnpm exec does not

e2e:seed (and the hirn:*/setup-admins scripts) ran 'npx tsx', which
silently downloaded tsx because it was never in devDependencies. pnpm
exec only resolves installed bins, so CI's Seed E2E step died with
'Command tsx not found'. Declare it.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

* fix(ci): drop '--' separators — pnpm run forwards them verbatim

npm strips the first '--' before handing args to the script; pnpm 11
passes it through, so 'pnpm run start -- -p 3001' executed
'next start -- -p 3001' and next read '-p' as a project directory.
pnpm forwards everything after the script name anyway, so the
separator is dead weight: remove it in ci.yml (start, e2e journeys,
e2e guards) and ship.sh.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WqKqMnHQHSmkGFfc5t7Rxn

---------

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-09-04 12:06:36 +00:00
1b69f7746e fix(ops): rename revampit-* systemd units to evig-* (#435)
Completes the deliberate follow-up #434 called out: the box paths were
already fixed to /opt/evig, but the unit *names* — evig-transcription
(installed directly on the box, no repo unit file existed for it),
evig-backup.{service,timer}, and evig-cron@{.service,*.timer} — were
still revampit-*.

Renamed on the box first with a verified cutover (installed new units,
confirmed every timer's next-elapse time was unchanged from the old
schedule, ran a live one-off test of evig-cron@close-decisions.service —
got a real HTTP 200 from the app — then removed the old units). This
commit brings the repo, the source of truth per scripts/ops/README.md,
in line with what's now actually running.

Left alone, deliberately: the R2 bucket name (`revampit-backups`) and its
object-key prefixes (`revampit-db-`, `revampit-uploads-`) — renaming
live storage is a separate, higher-stakes change with no reliability
upside, not folded in here.


Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 11:32:08 +00:00
b9248b21e1 fix(ops): the systemd units follow the box to /opt/evig (#432)
`revampit-cron@timecard-reminders.service` failed at 08:01 UTC today with
status=203/EXEC: "Unable to locate executable /opt/revampit/ops/run-cron.sh".

#430 renamed the box directory /opt/revampit -> /opt/evig at 07:44 UTC and
deliberately left the revampit-cron@* and revampit-backup units for a separate
pass. But those units name their program as a literal path — systemd cannot
interpolate a variable into ExecStart — so from 07:44 they all pointed at a
directory that no longer exists. timecard-reminders was simply the first timer
to fire afterwards; wake-recurring-tasks had run at 07:01, before the rename,
which is why only one unit looks broken.

It is not one job:

  - all five revampit-cron@* timers are dead from their next fire onward
  - revampit-backup.service — the ONLY off-box copy of prod Postgres — dies at
    03:32 UTC, and a 203/EXEC failure leaves no dump behind to notice
  - revampit-transcription.service still has WorkingDirectory=/opt/revampit and
    survives only because it has not been restarted since

and fixing the units alone would not have been enough: run-cron.sh itself
defaults APP_ENV to /opt/revampit/app/.env, so it would have read no
CRON_SECRET and every call would have come back 401.

Repoints every /opt path under scripts/ops/ at /opt/evig. Unit *names* stay
revampit-* — renaming a live schedule is still the separate, deliberate step
#430 called it.

Also here, because the same drift hid them:

  - revampit-cron@timecard-reminders.timer existed on the box but not in this
    repo, which claims to be the source of truth for scripts/ops/. Added,
    byte-identical to the installed copy.
  - release-escrow is the reverse: in this repo, never enabled on the box, so
    /api/cron/release-escrow has never once run on a schedule. Documented as a
    money-side go/no-go rather than switched on by an install loop.

The automation that ends the class: scripts/ci/ops-box-paths.sh compares every
/opt/<name> literal under scripts/ops/ against NAME= in the deploy script — the
one place that decides where the app lives — and fails when they disagree. Wired
into verify as `lint:ops`. Verified it fails on the pre-fix tree. The next box
rename now breaks CI instead of breaking the backups at 03:32 UTC.

.prettierignore gains .venv: a local python virtualenv (services/transcription)
made `npm run verify` fail locally on vendored site-packages while CI, which
never has one, stayed green — the precise local/CI split verify exists to
prevent.


Claude-Session: https://claude.ai/code/session_01LmyE2aLaXKB2V7WA3XQprm

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-02 09:41:31 +00:00
ba754f6508 chore(deploy): rename revampit infra references to evig (#430)
* chore(deploy): rename revampit infra references to evig

The GitHub repo was renamed revamp-it -> evig a while back and the
domain/Caddy layer already points at evig.orangecat.ch (with a 308 from
the old revampit.orangecat.ch), but the self-host deploy pipeline was
still targeting /opt/revampit and the revampit-app systemd unit. Renamed
the deploy script, CI's throwaway fixture names, and the smoke-test
default URLs to match. The systemd unit + /opt directory on the box were
renamed to evig-app / /opt/evig directly, verified live (200 before and
after).

Left untouched: production database names/users (revampit_cms etc. in
rollback-production.sh, monitoring-setup.sh, check-services.sh) and the
revampit-cron@*.timer / revampit-backup units — those are a separate,
higher-stakes rename.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

* chore(deploy): point deploy pipeline + CI fixtures at evig, not revampit

The GitHub repo was renamed revamp-it -> evig a while back and the
domain/Caddy layer already points at evig.orangecat.ch (with a 308 from
the old revampit.orangecat.ch), but the self-host deploy pipeline was
still targeting /opt/revampit and the revampit-app systemd unit. Updates
the deploy script's NAME var, CI's throwaway fixture names/emails, and
the smoke-test default URLs to match. The systemd unit + /opt directory
on the box were renamed to evig-app / /opt/evig directly, verified live
(200 before and after, zero downtime).

Left untouched: production database names/users (revampit_cms etc. in
rollback-production.sh, monitoring-setup.sh, check-services.sh) and the
revampit-cron@*.timer / revampit-backup units — those touch live data
and a schedule (one timer looks like it releases escrow), so they're a
separate, higher-stakes rename flagged for a deliberate go/no-go rather
than folded in here.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

* fix(docs): point deploy-script docs at the renamed evig script

The rename to scripts/selfhost-deploy-evig.sh left 5 docs pointing at the
old filename, tripping the docs-paths CI gate (stale count rose 68 -> 73).
Fixed the references; net stale count actually fell to 65, so lowered the
baseline in the same PR per the gate's own instruction.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

* fix(ci): correct the docs-paths baseline back to 68

My previous commit set this to 65 based on a local run that was reading a
dirty working tree (leftover untracked files were falsely satisfying 3
path checks). Verified against a truly clean clone of this branch: the
real count, after the doc-path fixes, is 68 — unchanged from main, since
this PR only touches the 5 revampit->evig references and leaves the
pre-existing unrelated stale docs alone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HVwg8DKHQktxJuHeLM3xpG

---------

Co-authored-by: Mao Nakamoto <41178744+maonakamoto@users.noreply.github.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
2026-09-02 10:37:38 +02:00
GandClaude Opus 5 a21d8906af chore: add a formatter, and close a CSS comment that was never closed (#419)
* chore: add a formatter, matching the style this repo already writes

singleQuote=true was chosen by counting this repo's own
imports, not by fleet decree. The fleet is genuinely split and the two repos
that already had a .prettierrc disagreed with each other, so there was no
standard to restore. Quote style does not cross repo boundaries; having a
gate does.

Markdown is ignored for now — prettier rewraps prose, which would bury the
real diff.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* style: format with prettier, and close a comment that was never closed

The formatter refused this repo outright, which turned out to be a real defect
rather than a tooling complaint. kivitendo-intake.css opens a header comment,
and line 17 contains an inner /* ⚠ PRÜFEN */ — CSS comments do not nest, so
that inner terminator CLOSES the header. Everything after it is parsed as CSS
until the stray */ on line 20. A browser mis-parses it the same way.

The file exists in two places (public/presentations/ and deliverables/), both
carrying the same defect; fixing one still failed the gate, which is how the
duplicate surfaced at all.

Mechanical otherwise. This SHA is listed in .git-blame-ignore-revs.

* chore: teach git blame to skip the reformat

* fix: undo a 3-way merge duplication in AdminSidebar.tsx

Merging main with -X theirs duplicated a 30-line block: main's currency-sweep
commit and this branch's prettier reformat both touched overlapping lines in
the single-destination-group render path, and the -X theirs strategy inserted
rather than replaced, leaving two near-identical copies and a dangling closing
brace — SyntaxError: ',' expected at line 298.

The branch has no legitimate change to this file's logic, only formatting, so
main's content is correct outright. Took it wholesale rather than hand-editing
the merge result.

* fix(lint): reattach 5 directives the reformat detached

Four eslint-disable-next-line sites for react-hooks/set-state-in-effect and one
@ts-expect-error, all the same defect: the directive sat above useEffect( (or
above a JSX element), while the statement that actually errors is 1-2 lines
further down inside the block. eslint/tsc report at the real statement; the
directive, still bound to its original line number, protects nothing there.

TimecardReviewDrawer.tsx (x2), DataEntryTabs.tsx, AppointmentBookingForm.tsx,
CreatePoolModal.tsx. Same root cause documented for hirnli, fleetcrown and
ivy-portal earlier today — a positional directive is a hidden dependency on
formatting, and this is the fourth distinct shape it's taken.

* fix(i18n): restore a same-line audit-exemption marker

Fifth shape of today's positional-directive defect, this time the repo's own
i18n-hardcoded-audit convention rather than eslint or tsc: a // i18n-ok comment
exempts a hardcoded string only when it trails the SAME line. prettier wrapped
this one if-statement's long condition onto its own line, leaving the marker
on the return statement below — the exact sibling one line down
('fortgeschrittene bis experten') stayed on one line because it was short
enough not to wrap, and it alone kept passing.

Restored the one-line form and added // prettier-ignore so a future reformat
cannot re-split it. Verified against the real audit script locally: 0 new
violations.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 13:35:50 +00:00
GandClaude Opus 5 ddd337d68c refactor(nav, services): one source of truth for what evig offers and where it appears (#389)
* wip: nav regroup

* refactor(nav, services): one source of truth for what evig offers and where it appears

Two menus were describing the same organisation and drifting apart. This makes
placement DATA and deletes what nothing read.

## The SSOT break was mine, from an hour earlier

Moving Linux and the open-source registry into Lernen, I listed them by hand
in navigation.tsx — while SERVICE_CONFIGS still fed them to the
Dienstleistungen menu. One item, two menus, two independent lists to keep in
step: exactly the drift the config exists to prevent.

Each service now declares `navGroup: 'services' | 'learn'` ONCE, and both
menus derive from that. A service cannot be in two menus or in none, and
`services-nav.test.ts` asserts precisely that — proved by planting the
duplicate back, which fails with "linuxOpenSource appears in 2 menus
(expected exactly 1)".

## The catalogue

Kept: webDesign (George's call — it is real revenue), linuxOpenSource,
openSourceSolutions. Added `aiAdoption` at /services/ai-robotics: pillar 5
existed only as a /contact link. The page describes how the work goes — look
at the work for a day, pick one task, build it, hand it over so someone on
their side can run and switch it off — and carries the required honesty
boundary: not a silver bullet, not a dependency, not a big firm.

Removed:
  hardwareRecycling → off-thesis outright. "Verantwortungsvolle Entsorgung"
                      is disposal; evig is not a recycler, and the homepage
                      now says so in as many words.
  buildYourComputer → 549 lines of interactive configurator for a service
                      flagged `available: false`, still selling the previous
                      org's "Revamped"-Zertifizierung under an English title.
  computerRepair    → redirects to /it-hilfe. It advertised evig repairing
  dataRecovery        your machine at CHF 70/h, which contradicts the
                      marketplace model where the technician sets the price.
                      Its "booking slug" also booked nothing: the seeded
                      service_types slugs never matched these hrefs, so the
                      page always fell through to isBookable: false.

Redirects rather than 404s — the URLs are indexed and the visitor still wants
the same thing. Also deleted /services/[service]/repair, a 135-line orphan
that ignored its own route param and rendered the same page at
/services/<anything>/repair.

## Über uns answers one question now

Nine unsectioned items spanning five unrelated groups — identity, a brand
division, a transactional product (join a pool, pay a share), trust pages,
and two operational explainers including a City of Zürich subsidy evig does
not administer and cannot redeem. Two carried a `new` badge simultaneously.
It was the only multi-item menu without `isSection` eyebrows.

Now five items in two groups: Wer wir sind (Mission, Vision, Projekte) and
Vertrauen (Transparenz, FAQ). `evig ai` and `Abos teilen` moved to Marktplatz,
which gains a third section — from the reader's side these are three ways to
get something, not three parts of an org chart. `So funktioniert’s` and
`Reparaturbonus Zürich` left the nav; both pages remain.

## Config that held German nobody read

src/config/community.ts was 644 lines: INVOLVEMENT_OPTIONS,
PARTNER_INSTITUTIONS and seven full PageContent trees with German titles,
descriptions and CTA labels — a second copy of getInvolved.* in the message
files. Nothing imported any of it except one type. It could have drifted from
the real copy forever without anyone noticing, because nothing read it. Now
22 lines: the type.

## A duplication that cannot be deleted yet, so it is gated instead

WORKSHOP_CATEGORIES carries German name/description per category, and the
messages carry the same strings again. The public page renders the MESSAGE
version; the config version is load-bearing elsewhere — normalizeCategoryId
matches legacy DB rows on the German name, and the admin filter uses it as an
option value. Deleting it needs an admin refactor.

So it can no longer diverge: workshops-config-matches-messages.test.ts fails
if you edit one and not the other. Mutation-tested. The real fix is noted in
the file.

Also removed the last "Vintage" copy: the hardware workshop said
"Vintage-Restauration", and a dead components.communitySpace block advertised
a "Museum für seltene Vintage-Hardware" — rendered by no component at all.

i18n baseline fell 2531 → 2430 source findings, most of it the deleted
community.ts tree. The one new entry is the edited workshop description: a
pre-existing violation whose text changed. Baselined rather than marked
i18n-ok, because it IS UI text in the wrong layer and should stay visible as
debt until the admin refactor removes it.

npm run verify green: lint, umlauts, chrome, docs, compliance, typecheck,
7755 tests (535 suites), production build.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 10:56:40 +00:00
GandClaude Opus 5 f20d183b3f fix(i18n): teach the wrong-language detector what it can actually detect (#387)
Third time in three PRs that this gate flagged correct Italian and Spanish —
"Trovare un tecnico", "Encontrar a quien lo repare", "LO QUE HACEMOS" and
seven more, none of them defects. Twice I verified them by hand and bumped
the baseline. The rule says the third time you stop fixing instances and
close the class.

## Why it was wrong

Not a threshold problem — HOLES in the stop-word lists. `un` was listed only
under fr; it had `una`/`uno` but not the masculine `un`. So "Trovare un
tecnico" scored Italian 0.00, French 0.33 and got flagged. Spanish was
missing `lo` and `a` while Italian had `lo`, which is why "Encontrar a quien
lo repare" looked Italian. A hole in a list makes CORRECT text look foreign.

Filling the holes then made it worse in the other direction: teaching es the
word `su` immediately made correct Italian ("Linux su vecchi ThinkPad") look
Spanish, and `e`, `non`, `nos` did the same across the other pairs. Sibling
Romance languages share their function words. A bag-of-stop-words comparison
cannot separate them, and no amount of dictionary work will change that.

## What it does now

It detects what it CAN detect: untranslated **English or German** sitting in
a translated file. Those function words barely overlap with Romance or CJK
ones, and that is the leak that actually happens here — DE is the source
language and EN the pivot. Sibling-language comparison is dropped.

Three guards, each earned:
  - LEAK_SOURCES = ['en','de'] — only judge against languages it can tell apart.
  - MIN_TOKENS_FOR_LANGUAGE_GUESS = 6 — the heuristic's resolution is 1/N; on
    a three-word string one shared article moves the ratio by 0.33, clearing
    the threshold on its own.
  - A script guard, because \w is ASCII-ONLY in JavaScript even under /u, so
    `[^\W\d_]` counted Hangul, kana and Cyrillic as ZERO letters and my first
    attempt at this guard silently did nothing. It uses \p{L} now. Without it
    a Korean sentence containing "evig" and "Revamp-IT" scores as English on
    those crumbs.

Proved by mutation, not by assertion: 16 cases, eleven correct-language
strings (it/es/fr/ko/ja/ru, including CJK carrying Latin brand names) all
clean, five real English/German leaks all still caught.

## What the fix immediately found

**Real untranslated English shipped to five locales.** es, fr, it, ja and ko
were all rendering English inside the IT-Hilfe hub — "Describe your issue and
receive offers from technicians", "Browse profiles and contact someone
directly", "Help as a technician — requests near you", "Register as a
technician and help people nearby." — plus the privacy page's data-export
sentence in ja and ko. The KEYS existed, so the missing-key audit passed;
only the values were English, and the old detector could not see them. All
translated here.

This is the same class as itHelp.hub.subtitle in #382, which I found by
reading a rendered page. The gate finds them now.

## And a dead storefront

`shop.*` held 140 keys; three loading/error boundaries use SIX. The other 134
describe a storefront whose pages are pure `redirect()` calls to /marketplace
— product grids, cart labels, category breadcrumbs, opening hours — shipped
in every visitor's page payload in eight languages. Pruned: ~54KB of JSON,
6511 deleted lines. Liveness checked by namespace prefix, not just call
sites (the lesson from home.newsletter), then proved by typecheck.

Baseline lowered in the same commit, per the ratchet rule: 706 message
findings → 84, with 632 resolved and 0 new.

Also folded in (was #386, which deadlocked against this: its new Italian and
Spanish headlines were flagged by the very detector this fixes):

  - /it-hilfe still showed "Computer reparieren, OS neu installieren,
    IT-Probleme lösen" as its H1 — a keyword list. #382 reframed the metadata
    and subtitle and missed the line a visitor reads first. It now matches the
    homepage pillar's link text exactly, so clicking "Jemanden finden, der es
    repariert" lands on a page with that headline.
  - "CHF 300.00" wrapped onto two lines on a 390px pool card. A price must not
    wrap; the title beside it gives way instead.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-26 01:34:11 +00:00
GandClaude Opus 5 f6b9a73b8b feat(brand): evig repairs becomes evig technicians, and evig stops asking for printers (#382)
Three changes from the same focusing pass, all of them cases where the copy
described an organisation the code had already outgrown.

## The division is named after the person, not the service

`evig repairs` → `evig technicians`. "Repairs" names what happens; a user is
looking for someone who will do it. The surface has worked that way for a long
time — post a request, receive offers from technicians nearby, choose one, with
a budget filter that already splits "Gratis / Community" from "Mit Budget" —
only the naming lagged behind the product.

Contained to `src/config/divisions.ts` plus the `divisions.items.<id>` key in
eight locales, because the wordmark is composed (`${ORG.name} ${id}`) and every
consumer derives from the array. No component changed.

## IT-Hilfe stops promising charity

The page called itself "Kostenlose Community-Reparatur" and said "kostenlos"
three times over: meta title, meta description, subtitle, tagline. That framing
does two bad things at once — it hides the marketplace the code implements, and
it forecloses the half of the model where a technician actually earns. Rewritten
to what it is: describe the problem, get offers, choose. "Über die Community
gratis oder fair bezahlt" keeps the free path visible without making it the
whole promise.

Fixed alongside: `itHelp.hub.subtitle` was stored as literal ENGLISH in es, fr,
it, ja and ko. Not a missing key — a wrong value, so no fallback could catch it
and no missing-key audit could see it. Five locales showed an English sentence
in the middle of a translated page.

## No more printers

The donation pages solicited "Laptops, Desktop-PCs, Monitore, Tastaturen,
Mäuse, Drucker" while the new homepage copy says evig does not deal in
printers. One of the two had to go. A printer is the archetype of what evig
deliberately does not take: low value, hard to refurbish, and — per
co2-impact.ts, which already refuses to publish a factor for the category —
without a defensible open number, so we could not even honestly claim a saving
for keeping one alive. GPUs take their place in the list, which is what the AI
thesis actually needs.

The erfassung category '60' (Drucker & Scanner) deliberately STAYS. Existing
inventory rows point at it, and deleting a category that historical records
reference would corrupt them. Not soliciting new ones is the change; rewriting
the past is not.

## /revamped deleted

294 lines selling "die REVAMPED-Zertifizierung … unser exklusives REVAMPED-
Label" — the previous organisation's name, as a product label, after the
rebrand. It was orphaned from nav and footer but still listed in the sitemap,
so it was indexable. It also advertised a certification for computers "we
build" on behalf of a service flagged `available: false`, and its inbound CTA
copy had sat unmaintained long enough to contain a German grammar error ("Hol
sich deine" for "Hol dir deine"). Page, messages, sitemap entry and the
inbound certification block are all gone. If evig wants a quality label later,
it belongs on the QC Prüfsiegel the intake pipeline already produces.

Also removed `ROUTES.public.transparenzKennzahlen` — a route constant used by
nothing, pointing at a page that deliberately calls notFound().

## One baseline moved, deliberately

Two new "wrong language" findings, both false positives of the same kind as the
last batch: "Trovare un tecnico" (correct Italian) and "Encontrar a quien lo
repare" (correct Spanish), each scored `own 0` because the words are absent
from the detector's own word list for that language. Verified by reading, then
accepted.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 20:07:56 +00:00
GandClaude Opus 5 c9db8c32ed feat(home): state the five pillars, and put shared subscriptions with evig ai (#381)
The hero already said the right thing — "Zugang zu Intelligenz. Für alle
bezahlbar." Everything under it was still the story of the organisation evig
came from.

## The homepage

Two bands are gone: a "zweites Leben / weitergeben" ribbon, and a "Drei
Schritte. Ein Kreislauf." funnel that opened by asking the reader to donate
their old kit. That story is true, but it is the consequence, not the reason,
and it answered a question nobody arriving here is asking. In their place, one
section driven by a new SSOT (`src/config/pillars.ts`):

  hardware    → machines good enough for real work, at a price people can pay
  technicians → finding someone to fix it, as easily as booking a ride
  software    → Linux and open source, because the machine gets faster
  training    → retraining for a labour market that AI is rewriting
  adoption    → helping organisations actually put AI and robotics to work

`adoption` points at a conversation, not a service page. Writing a consulting
page for work nobody has scoped yet is exactly the claim the honesty rule
exists to prevent. The section count is ICU-driven from the array — the
divisions subtitle taught us why: it hand-wrote "vom Gerät bis zum Gebäude"
and kept promising a building division for hours after that division was
deleted, sitting directly under a heading that correctly read "3 Bereiche".
That subtitle is fixed here too, along with two nav keys for the removed
divisions that were still being serialised into every page payload.

Pillars are deliberately NOT derived from EVIG_DIVISIONS. Divisions are how the
org is named; pillars are what it does. `training` and `adoption` have no
division and should not get one — inventing "evig academy" to make the lists
match is the brand proliferation that got architecture and health deleted.

## Subscription pools moved

They sat under "Mitmachen → Mitgliedschaft" as a generic Netflix/Spotify swap
board. The /ai page states the exact problem they solve — "Wer ein teures Abo
bezahlen kann, lernt schneller, arbeitet besser und kommt an Chancen, die
anderen verschlossen bleiben" — and then never said how. So: `ai` is now the
first pool category and the default, the page leads with the real number
(CHF 22 alone, CHF 5.50 split four ways), the nav entry sits beside evig ai,
and /ai gains a fourth strand that links to it. Strand links are a new optional
config field implementing the contextual-links rule: a paragraph naming an
offer with no way to reach it is a dead end.

## Metadata that had not caught up

The JSON-LD told search engines evig does "Reparatur und Aufbau von
Vintage-Computern" — a term for the opposite of what evig sells. And the SEO
keywords were a German array frozen into the component, so seven locales were
served German keywords. Keywords now come from the messages like every other
sentence, split from one comma-separated string per locale (the shape
`jsonld.areaServed` already uses — avoids the array-in-messages fragility,
since the DE fallback replaces arrays wholesale with no per-element merge).

## Chrome drift on the pools page

CreatePoolModal was a hand-rolled `fixed inset-0` overlay with its own
useFocusTrap and its own rounded-2xl surface — a second encoding of the
centered-dialog shape. It uses <Modal> now. PoolCard used `card-shell
rounded-2xl`, overriding the shared radius, so pool cards were visibly rounder
than every other card on the site; it uses <Card>. The loading skeleton
hand-rolled the shell in a way the ratchet grep could not even see
(`rounded-2xl` slips past a pattern matching `rounded-(lg|xl)`).

## One baseline moved, deliberately

The i18n gate flagged 8 new "wrong language" findings on the Spanish and
Italian strings. All 8 are correct in their own language ("Trova un tecnico",
"LO QUE HACEMOS"). The detector scored them "own 0" — the words are absent
from its Italian/Spanish word lists entirely, which is the sibling-language
limit, not a translation error. Accepted into the baseline; net it FELL
(48 insertions vs 53 deletions), it did not rise.

npm run verify green: lint, umlauts, chrome, docs, compliance, typecheck,
7746 tests, production build.

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 19:48:01 +00:00
GandClaude Fable 5 2b0699faba ci(compliance): five named gates had never run — wire four, state the fifth (#374)
package.json defined 'compliance' (ssot + i18n + i18n-hardcoded +
i18n-leaks + i18n-stale). grep across .github, .husky and package.json
found ZERO callers: the only one was scripts/ship.sh, which is manual.
npm run verify — the bundle CI actually calls — did not include it. Five
named gates buying confidence none of them had earned, while
docs/TRANSLATION.md said 'Pipe it into CI'.

Unrun, they had drifted far red: 1723 hardcoded-string violations, 175
missing translation keys, and locale leaks at ja 169 / ko 170 / ru 35
against a baseline of 9.

compliance:ci (ssot + i18n + hardcoded + leaks) now runs inside verify,
so it gates every PR AND the deploy. The three baselines are refreshed to
today's counts: that ACCEPTS the existing debt, deliberately. Ratcheted
debt that cannot grow beats invisible debt that has been growing for
months, and the numbers are stated here rather than buried.

compliance:i18n-stale is deliberately NOT in the bundle. Its --update
records that locale strings match the current German text — a claim only
a translator can make. A machine refreshing it to go green would be
writing down something false. It stays a manual command.

Mutation-tested rather than trusted, which surfaced a real blind spot:
the hardcoded scanner only reads QUOTED string literals, so a German
sentence written as JSX TEXT (<p>Keine Einträge…</p>) yields '0 new' and
a green gate. Attribute values and props ARE caught. Documented at the
top of the scanner so nobody reads green as 'no hardcoded German'.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 20:31:31 +00:00
GandClaude Fable 5 fe811bcfc2 docs: correct the design-system section that described a deleted file (#370)
CLAUDE.md carried a full 'Layer 2 — tailwind.config.ts' section for a file
Tailwind v4 removed, plus a token table naming --color-bg / --color-surface
/ --color-border (zero occurrences in globals.css; the real names are
--surface-base, --text-primary, --border-default), a dark-mode mechanism
that does not exist (it claimed @layer utilities auto-remaps bg-white —
globals.css contains no 'bg-white'), and a green #f0fdf4..#14532d palette
for a brand that is Ion Lime. Five false claims in sixty lines, in the
file every agent session reads first.

Also corrected: Tailwind 3.4 -> 4 and React 18 -> 19 in the stack tables;
the .claude/CLAUDE.md ADMIN_SECTIONS table (10 rows, wrong paths, ids that
no longer exist — 'products' and 'finances' are gone, and granting
'workshops' grants nothing because the admin section is 'workshops-admin')
replaced by a pointer to sections.ts and the two rules that do not change;
the dev-DB row that said Neon while CLAUDE.md said Docker:5433;
002-simplified-auth.sql -> 002b-; repairer_profiles -> technician_profiles
(renamed by migration 105); and a Revamp-IT street address in
SHARED_CONTEXT that org.ts explicitly forbids publishing.

scripts/ci/docs-paths-exist.sh closes the class: every backticked repo path
in the docs must exist. CLAUDE.md, .claude/CLAUDE.md and README.md are held
at ZERO; the 68 stale references in older reference docs are ratcheted so
they can fall but never rise. Historical plans and audits are excluded —
a June plan naming files that later moved is history, not a defect.
Proven by mutation: a planted bad path in CLAUDE.md exits 1.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 20:33:37 +02:00
GandClaude Fable 5 fed2289a2d fix(money): invoices charged the pre-2024 VAT rate — consolidate to one SSOT (#368)
Switzerland raised standard VAT from 7.7% to 8.1% on 2024-01-01. The rate
was declared in five places — lib/pricing, lib/payments/tax-compliance,
lib/payments/currency (twice), the zod default in api/invoices and the
invoices.tax_rate column default — and every copy carried the old rate.
Two of those files each described themselves as 'the SSOT for VAT'.

Meanwhile lib/services/payment-webhook books Kivvi at 8.1%, and its own
comment flagged the divergence as a follow-up nobody closed. So the
platform issued invoices at one rate and posted the accounting entry at
another, on every paid order.

- src/config/tax.ts is now the only declaration; everything derives.
- getVATRateLabel() returned a literal '7.7' — that string is printed on
  invoices, so customers were shown a rate that also wasn't charged.
- Migration 140 moves the invoices.tax_rate default to 0.0810. Existing
  rows are NOT back-filled: the column records what was actually charged,
  and rewriting it would falsify history rather than correct it. Any
  commercial correction is a business decision.
- ~25 assertions across six suites pinned the old rate, so correcting it
  looked like a regression. They now derive from the constant; the literal
  rate is asserted in exactly one place (config/__tests__/tax-ssot.test.ts),
  which also fails if any source file hardcodes 0.077 again.

Verified: migration applied to a real database (it initially targeted the
wrong table — caught by applying it rather than reading it), 7802 tests,
typecheck, lint 0 errors, umlaut gate clean.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 20:02:40 +02:00
GandClaude Fable 5 1f03185863 fix(deploy): one migration order for all three runners, and stop the prod fail-open (#359)
Migrations were enumerated three different ways. run-migration.sh sorted
-V with no skip list, apply-migrations-ci.sh sorted -V WITH one, and the
production deploy used a bare glob — lexicographic, which orders the
005* duplicates the opposite way. So the order production would use in a
disaster-recovery rebuild was the one order CI never replayed, and a
from-scratch local DB died on a duplicate CI had been skipping for
months. scripts/db/migration-order.sh is now the only enumeration.

The deploy also read schema_migrations with '|| true'. An empty answer
does not mean 'nothing applied', it means 'could not look' — and the
loop treats every unlisted file as pending, so one ssh blip would have
re-applied ~150 migrations to the live database. It now fails closed.

Also:
- deploy-selfhost.yml re-inlined four checks instead of calling verify,
  making the DEPLOY gate weaker than the MERGE gate (no card-shell
  ratchet, i18n subset instead of the full suite). Calls verify verbatim.
- .gitignore had a blanket *.sh + hand-kept negations, so every new
  script under scripts/ was invisible to git — it commits clean, then CI
  fails on a file that exists on one laptop. Anchored to the repo root.
- 5 dev-only packages sat in dependencies, where dependency-audit.sh
  (npm audit --omit=dev) reports an ESLint advisory as a runtime
  critical. Moved to devDependencies.
- dependabot: groups for the next / next-auth / tailwind / eslint / jest
  lockstep families, and @types/node major pinned to the runtime major
  (Node 20) — PR #356 was closed for exactly that.
- Untracked 2.7 MB of committed Jest output and a .bak dropping.

Verified: from-zero CI replay green (133 applied), local runner green
from a fresh DB (149 applied — it could not complete at all before),
lint 0 errors, typecheck clean, 7798 tests.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 16:56:55 +00:00
GandClaude Fable 5 df3818ddf6 refactor(chrome): normalize 95 hand-rolled card shells to Card/card-shell, ratchet 99 -> 3 (#347)
Every static-div shell becomes <Card>; non-div elements (Link, li, ul,
form, details, section) and dynamic classNames take the card-shell
class. The two remaining sites are deliberate: HelpRequestCard's
urgency-conditional border and AlternativeCard's border-2 hover shell.
Baseline lowered 99 -> 3 in the same change.

Verified: typecheck, lint (0 errors), 7798 tests, production build,
and before/after headless screenshots (1440px + 390px) of 11 affected
admin/dashboard pages on a locally seeded instance — layouts identical,
corners/borders normalized to the canonical shell.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-24 02:15:30 +02:00
GandClaude Fable 5 225e31be0b refactor(chrome): 21 hand-rolled card shells -> Card/card-shell, ratchet 120->99 (#340)
Every converted site was pixel-identical to card-shell already (bg-surface-base
+ rounded-xl + default 1px border — the v4 shim maps bare `border` to
var(--border-default)), so this is pure dedup: divs become <Card>, Link
elements take the card-shell utility directly. Sites with border-subtle/
strong/border-2 or rounded-lg are visually different and deliberately left
for a later, looked-at pass.

Baseline lowered 120 -> 99 in the same PR, per the ratchet's own rule.
Gate: lint 0 errors, umlauts clean, ratchet 99/99, tsc clean, 7797 tests,
build green.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 01:08:31 +00:00
GandClaude Fable 5 3c78deaecd chore: silence real warnings, retire deprecated utilities, ratchet chrome drift (#339)
- drop @types/uuid + @types/cookie (stub packages; both libs ship types)
- experimental.middlewareClientMaxBodySize -> proxyClientMaxBodySize (Next 16 rename)
- InstanceFormModal: hand-rolled fixed-inset overlay -> shared <Modal>
  (gains focus trap, escape, aria; loses nothing)
- last two bg-opacity-* scrims -> bg-black/NN (deprecated utility, audit item)
- NEW gate scripts/ci/card-shell-ratchet.sh in npm run verify: 120 hand-rolled
  card shells exist; the count may fall or hold, never rise. Mutation-tested
  (121 -> exit 1). Baseline lowering documented in CLAUDE.md audit section.

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-08-21 00:03:56 +00:00
GandClaude Opus 5 934e114b80 fix(ci): post-deploy smoke called a redirect a failure, and a redirect ready (#312)
The deploy of de244172 went red here while the deploy itself succeeded. Every
one of the 13 checks reported 308: the script points at revampit.orangecat.ch
and compares the status to a literal 200 without following redirects, so from
the moment that host started redirecting to evig.orangecat.ch, the whole smoke
failed. Nothing was wrong with the app — this run is simply the first deploy
since the redirect was added, and it would have failed the same way on the
301 it originally was.

The readiness probe had the opposite bug and was worse for being quiet:
`curl -sf` does not fail on a 3xx, so it reported the site ready after merely
receiving a redirect it never followed, then handed off to checks that all
failed. A wait loop that is satisfied by a redirect is not a wait loop.

  - default base is now the canonical host, evig.orangecat.ch
  - every curl passes -L, including the readiness probe

Following redirects rather than pinning the host means a future rename cannot
turn the entire smoke red on its own, and the run stays meaningful from either
host.

Verified against live prod: 13/13 from evig.orangecat.ch, and 13/13 through
revampit.orangecat.ch's 308. Also negative-tested that it still fails — a bogus
base exits 1 rather than passing vacuously.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 20:55:53 +00:00
GandClaude Opus 5 de244172ff fix(email): the relay says 250 and the mail goes nowhere (#311)
* fix(vote): give the "sign in to vote" error the door it names

The vote-auth fix (#305) tells someone whose email belongs to an account to
sign in, and then leaves them standing there. This repo's own rule is that
every stated problem links to where it is fixed — a warning without a way out
is a dead end.

The reason it shipped without the link was that apiFetch flattens every
failure to a bare { success, error } string. The only way for the UI to know
WHICH failure it got was to match the German sentence, and branching on prose
breaks the first time someone rewords or translates it. So the fix is one
level down: give the envelope a machine-readable code.

  ERROR_CODES        one SSOT for codes, next to ERROR_MESSAGES. Add one only
                     when the interface must DO something different — the
                     message is for the human, the code is for the UI.
  apiBadRequest      optional third argument, omitted from the body when unset
  ApiResponse.code   optional, so all ~100 existing callers are untouched
  apiFetch           passes a string code through; ignores a non-string one
                     rather than handing junk to the UI

The vote page now renders "Anmelden" as a link to loginUrl beside that error,
reusing the string already there for the success panel — no new i18n keys, so
no locale can desync.

Tests assert the passthrough and the omission, and I checked the passthrough
test fails with the apiFetch change reverted (1 of 14) rather than assuming a
green suite meant something. The route test now pins the code, using a mock
that actually forwards the third argument — a mock that dropped it would have
made the assertion vacuous.

5963 tests green across 440 suites; eslint and the umlaut linter clean.

* fix(vote): the one live decision could not be voted on at all

Found by opening the real share link at 390px while verifying #307, not by
any test. The page drew "Deine Stimme" and then nothing. Submitting answered
"Stimmdaten erforderlich". There was no ballot, and nothing on screen said
why.

`thumbs_up_down` has been in VOTING_METHODS all along, with a zod schema, a
validator and a tally on the server — and no branch in either voting surface,
and no case in useVoteState's switch. buildVoteData() fell through to
`undefined`, which TypeScript allows because the switch had no default and
the return type is `unknown`. So the absence compiled, rendered blank, and
failed at the server. Production's only decision uses that method.

Fixed on both surfaces — the public share-link page and the members'
VotingPanel — with one component, and the choice labels in config beside the
other methods' rather than typed into JSX. No default selection: a thumbs
vote is a single deliberate tap, so pre-selecting "Dafür" would submit an
opinion the voter never expressed.

Two guards, because the compile-time one alone would not have caught this:

  useVoteState  a `never` exhaustiveness default — a method with no case is
                now a build error rather than a silent undefined
  ballot-coverage.test.tsx  renders EVERY entry in VOTING_METHODS and asserts
                the ballot contains something interactive. A missing render
                branch is absence, and absence is what the switch guard cannot
                see. It iterates the config, so it cannot drift from it.

Checked the coverage test fails with the branch removed (thumbs_up_down only,
6 of 7 still passing) rather than trusting a green suite.

7747 tests green across 529 suites; eslint and the umlaut linter clean.

* fix(email): the relay says 250 and the mail goes nowhere

Sent a probe from the production host through the configured relay to a real
mailbox. The SMTP conversation was flawless — EHLO, STARTTLS, AUTH, accepted —
and the message never arrived. Not the inbox, not spam, not trash.

The cause is the sender domain. EMAIL_FROM in prod is noreply@revampit.ch,
which has no SPF record and no brevo._domainkey DKIM record. Brevo accepts mail
from a domain it has not authenticated and then drops it, so every layer
reports success and the inbox stays empty. Searching the recipient mailbox back
through its whole history finds no application mail at all: every revamp-it.ch
message in it is human mail from colleagues via the org's own server. evig's
transactional email has never worked.

scripts/test-email.ts could not have caught this. It mailed only itself, and it
called a relay handoff "Email sent successfully!". So it is rebuilt to answer
the question that matters:

  - takes the recipient as an argument instead of sending to EMAIL_FROM
  - resolves the sender domain's SPF, DKIM and DMARC before sending, and says
    plainly that an unauthenticated domain will vanish despite a 250
  - refuses to describe acceptance as delivery

The DKIM verdict is deliberately relay-aware. Selectors are chosen by the
provider and cannot be enumerated from DNS, so a missing selector is only
conclusive when we know which one to expect — Brevo documents brevo._domainkey.
Against any other relay an unknown selector is reported as inconclusive, not as
a failure. Checked both ways: google.com is flagged when sending through Brevo
(true — it has no Brevo key) and is not flagged otherwise.

Nothing here fixes delivery. That needs a sending domain that exists and is
authenticated with the provider, which is a purchase and a DNS change, not a
code change.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* docs: the canonical host moved, and the redirect to it must keep the method

revampit.orangecat.ch now redirects to evig.orangecat.ch, so every doc that
called the old host "where this codebase runs" was pointing at a redirect.

It was added as `redir ... permanent`, which is 301, and 301 does not preserve
the HTTP method — a POST arrives as a bodyless GET. Auth.js then answered
InvalidProvider ("Callback for provider type (credentials) is not supported"),
because a GET on a credentials callback is not a thing. Browser traffic never
noticed: it lands on the canonical host and posts there. Only non-browser POST
clients broke — the CI auth smoke, API callers, and any webhook still aimed at
the old host. Fixed on the box by making it a 308; documented here so it is not
reintroduced.

Also records why auth-smoke and inventory-smoke deliberately point
PLAYWRIGHT_BASE_URL at the OLD host: that is what exercises the redirect, and it
is how this was caught. Repointing them at the canonical host would turn a real
gate into a green one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 20:30:06 +00:00
GandClaude Opus 5 c27a404ae2 ci: call the central auto-merge sweep instead of carrying a copy (#310)
* ci: call the central auto-merge sweep instead of carrying a copy

auto-merge-sweep.sh was copied into 22 repos and drifted into EIGHT distinct
versions, 245 to 404 lines. Three of them independently grew different fixes for
real outages, and each fix reached only the repo that wrote it:

  evig, revampit   infra-failure detection + re-run. An Actions incident left
                   main "failure" with no failed job at all; 11 PRs stranded
                   for roughly 14 hours.
  fleetcrown       DEADLOCK naming — a red base with the repairing PR sitting in
                   the queue was indistinguishable from "nothing to merge".
  the other 19     neither.

Nothing could carry a fix across, so every repo waited to hit each outage
itself. This repo now calls the canonical sweep in maonakamoto/dotfiles, and the
local copy is deleted.

The canonical is the union of the three, built on the variant ten repos were
already running rather than on the longest one — the 404-line variant is missing
the step-summary reporting the 296-line one has, so "take the biggest file"
would have silently deleted working behaviour. The merge was 106 insertions and
zero deletions: nothing can be lost by adopting it.

The triggers stay in this file because they genuinely are per-repo: workflow_run
must name the CI workflow exactly, and that name differs across the fleet.

Two details that are silent when wrong, both found by piloting rather than
reasoning:

  rearm_workflows is SPACE-separated. The sweep word-splits it; a comma makes
  one bogus token, every dispatch fails, and the only symptom is that nothing
  deploys — while the sweep still exits 0 and reports a successful merge.

  permissions are declared on the CALLER as well. A called workflow's token is
  capped by what the caller grants, so relying on the callee's block alone can
  hand it a read-only token; the sweep would then merge nothing while exiting 0,
  which is indistinguishable from having nothing to merge.

Verified before this rollout: the canonical ran end to end in dotfiles' own CI,
and the reusable-workflow path ran end to end in the pilot repo (s-ink).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* test(ci): the sweep tests moved to dotfiles with the script they test

These two suites drove scripts/ci/auto-merge-sweep.sh directly, so deleting the
local copy of that script left them pointing at nothing — CI failed with
"Test Suites: 1 failed, 533 passed".

They were not dropped. This repo was the ONLY one in the fleet with tests for
the sweep, and centralising the code while discarding the only evidence it
behaves would have been the worst possible trade. They are ported to bash and
now run in maonakamoto/dotfiles CI against the canonical script
(scripts/ci/test-auto-merge-sweep.sh), where they cover every repo that calls
it rather than just this one.

Same six cases, same reasoning: re-run a cancelled or infra-failed base run,
never re-run a genuine failure, stop at the attempt cap, still reach the PR loop
when the base is green. They were also mutation-tested there — disabling the
re-run turns the two dependent cases red — because a suite that has only ever
passed is indistinguishable from one that asserts nothing.

Net effect: the coverage this repo wrote now defends twenty-two repos instead of
one.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-16 16:22:45 +00:00
GandClaude Opus 5 c849d6c596 feat(ci): make a dependency advisory turn something red (#278)
Three CRITICAL auth advisories sat open against the live site today and
nothing in CI was red. They surfaced only because `git push` happened to
print GitHub's "found 10 vulnerabilities" banner, which is not monitoring.

Cleared the two remaining runtime highs first, both instances of the same
trap that hid the auth critical — a patched copy hoisted while a vulnerable
one survives underneath:

- postcss was declared ^8.5.10 in devDependencies AND in overrides, so it
  resolved to 8.5.15, below the 8.5.23 that patches the source-map path
  traversal. Raised both to ^8.5.26.
- sharp: the root had a patched ^0.35.3, but next pinned ^0.34.5 and got its
  own nested vulnerable copy (libvips CVE-2026-33327 et al). Added the
  `"sharp": "$sharp"` override so the nested copy resolves to the root's.
  This removes 26 duplicate platform binaries from the lockfile.

npm audit is now clean at every severity, dev included.

The check itself, in scripts/ci/dependency-audit.sh, has two callers:

- ci.yml `security` job — blocks a PR that INTRODUCES a critical.
- security-audit.yml — scheduled daily, files/closes one issue for high+.

The scheduled half is the one that matters: advisories appear with NO code
change, so no push-triggered check has any reason to run. That is exactly
how today's criticals stayed invisible.

Critical blocks, high only reports. Auto-merge refuses a red base, so
failing CI on every new advisory would hand a third party the power to jam
the entire merge train on their release schedule.

Verified: script unit-tested against stubbed audit output across critical /
high-only / clean / malformed-JSON / empty-output / bad-threshold cases —
including that malformed and empty output FAIL rather than read as a pass.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 21:26:19 +02:00
GandClaude Opus 5 0abca3ca29 fix(ci): merge via REST when gh's client-side precheck refuses (#286)
Diagnosis, now with the number that was missing before: the sweep logs its own
view at the merge site, and it reads

    #278 direct merge refused (MERGEABLE/BLOCKED)
    #282 direct merge refused (MERGEABLE/BLOCKED)

while a PAT reads MERGEABLE/CLEAN for the same two PRs at the same moment.
mergeStateStatus is computed per viewer, and `gh pr merge` refuses client-side
on BLOCKED. `--auto` goes through the identical precheck, so it was refused
too — that fallback never fired.

main has branch protection with every option disabled, no rulesets, no
CODEOWNERS, no required checks and no required reviews, so there is no rule
being enforced here. Meanwhile #224, #225 and #226 — all of which modify
.github/workflows/ — merged normally, so this is not the workflows scope.

The REST merge endpoint skips the precheck and enforces the branch's actual
protection instead. If GitHub does refuse, it returns non-2xx and the PR is
left for the next sweep exactly as before; nothing is forced past a real rule.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 11:04:42 +00:00
G 0dd5619fe7 fix(ci): a red base must not trap the PR that repairs it (#285) 2026-08-07 10:47:20 +00:00
GandClaude Opus 5 18bab73f63 fix(ci): fall back to native auto-merge when a direct merge is refused (#283)
Three consecutive sweeps read #278 and #282 as MERGEABLE/CLEAN, announced the
merge, and were refused:

    X Pull request maonakamoto/evig#278 is not mergeable:
      the base branch policy prohibits the merge.

There is no such policy. main has branch protection with every option
disabled, no rulesets, no CODEOWNERS, no required checks and no required
reviews. Throughout the same window the bot merged #225, #226, #279 and #280
without trouble — including #225/#226, which modify .github/workflows/, so
this is not the token's workflows scope either.

The refusal is gh's client-side precheck reading the mergeStateStatus that
GITHUB_TOKEN sees, which is not the one a PAT sees — nothing this script can
inspect its way around. So log both what we saw and delegate: native
auto-merge is GitHub performing the merge itself, and does not go through that
precheck. It is the escape hatch gh names in its own error message.

Still one car per sweep — the fallback is followed by the same `break`, so at
most one PR per sweep is handed over, and the green-base guard is unchanged.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 10:26:10 +00:00
GandClaude Opus 5 3988c47786 fix(ci): retry runs that failed before executing any of our code (#280)
* fix(ci): retry runs that failed before executing any of our code

The sweep retries CANCELLED checks but deliberately leaves genuine failures
alone. A GitHub Actions incident lands in the gap between those two: the run
fails with conclusion=failure, so it is treated as a real verdict — but it
never executed a line of this repo's code.

Consequence: during an incident EVERY open PR is stranded permanently, and
nobody is in the merge loop to notice. Today (2026-08-06, Actions major
outage, webhooks throttled to ~15%) three jobs on PR #278 died with "Failed
to resolve action download info. Error: Service Unavailable" and that PR
cannot become green again without a human running `gh run rerun --failed`.

The discriminator is precise: a job whose ONLY failed step is "Set up job"
never got as far as running our code, so it produced no verdict about it.
A real failure names a real step.

Verified against live runs:
  PR #278 outage run  -> [Set up job]                                -> infra
  PR #228 (TS 7)      -> [Verify (lint + umlauts + typecheck + build)] -> real
  PR #265 (ESLint 10) -> [Verify (lint + umlauts + typecheck + build)] -> real
  nonexistent run     -> no data -> refuses to guess

Conservative by construction: retries only when EVERY failed job in the run
failed at set-up. One real step failure anywhere and the PR is left alone.

Capped at MAX_RUN_ATTEMPTS (default 3) — an incident can last hours, and an
uncapped retry would re-run the same doomed run every sweep forever.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

* fix(ci): self-heal a base branch whose CI ended without a verdict

The sweep already knew that a cancelled/infra-failed run is noise rather than
a judgement — but only for PR checks. The base branch kept the original
"refuse and exit" behaviour, which deadlocks: the only thing that produces a
new CI run on main is a merge, and merges are exactly what the guard blocks.

Observed here on 2026-08-07. An Actions incident left main's run `failure`
with no failed job at all (Migration Drift cancelled, everything else green).
Eleven PRs sat for ~14h while every sweep exited 0 and looked healthy.

So: extract the "is this a verdict about the code?" test and apply it to the
base run too. A genuine failure still blocks — that IS a verdict. Retries are
capped by the run's own attempt counter, which is why this re-runs rather than
dispatching fresh (a new dispatch resets to attempt 1 and could churn forever).

Also drops `--failed` from the PR-side retry. A partial re-run flips SKIPPED
jobs to CANCELLED, so the PR ends up non-green for a brand new reason and needs
yet another retry — seen on #278 today.

Tested by running the real script against a fake `gh` on PATH, so this covers
shipped control flow rather than a re-description of it. Mutation-checked:
disabling the self-heal turns 3 of the 6 tests red.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-07 08:19:13 +00:00
GandClaude Opus 5 a7a6fece92 fix(ci): drain the merge queue oldest-first, not newest-first (#275)
`gh pr list` returns newest-first, and the sweep merges the first eligible PR
then stops. So the newest green PR wins every sweep, and an older one can wait
indefinitely.

Observed in maonakamoto/fleetcrown on 2026-08-06: two consecutive sweeps merged
the two newest PRs while three older green ones sat untouched and were never
even evaluated. With several agent sessions opening PRs continuously that is
starvation — and it starves the worst candidate, since the longest-waiting PR
is the one whose checks were proven against the most now-stale base.

PR numbers increase monotonically with creation, so sorting ascending is FIFO.
The ordering was never a decision, just whatever gh happened to return.

Fixed upstream first (fleetcrown #182) and verified in production there: the
sweep immediately after it landed correctly took the oldest open PR rather than
the newest. This is that one-line change, applied to the fleet.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 16:19:15 +00:00
GandClaude Opus 5 5221d374aa fix(ci): main-red alarm was silent on the path that produces nearly every run (#277)
#272 added the alarm on `workflow_run`. That covers pushes to main — but
every merge in this repo is an auto-merge made with GITHUB_TOKEN, which
fires no push event. The sweep therefore re-arms ci.yml by dispatch, and
GitHub emits no `workflow_run` for a dispatched run. The alarm was blind on
the path producing almost every main CI run.

Proven within the hour: main went red on 0c14621d (a transient puppeteer
403 fetching chrome-headless-shell), the sweep started refusing merges
again, and no issue was filed.

Now dual-path, one policy:

- scripts/ci/main-red-alert.sh holds the verdict logic, so the two callers
  cannot drift.
- main-red-alert.yml keeps the push path and calls the script.
- ci.yml gains a post-main job, gated to dispatched runs on main, which
  resolves its own verdict from the job results and calls the same script.
  `skipped` counts as success (jobs here are conditional on event type);
  failure outranks cancelled.

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-06 14:51:44 +00:00
G 91b8fec42c ci: green PRs merge and deploy themselves (#269)
* ci: add the auto-merge sweep policy

* ci: green PRs merge and deploy themselves

* ci: allow CI to be dispatched so auto-merge can re-arm it

* ci: allow deploy to be dispatched so an automated merge still ships
2026-08-05 19:16:36 +02:00
GandClaude Opus 4.8 3ac9c4bac7 feat: /vision — the founding vision as a real route (#246)
* docs(evig): founding story SSOT, brand package, non-profit framing

- docs/EVIG_STORY.md: canonical founding narrative (the 'access to
  intelligence is the inequality that matters' thesis) that About/hero/
  decks/grants derive from.
- public/brand/: organised brand package (SVGs + raster exports + manifest).
- .claude/CLAUDE.md: reconcile non-profit framing (gemeinnütziger Verein in
  Gründung) with the standing honesty boundary (no tax-deductible receipts
  until registered + canton-recognised).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(vision): add /vision manifesto route (Obsidian & Ion Lime, DE+EN)

The founding vision as a real, full-bleed public route — the surface the
live site had nothing of (mission/thesis for donors + talent). Debuts evig's
new obsidian+lime identity as a scoped, low-risk beachhead; the green app is
untouched and the global retheme stays a separate decision.

- Route src/app/[locale]/vision/{page,content}.tsx — static, own header/footer.
- ConditionalMainLayout: locale-aware /vision opt-out from standard chrome.
- globals.css: scoped .theme-vision tokens (obsidian/lime primitives +
  semantic overrides) + self-contained .v-* layout. Zero literal hex in TSX.
- Fonts self-hosted (subset woff2, no CDN): Space Grotesk, Inter, Plex Mono.
- i18n: DE (canonical) + EN vision namespace; other 6 locales fall back to DE
  and are recorded in the i18n baseline (intentional deferral until copy locks).
- routes SSOT + sitemap wired.

Verified: typecheck, lint (0 errors), test:i18n (16/16) all green; rendered
/vision (de) + /en/vision at 1200px and 390px — fonts load, theme scopes,
chrome opt-out works, no horizontal overflow.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* feat(vision): real CTA destinations, footer discoverability, repo cleanup

- CTAs no longer point at the non-existent hallo@evig.ch mailbox — route to
  real in-app pages instead: Support → /get-involved/partnerships, Build →
  /get-involved, products → /contact (added partnerships + contact to the
  ROUTES.public SSOT).
- Discoverability: link /vision from the site footer navigation.
- Cleanup: remove 11 orphaned 'ChatGPT Image …' scratch PNGs (8.4 MB) that
  were shipping unreferenced in public/images/logo/.
- i18n: drop the now-unused mailto subject keys; add footer.vision label
  (DE+EN); baseline the deferred locales for the new keys.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-27 17:50:04 +02:00
Mao NakamotoandClaude Opus 4.8 9ef3c02008 rebrand(evig): identity SSOT, i18n, README, logo assets [Layer A/1]
- org.ts: name/mission/founding → evig; positioning = affordable intelligence
- KILL money-routing: blank revamp-it IBAN; add PAYMENT (BTC + OrangeCat, TODO)
- blank infra-coupled fields evig lacks (phone, legacy site, external shops)
- i18n: brand tokens → evig across all locales (values only, keys untouched)
- README + logo assets → evig

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-26 12:19:40 +02:00
GandClaude Opus 4.8 da2655a276 chore(infra): remove Vercel references — everything is self-hosted now (#239)
Vercel is fully decommissioned; production runs self-hosted on the Hetzner
box (revampit.orangecat.ch) behind Caddy, deployed via deploy-selfhost.yml.

- Sentry configs: VERCEL_ENV/VERCEL_GIT_COMMIT_SHA → NODE_ENV +
  NEXT_PUBLIC_BUILD_SHA (the self-host build SHA set by the deploy script).
- proxy.ts: drop dead '/_vercel' from BYPASS_INTL.
- prune-audit-log cron: drop x-vercel-cron auth branch, keep CRON_SECRET
  (aligns with the other cron routes + run-cron.sh); wake-recurring-tasks
  schedule comment reworded to the systemd-timer reality.
- Public web-design "technologies we use": Vercel → self-hosted Hetzner
  (tsx url + hosting description in all 8 locales).
- Presentations: ki-nachhaltigkeit demo links revampit.vercel.app →
  revampit.orangecat.ch; aoz-wohnen hosting slide → self-hosted Hetzner.
- Email template admin links: hardcoded revampit.vercel.app → ${ORG.website}.
- .env.example: Vercel Blob → S3 (Hetzner Object Storage) vars;
  KIVVI_API_URL → kivvi.orangecat.ch.
- CI: drop dead NEXT_PUBLIC_VERCEL_ENV build env.
- Comments (auth/env/sanitize/instrumentation/tax-reports/hirn/kivvi/
  inventory) reworded to self-hosted reality, rationale preserved.

Accurate historical/current docs (docs/**, README, archive) and the
immutable migration 033 comment left as-is.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-22 21:46:20 +02:00
Mao NakamotoandClaude Opus 4.8 7615dc8da0 feat(blog): 3-level audience access control (public/team/author)
Adds an `audience` axis to blog posts, orthogonal to the existing
`visibility` (discoverability) column:
  - public — anyone (default; every existing post, via migration default)
  - team   — logged-in staff only (session.user.isStaff)
  - author — the author (created_by) + super admins only

SSOT: enum + labels + parser in src/config/blog.ts; one access helper
(src/lib/blog-access.ts, canViewPost/filterViewable) reused at every read
surface — index, post page + generateMetadata, RSS, sitemap, comments API.
Admin editor gains a "Zugriff" select (config-driven) and the list shows a
per-post access badge. Migration 138 is additive (ADD COLUMN ... DEFAULT
'public', no CHECK — app-validated per migration-110 policy).

Verified: typecheck, lint, 83 blog tests (incl. new blog-access truth table),
lint:umlauts — all green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-21 09:03:21 +02:00
Mao NakamotoandClaude Fable 5 ebc1de2774 feat(zeiterfassung): shareable Monatsrapport link for social workers
The approver has to get the monthly report to a referring social worker, who
can't log in to the admin report page — and app email isn't reliably
deliverable (unauthenticated sending domain). So deliver it the way the
codebase already delivers deliverables: an unguessable public bearer link.

- Migration 137 `report_shares` (token, user_id, month, revoked_at) — keyed by
  (user_id, month), since a running month may have no timecard row yet.
- `report-shares.ts` service: ensure/lookup/revoke, mirroring the deliverables
  share_token pattern.
- Extract the report body into a shared, presentational `<MonthlyReportSheet>`
  (+ neutral `<ReportPrintButton>`), reused by the admin page and the new
  public page — no behaviour change to the admin sheet.
- Public `/r/[token]` route (view + print, never indexed, no auth); `/r/` added
  to proxy BYPASS_INTL.
- `<ReportShareCard>` on the admin report page: create / copy / revoke the link.
  Same access rule as viewing the report (owner or timecard approver).

Migration already applied + recorded on prod.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-20 18:34:15 +02:00
Mao NakamotoandClaude Fable 5 de9db2f60d feat(zeiterfassung): Saldo ledger, monthly reminders, one-click submit — SMALL-Time retirement phase 1
The accounting layer the legacy SMALL-Time punch clock had and we lacked:

- migration 136: employment_periods (effective-dated Pensum in weekly
  minutes, seeded from contract_hours), vacation_entitlements (per
  person-year + carryover «Übertrag F»), team_profiles opening balance
  («Übertrag T») + zeiterfassung_reminder_day
- src/config/holidays.ts: Kanton-ZH public holidays SSOT (fixed +
  Easter-derived, deterministic — no yearly maintenance)
- lib/team/saldo.ts: pure Zeitsaldo engine — saldo is DERIVED, never
  typed: opening + Σ(Ist − Soll). Soll from employment periods spread
  over scheduled weekdays; holidays reduce Soll (no manual Feiertag
  rows, double-count guard); paid absences fulfil Soll, unpaid don't.
  10 tests incl. an exact reproduction of the legacy tool's −56h July
  example and a mid-year Pensum change
- lib/services/saldo.ts + GET /api/timecards/saldo (own; ?user_id= for
  approvers) — Feriensaldo defaults to 20 days pro-rated by Pensum when
  HR hasn't set an entitlement (exactly the legacy 60% → 12 Tage rule)
- SaldoStrip on /admin/zeiterfassung + compact variant on the team
  profile tab: Zeitsaldo, Feriensaldo, month Ist/Soll, plus a hint when
  the schedule template disagrees with the Pensum
- monthly reminder: pick a day (ReminderSetting), daily cron
  /api/cron/timecard-reminders nudges in-app+mail if the month is not
  submitted — verified end-to-end (approved cards correctly skipped)
- one-click «Füllen & einreichen» on an empty draft month (also the
  reminder's landing action)
- all new UI strings in 8 locales

Verified in the browser against live data: +27h36 saldo = 90h Ist vs
62h24 Soll-to-date at 24h/week, hand-checked.

Phase 2 (tracked): vacation-flow unification, monthly close snapshot +
PDF (payroll + social-worker report), HR proxy entry, opening-balance
UI, SMALL-Time cutover.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-17 16:07:57 +02:00
e92df22be1 fix(protocols): chunked transcription for long recordings + one retry pipeline (#218)
The 2026-07-16 follow-up incident: after migration 134 unblocked the INSERT,
a 63 MB meeting recording still failed with "Fehler bei der Audio-Verarbeitung".
Root cause: Groq Whisper caps uploads at ~25 MB and the local faster-whisper
fallback only exists in dev — so any recording longer than ~45 minutes could
NEVER transcribe on prod, while the upload UI advertised 250 MB. On top of
that, the detail-page retry used the legacy /process-audio endpoint, which
collapsed the specific error into a generic message.

Transcription (root fix):
- src/lib/transcription/segment-audio.ts — ffmpeg transcodes big files to
  16 kHz mono MP3 and splits them into 15-minute segments (~5 MB each)
- transcribeAudio: <=24 MB goes to Groq directly; bigger files are segmented
  and transcribed chunk by chunk, text joined in playback order; local
  whisper stays as the dev fallback
- selfhost-deploy: idempotently installs ffmpeg on the prod box
- process-sources: an empty audio transcription only fails the request when
  audio was the sole source — typed notes / files still carry the meeting
- unit tests for provider selection incl. the chunked path

One pipeline (DRY):
- Detail-page retry (draft "Inhalt liefern" card + review "Erneut verarbeiten")
  now posts to the SAME /api/protocols/[id]/process-sources the create page
  uses — audio and/or text, same specific error messages
- Legacy /process and /process-audio routes and their tests deleted;
  /process-notes stays (direct JSON import without AI), /import-tasks stays
- ProtocolDraftInput reworked: one card, audio + text together, "Mit KI
  strukturieren" instead of "Schritt 2 starten" jargon
- Footer actions moved out of the notes-only block: a stuck draft can now be
  deleted instead of lingering forever

Prod verification:
- tests/e2e/prod-protocols-smoke.spec.ts + "Prod protocols smoke" workflow
  (workflow_dispatch): generates real German speech audio with espeak-ng,
  logs in as the staff E2E account, uploads on /admin/protocols/new, waits
  for transcription + AI structuring, asserts review state, deletes the
  protocol. Variants for the direct (<24 MB) and chunked (>24 MB) paths.


Claude-Session: https://claude.ai/code/session_01QXEBWjhBB9JYsgLSX4jNES

Co-authored-by: Georgy Butaev <georgy.butaev@revamp-it.ch>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 12:38:24 +02:00
G 6dc60279e2 feat(intake): quality-control pipeline — verdicts, publish gates, buyer-facing test results, QR labels, mobile UX, Kivvi (#212)
Checklist pass/fail/n.a. verdicts with a failed pipeline state; QC publish gate on all three publish paths; buyer-visible test results + verified badge; QR device labels; Vier-Augen-Prinzip on final QA; mobile-first pipeline cards; Kivvi sync from both intake doors. E2E journey updated to the verdict API with a second seeded staff account for four-eyes sign-off.
2026-07-16 12:11:35 +02:00
GandClaude Fable 5 6bea23a407 feat(teams): team space — AI form assist, task/protocol connections, members-first UI (#216)
* feat(teams): invite members by email + seed Forschung & Entwicklung team

Team onboarding gets a full email-invite flow, unified on the existing
placeholder-claim mechanism (one path, no parallel invitation table):

- Invite by name + email on the team page (super admin): registered staff
  are added directly and notified; unknown addresses get a placeholder
  account with the membership plus a claim link (14d, single-use) by email
  (POST /api/admin/teams/[id]/invitations)
- Placeholder "Einladen" can now send the claim link by email (optional
  address field) instead of clipboard-only delivery
- Claim page prefills the email field from the delivery address
- Direct member-add notifies the person by email (self-join stays silent)
- New templates teamClaimInvite / teamMemberAdded (Swiss German, escaped)
- Migration 132 seeds the Forschung & Entwicklung team with Georgy as lead
- Docs: EMAILS.md trigger table gains the Teams rows

Tests: 18 new (templates + schemas); typecheck, lint, lint:umlauts clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(ci): repair inherited E2E breakage — seed columns + moved admin route

Both failures predate this branch (main's last five CI runs fail the same
two jobs):

- e2e-seed.ts still wrote technician_profiles.is_verified /
  verification_date, dropped in migration 122 (identity moved to
  user_profiles in 121). Seed now sets the verified flag on user_profiles,
  keeping the "verified technician" premise.
- inventory-routes.ts pointed at /admin/repairer-applications — the one
  hardcoded path in the list, which drifted when the section moved. Now
  uses ROUTES.admin.hrApplications (config-driven like every other row).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(db): recreate ensure_seller_profile() without dropped display_name

Migration 122 dropped seller_profiles.display_name but the trigger
function from 031 still inserted it, so the first listing insert of any
user without a seller_profiles row errored — surfaced by the E2E seed,
and a live bug for new P2P sellers. Migration 133 recreates the function
inserting only user_id (identity lives on user_profiles since 121).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(e2e): first() on assertions whose text legitimately renders twice

Timecard submit ("Zur Prüfung gesendet" in status banner + summary line),
tasks empty state, and blog body/excerpt all resolve to two elements,
tripping Playwright strict mode — timecard failed every retry, the other
two were flaky. Assert on .first(); either occurrence being visible is
what the journeys actually verify.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(timecards): race-safe draft creation + stale E2E heading assertion

Two concurrent first-hits of GET /api/timecards for the same user+period
both passed the existence check and raced the
UNIQUE(user_id, period_start, period_end) insert — the loser 500'd
("Zeitkarte konnte nicht geladen werden"). Insert now uses ON CONFLICT DO
NOTHING and serves the row the winner created.

The timecard journey also asserted a "Zeitkarten" heading on
/admin/zeiterfassung — that page's H1 is "Zeiterfassung" (the Zeitkarten
approval queue moved to its own page). Assert the real heading.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* feat(teams): AI form assist on team create/edit

The team-config form (/admin/teams/new) was one of the few creation
forms without the shared AIFormAssist bar. Standard two-step wiring:

- FORM_AI_REGISTRY entry 'team-config' — describe the team in a sentence
  and name/purpose/mail_folders/meeting_cadence/accent are filled; accent
  options derive from the teams config SSOT, no invented mail addresses
- AIFormAssist dropped into TeamFormClient (expanded on create, refine
  available on edit); AI-filled mail_folders array maps onto the form's
  newline-joined field, accent validated against the config enum
- Accent labels hoisted from the component into TEAM_ACCENT_LABELS in
  src/config/teams.ts (SSOT — form select and AI prompt share one list)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* feat(teams): team space — tasks + protocols connected to the team page

The team page becomes a working space by connecting existing systems
instead of adding new ones (goals, KPIs, focus, coverage already live
there):

- Migration 134: optional team_id on tasks + meeting_protocols
  (ON DELETE SET NULL, indexed) — org-wide records stay untouched
- Task form gains an optional Team select (create + edit); protocol
  form the same (options server-fed from listTeams)
- "Neue Aufgabe" / "Neues Protokoll" on the team page preselect the
  team via ?team= (validated against real teams before prefill)
- Team page shows two new panels: open tasks (due-first, assignee +
  priority) and recent protocols (status-badged), with empty states
- New team-space service (SoC: queries only); panels are pure server
  components reusing config label/color SSOTs

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(teams): members first, one add/invite element below the list

The Mitglieder section led with two stacked forms before showing a
single member — backwards for a page you mostly read. Now the member
list comes first; below it sits ONE card: the staff picker row, and
for super admins a fold-out «Noch nicht registriert? Per E-Mail
einladen» containing the email invite (no second card, no chrome).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-16 11:33:50 +02:00
ec5ce6babc fix(protocols): drop drifted enum CHECKs blocking audio protocols + calmer create form (#214)
Creating a protocol from an audio recording failed on prod: migration 027b
used ADD COLUMN IF NOT EXISTS ... CHECK, which silently skips the CHECK when
the column already exists — so the stale input_method value list (without
'audio') survived and rejected every valid audio insert.

Migration 134 guarantees the input_method column exists and drops all CHECK
constraints on meeting_protocols + protocol_action_links by catalog lookup.
All of them are hand-synced enum lists already validated at the write
boundary via zod schemas derived from src/config/protocols.ts — same policy
as migration 110 (notifications). Verified by replaying both the fresh-from-
zero and the drifted-prod state in a throwaway Postgres 16.

Create form (/admin/protocols/new) noise reduction:
- Open-source fallback tools (CaptureAlternatives) move out of the middle of
  the hero card to a collapsed disclosure at the page bottom — reference
  material, not part of the flow.
- Hero hierarchy now matches usage: drop zone first, record button with its
  consent checkbox beside it, notes textarea last; the filler "oder / Datei
  hochladen ↓" spans are gone.
- Submit is a plain action row instead of a third card; the format/char-count
  meta line only renders once there is text.


Claude-Session: https://claude.ai/code/session_01QXEBWjhBB9JYsgLSX4jNES

Co-authored-by: Georgy Butaev <georgy.butaev@revamp-it.ch>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
2026-07-16 11:22:09 +02:00
GandClaude Fable 5 2499936262 feat(teams): invite members by email + seed Forschung & Entwicklung team (#210)
* feat(teams): invite members by email + seed Forschung & Entwicklung team

Team onboarding gets a full email-invite flow, unified on the existing
placeholder-claim mechanism (one path, no parallel invitation table):

- Invite by name + email on the team page (super admin): registered staff
  are added directly and notified; unknown addresses get a placeholder
  account with the membership plus a claim link (14d, single-use) by email
  (POST /api/admin/teams/[id]/invitations)
- Placeholder "Einladen" can now send the claim link by email (optional
  address field) instead of clipboard-only delivery
- Claim page prefills the email field from the delivery address
- Direct member-add notifies the person by email (self-join stays silent)
- New templates teamClaimInvite / teamMemberAdded (Swiss German, escaped)
- Migration 132 seeds the Forschung & Entwicklung team with Georgy as lead
- Docs: EMAILS.md trigger table gains the Teams rows

Tests: 18 new (templates + schemas); typecheck, lint, lint:umlauts clean.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(ci): repair inherited E2E breakage — seed columns + moved admin route

Both failures predate this branch (main's last five CI runs fail the same
two jobs):

- e2e-seed.ts still wrote technician_profiles.is_verified /
  verification_date, dropped in migration 122 (identity moved to
  user_profiles in 121). Seed now sets the verified flag on user_profiles,
  keeping the "verified technician" premise.
- inventory-routes.ts pointed at /admin/repairer-applications — the one
  hardcoded path in the list, which drifted when the section moved. Now
  uses ROUTES.admin.hrApplications (config-driven like every other row).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(db): recreate ensure_seller_profile() without dropped display_name

Migration 122 dropped seller_profiles.display_name but the trigger
function from 031 still inserted it, so the first listing insert of any
user without a seller_profiles row errored — surfaced by the E2E seed,
and a live bug for new P2P sellers. Migration 133 recreates the function
inserting only user_id (identity lives on user_profiles since 121).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(e2e): first() on assertions whose text legitimately renders twice

Timecard submit ("Zur Prüfung gesendet" in status banner + summary line),
tasks empty state, and blog body/excerpt all resolve to two elements,
tripping Playwright strict mode — timecard failed every retry, the other
two were flaky. Assert on .first(); either occurrence being visible is
what the journeys actually verify.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

* fix(timecards): race-safe draft creation + stale E2E heading assertion

Two concurrent first-hits of GET /api/timecards for the same user+period
both passed the existence check and raced the
UNIQUE(user_id, period_start, period_end) insert — the loser 500'd
("Zeitkarte konnte nicht geladen werden"). Insert now uses ON CONFLICT DO
NOTHING and serves the row the winner created.

The timecard journey also asserted a "Zeitkarten" heading on
/admin/zeiterfassung — that page's H1 is "Zeiterfassung" (the Zeitkarten
approval queue moved to its own page). Assert the real heading.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Akm86ZwqhiSM2BfdKH96cN

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-07-16 08:57:54 +02:00
Mao NakamotoandClaude Opus 4.8 3b1178ab69 refactor(teams): extract useAsyncAction hook (DRY) + David rename + example seed
- useAsyncAction: the run(key,fn){busy;error;refresh} pattern was copy-pasted
  across 8 team components. Extract one hook (SSOT); adopt it in the 3 new
  coordination components (Goals/Metrics/JoinButton).
- Placeholder Dana → David (Dani = Daniel; keep gender). Email + seed updated;
  stale "Platzhalter surname is the marker" comment corrected (email domain is
  the only marker now).
- scripts/db/seeds/team-coordination-examples.sql: example goals + KPIs on the
  Reparatur team so the hub isn't empty (idempotent; editable rows).

Verified: typecheck + lint (0 errors). Prod DB updated.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 19:15:58 +02:00
Mao NakamotoandClaude Opus 4.8 b06f1941d3 feat(teams): team page as coordination hub — goals + KPI metrics + self-join
Make each team page useful for coordination, and let any staff join/leave a
team in one click from the team page itself.

- Migration 131: team_goals (title/detail/status/target_label) + team_metrics
  (label/current/target/unit/higher_is_better, nullable source_key reserved for
  a future auto-compute path). goal status enum lives in src/config/teams.ts +
  zod — plain TEXT column, no CHECK (per CLAUDE.md §DB).
- Service in a NEW file team-coordination.ts (teams.ts was already ~385 lines —
  no god file); shared metricProgress() helper honours metric direction.
- API: /teams/[id]/goals[/[goalId]] + /metrics[/[metricId]], all withAdmin('teams')
  so any staff can maintain them (transparent, matches membership edits).
- UI: TeamGoalsSection (roadmap w/ config-driven status chips), TeamMetricsSection
  (KPI cards + progress bar), TeamJoinButton (self join/leave — the API already
  allowed it; this exposes it on the team page). Draft forms are module-level
  (react-hooks/static-components), statuses/labels/colours all from config.
- Team page also surfaces meeting cadence.

Verified: typecheck, lint (0 errors), test:i18n 7/7. Migration applied + recorded
on prod.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 18:42:33 +02:00
Mao NakamotoandClaude Opus 4.8 b5825da736 feat(teams): rock-legend placeholder names (recognizable first name + real surname)
Rename the 15 placeholders from "<First> Platzhalter" to "<First> <rock legend>"
(Vera Hendrix, Rezo Hetfield, …). First name still starts with the same letters
as the real teammate so who-is-who stays clear; the @placeholder.revamp-it.ch
email remains the systematic not-yet-claimed marker. Applied to prod via UPDATE.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 17:57:22 +02:00
Mao NakamotoandClaude Opus 4.8 dfac12e500 feat(teams): complete 8-team set + pseudonymised placeholder members
Migration 130 adds the 4 teams the Teamsliste has beyond 129's first four:
verkauf, lager, reparatur, and fundraising (seeded is_active=false — crossed
out on the source; kept for history, not deleted). mail_folders left empty
(source listed none for these) — fill via /admin/teams, never guess an address
onto the wrong team.

Seed (scripts/db/seeds/team-placeholders.sql, NOT a migration → never runs in
CI/fresh dev) creates 15 locked placeholder members + 30 memberships across all
8 teams. Placeholders are password_hash NULL (cannot log in until claimed),
surname "Platzhalter" + @placeholder.revamp-it.ch domain (findable/claimable
markers). Real people onboard later by claiming their row via a registration
link. Georgy is the only real account (georgy.butaev@revamp-it.ch), never
pseudonymised. Roles map the Teamsliste's Haupt/Vertretung → lead/deputy.

Applied + recorded on prod; verified all 8 teams read correctly.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 17:39:59 +02:00
Mao NakamotoandClaude Opus 4.8 28e2359381 feat(teams): first-class Teams + many-to-many membership (Phase 1)
Replace the fictional team_profiles.department string with real named teams
(Orga, IT-Admin, Medien/Kommunikation, Laden). Each team owns Nextcloud mail
folders and has members with a role (lead/deputy/member); people belong to
MULTIPLE teams, so membership is a many-to-many join. left_at preserves
transfer history.

- Migration 129: teams + team_memberships (enums = plain TEXT, authority in
  src/config/teams.ts + zod per CLAUDE.md §DB; only structural invariant in SQL
  is the partial-unique of one LIVE membership per (team, person)). Seeds the 4
  teams + confirmed @revamp-it.ch accounts, guarded for from-zero CI replay.
- src/config/teams.ts — SSOT for team roles + membership enums
- src/db/schema/teams.ts, src/lib/schemas/teams.ts, src/lib/services/teams.ts
- /admin/teams CRUD + assignment board + MembershipManager (transfer via
  MoveMemberModal) + TeamFocusInput
- /admin/team/me + MemberTeamsCard/MemberBoardCard on the member view
- i18n keys for all locales

Verified: lint, typecheck, test:i18n (7/7) all green. Migration idempotent.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 17:17:08 +02:00
Mao NakamotoandClaude Opus 4.8 2b444f29d4 feat(deliverables): render description as markdown on share page + general, name-free instructions
Share page now shows the deliverable description as formatted markdown (what it
is, how to view/download/embed/ask/give feedback) so any recipient can use it
without a login — not personalised to one person.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-14 10:56:49 +02:00
Mao NakamotoandClaude Opus 4.8 6e4db31c69 feat(presentations): real team photos on V3 (repair + support desk)
From PR-Fotos/Fotos-Feb26: a team member doing focused repair now sits beside
the 'grosses Team' slide (split layout — the team finally has a face), and the
Support-Desk photo (two people, the 'Support Desk' sign) replaces the generic
bench shot on the Beratung/Support slide.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 21:26:55 +02:00
Mao NakamotoandClaude Opus 4.8 b64709eada fix(feedback): unblock deck comments (CSRF) + make site feedback reliable
Presentation comments were dead in prod: the static decks are served outside
middleware, so a reader has no CSRF cookie and the POST always failed
'CSRF validation failed'. Exempt /api/presentations/comments from CSRF (like
the webhook endpoints) and compensate with per-IP rate limiting + the honeypot.

Site feedback widget (/api/suggestions) was email-only and silently lossy —
sendCustomEmail resolves {success:false} instead of throwing, so failed
delivery went unnoticed. Now:
- persists to site_suggestions (migration 127) — the reliable channel
- notifies super admins in-app (bell) per submission
- still emails the team, but CHECKS the result and logs failures
- new admin page /admin/feedback to browse, resolve, copy-as-prompt
- route test updated (13/13) for the new persistence/notify/auth side channels

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 17:56:42 +02:00
Mao NakamotoandClaude Opus 4.8 5fe8e02c64 feat(presentations): per-slide reader comments + admin collection
Readers of a shared deck can comment on any slide — signed in OR anonymous:
- New table presentation_comments (migration 126) + Drizzle schema.
- Public API /api/presentations/comments: GET (who-am-I for the form) +
  POST (anonymous allowed; signed-in identity taken from the session, not
  spoofable; honeypot for bots). Notifies super admins in-app per comment.
- Deck UI: a 'Kommentar' button on every slide (hidden in fullscreen/print/
  export) that posts feedback for the current slide.
- Admin /admin/presentations/feedback: comments grouped by deck -> slide with
  an 'Als Prompt kopieren' button (slide-keyed, paste-ready for the AI) and a
  resolve toggle. Feedback link + open-count badge on the Präsentationen page.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 17:35:48 +02:00
Mao NakamotoandClaude Opus 4.8 a4da182541 feat(blog): auto-translate on publish + staff draft preview
Auto-translate (opt-in per post, default on):
- migration 124: blog_posts.auto_translate, blog_post_translations.is_machine.
- On publish (create or edit) with auto_translate on, missing locales are filled
  from the German base in the background (fire-and-forget, like syncToKivvi) via
  the shared fillMissingTranslations helper — missing-only, never overwrites a
  human tab. Editor gets an "auto-translate on publish" toggle.
- Machine rows are flagged is_machine; a human edit in the editor clears it. The
  editor tab shows an amber sparkle for unreviewed machine translations, and the
  public page shows an "automatisch übersetzt" note.

Staff draft preview:
- getDbPostForPreview fetches a post regardless of published state; the [slug]
  page renders drafts for logged-in staff (with an "Entwurf" banner) and 404s
  for everyone else. The editor's Vorschau link now works for drafts too — fixes
  "can't see what a draft will look like before publishing".

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 16:05:17 +02:00
Mao NakamotoandClaude Opus 4.8 82463eabd4 feat(blog): no-git per-locale translations for DB posts + AI translate
Closes the last gap in "admins manage posts without git": DB-authored blog
posts can now be translated into every locale entirely in the editor.

- migration 123: blog_post_translations (base German in blog_posts, non-de
  overlay here; PK (post_id, locale), FK cascade). Locale validated at the
  write boundary (no SQL CHECK, per migration-110 policy).
- read overlay in blog-db.ts: getPostBySlug/getAllPosts take a locale and
  overlay the translation, falling back to the German base; getDbPostLocales
  feeds hreflang. seo_title/seo_description now drive generateMetadata.
- write: admin blog API accepts a translations[] array; syncPostTranslations
  (validated upsert + prune) reused by create + edit.
- editor: language tabs (BlogTranslationTabs) + locale-aware useBlogPostForm.
- scalable AI translation: POST /api/admin/blog/[id]/translate fills missing
  locales from the German base via the provider cascade (Groq→OpenRouter→
  Ollama), sequential with retry/backoff to respect the per-minute token
  limit; "Fehlende übersetzen" button in the editor.
- tests: schema, translation sync, AI translate service, blog-db overlay.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 14:45:05 +02:00
Mao NakamotoandClaude Opus 4.8 a44b787a84 fix(profiles): migration 122 drops lingering helper_profiles_v before column
Prod deploy aborted (safely — 2b stayed live) because a dead view,
helper_profiles_v, still referenced technician_profiles.is_verified. The view
was DROPped in migration 073 (its TS was removed, no reader), so it was already
absent in the from-zero replay — but it lingered on the prod DB (drift). Drop the
remnant at the top of 122; IF EXISTS keeps the clean replay a no-op. Confirmed on
prod: nothing depends on the view, and no other object depends on any dropped
column.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 07:27:55 +02:00