Commit Graph
3 Commits
Author SHA1 Message Date
GandClaude Opus 5 a21d8906af chore: add a formatter, and close a CSS comment that was never closed (#419)
* chore: add a formatter, matching the style this repo already writes

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

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

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

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

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

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

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

* chore: teach git blame to skip the reformat

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

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

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

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

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

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

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

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

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

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-08-31 13:35:50 +00:00
GandClaude Opus 5 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
g-butandClaude Opus 4.5 280a749db4 fix(tasks): add type assertions to all API route query results
Fix TypeScript errors by properly typing database query results
throughout the task management API routes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 14:20:56 +01:00