Commit Graph
222 Commits
Author SHA1 Message Date
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
Mao NakamotoandClaude Opus 4.8 702b803633 feat(profiles): SSOT slice 3 — drop duplicated identity columns
Contract phase of the Profiles SSOT consolidation. 2a (sellers) and 2b
(technicians) moved every reader AND writer of public identity to user_profiles
and both are LIVE on prod, so the role-table duplicates are dead. Remove them.

- migration 122: drops seller_profiles.{display_name,avatar_url,bio,is_verified,
  verification_date} and technician_profiles.{is_verified,verification_date}
  (+ the two verified indexes). Idempotent; ordered after 121's backfill so the
  from-zero CI replay stays green (verified locally: 131 migrations apply clean,
  end state has identity only on user_profiles).
- Drizzle: identity columns removed from sellerProfiles / repairerProfiles.
- Kept: seller/technician canton, technician city + verification_documents,
  technician_reviews.is_verified (a review flag) — those are role facts, not
  identity.

user_profiles is now the sole owner of public identity + per-person verification.

DEPLOY NOTE: safe only because 2a/2b are already live — the migrate→activate
window has no build that still reads these columns.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-13 07:18:01 +02:00
Mao NakamotoandClaude Opus 4.8 ef4d3c6472 feat(profiles): SSOT slice 2a — seller reads+writes via user_profiles
Public seller identity (display_name/bio/avatar/is_verified) now resolves
from user_profiles everywhere, and the seller's own editor writes there —
so the duplicated seller_profiles columns have no live reader/writer left
(dropped in slice 3). Reads and the /me write ship together, so there is no
window where the public sees a stale name.

- sellerProfileCoreFields: identity fields sourced from userProfiles; every
  caller now leftJoins user_profiles (sellers/[id], sellers/me GET).
