HSCP-T-007 · open test
Version support calendar: promised duration, notice kept, fixes delivered separately
What the test checks
The evidence is the version support calendar, one JSON object per version (JSON Lines), following the recipe's data model:
| Field | Required | Meaning |
|---|---|---|
version |
yes | branch or major version |
sortie |
yes | release date (YYYY-MM-DD) |
fin_evolutions |
yes | date from which the version only receives fixes |
fin_correctifs |
yes | end-of-support date |
annonce_fin |
yes | date on which end of support is or was announced |
correctifs_separes |
yes | true if fixes are delivered without new features |
remplacee_par |
once support has ended | recommended version |
The maintenance plan sets two values, passed to the test: the minimum support duration (--assistance-mois) and the announcement notice (--preavis-mois). The test accepts the calendar if, for each version:
- dates are readable and in order: release, end of new features, end of fixes;
- support lasts at least the plan's duration;
- end of support is announced at least the plan's notice before the end of fixes;
- a version still supported on the day of the check receives its fixes separately from new features;
- a version whose support has ended names its replacement.
It reports, without refusing, an end-of-support announcement due within 90 days.
Running the test
python3 verifier.py calendrier.jsonl --assistance-mois 36 --preavis-mois 6
--date sets the day of the check, --json returns the answer as JSON. Exit code: 0 evidence accepted, 1 evidence refused, 2 incorrect call. Python 3.10 or later, no dependency.
Examples
exemples/valide/: two versions, 36 months of support, announcement 6 months ahead, separate fixes, replacement named. Accepted.exemples/refuse/: one version stopped too early, announced too late and without a replacement; one supported version whose fixes come with new features; one version with dates out of order. Refused.
What the test does not say
- It does not say that the promised fixes are actually published: matching against the release history remains a review.
- It does not say that the announcement was made or read.
- It checks neither the decommissioning plan, nor what happens to the data at shutdown, nor the integrity of the record: these are reviews in the recipe.
Code
Download the test (zip archive: program, examples, README, licence) (10 KB) · verifier.py
The code and its messages are not translated (French).
#!/usr/bin/env python3
# SPDX-License-Identifier: Apache-2.0
# Copyright 2026 les contributeurs des Gestes communs du logiciel de santé
"""HSCP-T-007 : calendrier d'assistance des versions, au plan de maintenance.
python3 verifier.py <calendrier.jsonl> --assistance-mois N --preavis-mois M [--date AAAA-MM-JJ] [--json]
Lit le calendrier, un objet JSON par version (JSON Lines) : version, sortie, fin_evolutions, fin_correctifs,
annonce_fin, correctifs_separes, remplacee_par (facultatif).
Refus : ligne illisible ; champ obligatoire absent ; date illisible ; version en double ; dates dans le désordre
(sortie <= fin_evolutions <= fin_correctifs) ; assistance plus courte que --assistance-mois ; annonce de fin à moins
de --preavis-mois avant la fin des correctifs ; version encore en assistance à --date dont les correctifs ne sont pas
livrés à part ; version dont la fin des correctifs est passée sans remplacee_par.
Note seulement : version dont l'annonce de fin est à venir dans les 90 jours.
Il ne dit pas que les correctifs promis sont publiés, ni que l'annonce a été faite ou lue.
Codes de retour : 0 pièce acceptée, 1 pièce refusée, 2 appel incorrect.
Bibliothèque standard seulement, aucun accès réseau.
"""
import argparse
import datetime as dt
import json
import sys
ID = "HSCP-T-007"
OBLIGATOIRES = ("version", "sortie", "fin_evolutions", "fin_correctifs", "annonce_fin", "correctifs_separes")
DATES = ("sortie", "fin_evolutions", "fin_correctifs", "annonce_fin")
def jour(v):
try:
return dt.date.fromisoformat(str(v))
except ValueError:
return None
def plus_mois(d, n):
m = d.month - 1 + n
a, m = d.year + m // 12, m % 12 + 1
for j in (d.day, 30, 29, 28):
try:
return dt.date(a, m, j)
except ValueError:
continue
def verifier(chemin, assistance, preavis, aujourdhui):
refus, notes, vues, n = [], [], set(), 0
for num, ligne in enumerate(open(chemin, encoding="utf-8"), 1):
if not ligne.strip():
continue
try:
v = json.loads(ligne)
assert isinstance(v, dict)
except (ValueError, AssertionError):
refus.append(f"ligne {num} : objet JSON illisible")
continue
n += 1
nom = str(v.get("version", f"ligne {num}"))
manque = [c for c in OBLIGATOIRES if c not in v or v[c] in (None, "")]
if manque:
refus.append(f"{nom} : champ(s) absent(s) : {', '.join(manque)}")
continue
if nom in vues:
refus.append(f"{nom} : version en double")
vues.add(nom)
d = {c: jour(v[c]) for c in DATES}
illisibles = [c for c, x in d.items() if x is None]
if illisibles:
refus.append(f"{nom} : date(s) illisible(s) : {', '.join(illisibles)}")
continue
if not d["sortie"] <= d["fin_evolutions"] <= d["fin_correctifs"]:
refus.append(f"{nom} : dates dans le désordre (sortie, fin des évolutions, fin des correctifs)")
if d["fin_correctifs"] < plus_mois(d["sortie"], assistance):
refus.append(f"{nom} : assistance plus courte que {assistance} mois")
if d["annonce_fin"] > plus_mois(d["fin_correctifs"], -preavis):
refus.append(f"{nom} : fin annoncée à moins de {preavis} mois de la fin des correctifs")
en_assistance = d["sortie"] <= aujourdhui <= d["fin_correctifs"]
if en_assistance and v["correctifs_separes"] is not True:
refus.append(f"{nom} : en assistance, correctifs non livrés à part des évolutions")
if d["fin_correctifs"] < aujourdhui and not v.get("remplacee_par"):
refus.append(f"{nom} : fin d'assistance passée sans version de remplacement")
if aujourdhui <= d["annonce_fin"] <= aujourdhui + dt.timedelta(days=90):
notes.append(f"{nom} : annonce de fin d'assistance à faire le {d['annonce_fin']}")
if n == 0:
refus.append("calendrier vide")
return refus, notes, n
def main(argv):
p = argparse.ArgumentParser(prog="verifier.py", description=__doc__.splitlines()[0])
p.add_argument("calendrier")
p.add_argument("--assistance-mois", type=int, required=True)
p.add_argument("--preavis-mois", type=int, required=True)
p.add_argument("--date")
p.add_argument("--json", action="store_true")
try:
a = p.parse_args(argv)
except SystemExit:
return 2
aujourdhui = jour(a.date) if a.date else dt.date.today()
if aujourdhui is None or a.assistance_mois < 1 or a.preavis_mois < 0:
print(f"{ID} : appel incorrect (--date AAAA-MM-JJ, durées en mois positives)", file=sys.stderr)
return 2
try:
refus, notes, n = verifier(a.calendrier, a.assistance_mois, a.preavis_mois, aujourdhui)
except OSError as e:
print(f"{ID} : pièce illisible : {e}", file=sys.stderr)
return 2
if a.json:
print(json.dumps({"test": ID, "accepte": not refus, "versions": n, "refus": refus, "notes": notes},
ensure_ascii=False, indent=2))
else:
print(f"{ID} : {'pièce acceptée' if not refus else 'pièce refusée'} ({n} version(s))")
for r in refus:
print(" refus :", r)
for x in notes:
print(" note :", x)
return 0 if not refus else 1
if __name__ == "__main__":
sys.exit(main(sys.argv[1:]))