This commit is contained in:
1 parent
23b1cb2966
commit
e9532e8878
30 files changed
+1835
-542
No files matched your search
+49
-15
@@ -1,25 +1,59 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
"""
|
||||
Script: scripts/report_hashes.py — Übersicht & Lücken bei Mehrfach-Hashes
|
||||
Version: 1.0.0
|
||||
Datum: 2025-09-10
|
||||
FILE: scripts/report_hashes.py
|
||||
VERSION: 2.1.0 (2025-12-15)
|
||||
STATUS: Active
|
||||
COMPATIBILITY: v2.9.1 (Post-WP14/WP-15b)
|
||||
|
||||
Funktion
|
||||
--------
|
||||
Listet je Note die vorhandenen Einträge im Feld `hashes` (Signaturen: <mode>:<source>:<normalize>)
|
||||
und meldet fehlende Soll-Keys. Eignet sich als CI-Check.
|
||||
Zweck:
|
||||
-------
|
||||
Erstellt Übersicht über Hash-Signaturen in Note-Payloads.
|
||||
Meldet fehlende Soll-Keys für Multi-Hash Change Detection.
|
||||
|
||||
Optionen
|
||||
--------
|
||||
--prefix TEXT Collection-Prefix (CLI überschreibt ENV)
|
||||
--require K [K ...] Zusätzliche Soll-Keys (Default: body|frontmatter|full:parsed:canonical)
|
||||
--fail-on-missing Exitcode 2, wenn fehlende Keys gefunden werden
|
||||
Funktionsweise:
|
||||
---------------
|
||||
1. Lädt alle Notes aus {prefix}_notes
|
||||
2. Prüft für jede Note das `hashes` Feld
|
||||
3. Vergleicht vorhandene Keys mit Soll-Keys
|
||||
4. Meldet fehlende Keys pro Note
|
||||
|
||||
Beispiele
|
||||
Ergebnis-Interpretation:
|
||||
------------------------
|
||||
- Ausgabe: JSON mit Hash-Übersicht
|
||||
* notes_total: Anzahl geprüfter Notizen
|
||||
* notes_with_missing: Anzahl Notizen mit fehlenden Keys
|
||||
* missing_keys: Liste fehlender Keys pro Note
|
||||
- Exit-Code 0: Keine fehlenden Keys (oder --fail-on-missing nicht gesetzt)
|
||||
- Exit-Code 2: Fehlende Keys gefunden (nur mit --fail-on-missing)
|
||||
|
||||
Verwendung:
|
||||
-----------
|
||||
- CI/CD-Validierung der Hash-Integrität
|
||||
- Audit nach Migrationen
|
||||
- Prüfung der Change Detection Funktionalität
|
||||
|
||||
Hinweise:
|
||||
---------
|
||||
python3 -m scripts.report_hashes --prefix mindnet
|
||||
python3 -m scripts.report_hashes --require frontmatter:raw:none --fail-on-missing
|
||||
- Multi-Hash Format: <mode>:<source>:<normalize>
|
||||
- Standard Soll-Keys: body:parsed:canonical, full:parsed:canonical
|
||||
- Kann zusätzliche Keys via --require anfordern
|
||||
|
||||
Aufruf:
|
||||
-------
|
||||
python3 -m scripts.report_hashes --prefix mindnet
|
||||
python3 -m scripts.report_hashes --require frontmatter:raw:none --fail-on-missing
|
||||
|
||||
Parameter:
|
||||
----------
|
||||
--prefix TEXT Collection-Präfix (überschreibt ENV COLLECTION_PREFIX)
|
||||
--require KEY ... Zusätzliche Soll-Keys (Default: body:parsed:canonical, full:parsed:canonical)
|
||||
--fail-on-missing Exit-Code 2, wenn fehlende Keys gefunden werden
|
||||
|
||||
Änderungen:
|
||||
-----------
|
||||
v2.1.0 (2025-12-15): Dokumentation aktualisiert
|
||||
v1.0.0 (2025-09-10): Initial Release
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
|
||||
Reference in new issue
Block a user