7 Commits
Author SHA1 Message Date
CatoandClaude Opus 5 3c1cf2db79 fix(cron): a reboot raced the app, and a daily timer stayed failed for 24h (#471)
evig-cron@timecard-reminders.service went red on 2026-09-10 and stayed red.
Nothing was broken.

The box booted at 08:01:48 UTC. `Persistent=true` makes systemd fire every
schedule missed while the box was off the moment it comes back, so the 08:00
run caught up at 08:01:58 — the same second evig-app.service started. Next
bound :4004 at 08:02:00. curl got connection-refused in between, `set -e`
turned curl's exit 7 into run-cron.sh's exit status, and because this is a
*daily* timer the unit then sat `failed` until the next morning: an incident
page for a two-second race, and one day of reminders silently skipped.

`After=evig-app.service` cannot fix this — it orders the timer after the app
unit's *start*, never its readiness. So run-cron.sh now waits for the app it is
supposed to call: retry ONLY curl's exit 7 (10 attempts, 6s apart, bounded well
inside TimeoutStartSec=180), and log each wait so it is not a silent hang. A
real HTTP status still fails on the first response — a broken endpoint stays
exactly as loud as it was.

Two smaller things in the same file: `set -e` would have killed the run before
curl if CRON_SECRET were ever unset (the `[ -n ... ] && hdr=(...)` one-liner is
the script's exit status when the test is false), and a connection failure used
to produce no journal line at all.

The Never-Twice half: scripts/ci/test-run-cron.sh drives the script against a
fake app that binds late, one that answers 500, and one that never comes up,
and asserts the retry is spent on exactly one of them. Wired into `verify` as
`test:ops`, so CI runs it. Verified it fails against the pre-fix script.

Editing this file changes nothing on the box — the deploy only rsyncs the
standalone build — so the README's install block is now flagged as the only
channel that ships it, and it must be re-run.


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

Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-09-10 13:38:32 -07: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
GandClaude Opus 4.8 0a01a8727e fix(payments): make Payrexx truly plug-and-play (webhook signature, capture, partial-config guard) (#191)
Audit of the Payrexx integration found gaps that would break live payments the
moment real credentials are added. Closes them so go-live is config-only:

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

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

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

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

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

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

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-30 15:52:58 +02:00
Mao NakamotoandCursor e4411bfd4f fix(db): Hetzner-only DATABASE_URL SSOT and user/admin E2E smoke
Retire cloud DB and AUTH_DB_* split in code, env examples, and docs so
local dev uses Docker Postgres and prod ops use the Hetzner tunnel pattern.
Add Playwright user-admin-flows spec with locale-aware auth helper.

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

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

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-19 03:19:26 +02:00