feat: Add Grafana auto-update & improve classifier

Add auto-update for Grafana on Synology via SSH + docker compose,
with review examples and a context.txt describing the specific setup
(Prometheus + Node Exporter, no plugins) so the classifier can
ignore plugin-only breaking changes.

The classifier now loads an optional context.txt per service to
tailor decisions to the actual deployment. It also truncates large
release notes intelligently, keeping important sections (breaking
changes, deprecations, migration notes) while dropping long PR
lists that add no signal.

test_classifier.py now also loads context.txt and accepts any
service name as argument.
This commit is contained in:
Jeena 2026-04-13 03:57:22 +00:00
parent 67a9509eaa
commit ea90b8569b
10 changed files with 185 additions and 1 deletions

View file

@ -66,12 +66,20 @@ def load_examples(directory: Path) -> list[dict]:
def build_messages(examples: list[dict], target_notes: str, current: str = "1.0.0", latest: str = "2.0.0") -> list[dict]:
context_file = EXAMPLES_DIR.parent / "context.txt"
context = context_file.read_text(encoding="utf-8").strip() if context_file.is_file() else None
system = (
f"You are an update safety classifier for self-hosted {SERVICE_NAME} instances.\n"
f"Given release notes for a {SERVICE_NAME} update, decide whether the update can be\n"
"applied automatically (action: auto) or requires the admin to intervene\n"
"manually before or during the update (action: manual).\n\n"
)
if context:
system += f"Instance context: {context}\n\n"
system += (
"Rules:\n"
"- Only flag as manual if the breaking changes actually affect this specific setup.\n"
"- Classify only THIS release, not future or past releases mentioned in the notes.\n"
"- Warnings or announcements about breaking changes in upcoming versions do NOT\n"
" make the current release manual.\n"