4 Commits
Author SHA1 Message Date
Spark 05b8c506e0 chore(release): Kanbante 0.6.0 — colonne QA, réconciliation par étiquettes, Wallboard
CI / test (push) Successful in 1m42s
2026-10-11 12:26:12 -04:00
Spark 943ecd6a6b test(0.6.0): colonne QA, adoption d'étiquettes, wallboard (10 tests, 98 au total) 2026-10-11 12:26:12 -04:00
Spark af59417d07 feat(wall): Wallboard plein écran /wall — issue #14 de la feuille de route
Rotation automatique entre projets actifs (30 s), compteurs des
six colonnes, cartes en vol avec âge, fermées du jour (journal),
horloge; rafraîchissement en direct par le flux SSE (rechargement,
aucune interaction à protéger) + filet de sécurité à 5 min.
?repo= fige un projet. Lien de navigation ajouté partout.
2026-10-11 12:26:12 -04:00
Spark a358c45d73 feat(colonnes): colonne QA entre En cours et Révision + réconciliation par étiquettes
- KANBAN_COLUMNS gagne 'qa' (🧪, #06b6d4, étiquette kanban:qa);
  Focus inclut QA; dashboard et board affichent les 6 colonnes.
- _adopt_label_columns: une étiquette kanban:* unique qui diverge
  de l'état local fait adopter sa colonne (board + focus), avec
  événement journalisé source 'gitea'. C'est ce qui permet de
  piloter le board depuis Gitea même.
2026-10-11 12:26:12 -04:00
17 changed files with 515 additions and 12 deletions
+25
View File
@@ -1,5 +1,30 @@
# Changelog
## 0.6.0 — 2026-10-11
### Nouveautés
- **Colonne QA** entre « En cours » et « Révision » (🧪, étiquette
`kanban:qa`) : une étape de validation finale avant la révision.
Le flux complet devient Backlog → À faire → En cours → QA →
Révision → Terminé ; la vue Focus inclut les cartes en QA.
- **Wallboard** (issue #14 de la feuille de route) : `GET /wall`,
affichage plein écran pensé pour un écran d'atelier — rotation
automatique (30 s) entre les projets actifs, compteurs des six
colonnes, cartes en vol (En cours / QA / Révision / À faire) avec
âge, fermées du jour, horloge ; rafraîchissement en direct via le
flux SSE. `?repo=Proprietaire/depot` fige un seul projet. Lien
« 🖥️ Wallboard » ajouté à la navigation de toutes les pages.
- **Réconciliation par étiquettes** : si l'étiquette `kanban:*` d'une
issue ouverte diverge de sa colonne enregistrée (modifiée dans
Gitea ou par un autre outil), le board et la vue Focus adoptent la
colonne de l'étiquette et journalisent le déplacement (source
`gitea`). Règles : exactement une étiquette `kanban:*` fait foi ;
zéro ou plusieurs = l'état local gagne ; inactif si
`KANBANTE_SYNC_LABELS=0`. Déplacer une carte depuis Gitea devient
donc possible.
10 tests ajoutés (98 au total).
## 0.5.2 — 2026-10-11
### Correctif
+6 -3
View File
@@ -5,7 +5,7 @@
## Features
- 📋 **Dashboard** — tous tes projets Gitea en un coup d'œil (actifs / inactifs / archivés — le vrai drapeau Gitea)
- 🗂️ **Kanban Board** — colonnes Backlog → À faire → En cours → Révision → Terminé, ordre des cartes persisté
- 🗂️ **Kanban Board** — colonnes Backlog → À faire → En cours → **QA** → Révision → Terminé, ordre des cartes persisté
- 🎯 **Drag & Drop** — glisse les issues entre colonnes ; en cas d'échec, la carte est replacée
- 🔗 **Gitea Sync bidirectionnelle** — « Terminé » ferme l'issue dans Gitea, la ressortir la rouvre ; l'état local est réconcilié à chaque chargement
- ➕ **Création d'issues** depuis le board, filtres texte + étiquettes, cartes liées à Gitea
@@ -14,7 +14,9 @@
- 🗂️ **Panneau détail** — clic sur une carte : corps markdown, commentaires, et réponse postée dans Gitea sans quitter le board
- 📰 **Journal d'événements** — chaque mouvement est horodaté : fil d'activité (`/activity`), métriques de débit et de temps de cycle (`/api/metrics`)
- ⏳ **Vieillissement + limites WIP** — badge d'ancienneté par colonne et limites souples configurables
- 🎯 **Vue Focus** — tout ce qui est En cours / En révision, tous projets confondus (`/focus`)
- 🎯 **Vue Focus** — tout ce qui est En cours / en QA / En révision, tous projets confondus (`/focus`)
- 🖥️ **Wallboard** — mode TV plein écran (`/wall`) : rotation automatique entre les projets actifs, cartes en vol et compteurs en très grands caractères, rafraîchi en direct ; `?repo=Proprietaire/depot` fige un seul projet
- 🔀 **Réconciliation par étiquettes** — si l'étiquette `kanban:*` d'une issue change hors de Kanbante (dans Gitea, par un autre outil), le board adopte la colonne de l'étiquette au chargement et le journalise (source `gitea`). Une seule étiquette `kanban:*` fait foi ; aucune ou plusieurs = l'état local gagne
- 🔍 **Recherche globale + Mes issues** — chercher dans toutes les issues de tous les projets (`/search`), et voir ce qui vous est assigné (`/my`)
- 📊 **Briefing quotidien** — encours, vieillissement, milestones proches : page `/briefing` et envoi **ntfy** planifié
- 🤖 **Serveur MCP** — 7 outils en lecture seule (boards, focus, recherche, métriques) exposés en JSON-RPC sur `/mcp` pour vos agents
@@ -151,7 +153,8 @@ kanbante/
|---------|-------|-------------|
| GET | `/` | Dashboard tous les projets |
| GET | `/board/{owner}/{repo}` | Kanban board |
| GET | `/focus` | En cours + En révision, tous projets actifs |
| GET | `/focus` | En cours + QA + En révision, tous projets actifs |
| GET | `/wall` | Wallboard plein écran (rotation des projets actifs ; `?repo=` pour un seul projet) |
| GET | `/activity` | Fil d'activité (journal d'événements, tous projets) |
| POST | `/api/move` | Déplacer une issue (ordre persisté, synchro Gitea) |
| POST | `/api/issues` | Créer une issue Gitea depuis le board |
+1 -1
View File
@@ -44,7 +44,7 @@ from pathlib import Path
BASE_DIR = Path(__file__).resolve().parent.parent
APP_VERSION = "0.5.2"
APP_VERSION = "0.6.0"
def _env_bool(name: str, default: bool) -> bool:
+140 -4
View File
@@ -64,6 +64,7 @@ COLUMN_LABELS = {
"backlog": "📥 Backlog",
"todo": "📋 À faire",
"in_progress": "🚧 En cours",
"qa": "🧪 QA",
"review": "🔍 Révision",
"done": "✅ Terminé",
}
@@ -72,11 +73,16 @@ COLUMN_COLORS = {
"backlog": "#6b7280",
"todo": "#3b82f6",
"in_progress": "#f59e0b",
"qa": "#06b6d4",
"review": "#8b5cf6",
"done": "#10b981",
}
FOCUS_COLUMNS = ["in_progress", "review"]
FOCUS_COLUMNS = ["in_progress", "qa", "review"]
# Columns mirrored to Gitea as kanban:<column> labels (backlog and
# done carry none: done is the closed state itself).
LABELLED_COLUMNS = ("todo", "in_progress", "qa", "review")
EVENT_ICONS = {
"created": "➕",
@@ -353,6 +359,44 @@ def _merge_issues_with_board(
return columns
def _adopt_label_columns(
full_name: str, open_issues: list[dict], board_state: dict
) -> None:
"""Adopt the column named by an issue's kanban:* label, if any.
Labels are the Gitea-visible mirror of columns (written on every
drag). If the label changed outside Kanbante — edited in Gitea,
or set by another tool — the board follows it and the move is
journaled (source "gitea"). Rules: exactly one kanban:* label
(zero or several = no opinion), target must be a labelled column,
and label synchronisation must be enabled.
"""
if not get_settings().sync_labels:
return
placement: dict[int, str] = {}
for col_name, cards in board_state.items():
for card in cards:
placement[card["issue_number"]] = col_name
for issue in open_issues:
names = [
str(label.get("name", "")) for label in issue.get("labels") or []
]
kanban = [n for n in names if n.startswith("kanban:")]
if len(kanban) != 1:
continue
target = kanban[0].split(":", 1)[1]
if target not in LABELLED_COLUMNS:
continue
current = placement.get(issue["number"], "backlog")
if current != target:
move_issue(full_name, issue["number"], target)
log_event(
full_name, issue["number"], "moved",
from_column=current, to_column=target, source="gitea",
)
placement[issue["number"]] = target
def _split_full_name(repo_full_name: str) -> tuple[str, str] | None:
owner, sep, repo = repo_full_name.partition("/")
if not sep or not owner or not repo or "/" in repo:
@@ -405,6 +449,9 @@ async def board(request: Request, owner: str, repo: str, milestone: str = ""):
for number in changes["closed_numbers"]:
log_event(full_name, number, "closed", to_column="done", source="gitea")
# A kanban:* label changed outside Kanbante wins over local state.
_adopt_label_columns(full_name, open_issues, get_board_state(full_name))
# Milestone view: filter the board to one milestone (sprint-style),
# with its deadline and completion progress.
milestones: list[dict] = []
@@ -530,6 +577,7 @@ async def _collect_focus_groups() -> list[dict]:
logger.warning("focus: repo fetch failed: %s", result)
continue
full_name, open_issues = result
_adopt_label_columns(full_name, open_issues, get_board_state(full_name))
columns = _merge_issues_with_board(open_issues, get_board_state(full_name))
cards = [
{"issue": issue, "column": col}
@@ -578,6 +626,96 @@ def _group_issue_results(issues: list[dict]) -> list[dict]:
return groups
WALL_COLUMNS = ["in_progress", "qa", "review", "todo"]
async def _collect_wall_data(only_repo: str | None) -> list[dict]:
"""Slides for the wallboard: one per active project.
Each slide carries the column counts, the cards in flight
(in progress / QA / review / todo, in flow order) with their age
in column, and how many cards were closed today (journal).
"""
if only_repo:
if _split_full_name(only_repo) is None:
return []
known = await gitea.search_repos()
match = [r for r in known if r.get("full_name") == only_repo]
if not match:
return []
repos = match
else:
all_repos = await gitea.search_repos()
active, _inactive, _archived = classify_repos(all_repos)
repos = active[:12]
today = datetime.now(timezone.utc).strftime("%Y-%m-%d")
closed_today: dict[str, int] = {}
for event in get_events(limit=500):
if event["event_type"] == "closed" and str(
event["created_at"]
).startswith(today):
closed_today[event["repo_full_name"]] = (
closed_today.get(event["repo_full_name"], 0) + 1
)
slides = []
for repo in repos:
full_name = repo["full_name"]
owner, _, name = full_name.partition("/")
try:
items = await gitea.get_repo_issues(owner, name, state="open")
except Exception as exc:
logger.debug("wall: issues failed for %s: %s", full_name, exc)
continue
open_issues = [i for i in items if _is_issue(i)]
_adopt_label_columns(full_name, open_issues, get_board_state(full_name))
board_state = get_board_state(full_name)
columns = _merge_issues_with_board(open_issues, board_state)
ages = _card_ages(full_name, open_issues, board_state)
aging_days = get_settings().aging_days
cards = []
for col in WALL_COLUMNS:
for issue in columns[col]:
age = ages.get(issue["number"]) or {}
days = age.get("days")
cards.append(
{
"number": issue["number"],
"title": issue.get("title", ""),
"column": col,
"column_label": COLUMN_LABELS[col],
"age_days": days,
"aging": days is not None and days >= aging_days,
}
)
slides.append(
{
"full_name": full_name,
"counts": {col: len(columns[col]) for col in KANBAN_COLUMNS},
"open_total": len(open_issues),
"cards": cards[:9],
"closed_today": closed_today.get(full_name, 0),
}
)
return slides
@app.get("/wall", response_class=HTMLResponse)
async def wall(request: Request, repo: str = ""):
"""Wallboard: full-screen, auto-rotating, live project display."""
slides = await _collect_wall_data(repo or None)
return render(
request,
"wall.html",
slides=slides,
single=bool(repo),
column_labels=COLUMN_LABELS,
column_colors=COLUMN_COLORS,
columns=KANBAN_COLUMNS,
)
@app.get("/search", response_class=HTMLResponse)
async def search_page(request: Request, q: str = ""):
"""Global issue search across every repo (Gitea search API)."""
@@ -970,9 +1108,7 @@ async def api_move(
if settings.sync_labels and from_column != to_column:
try:
desired = (
f"kanban:{to_column}"
if to_column in ("todo", "in_progress", "review")
else None
f"kanban:{to_column}" if to_column in LABELLED_COLUMNS else None
)
issue = await gitea.get_issue(owner, repo, issue_number)
current = [
+1 -1
View File
@@ -16,7 +16,7 @@ import sqlite3
from contextlib import contextmanager
from typing import Iterator
KANBAN_COLUMNS = ["backlog", "todo", "in_progress", "review", "done"]
KANBAN_COLUMNS = ["backlog", "todo", "in_progress", "qa", "review", "done"]
def db_path() -> str:
+1
View File
@@ -20,6 +20,7 @@
<a href="/activity" class="nav-pill active">📰 Activité</a>
<a href="/briefing" class="nav-pill">📊 Briefing</a>
<a href="/search" class="nav-pill">🔍 Recherche</a>
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
</nav>
</header>
+2 -1
View File
@@ -23,6 +23,7 @@
<a href="/my" class="nav-pill">👤 Mes issues</a>
<a href="/activity" class="nav-pill">📰 Activité</a>
<a href="/search" class="nav-pill">🔍 Recherche</a>
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
{% if repo_info.html_url %}
<a href="{{ repo_info.html_url }}" target="_blank" class="nav-pill">🔗 Gitea ↗</a>
{% endif %}
@@ -72,7 +73,7 @@
<main class="board-container">
<div class="kanban-board">
{% for col in ['backlog','todo','in_progress','review','done'] %}
{% for col in ['backlog','todo','in_progress','qa','review','done'] %}
<div class="kanban-column"
data-column="{{ col }}">
<div class="column-header" style="border-top: 3px solid {{ column_colors[col] }}">
+1
View File
@@ -20,6 +20,7 @@
<a href="/my" class="nav-pill">👤 Mes issues</a>
<a href="/activity" class="nav-pill">📰 Activité</a>
<a href="/search" class="nav-pill">🔍 Recherche</a>
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
</nav>
</header>
+2 -1
View File
@@ -20,6 +20,7 @@
<a href="/activity" class="nav-pill">📰 Activité</a>
<a href="/briefing" class="nav-pill">📊 Briefing</a>
<a href="/search" class="nav-pill">🔍 Recherche</a>
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
</nav>
</header>
@@ -84,7 +85,7 @@
<span>{{ repo.open_issues_count or 0 }} issues ouvertes</span>
{% if full in stats %}
<div class="mini-progress">
{% for col in ['backlog','todo','in_progress','review','done'] %}
{% for col in ['backlog','todo','in_progress','qa','review','done'] %}
{% set n = stats[full].get(col, 0) %}
{% if n > 0 %}
<span class="chip" style="background: {{ COLUMN_COLORS[col] }}20; color: {{ COLUMN_COLORS[col] }}">
+1
View File
@@ -20,6 +20,7 @@
<a href="/activity" class="nav-pill">📰 Activité</a>
<a href="/briefing" class="nav-pill">📊 Briefing</a>
<a href="/search" class="nav-pill">🔍 Recherche</a>
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
<span class="badge">{{ groups|map(attribute='cards')|map('length')|sum }} cartes en cours</span>
</nav>
</header>
+1
View File
@@ -19,6 +19,7 @@
<a href="/my" class="nav-pill active">👤 Mes issues</a>
<a href="/activity" class="nav-pill">📰 Activité</a>
<a href="/search" class="nav-pill">🔍 Recherche</a>
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
</nav>
</header>
+1
View File
@@ -19,6 +19,7 @@
<a href="/my" class="nav-pill">👤 Mes issues</a>
<a href="/activity" class="nav-pill">📰 Activité</a>
<a href="/search" class="nav-pill active">🔍 Recherche</a>
<a href="/wall" class="nav-pill">🖥️ Wallboard</a>
</nav>
</header>
+70
View File
@@ -0,0 +1,70 @@
<!DOCTYPE html>
<html lang="fr">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Kanbante — Wallboard</title>
<link rel="stylesheet" href="/static/css/style.css">
</head>
<body class="wall-body">
{% if slides %}
<div class="wall-stage" id="wall-stage">
{% for slide in slides %}
<section class="wall-slide{% if loop.first %} active{% endif %}">
<header class="wall-head">
<div>
<div class="wall-kicker">📂 Projet</div>
<h1 class="wall-project">{{ slide.full_name }}</h1>
</div>
<div class="wall-clock">
<div class="wall-time" data-clock>--:--</div>
<div class="wall-date" data-date></div>
{% if not single and slides|length > 1 %}
<div class="wall-rotation">{{ loop.index }} / {{ slides|length }}</div>
{% endif %}
</div>
</header>
<div class="wall-counts">
{% for col in columns %}
<div class="wall-count" style="--col: {{ column_colors[col] }}">
<span class="wall-count-n">{{ slide.counts[col] }}</span>
<span class="wall-count-l">{{ column_labels[col] }}</span>
</div>
{% endfor %}
</div>
{% if slide.cards %}
<ul class="wall-cards">
{% for card in slide.cards %}
<li class="wall-card">
<span class="wall-card-col" style="--col: {{ column_colors[card.column] }}">{{ card.column_label }}</span>
<span class="wall-card-title">#{{ card.number }} · {{ card.title }}</span>
{% if card.age_days is not none and card.age_days >= 1 %}
<span class="wall-card-age{% if card.aging %} hot{% endif %}">⏳ {{ card.age_days }} j</span>
{% endif %}
</li>
{% endfor %}
</ul>
{% else %}
<p class="wall-idle">🌿 Rien en vol pour le moment — tout est au Backlog ou terminé.</p>
{% endif %}
<footer class="wall-foot">
<span>✅ Fermées aujourd'hui : <strong>{{ slide.closed_today }}</strong></span>
<span>📋 Ouvertes : <strong>{{ slide.open_total }}</strong></span>
<span class="wall-live">● EN DIRECT</span>
</footer>
</section>
{% endfor %}
</div>
{% else %}
<div class="wall-empty">
<h1>🖥️ Wallboard</h1>
<p>Aucun projet actif à afficher{% if single %} pour ce dépôt{% endif %}.</p>
<p class="wall-empty-hint">Astuce : <code>/wall?repo=Proprietaire/depot</code> fige un seul projet.</p>
</div>
{% endif %}
<script src="/static/js/wall.js"></script>
</body>
</html>
+1 -1
View File
@@ -1,6 +1,6 @@
[project]
name = "kanbante"
version = "0.5.2"
version = "0.6.0"
description = "Kanban project manager integrated with Gitea"
requires-python = ">=3.11"
dependencies = [
+74
View File
@@ -893,3 +893,77 @@ footer {
scroll-behavior: auto !important;
}
}
/* ── Wallboard (0.6.0) : affichage plein écran, lisible à 3 mètres ── */
.wall-body {
background: #0b1220;
color: #e5ecf5;
margin: 0;
font-family: inherit;
}
.wall-stage { position: relative; min-height: 100vh; }
.wall-slide {
display: none;
min-height: 100vh;
box-sizing: border-box;
padding: 4vh 4vw;
flex-direction: column;
gap: 3vh;
}
.wall-slide.active { display: flex; animation: wall-in 0.45s ease; }
@keyframes wall-in { from { opacity: 0; } to { opacity: 1; } }
.wall-head {
display: flex; justify-content: space-between; align-items: flex-start; gap: 24px;
}
.wall-kicker { font-size: 1rem; letter-spacing: 0.22em; text-transform: uppercase; color: #8fa3bf; }
.wall-project { font-size: clamp(2.2rem, 5.2vw, 4.2rem); margin: 0.4rem 0 0; line-height: 1.05; }
.wall-clock { text-align: right; }
.wall-time { font-size: clamp(2rem, 4.5vw, 3.6rem); font-weight: 800; line-height: 1; }
.wall-date { color: #8fa3bf; font-size: 1.15rem; margin-top: 0.35rem; text-transform: capitalize; }
.wall-rotation { color: #5b6b84; margin-top: 0.4rem; font-size: 1rem; }
.wall-counts {
display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px;
}
.wall-count {
border: 1.5px solid var(--col);
border-top: 6px solid var(--col);
border-radius: 14px;
padding: 14px 10px 12px;
text-align: center;
background: rgba(255, 255, 255, 0.03);
}
.wall-count-n { display: block; font-size: clamp(1.9rem, 3.6vw, 3rem); font-weight: 800; }
.wall-count-l { display: block; color: #aebdd2; font-size: clamp(0.78rem, 1.25vw, 1.02rem); margin-top: 2px; }
.wall-cards { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.wall-card {
display: flex; align-items: center; gap: 18px;
background: rgba(255, 255, 255, 0.045);
border-radius: 14px;
padding: 16px 20px;
font-size: clamp(1.15rem, 2.1vw, 1.7rem);
}
.wall-card-col {
border: 1.5px solid var(--col); color: var(--col);
border-radius: 999px; padding: 4px 14px;
font-size: 0.62em; font-weight: 700; white-space: nowrap;
}
.wall-card-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wall-card-age { color: #fbbf24; font-weight: 700; white-space: nowrap; }
.wall-card-age.hot { color: #f87171; }
.wall-idle { font-size: 1.5rem; color: #8fa3bf; }
.wall-foot {
margin-top: auto;
display: flex; gap: 36px; flex-wrap: wrap;
font-size: clamp(1rem, 1.7vw, 1.35rem); color: #aebdd2;
}
.wall-live { color: #34d399; font-weight: 700; letter-spacing: 0.08em; }
.wall-empty {
min-height: 100vh; display: flex; flex-direction: column;
align-items: center; justify-content: center; gap: 10px; text-align: center;
color: #aebdd2; padding: 24px;
}
.wall-empty h1 { color: #e5ecf5; font-size: 2.6rem; margin: 0; }
.wall-empty code { background: rgba(255,255,255,0.08); padding: 2px 8px; border-radius: 6px; }
@media (max-width: 900px) {
.wall-counts { grid-template-columns: repeat(3, 1fr); }
}
+42
View File
@@ -0,0 +1,42 @@
/**
* Kanbante — Wallboard: slide rotation, clock, live refresh.
*
* The wall is a display, not a workspace: no interaction to protect,
* so a realtime event simply reloads the page (plus a slow safety
* reload in case the stream drops silently).
*/
(function () {
var slides = Array.from(document.querySelectorAll('.wall-slide'));
var ROTATE_MS = 30000;
var current = 0;
if (slides.length > 1) {
setInterval(function () {
slides[current].classList.remove('active');
current = (current + 1) % slides.length;
slides[current].classList.add('active');
}, ROTATE_MS);
}
function tickClock() {
var now = new Date();
var time = now.toLocaleTimeString('fr-CA', { hour: '2-digit', minute: '2-digit' });
var date = now.toLocaleDateString('fr-CA', {
weekday: 'long', day: 'numeric', month: 'long',
});
document.querySelectorAll('[data-clock]').forEach(function (el) { el.textContent = time; });
document.querySelectorAll('[data-date]').forEach(function (el) { el.textContent = date; });
}
tickClock();
setInterval(tickClock, 15000);
// Live: any board activity refreshes the wall.
try {
var source = new EventSource('/api/stream');
source.onmessage = function () { location.reload(); };
} catch (err) {
console.warn('Wallboard live stream unavailable:', err);
}
// Safety net.
setTimeout(function () { location.reload(); }, 5 * 60 * 1000);
})();
+146
View File
@@ -0,0 +1,146 @@
"""Palier 4 (0.6.0): QA column, label reconciliation, wallboard."""
from fastapi.testclient import TestClient
import app.main as main
from app import models
from tests.conftest import _issue, csrf_from
def _column_block(html: str, column: str) -> str:
blocks = html.split('<div class="kanban-column"')
for block in blocks[1:]:
if f'data-column="{column}"' in block.split(">", 1)[0]:
return block
raise AssertionError(f"column {column} not found")
def _labelled(number: int, title: str, label_names: list[str]) -> dict:
issue = _issue(number, title)
issue["labels"] = [
{"id": 900 + i, "name": name, "color": "8b5cf6"}
for i, name in enumerate(label_names)
]
return issue
# ── QA column ─────────────────────────────────────────────────────
def test_board_has_six_columns_including_qa(client):
r = client.get("/board/Projets/demo")
assert r.status_code == 200
assert "🧪 QA" in r.text
positions = [
r.text.index(f'data-column="{col}"')
for col in ("backlog", "todo", "in_progress", "qa", "review", "done")
]
assert positions == sorted(positions) # QA between in_progress and review
def test_move_to_qa_syncs_kanban_qa_label(client, fake_gitea):
token = csrf_from(client)
r = client.post(
"/api/move",
data={
"repo_full_name": "Projets/demo", "issue_number": 1,
"to_column": "qa", "from_column": "backlog",
"to_order": "1", "from_order": "5", "csrf_token": token,
},
)
assert r.status_code == 200
assert r.json()["label_sync"] == "ok"
assert ("add", 1, "kanban:qa") in fake_gitea.label_ops
state = models.get_board_state("Projets/demo")
assert 1 in [c["issue_number"] for c in state["qa"]]
def test_qa_cards_appear_in_focus(client, fake_gitea):
models.move_issue("Projets/demo", 5, "qa")
r = client.get("/focus")
assert r.status_code == 200
assert "Tâche focus" in r.text
assert "🧪 QA" in r.text
# ── Label reconciliation (adoption) ───────────────────────────────
def test_board_adopts_diverging_kanban_label(client, fake_gitea):
fake_gitea.issues["Projets/demo"].append(
_labelled(9, "Déplacée via Gitea", ["kanban:review"])
)
r = client.get("/board/Projets/demo")
assert r.status_code == 200
assert "Déplacée via Gitea" in _column_block(r.text, "review")
state = models.get_board_state("Projets/demo")
assert 9 in [c["issue_number"] for c in state["review"]]
events = [
e for e in models.get_events("Projets/demo") if e["issue_number"] == 9
]
assert any(
e["event_type"] == "moved" and e["to_column"] == "review"
and e["source"] == "gitea"
for e in events
)
def test_board_ignores_conflicting_kanban_labels(client, fake_gitea):
fake_gitea.issues["Projets/demo"].append(
_labelled(9, "Étiquettes en conflit", ["kanban:todo", "kanban:review"])
)
r = client.get("/board/Projets/demo")
assert r.status_code == 200
assert "Étiquettes en conflit" in _column_block(r.text, "backlog")
state = models.get_board_state("Projets/demo")
elsewhere = [
c["issue_number"]
for col, cards in state.items() if col != "backlog"
for c in cards
]
assert 9 not in elsewhere
def test_adoption_is_idempotent(client, fake_gitea):
fake_gitea.issues["Projets/demo"].append(
_labelled(9, "Stable", ["kanban:qa"])
)
client.get("/board/Projets/demo")
client.get("/board/Projets/demo")
events = [
e for e in models.get_events("Projets/demo")
if e["issue_number"] == 9 and e["event_type"] == "moved"
]
assert len(events) == 1 # adopted once, then label and state agree
# ── Wallboard ─────────────────────────────────────────────────────
def test_wall_renders_active_projects(client):
models.move_issue("Projets/demo", 5, "in_progress")
r = client.get("/wall")
assert r.status_code == 200
assert "Projets/demo" in r.text
assert "Tâche focus" in r.text # the in-progress card is on the wall
assert 'class="wall-slide active"' in r.text
assert "🧪 QA" in r.text # the six column counters include QA
def test_wall_single_repo_mode(client):
r = client.get("/wall", params={"repo": "Projets/demo"})
assert r.status_code == 200
assert "Projets/demo" in r.text
def test_wall_unknown_repo_shows_empty_state(client):
r = client.get("/wall", params={"repo": "Inconnu/xyz"})
assert r.status_code == 200
assert "Aucun projet actif" in r.text
def test_wall_is_behind_auth(monkeypatch, fake_gitea):
monkeypatch.setenv("KANBANTE_AUTH_USER", "bruno")
monkeypatch.setenv("KANBANTE_AUTH_PASSWORD", "motdepasse")
with TestClient(main.app) as secured:
assert secured.get("/wall").status_code == 401