From 2ba3f59470d8478435bbd5c427db6ef5b5c4bcf9 Mon Sep 17 00:00:00 2001 From: bchanot Date: Fri, 30 Oct 2026 17:45:39 +0100 Subject: [PATCH 1/2] =?UTF-8?q?chore(memory):=20registries=20v2=20?= =?UTF-8?q?=E2=80=94=20memory.sh=20upgrade=20(phase=204a)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .claude/memory/blockers.md | 7 +------ .claude/memory/decisions.md | 16 ++++------------ .claude/memory/evals.md | 7 +------ .claude/memory/journal.md | 3 +++ .claude/memory/learnings.md | 10 +--------- 5 files changed, 10 insertions(+), 33 deletions(-) diff --git a/.claude/memory/blockers.md b/.claude/memory/blockers.md index dddf881..80d95b3 100644 --- a/.claude/memory/blockers.md +++ b/.claude/memory/blockers.md @@ -1,4 +1,5 @@ --- +format: 2 type: blockers_registry entry_prefix: BLK schema: @@ -16,12 +17,6 @@ rules: # Blockers registry (BLK) -## Index - -| ID | Date | Friction | Status | -|----|------|---------|--------| -| BLK-001 | 2026-05-17 | Favicon 404 in prod after rebuild — Dockerfile selective COPY hid new repo files | resolved | - --- ## BLK-001 — Favicon 404 in prod after Docker rebuild diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 3896892..9a63a45 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -1,4 +1,5 @@ --- +format: 2 type: decisions_registry entry_prefix: BDR schema: @@ -18,18 +19,6 @@ rules: # Decisions registry (BDR) -## Index - -| ID | Date | Title | Status | -|----|------|-------|--------| -| BDR-001 | 2026-05-15 | Static single-file site, no framework | accepted | -| BDR-002 | 2026-05-15 | weasyprint pour PDF CV depuis HTML | accepted | -| BDR-003 | 2026-05-15 | Position pro: CDI prioritaire, freelance parallèle | accepted | -| BDR-004 | 2026-05-15 | Containerize site with nginx:alpine behind reverse proxy | accepted | -| BDR-005 | 2026-05-17 | Favicon: SVG primary + PIL raster fallback | accepted | -| BDR-006 | 2026-07-05 | Hardened container: nginx-unprivileged + port 8080 | accepted (supersedes BDR-004 infra detail) | -| BDR-007 | 2026-07-05 | Profile geo canonical: Nantes relocation | accepted (supersedes BDR-003 geo) | - --- ## BDR-001 — Static single-file site, no framework @@ -43,6 +32,7 @@ rules: - React SPA — interdit pour site public indexable (cf `~/.claude/CLAUDE.md`). - HTML + CSS externes — éclate 1 livrable en 3 fichiers sans bénéfice. - **Référence**: `index.html`, section Stack de `CLAUDE.md`. +- **Status (2026-10-30, upgrade)**: accepted --- @@ -58,6 +48,7 @@ rules: - Print manuel via navigateur — pas reproductible, dérive entre HTML et PDF. - **Warnings connus**: `box-shadow: none` ignoré par weasyprint, sans impact visuel. - **Référence**: `CV_Bastien_Chanot.pdf`. +- **Status (2026-10-30, upgrade)**: accepted --- @@ -68,6 +59,7 @@ rules: - **Décision**: Site annonce **CDI systèmes/embarqué prioritaire**, ZenQuality (freelance) en parallèle. Géo: full remote idéal, hybride 1-2 j/mois si Paris, mobilité Pays de la Loire. - **Pourquoi**: Recadrage user. Première version annonçait "Missions long terme & expertise" — pas représentatif. Hiérarchie CDI > freelance maintenant explicite (hero eyebrow + about para + callout + CV header). - **Référence**: `index.html` (hero-eyebrow, about-text para 3, about-callout) + `CV_Bastien_Chanot.html` (header). +- **Status (2026-10-30, upgrade)**: accepted --- diff --git a/.claude/memory/evals.md b/.claude/memory/evals.md index c7a6665..75ad8a5 100644 --- a/.claude/memory/evals.md +++ b/.claude/memory/evals.md @@ -1,4 +1,5 @@ --- +format: 2 type: evals_registry entry_prefix: EVAL schema: @@ -17,12 +18,6 @@ rules: # Evals registry (EVAL) -## Index - -| ID | Date | Output | Action | -|----|------|--------|--------| -| EVAL-001 | 2026-07-06 | /tour run 2026-07-05-3 (3 it., converged) + residual closure | keep | - ## EVAL-001 — /tour run 2026-07-05-3 + residual closure pass - **Date**: 2026-07-06 diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 3216086..b6b663d 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -47,3 +47,6 @@ rules: - Tour 2026-07-05-3 finished (session-limit pause mid-it3, agents transcript-resumed): CONVERGED 3 it. SEC-1 HIGH fixed — base 1.28→1.30-alpine, CVE-2026-42945 (`1aa97f0`); clean F1-F8 (`613bfc0`, −54 lines, render-hash proven); README synced (`2f5e51a`). - All 10 residuals closed on owner GO: Google Fonts trimmed both files (CV render-hash identical, index browser-verified 375+1440), CV date chips French + en-dash, CV tags → 999px pills, contact-grid no-ops dropped, nginx dotfile block reordered first, PDF gzip dropped, compose healthcheck deduped (image healthcheck verified healthy), CLAUDE.md white-family + CV-typography exception documented, BDR-006 annotated (1.30 bump). - LRN-004 (pinned base = frozen CVE exposure) + EVAL-001 (tour verdict) logged. Branch chore/tour-2026-07-05-3 → develop on owner GO (this session). + +## 2026-10-30 +- Memory registries → v2 (`memory.sh upgrade`, claude-config BDR-129 phase 4a): `check` green, open blockers unchanged. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index ec32425..161f62b 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -1,4 +1,5 @@ --- +format: 2 type: learnings_registry entry_prefix: LRN schema: @@ -15,15 +16,6 @@ rules: # Learnings registry (LRN) -## Index - -| ID | Date | Pattern | Applies to | -|----|------|---------|------------| -| LRN-001 | 2026-05-15 | certbot --nginx matches `server_name`, not filename | nginx + certbot on multi-site VPS | -| LRN-002 | 2026-05-17 | PIL supersample ×8 + Lanczos = clean icon antialiasing | Python stdlib icon generation | -| LRN-003 | 2026-07-05 | Prove CSS cleanup behavior-preserving via before/after PDF render-hash | weasyprint / paged-media PDF projects | -| LRN-004 | 2026-07-06 | Digest-pinned base image = frozen CVE exposure; SAST can't see it | any Dockerfile with pinned FROM | - --- ## LRN-001 — certbot --nginx matches `server_name`, not filename From 5a7d01dee06e195d1c4aa3b7d66620f5ee586d58 Mon Sep 17 00:00:00 2001 From: bchanot Date: Sat, 31 Oct 2026 14:34:03 +0100 Subject: [PATCH 2/2] chore(githooks): refresh versioned hooks --- .githooks/post-commit | 23 +++++++++++++++++++++++ .githooks/post-merge | 23 +++++++++++++++++++++++ .githooks/pre-commit | 29 ++++++++++++++++++++++++++--- .githooks/reference-transaction | 15 +++++++++++++++ 4 files changed, 87 insertions(+), 3 deletions(-) create mode 100755 .githooks/post-commit create mode 100755 .githooks/post-merge create mode 100755 .githooks/reference-transaction diff --git a/.githooks/post-commit b/.githooks/post-commit new file mode 100755 index 0000000..08d9954 --- /dev/null +++ b/.githooks/post-commit @@ -0,0 +1,23 @@ +#!/bin/sh +# gitflow post-commit — generated by gitflow_init. Do not hand-edit. +hook=post-commit +# Pushes every commit as it lands (BDR-095): a remote only backs up what it +# holds. Never fails the commit: no origin / offline / refused → warning only. +# Opt out for one command with GITFLOW_NO_PUSH=1 (throwaway repos, tests). +[ "${GITFLOW_NO_PUSH:-0}" = 1 ] && exit 0 +# Manual-push mode (human-set): git config gitflow.autopush false. Fail closed: +# an unparseable value or a config read failure also means "no push", named. +# Mirrors gitflow_push_mode (lib/gitflow.sh); arms pinned by T18b/T18h/T18q2/T18q4. +v=$(git config --bool gitflow.autopush 2>/dev/null); rc=$? +case "$rc:$v" in + 0:true|1:*) ;; + 0:false) exit 0 ;; + *) echo "gitflow $hook: gitflow.autopush unreadable (git rc $rc) — NOT pushed, treated as manual push mode; fix the value by hand" >&2; exit 0 ;; +esac +git remote get-url origin >/dev/null 2>&1 || exit 0 +br=$(git symbolic-ref --short -q HEAD 2>/dev/null) || exit 0 # detached HEAD — nothing to track +if command -v timeout >/dev/null 2>&1; then t="timeout ${GITFLOW_PUSH_TIMEOUT:-30}"; else t=""; fi +if $t git push -q -u --follow-tags origin "$br" >/dev/null 2>&1; then exit 0; fi +echo "gitflow $hook: push of '$br' FAILED — this commit exists only on this disk." >&2 +echo " Push by hand: git push -u origin $br (rejected as non-fast-forward? never force-push; ask first)" >&2 +exit 0 diff --git a/.githooks/post-merge b/.githooks/post-merge new file mode 100755 index 0000000..853eda0 --- /dev/null +++ b/.githooks/post-merge @@ -0,0 +1,23 @@ +#!/bin/sh +# gitflow post-merge — generated by gitflow_init. Do not hand-edit. +hook=post-merge +# Pushes every commit as it lands (BDR-095): a remote only backs up what it +# holds. Never fails the commit: no origin / offline / refused → warning only. +# Opt out for one command with GITFLOW_NO_PUSH=1 (throwaway repos, tests). +[ "${GITFLOW_NO_PUSH:-0}" = 1 ] && exit 0 +# Manual-push mode (human-set): git config gitflow.autopush false. Fail closed: +# an unparseable value or a config read failure also means "no push", named. +# Mirrors gitflow_push_mode (lib/gitflow.sh); arms pinned by T18b/T18h/T18q2/T18q4. +v=$(git config --bool gitflow.autopush 2>/dev/null); rc=$? +case "$rc:$v" in + 0:true|1:*) ;; + 0:false) exit 0 ;; + *) echo "gitflow $hook: gitflow.autopush unreadable (git rc $rc) — NOT pushed, treated as manual push mode; fix the value by hand" >&2; exit 0 ;; +esac +git remote get-url origin >/dev/null 2>&1 || exit 0 +br=$(git symbolic-ref --short -q HEAD 2>/dev/null) || exit 0 # detached HEAD — nothing to track +if command -v timeout >/dev/null 2>&1; then t="timeout ${GITFLOW_PUSH_TIMEOUT:-30}"; else t=""; fi +if $t git push -q -u --follow-tags origin "$br" >/dev/null 2>&1; then exit 0; fi +echo "gitflow $hook: push of '$br' FAILED — this commit exists only on this disk." >&2 +echo " Push by hand: git push -u origin $br (rejected as non-fast-forward? never force-push; ask first)" >&2 +exit 0 diff --git a/.githooks/pre-commit b/.githooks/pre-commit index 0ddeefc..a42373a 100755 --- a/.githooks/pre-commit +++ b/.githooks/pre-commit @@ -7,17 +7,40 @@ br=$(git symbolic-ref --short -q HEAD 2>/dev/null) git rev-parse --verify -q HEAD >/dev/null 2>&1 || exit 0 # root commit — allow [ -f "$gd/MERGE_HEAD" ] && exit 0 # merge in progress — allow +# Secret backstop (job7) — any branch, not just protected ones. Non-blocking +# if gitleaks isn't installed; auto-discovers ./.gitleaks.toml (repo root). +# gitleaks >= 8.19 scans the index with `git --staged`; older builds (Ubuntu's +# 8.16 package) only know `protect --staged`, and `git` exits 1 there as an +# unknown command — which would block every commit. Probe the subcommand first. +if command -v gitleaks >/dev/null 2>&1; then + gl_sub=git + gitleaks git --help >/dev/null 2>&1 || gl_sub=protect + if ! gitleaks "$gl_sub" --staged --no-banner >/dev/null 2>&1; then + echo "gitflow pre-commit: BLOCKED — gitleaks found a secret in staged changes." >&2 + echo " Details: gitleaks $gl_sub --staged --no-banner" >&2 + echo " Genuine false-positive? add an allowlist rule to .gitleaks.toml — never bypass with --no-verify." >&2 + exit 1 + fi +else + echo "gitflow pre-commit: gitleaks not installed — secret scan skipped (https://github.com/gitleaks/gitleaks)." >&2 +fi + +# Per-repo opt-out of the branch model (a clone of a foreign project): +# git config gitflow.protect false +[ "$(git config --bool --default true gitflow.protect)" = false ] && exit 0 + case "$br" in main|develop) ;; # protected — keep checking *) exit 0 ;; # working branch — allow esac -# whitelist: all-staged-under-.claude/ (memory/doc/deploy helpers) — allow -if [ -z "$(git diff --cached --name-only | grep -v '^\.claude/' | head -1)" ]; then +# whitelist: all-staged-under-.claude/ (memory/doc/deploy helpers) or +# .githooks/ (the hooks themselves, refreshed by the lib) — allow +if [ -z "$(git diff --cached --name-only | grep -vE '^\.(claude|githooks)/' | head -1)" ]; then exit 0 fi echo "gitflow pre-commit: BLOCKED — direct commit on '$br'." >&2 echo " Branch from the right base (feature/bugfix->develop, hotfix->main), or merge." >&2 -echo " (.claude/** memory commits are exempt; --no-verify bypasses locally.)" >&2 +echo " (.claude/** and .githooks/** commits are exempt; foreign clone? git config gitflow.protect false)" >&2 exit 1 diff --git a/.githooks/reference-transaction b/.githooks/reference-transaction new file mode 100755 index 0000000..1e2cab1 --- /dev/null +++ b/.githooks/reference-transaction @@ -0,0 +1,15 @@ +#!/bin/sh +# gitflow reference-transaction — generated by gitflow_init. Do not hand-edit. +# Refuses deleting (or renaming) main / develop, whatever the +# command. Mirrors gitflow_protected_base (lib/gitflow.sh). +[ "$1" = prepared ] || exit 0 +while read -r _old new ref; do + case "$ref" in refs/heads/main|refs/heads/develop) ;; *) continue ;; esac + case "$new" in *[!0]*) continue ;; esac # new value not all-zeros → an update, not a deletion + # Per-repo opt-out (a foreign clone): git config gitflow.protect false + [ "$(git config --bool --default true gitflow.protect)" = false ] && exit 0 + echo "gitflow reference-transaction: BLOCKED — deleting '$ref', a protected base." >&2 + echo " main and develop are never deleted or renamed. A merged working branch: gitflow.sh delete " >&2 + exit 1 +done +exit 0