Commit Graph
3 Commits
Author SHA1 Message Date
GandClaude Opus 5 53d2e70723 chore: add a formatter (#233)
* 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 (199 files)

Mechanical. No behaviour change. This SHA is listed in
.git-blame-ignore-revs so `git blame` skips it.

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

* chore: teach git blame to skip the reformat

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

* fix(ci): put prettier where CI actually installs

The formatter was added to the root package.json, but CI installs with
working-directory: frontend and then runs npm run verify at the root, so root
devDependencies are never installed at all. format:check died with
'prettier: not found' before checking a single file.

Root now delegates into frontend the way every other root script already does,
and prettier is a devDependency of frontend, whose lockfile CI installs.

frontend also needs its own .prettierignore: prettier resolves that file
relative to the working directory, so the root one stopped applying the moment
the command ran from frontend/ — which is how README.md and Playwright output
ended up being checked.

* fix(ci): do not format contentlayer's generated output

format:check ran green locally and failed in CI on files that do not exist
locally: CI builds contentlayer before verify, so .contentlayer/generated is
present by the time prettier looks. One generated module imports with
assert { type: 'json' }, which prettier's parser rejects outright.

A local --check cannot see build output, so generated directories have to be
ignored by name rather than discovered.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-29 11:06:25 +00:00
GandClaude Opus 5 d773b32a3c test: add the hermetic unit gate, and stop an empty env var blanking the brand (#219)
* test: add the hermetic unit gate, and stop an empty env var blanking the brand

`verify` was lint + typecheck + build. The only suite in the repo was
`npx playwright test` — e2e, needing browsers and a running server, so it can
only run somewhere expensive enough that it rarely does. backend's `test` was
`echo "Error: no test specified" && exit 1`. There was no hermetic gate at all,
which is why the fleet audit lists this repo as needing a unit suite rather
than a verify edit.

Adds vitest (one runner, both packages), 43 tests, and puts `test` inside
`verify`. Script names now match the rest of the fleet: `test` is the hermetic
unit suite, `test:e2e*` is Playwright. Nothing live called `npm run test` — CI
calls `npm run verify`, and the only other reference is in
deploy.yml.disabled.

ONE REAL BUG FIXED, in the white-label merge:

  Object.entries(envBranding).filter(([_, value]) => value !== undefined)

An UNSET env var is `undefined`, but a var that is present-and-empty is `''`.
`NEXT_PUBLIC_BRAND_NAME=` is an ordinary line to find in a .env, and that empty
string beat the default — blanking the product name, or the logo path, or the
domain, with nothing to say why. The filter now also rejects empty and
whitespace-only values. This matters here more than in most repos: DataCat
ships as TalentFlow, HealthIntake and LegalIntake, so the branding merge IS the
product's identity.

What the tests hold still:

  - defaults are complete, and the theme is one the type allows — a blank
    default reaches production as an empty <title> or a broken logo src
  - a real env value overrides; an empty or whitespace one does not
  - the merged config never grows a key the defaults do not declare
  - every preset sets only keys BrandingConfig declares. A preset writing
    `primary_color` next to a config reading `primaryColor` renders the default
    and reports success — the expensive drift in a config layer is a key that
    looks applied and is not.
  - every preset merges to a complete config with valid hex colours
  - responseHandlers keeps a uniform envelope: every handler sets a boolean
    `success`, since a client that branches on it must never meet a response
    without it
  - `error()` NEVER attaches `details` in production. That is the leak guard —
    details carry stack traces and driver messages — and it is one `if` away
    from being refactored into always-on.

Negative-tested rather than assumed. Restoring the old `!== undefined` filter
turns exactly the two empty-value tests red; making `details` unconditional
turns exactly the production-leak test red.

Verified locally: lint clean, 43/43 tests. `typecheck` and `build` were NOT run
locally — `contentlayer build` fails on this Node with ERR_INVALID_ARG_TYPE,
the prerequisite PR #191 documents. CI runs the full `verify`, and this change
does not touch the typecheck or build paths.

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

* fix(test): declare vitest in frontend so the new test typechecks

CI caught what my local run could not: `npm run typecheck` is
`cd frontend && npx tsc --noEmit`, so it typechecks frontend/src — including
the new branding.test.ts — but vitest was only installed at the repo root.
tsc could not resolve the module, and the four `it.each` callbacks then fell
back to implicit `any`.

Declared in frontend/package.json rather than excluded from tsconfig. Excluding
test files would have made the error go away while leaving the tests
un-typechecked, and a test that does not compile is not a gate.

This repo is not npm workspaces — frontend and backend install separately — so
a package that imports vitest has to declare it. The root copy stays because
that is where the runner is invoked from.

Verified: full `npm run verify` now passes locally end to end — lint clean,
tsc 0 errors, 43/43 tests, build clean. (Contentlayer generated correctly this
time via frontend's postinstall, which is what had blocked the local typecheck
earlier.)

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

* fix(test): run vitest from frontend, the only place CI installs

Second CI failure on this branch, and my first fix was aimed at the wrong
layer. Exit code 127 — command not found — after lint and typecheck passed.

The cause is in .github/workflows/ci.yml: it installs with
`working-directory: frontend`. The ROOT node_modules never exists in CI. So a
root-installed vitest is not a dependency CI has, and `vitest run` from the
repo root could only ever fail there while passing on my machine, where I had
run `npm install` at the root by hand.

Moving the config into frontend/ rather than adding a root install step: the
runner has to launch from the one directory that has a node_modules, and that
is a fact about this repo's pipeline, not a preference. The config still sets
`root` back to the repo, because the suite spans frontend AND backend.

Root `vitest` devDependency removed for the same reason — declaring a package
that is never installed is a claim the repo cannot back.

Reproduced properly this time: `rm -rf node_modules` at the root, then
`npm run test` — 43/43 pass against CI's actual layout rather than a locally
convenient one. lint and typecheck also clean.

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

* fix: load vitest config as native ESM to survive Node 18 CI

vite 7 (pulled in by vitest ^3.2.7) dropped its CJS build entirely.
frontend/package.json has no "type": "module", so a .ts config gets
bundled and require()'d as CommonJS — and that bundle itself requires
'vite', which is ESM-only, throwing ERR_REQUIRE_ESM under Node 18 (the
version .nvmrc pins for contentlayer). Renaming to vitest.config.mts
makes Vite load it via native dynamic import instead, sidestepping the
CJS bridge. Verified: `npm run verify` (lint+typecheck+test+build)
green under both Node 18 and 22.

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-18 23:30:54 +00:00
Your NameandClaude b2a4656d16 feat: prepare for deployment - update documentation and backend structure
- Updated CLAUDE.md with unified Erfassung platform concept
- Enhanced backend controllers and routes structure
- Updated dependencies and configurations

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 19:49:19 +02:00