diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b8e34ef..60542fd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -70,13 +70,14 @@ jobs: - name: Typecheck run: bun run typecheck - # The checks of the logic no build exercises: the dither field, the hero scenes and their + # The checks of the logic no build exercises: the dither field and charts, the hero scenes and their # OG colours (kept in step with theme.css), the panels' cameos, the activity feed, the # gitfut card the hero's easter egg reads, the article reader's voice and utterances, the # release tag routing, and which pushes to main deploy production - name: Script checks run: | bun scripts/dither.test.ts + bun scripts/dither-charts.test.ts bun scripts/pixel-scenes.test.ts bun scripts/cameos.test.ts bun scripts/github-activity.test.ts diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 35fea06..aee6dba 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -165,6 +165,7 @@ jobs: env: SSH_KEY: ${{ secrets.VPS_SSH_PRIVATE_KEY }} VPS_HOST: ${{ secrets.VPS_HOST }} + VPS_HOST_KEY: ${{ secrets.VPS_HOST_KEY }} run: | mkdir -p ~/.ssh chmod 700 ~/.ssh @@ -176,24 +177,23 @@ jobs: chmod 600 ~/.ssh/id_ed25519 # sanity check sans dévoiler la clé ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null && echo "ssh key OK" - # ssh-keyscan expire au bout de 5 s par defaut, et son echec en - # derniere commande d'un step lance sous `bash -e` faisait tomber tout - # le deploiement, avec `2>/dev/null` pour masquer la raison. Vecu sur - # le premier deploiement prod de v1.0.0. Timeout explicite, retry, et - # verification qu'on a vraiment une cle avant de continuer. - for i in 1 2 3 4 5; do - if ssh-keyscan -T 10 -H "$VPS_HOST" >> ~/.ssh/known_hosts 2>/dev/null \ - && [ -s ~/.ssh/known_hosts ]; then - echo "known_hosts ok (tentative $i)" - break - fi - echo "ssh-keyscan sans reponse (tentative $i/5)" - if [ "$i" -eq 5 ]; then - echo "::error::ssh-keyscan n'a pas recupere la cle hote apres 5 tentatives" - exit 1 - fi - sleep 5 - done + # La clé hôte vient du secret VPS_HOST_KEY (`ssh-ed25519 AAAA…`, lue + # sur le VPS) : plus de scan au déploiement, ses timeouts muets ont + # fait tomber v1.0.0 et v1.0.1 (#42, #163). Pas de repli sur un scan, + # sinon la dépendance reste. Le sed retire un CRLF collé avec la + # valeur ; ssh-keygen -l refuse une ligne mal formée. Son empreinte ne + # va pas au log public : elle se cherche dans les index de scan + # Internet et y rend l'IP d'origine. + if [ -z "$VPS_HOST_KEY" ]; then + echo "::error::VPS_HOST_KEY manquant, voir docs/CONFIGURATION.md (The deploy key)" + exit 1 + fi + printf '%s %s\n' "$VPS_HOST" "$VPS_HOST_KEY" > ~/.ssh/known_hosts + sed -i 's/\r$//' ~/.ssh/known_hosts + if ! ssh-keygen -l -f ~/.ssh/known_hosts >/dev/null; then + echo "::error::VPS_HOST_KEY illisible : une ligne \`ssh-ed25519 AAAA…\`, sans nom d'hôte devant" + exit 1 + fi - name: Compute image ref id: img @@ -215,8 +215,17 @@ jobs: NUXT_APP_SECRET: ${{ secrets.NUXT_APP_SECRET }} TURNSTILE_SECRET_KEY: ${{ secrets.TURNSTILE_SECRET_KEY }} run: | + # ssh cite l'adresse résolue sur certaines erreurs (`Connection closed + # by port 22`), que le masque du secret ne couvre pas quand + # VPS_HOST est un nom d'hôte : masquée avant la connexion (#162). + # Sur une clé hôte qui ne correspond pas, il imprime l'empreinte que + # le serveur a envoyée, qui rend l'IP d'origine comme celle de Setup + # ssh : le sed la masque, pipefail garde le code de sortie de ssh. + getent ahosts "$VPS_HOST" | awk '!s[$1]++ {print "::add-mask::" $1}' || true REMOTE_CMD="ENV=$ENV IMAGE=$IMAGE GITHUB_TOKEN=$GH_TOKEN RESEND_API_KEY=$RESEND_API_KEY NUXT_STUDIO_TOKEN=$NUXT_STUDIO_TOKEN NUXT_APP_SECRET=$NUXT_APP_SECRET TURNSTILE_SECRET_KEY=$TURNSTILE_SECRET_KEY $ACTION" - ssh -o BatchMode=yes -o ConnectTimeout=20 "$VPS_USER@$VPS_HOST" "$REMOTE_CMD" + set -o pipefail + ssh -o BatchMode=yes -o ConnectTimeout=20 -o StrictHostKeyChecking=yes "$VPS_USER@$VPS_HOST" "$REMOTE_CMD" 2>&1 \ + | sed -u -E 's/SHA256:[A-Za-z0-9+/]+/SHA256:***/g' - name: Summary if: always() diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ad73ab..1b30f28 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -248,6 +248,7 @@ jobs: env: SSH_KEY: ${{ secrets.VPS_SSH_PRIVATE_KEY }} VPS_HOST: ${{ secrets.VPS_HOST }} + VPS_HOST_KEY: ${{ secrets.VPS_HOST_KEY }} run: | mkdir -p ~/.ssh chmod 700 ~/.ssh @@ -255,24 +256,23 @@ jobs: sed -i 's/\r$//' ~/.ssh/id_ed25519 chmod 600 ~/.ssh/id_ed25519 ssh-keygen -y -f ~/.ssh/id_ed25519 >/dev/null && echo "ssh key OK" - # ssh-keyscan expire au bout de 5 s par defaut, et son echec en - # derniere commande d'un step lance sous `bash -e` faisait tomber tout - # le deploiement, avec `2>/dev/null` pour masquer la raison. Vecu sur - # le premier deploiement prod de v1.0.0. Timeout explicite, retry, et - # verification qu'on a vraiment une cle avant de continuer. - for i in 1 2 3 4 5; do - if ssh-keyscan -T 10 -H "$VPS_HOST" >> ~/.ssh/known_hosts 2>/dev/null \ - && [ -s ~/.ssh/known_hosts ]; then - echo "known_hosts ok (tentative $i)" - break - fi - echo "ssh-keyscan sans reponse (tentative $i/5)" - if [ "$i" -eq 5 ]; then - echo "::error::ssh-keyscan n'a pas recupere la cle hote apres 5 tentatives" - exit 1 - fi - sleep 5 - done + # La clé hôte vient du secret VPS_HOST_KEY (`ssh-ed25519 AAAA…`, lue + # sur le VPS) : plus de scan au déploiement, ses timeouts muets ont + # fait tomber v1.0.0 et v1.0.1 (#42, #163). Pas de repli sur un scan, + # sinon la dépendance reste. Le sed retire un CRLF collé avec la + # valeur ; ssh-keygen -l refuse une ligne mal formée. Son empreinte ne + # va pas au log public : elle se cherche dans les index de scan + # Internet et y rend l'IP d'origine. + if [ -z "$VPS_HOST_KEY" ]; then + echo "::error::VPS_HOST_KEY manquant, voir docs/CONFIGURATION.md (The deploy key)" + exit 1 + fi + printf '%s %s\n' "$VPS_HOST" "$VPS_HOST_KEY" > ~/.ssh/known_hosts + sed -i 's/\r$//' ~/.ssh/known_hosts + if ! ssh-keygen -l -f ~/.ssh/known_hosts >/dev/null; then + echo "::error::VPS_HOST_KEY illisible : une ligne \`ssh-ed25519 AAAA…\`, sans nom d'hôte devant" + exit 1 + fi - name: Deploy via ssh wrapper env: @@ -286,8 +286,17 @@ jobs: NUXT_APP_SECRET: ${{ secrets.NUXT_APP_SECRET }} TURNSTILE_SECRET_KEY: ${{ secrets.TURNSTILE_SECRET_KEY }} run: | + # ssh cite l'adresse résolue sur certaines erreurs (`Connection closed + # by port 22`), que le masque du secret ne couvre pas quand + # VPS_HOST est un nom d'hôte : masquée avant la connexion (#162). + # Sur une clé hôte qui ne correspond pas, il imprime l'empreinte que + # le serveur a envoyée, qui rend l'IP d'origine comme celle de Setup + # ssh : le sed la masque, pipefail garde le code de sortie de ssh. + getent ahosts "$VPS_HOST" | awk '!s[$1]++ {print "::add-mask::" $1}' || true REMOTE_CMD="ENV=$ENV IMAGE=$IMAGE GITHUB_TOKEN=$GH_TOKEN RESEND_API_KEY=$RESEND_API_KEY NUXT_STUDIO_TOKEN=$NUXT_STUDIO_TOKEN NUXT_APP_SECRET=$NUXT_APP_SECRET TURNSTILE_SECRET_KEY=$TURNSTILE_SECRET_KEY deploy" - ssh -o BatchMode=yes -o ConnectTimeout=20 "$VPS_USER@$VPS_HOST" "$REMOTE_CMD" + set -o pipefail + ssh -o BatchMode=yes -o ConnectTimeout=20 -o StrictHostKeyChecking=yes "$VPS_USER@$VPS_HOST" "$REMOTE_CMD" 2>&1 \ + | sed -u -E 's/SHA256:[A-Za-z0-9+/]+/SHA256:***/g' # Vérifie depuis l'extérieur que c'est bien cette version qui sert le # trafic, pas seulement que le conteneur a démarré. deploy.sh attend diff --git a/CHANGELOG.md b/CHANGELOG.md index c10ce85..7e9b170 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ migrates `[Unreleased]` into that file and empties this one, see ## Past releases +- [2.3.0](changelogs/2.3.0.md) · 2026-11-25 - [2.2.0](changelogs/2.2.0.md) · 2026-11-17 - [2.1.0](changelogs/2.1.0.md) · 2026-11-02 - [2.0.0](changelogs/2.0.0.md) · 2026-10-29 diff --git a/CLAUDE.md b/CLAUDE.md index d004e89..4fcd8d6 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -99,13 +99,17 @@ These modules are in dependencies but not yet integrated into `nuxt.config.ts`, `bunfig.toml` (`[fmt]`) carries over the former `.oxfmtrc.json` and prints byte for byte what oxfmt 0.74 printed. `flavor = "oxfmt"` is load-bearing: without oxfmt installed, `bun fmt` falls back to Prettier's flavor, which breaks union types differently. There is no `fmt` script on purpose: before Bun 1.4.4, `bun fmt` means `bun run fmt`, so a `"fmt": "bun fmt"` script would call itself forever; without one, an older Bun fails on "Script not found". Leave `sortTailwindcss` off: it skips every file of a @nuxt/ui project (oven-sh/bun#47229). The Bun version is pinned in three places that move together: `bun-version` in `ci.yml`, the `Dockerfile` base image, the `bun` override in `flake.nix` (drop it once nixpkgs ships 1.4.4, with its line in the check below). Dependabot only bumps the Dockerfile: the CI step `Bun version pins` fails until the other two follow. `fmt:check` passes `--no-script`, so a `fmt` script added later cannot stand in for the formatter. -It formats code only, with three deliberate exceptions; the last two break at request time, where lint, typecheck and build cannot see them: +It formats code only, with four deliberate exceptions; the last two break at request time, where lint, typecheck and build cannot see them: - Markdown and MDX (blog articles, changelogs, docs) are prose, never reformatted; +- `app/utils/dither-charts.js` is a verbatim copy of a shared file (see Dither charts below): reformatted, it no longer matches its source; - `app/components/OgImage/**` is rendered by satori, whose gradient parser fails on a `style` value split across lines (`/_og/*` returns 500); - CSS keeps double quotes (`[[fmt.overrides]]`): nuxt-og-image (6.1, still true in 7) only recognises the Tailwind entry through `@theme` or a double-quoted `@import "tailwindcss"` (`dist/chunks/tw4.mjs`). `main.css` has no `@theme`, so `@import 'tailwindcss'` turns that resolver off and the OG images fall back to the mono font. `theme.css` quotes alone change nothing. CI catches both: `scripts/og-smoke.sh` serves the build and compares the OG images of `/`, `/blog`, `/blog/gwm` (French, at the root) and `/en` byte for byte against `scripts/og-smoke/*.png` (rendering is deterministic across platforms). That determinism rests on the `Inter OG` family (`public/fonts/inter`, static TTF, root `font-family` of both templates): Google serves Inter as a variable font, satori cannot read it, and nuxt-og-image's fallback download differs per machine (Inter on a Mac with Inter installed, Fenix on the CI runner and so in prod). A weight the templates start using needs its static TTF there. It also checks those pages' `` (``, exactly one canonical, JSON-LD that parses with an `@type` on every node) and that `/sitemap.xml` lists the article: no other step renders these tags. When og-smoke fails in CI, the actual renders are uploaded as the `og-smoke` artifact. An intended change to an OG image (hero copy, that article, a satori component) needs `scripts/og-smoke.sh --update` after `bun run build`, and the new PNGs committed. The repo-wide reformat commit is listed in `.git-blame-ignore-revs`. +### Dither charts +`UiDitherChart` draws Monocode's dither charts (heatmap, donut, sparkline, bar/line/area, gauge, progress), `UiDitherStat` a figure with its sparkline, with `app/utils/dither-charts.js`, a verbatim copy of the shared core kept with the `me:report` skill (`~/.claude/skills/me/report/shell/dither-charts.js` in the dotfiles; MIT, the notice at its top). Never edit the copy: fix the source, copy it again, `bun scripts/dither-charts.test.ts`. Its API is typed by hand in `app/utils/dither-charts.d.ts`, which the component and the test both read: a new copy that changes the API changes it too, nothing detects the drift. Colours are the core's tokens (`accent`, `positive`, `muted`, `series1` to `series6`…), mapped to the theme's variables in the component (`--series-*` live in `theme.css`), so a theme switch repaints them. The core only reads `prefers-reduced-motion`: the component settles the entrance itself for the site's pause button (`useReducedMotion`), through the controller's `settled` flag, which the core does not document. A heatmap's cell reads in the site's tooltip (`TOOLTIP_CLASS`, teleported, so no scroller clips it), driven by the core's `onHover`; the core's own card is hidden. The minifier drops the copy's MIT header, legal comments included: `nuxt.config.ts` reads it (`MIT License` to `SOFTWARE.`) and puts it back on the chunk that carries the core (`postBanner`). A new copy that changes either of them fails the build (notice) or lets the charts animate under the pause button (`settled`). + ### Content System The project uses Nuxt Content v3's collection-based API (not the legacy document-driven mode). Always use `queryCollection()` instead of deprecated content APIs. @@ -164,6 +168,7 @@ The routing logic lives in a script rather than inline YAML because getting it w ### Required Secrets Repo-level GitHub Actions secrets (see `docs/CONFIGURATION.md`): - `VPS_HOST` / `VPS_USER` / `VPS_SSH_PRIVATE_KEY` - SSH deploy target + key +- `VPS_HOST_KEY` - the VPS's host key (`ssh-ed25519 AAAA…`, no host name), pinned in `known_hosts` instead of an `ssh-keyscan` at deploy time (#163). Missing or malformed, `Setup ssh` fails; a reinstalled VPS fails every deploy on `Host key verification failed` until it is updated - `GH_TOKEN` - GitHub API access (threaded to the VPS at deploy time) - `RESEND_API_KEY` - Email sending (contact form), **source of truth for prod**, injected into the VPS by `deploy.yml` - `NUXT_STUDIO_TOKEN` - **not defined**: passed by `deploy.yml` and `release.yml`, but unused while `nuxt-studio` is disabled @@ -173,7 +178,7 @@ Repo-level GitHub Actions secrets (see `docs/CONFIGURATION.md`): Repo-level **variables** (not secrets), passed as build-args by both workflows: - `CV_URL_FR` / `CV_URL_EN` - addresses of the CV PDFs, hosted outside this public repo (on the VPS). Empty: the CV sections on `/experience` and `/contact` stay hidden - `TURNSTILE_SITE_KEY` - site key of the contact form's Turnstile widget (hostnames `kbrdn.dev` + `pre-prod.kbrdn.dev`). Empty: no widget, so no message can be sent. Locally, `.env.example` has Cloudflare's always-pass test keys -- `GA_ID` - Google Analytics 4 measurement ID, passed to **prod builds only**. Empty: no cookie banner, no gtag. Consent is CookieConsent (`app/plugins/cookie-consent.client.ts`, basic consent mode: gtag.js loads only after "accept"); events go through `trackEvent()` (`app/utils/analytics.ts`), a no-op before consent. The terms page (`/cgu`, `/en/terms`) lists the cookies: keep it in step +- `GA_ID` - Google Analytics 4 measurement ID, passed to **prod builds only**. Empty: no cookie banner, no gtag. Consent is CookieConsent (`app/plugins/cookie-consent.client.ts`, basic consent mode: gtag.js loads only after "accept"); events go through `trackEvent()` (`app/utils/analytics.ts`), a no-op before consent. The terms page (`/cgu`, `/en/terms`) lists the cookies: keep it in step. The Google tag ignores an on-page `gtag('config')` that repeats its own, parameters included: the cookie duration (13 months from the first visit), Google signals (off) and history-based page views (off, the plugin sends them once the page is rendered) are set in GA, in the stream's tag settings, not in code **Email**: the form sends from `contact@email.kbrdn.dev` (Resend, subdomain verified) to `hello@kbrdn.dev`. A bounce puts that address on Resend's suppression list, after which every message is dropped as `suppressed` while the form still answers success (`docs/CONFIGURATION.md`) diff --git a/app/app.vue b/app/app.vue index 7cd67d3..a068002 100644 --- a/app/app.vue +++ b/app/app.vue @@ -5,6 +5,9 @@ useSiteSeo()