Five literals that each duplicated a fact owned somewhere else, or named
something that no longer exists.
1. packages/saldo/package.json — `homepage` pointed at
`revampit.orangecat.ch/saldo`. That host is retired: the organisation renamed
to evig, the canonical host is `evig.orangecat.ch`, and this repo's own
`src/config/urls.ts` and `.env.selfhost.local.example` already say so. A
published package's homepage is the one copy that would outlive the Caddy
redirect keeping the old name alive.
2. scripts/setup-deploy-keybind.sh — the generated trigger script baked
`PROJECT_DIR="/home/g/dev/revampit"`, wrong twice over: it names one
developer's laptop, and it names the repo by a directory it no longer uses.
The checkout knows where it is, so ask it: PROJECT_DIR is now derived from
the setup script's own resolved location (`scripts/` -> repo root), which is
the same root the rest of the file already assumes. The heredoc had to become
interpolating for that, so the generated script's own `$PROJECT_DIR`
references are escaped to stay literal. Verified by running it: the generated
file lands on the parent of `scripts/`, and `bash -n` passes on both.
3+4. The Hetzner box IP was written out twice — `ssh-keyscan -H 167.233.22.31`
in .github/workflows/deploy-selfhost.yml and
`BOX="${BOX:-ubuntu@167.233.22.31}"` in scripts/selfhost-deploy-evig.sh — for
one fact that already has an org-wide definition: the `HETZNER_IP` Actions
variable (visibility: all). Both now read it, the workflow passing it to the
script through the job env.
Each end fails LOUDLY rather than proceeding on an empty value.
`ssh-keyscan -H ""` writes nothing and exits 0, so an unset variable would
have produced a deploy that died much later with an unhelpful host-key error;
the step now emits `::error::` and stops. The script uses `${HETZNER_IP:?…}`
so it refuses to guess a target. Setting BOX explicitly still overrides both,
for a one-off host. Proved by mutation: unset -> exit 1 with the message;
set -> ubuntu@<ip>; BOX set with HETZNER_IP unset -> BOX wins.
5. src/config/e2e-test-accounts.ts held two real personal addresses as a shipped
`as const` array. That published who they were in a public repo and made
changing them a release. The list is configuration: it now comes from
`E2E_TEST_ACCOUNT_EMAILS` (comma-separated) and defaults to EMPTY.
Empty is the safe direction and the reason this is not a behaviour risk: the
list only ever RELAXES a rate limit, so an unset variable means nobody is
exempt — the strict path every other account already takes. The opposite
default would trust an address nobody configured on every deployment of this
code. It is read at call time, not module load, so the value cannot be
snapshotted before the environment is populated. This follows the direction
scripts/e2e-inventory-prod.sh already took when it dropped its own hardcoded
account default.
OPERATIONAL NOTE: until `E2E_TEST_ACCOUNT_EMAILS` is added to `SELFHOST_ENV`,
the prod dual-persona smoke runs under normal rate limits. Documented in
.env.example and .env.selfhost.local.example.
The test asserted the hardcoded list's length, which is no longer a property
of the source. It now sets the variable itself with fictional fixture
addresses — a test naming a real person's mailbox is the same leak the source
just stopped committing — and adds the two cases that matter most: unset and
empty must both exempt nobody.
Deliberately NOT touched: src/config/org.ts DEFAULT_CONTACT_EMAIL. The comment
above it records that the gmail address is a live decision because evig.ch is
not registered and the previous address bounced.
Claude-Session: https://claude.ai/code/session_01NLZ6vs1jsWw2kKbpWTZHf2
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Saldo
Time tracking that balances. — Zeiterfassung, die aufgeht.
A dependency-free TypeScript engine for Soll/Ist time balances, vacation, and honest monthly reports. It answers the one question every timesheet dodges: did this person work the hours they were supposed to? — and it does so correctly across mid-year workload changes, public holidays, paid and unpaid absences, and historical months.
Zero runtime dependencies. Pure functions. Bring your own storage and UI.
The name lives in one place —
src/brand.ts. Rename the whole product by editing that object.
Install
npm install saldo-engine
Quick start
import {
computeTimeSaldo,
computeVacationBalance,
getHolidayDateSet,
STANDARD_WEEKLY_SCHEDULE,
} from 'saldo-engine'
const result = computeTimeSaldo({
openingMinutes: 0, // carried-in balance
openingDate: '2026-01-01', // …as of this date
periods: [{ validFrom: '2026-01-01', weeklyMinutes: 21 * 60 }], // the Pensum, effective-dated
schedule: STANDARD_WEEKLY_SCHEDULE, // which weekdays are worked
entries: [{ work_date: '2026-07-06', duration_minutes: 420, category: 'work' }],
holidays: getHolidayDateSet(2026, 2026),
today: '2026-07-20', // as-of date (inject for reports)
})
// → { saldoMinutes, monthSollMinutes, monthIstMinutes, monthSaldoMinutes, computedFrom }
What it computes
- Zeitsaldo (running balance) —
opening + Σ(Ist − Soll)through the as-of date. A scheduled day without entries shows as a minus immediately. - Soll (target) — the effective-dated weekly Pensum distributed across the scheduled weekdays. A mid-year 60% → 80% change keeps every past month correct.
- Month decomposition — real Soll/Ist for the as-of month, computed always, even for a month before the opening date (historical reports show real numbers, never a fake 0).
- Feriensaldo (vacation) — entitlement + carryover − taken, with a pro-rata default when no explicit entitlement is set.
Design rules baked in: public holidays on scheduled days reduce Soll automatically; paid absences (holiday/sick/…) count as Ist, unpaid ones don't; a manual holiday-category entry on a real holiday is dropped so it can't double-count.
Bring your own categories
The engine ships a sensible Swiss default (paid: Ferien/Krank/Unfall/Feiertag/ Militär; unpaid: Unbezahlt). Any organisation can supply its own:
import { categoryConfigFromAbsences, computeTimeSaldo } from 'saldo-engine'
const categories = categoryConfigFromAbsences(
[{ value: 'pto', paid: true }, { value: 'sabbatical', paid: false }],
'public_holiday', // your holiday-marker category
)
computeTimeSaldo(input, { categories })
Holidays
getHolidayDateSet / getPublicHolidays ship the Kanton Zürich statutory set
(deterministic, Easter-derived — no per-year maintenance). For other countries or
cantons, pass your own Set<'YYYY-MM-DD'> as holidays.
Scope
This is the accounting core — the maths, fully tested. Storage (DB), auth, the UI, PDF/print reports, and localisation live in the app that embeds it. See the Saldo product for a reference Next.js implementation (self-service timecards, four-eyes approval, printable monthly reports, and public share links for a referring social worker).
Develop
npm run typecheck # tsc --noEmit
npm test # node:test via tsx — zero external deps
npm run build # emit dist/
License
MIT — see LICENSE.