fix/dossiers-ngi: update README and scripts for branch status

This commit is contained in:
Hernâni Marques 2026-10-01 12:09:29 +02:00
parent 8ad49de231
commit 197e0ab19a
No known key found for this signature in database
3 changed files with 32 additions and 3 deletions

View file

@ -63,7 +63,7 @@ Per branch in JSON / sticky bar:
| `vs_parent_plus` / `vs_parent_minus` | `git diff --numstat` tip vs **parent** tip (sticky bar +grün/−rot; omitted when `parent` is empty or not in the tree, e.g. `main` and `feature/nl-net-injestion-injestor-update`) | | `vs_parent_plus` / `vs_parent_minus` | `git diff --numstat` tip vs **parent** tip (sticky bar +grün/−rot; omitted when `parent` is empty or not in the tree, e.g. `main` and `feature/nl-net-injestion-injestor-update`) |
| `loc` | text-file line count of the tip vs the empty tree (gray `N LOC` in the plus/minus columns; only when there is no parent) | | `loc` | text-file line count of the tip vs the empty tree (gray `N LOC` in the plus/minus columns; only when there is no parent) |
Rebuild runs **only when** the current origin tip is not already a successful freeze (`freeze_ok`; timer never forces). Rebuild runs **only when** the current origin tip is not already a successful freeze (`freeze_ok`; timer never forces). Cookie alias `editions/flask` copies from `DEFAULT_BRANCH` unless that alias is already `freeze_ok` for the same tip **and** `.edition-built-at` matches the source freeze.
Each run also: `git fetch --prune`, `worktree prune`, drop stale Each run also: `git fetch --prune`, `worktree prune`, drop stale
`editions/<slug>/` (gone remotes), purge leftover `tdpd-*` tmp dirs. `editions/<slug>/` (gone remotes), purge leftover `tdpd-*` tmp dirs.

View file

@ -534,15 +534,26 @@ def rebuild_edition(repo: Path, branch: str, tip: str, editions: Path) -> dict:
shutil.rmtree(wt, ignore_errors=True) shutil.rmtree(wt, ignore_errors=True)
def _edition_built_at(editions: Path, slug: str) -> str:
p = editions / slug / ".edition-built-at"
if not p.is_file():
return ""
return p.read_text(encoding="utf-8").strip()
def sync_flask_alias(editions: Path, tips: dict[str, str]) -> None: def sync_flask_alias(editions: Path, tips: dict[str, str]) -> None:
"""Keep editions/flask in sync with DEFAULT_BRANCH freeze when present.""" """Keep editions/flask in sync with DEFAULT_BRANCH freeze when present."""
src_branch = default_branch() src_branch = default_branch()
if src_branch not in tips: if src_branch not in tips:
return return
src = editions / edition_slug(src_branch) src_slug = edition_slug(src_branch)
src = editions / src_slug
dst = editions / "flask" dst = editions / "flask"
tip = tips[src_branch] tip = tips[src_branch]
if tip_recorded(editions, "flask") == tip and (dst / "index.html").is_file(): flask_ok, _ = freeze_ok_for(editions, "flask", tip)
src_built = _edition_built_at(editions, src_slug)
flask_built = _edition_built_at(editions, "flask")
if flask_ok and src_built and src_built == flask_built:
return return
if not (src / "index.html").is_file(): if not (src / "index.html").is_file():
ensure_placeholder(editions, "flask", tip) ensure_placeholder(editions, "flask", tip)

View file

@ -100,6 +100,24 @@ PY
printf '1\n' > "$EDITIONS/feat-a/.edition-freeze-ok" printf '1\n' > "$EDITIONS/feat-a/.edition-freeze-ok"
rm -f "$EDITIONS/feat-a/.edition-freeze-error" rm -f "$EDITIONS/feat-a/.edition-freeze-error"
# flask alias: matching tip + stale HTML must copy from DEFAULT_BRANCH
MAIN_TIP="$(tr -d '\n' < "$EDITIONS/main/.edition-tip")"
mkdir -p "$EDITIONS/flask"
printf '%s\n' "$MAIN_TIP" > "$EDITIONS/flask/.edition-tip"
printf '%s\n' '<html>stale-flask</html>' > "$EDITIONS/flask/index.html"
printf '%s\n' '2026-09-30T17:35:26+02:00' > "$EDITIONS/flask/.edition-built-at"
FETCH=0 TDPD_ROOT="$CLONE" OUT="$OUT" EDITIONS_ROOT="$EDITIONS" \
FREEZE_CMD="$FREEZE_CMD" REBUILD=1 DEFAULT_BRANCH=main \
python3 "$SCRIPT" --rebuild --no-fetch
grep -q "main" "$EDITIONS/flask/index.html"
if grep -q "stale-flask" "$EDITIONS/flask/index.html"; then
echo "FAIL flask alias kept stale HTML"
exit 1
fi
test "$(tr -d '\n' < "$EDITIONS/flask/.edition-freeze-ok")" = "1"
test "$(tr -d '\n' < "$EDITIONS/flask/.edition-built-at")" = "$(tr -d '\n' < "$EDITIONS/main/.edition-built-at")"
echo "OK flask alias copied after stale skip"
# delete smoke branch on origin; fetch --prune drops remote-tracking ref # delete smoke branch on origin; fetch --prune drops remote-tracking ref
cd "$CLONE" cd "$CLONE"
git push origin --delete smoke/temp-sibling >/dev/null 2>&1 git push origin --delete smoke/temp-sibling >/dev/null 2>&1