- /api/sellers/me PATCH: upserts identity into user_profiles, writes
  city/canton to seller_profiles, re-selects the joined row for the response
  (can't RETURNING across two tables).
- listings GET / [id] / favorites, checkout-listing, sellers/[id] layout:
  join user_profiles for display_name/bio/avatar/is_verified; city/rating
  stay on seller_profiles (storefront facts).
- members/[id]: is_verified + name/avatar from user_profiles SSOT.
- tests updated for the new join/write shapes (55 green).

City/canton intentionally untouched (service base / storefront ≠ identity).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 10:16:20 +02:00
Mao NakamotoandClaude Opus 4.8 2d8ac0b019 feat(profiles): SSOT slice 1 — user_profiles owns public identity
First of 3 slices consolidating duplicated public-identity fields
(display_name/avatar/bio/is_verified) that today live on seller_profiles
and technician_profiles and can disagree. Non-breaking expand+backfill:

- migration 121: add is_verified/verification_date to user_profiles;
  backfill display_name/avatar/bio/is_verified from the role tables
  (COALESCE-preserve any existing value; verified = OR across roles).
  Role-table columns kept in place — readers move in slice 2, columns
  drop in slice 3. Replay-validated against seeded deps (existing
  display_name preserved, verified merged, rows created).
- Drizzle: userProfiles.isVerified / verificationDate.
- new public-identity.ts: getPublicIdentityMap / publicIdentityColumns /
  resolveDisplayName — the read chokepoint slice 2 routes everything through.
- city/canton deliberately left on role tables (storefront / service base,
  not identity). Full rationale + slice plan in docs/PROFILES_SSOT_PLAN.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-11 09:52:22 +02:00
Mao NakamotoandClaude Opus 4.8 5b4dc37a4a feat(blog): make every post editable & deletable from admin (no git)
Staff can now manage git/file-authored posts from the admin UI without touching
the repo:
- 'Edit' imports the file post into blog_posts (DB wins on slug in the merged
  reader) and opens the normal editor.
- 'Delete' hides the slug via blog_hidden_slugs; public readers + the admin list
  skip it (the markdown stays in the repo as a harmless fallback).
- blog_posts gains a visibility column (public|unlisted); the DB reader + admin
  list now report it instead of hardcoding 'public'. (migration 120)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 09:47:21 +02:00
Mao NakamotoandClaude Opus 4.8 d3d7338231 feat(blog): comments — any logged-in user can comment
New blog_comments table (migration 119) keyed by post SLUG so it works for
both DB- and git/file-authored posts. Public GET; auth-gated POST (2–2000
chars); author or staff can delete. Comment thread + composer render on every
post page (login prompt when logged out). UI strings translated in all 8 locales.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-10 09:25:42 +02:00
Mao NakamotoandClaude Opus 4.8 ea5e717f53 feat(erfassung): structured storage-location picker (replaces free-text location)
When erfassing a product, staff now pick WHERE it physically is from a
runtime-addable list instead of typing free text — and can add a new location
inline without leaving the form.

- Migration 117: `storage_locations` table (name, kind, holder_user_id for
  member-possession, is_active) seeded with Hauptlager/Laden/Nebenlager +
  `inventory_items.storage_location_id` FK. Free-text `location` kept for compat.
- Config SSOT `config/erfassung/storage-locations.ts`: 5 kinds (main_storage,
  shop, secondary_storage, member_possession, other) + DE labels + seeds.
- API `/api/admin/storage-locations` GET (active list) + POST (add).
- `<StorageLocationSelect>`: fetch + Select + inline "+ Standort" add, wired
  into ProductDimensionFields; threaded through the erfassung zod schemas →
  formDataToPayload → create-product so it persists.
- i18n: components.erfassung.storageLocation (de + en).

Distinct from the public `locations` table (venues). One location per product.
0 tsc errors, lint clean, umlauts + i18n-parity clean, 342 erfassung/schema/
config tests green. Built in an isolated worktree (a parallel session held the
main tree with in-progress blog work).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 18:51:39 +02:00
Mao NakamotoandClaude Opus 4.8 6bd1f9ae8f refactor(repairer): remove orphaned pro-repairer application/certification flow
The "professional repairer" application flow let users apply to become vetted
pro technicians pending admin approval — but the professional tier was never
assigned to any profile, so the whole pipeline (apply → review → approve/reject,
certification + document verification) produced only dead pending/rejected rows
with no downstream effect. Removed entirely.

Deleted (36 files): /api/repairer/apply, all /api/admin/repairer-applications
routes, /api/admin/documents + /api/admin/certifications routes, the
/admin/repairer-applications page, the 9-file review-UI component dir, the
repairer email templates, and the now-dead certification-status.ts +
document-status.ts config.

Shared-file edits:
- schema: dropped the `repairerApplications` (technician_applications) table
- TABLE_NAMES: removed REPAIRER_APPLICATIONS + the 4 cert/doc tables that the
  deleted routes queried (those 4 never had a migration — they never existed)
- dashboard: removed the repairer-application count + inline action
  (getDashboardStats / buildActionItems / types / InlineActionButton)
- actions.ts: removed approveRepairerApplicationAction
- config/permissions/nav: removed the `repairer-applications` section,
  permission alias, and breadcrumb
- IT-Hilfe admin: the empty-state CTAs (which pointed at the deleted review
  page) now point at the technician directory /it-hilfe/techniker; DE copy
  updated to reflect that technicians self-register
- email: removed the repairer + adminNewRepairerApplication templates/exports
- config/repairer-status: removed REPAIRER_APPLICATION_STATUS(+_LABELS)

Migration 116 drops technician_applications (CASCADE).

KEPT (the live community-technician / IT-Hilfe flow): repairer_profiles
(profile_tier='community'), technician_services/availability/reviews,
getActiveTechnicianProfileId, all /api/it-hilfe/* + /it-hilfe/* pages,
TechnicianProfileSchema, the dashboard totalTechnicians count.

Verified: 0 dangling references, 0 typecheck errors, lint clean, 131 test
suites / 3082 tests green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 18:06:15 +02:00
Mao NakamotoandClaude Opus 4.8 f1d552f62a feat(promo): discount/gift-code foundation — schema + engine + seeds
Phase 1 slice 1 of the promo/gift-code system. Adds the redeemable-code
rail without wiring it into checkout yet (that's the next slice):

- Migration 115: promo_codes (typed: percent | fixed | gift_card, with
  scope, usage/per-user limits, validity window, gift-card balance) +
  promo_code_redemptions ledger. Type/scope are app enums, not DB CHECK
  lists (repo rule); only true invariants are CHECK-constrained. Seeds
  revamp100 (CHF 100 off) + revamp100p (100% off). Replays cleanly +
  idempotent (verified in a throwaway pg16).
- Pure discount engine (src/config/promo-codes.ts, 9 unit tests): caps
  fixed/gift-card at the order total (never negative), percent floors,
  enforces scope/min-order/expiry/limits.
- Redemption service (validate → compute; record consumes atomically,
  decrementing gift-card balance under a tx so limited codes can't
  overspend).

Distinct from the referral `coupons` table (per-user auto-rewards).
Next: admin issuance UI + checkout redemption (incl. 100%-off →
skip-gateway) across marketplace/workshop/appointment.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-09 12:07:33 +02:00
Mao NakamotoandCursor 9aa982de60 feat(marketplace): add listing Q&A and buy CTA
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-04 19:36:11 +02:00
Mao Nakamoto ca322b00e3 ci(e2e): fix seeded journey drift 2026-07-04 13:04:02 +02:00
Mao Nakamoto 22117c0622 ci(e2e): add seeded local journey environment 2026-07-03 22:06:09 +02:00
Mao Nakamoto afe305d56c chore(db): retire dead medusa table and persist login lockouts 2026-07-03 21:48:44 +02:00