diff --git a/services/immich/auto-update.sh b/services/immich/auto-update.sh index cff7663..f26a2f9 100755 --- a/services/immich/auto-update.sh +++ b/services/immich/auto-update.sh @@ -3,4 +3,4 @@ set -euo pipefail NEW_VERSION="$2" -/home/jeena/Projects/immich-app/upgrade.sh "$NEW_VERSION" +bash -euo pipefail /home/jeena/Projects/immich-app/upgrade.sh "$NEW_VERSION" diff --git a/services/peertube/auto-update.sh b/services/peertube/auto-update.sh new file mode 100755 index 0000000..47daa20 --- /dev/null +++ b/services/peertube/auto-update.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -euo pipefail + +ssh jeena@jeena.net 'cd /var/www/peertube && bash -euo pipefail upgrade.sh 2>&1 | tail -5' diff --git a/services/peertube/review-examples/auto-1.txt b/services/peertube/review-examples/auto-1.txt new file mode 100644 index 0000000..c6d67f8 --- /dev/null +++ b/services/peertube/review-examples/auto-1.txt @@ -0,0 +1,12 @@ +action: auto +reason: Bug fix release. No migration scripts, no configuration changes. The note to follow v8.1.0 instructions only applies if upgrading from v8.0.2 or older, not for patch-to-patch upgrades. +--- +### IMPORTANT NOTES + + * Follow v8.1.0 IMPORTANT NOTES if you upgrade from PeerTube <= v8.0.2 + +### Bug fixes + + * Fix infinite loop when processing some GIF images + * Correctly inject custom admin colors in dark theme + * Fix broken player when loading the page in background diff --git a/services/peertube/review-examples/auto-2.txt b/services/peertube/review-examples/auto-2.txt new file mode 100644 index 0000000..63ddbd4 --- /dev/null +++ b/services/peertube/review-examples/auto-2.txt @@ -0,0 +1,17 @@ +action: auto +reason: Bug fix and security patch release. No migration scripts or configuration changes needed. The v8.1.0 note only applies when upgrading from v8.0.2 or older. +--- +### IMPORTANT NOTES + + * Follow v8.1.0 IMPORTANT NOTES if you upgrade from PeerTube <= v8.0.2 + +### SECURITY + + * Updates vulnerable dependencies + +### Bug fixes + + * Fix error 500 in home page if there are many channels + * Prevent 500 error for podcast feed + * Re-fetch remote videos if the thumbnail if not found + * Handle non jpg remote thumbnails diff --git a/services/peertube/review-examples/manual-1.txt b/services/peertube/review-examples/manual-1.txt new file mode 100644 index 0000000..86698b4 --- /dev/null +++ b/services/peertube/review-examples/manual-1.txt @@ -0,0 +1,120 @@ +action: manual +reason: Requires manually running a migration script after upgrade while PeerTube is running. Also recommends running regenerate-thumbnails and prune-storage scripts, and has configuration changes for thumbnail sizes and object storage prefixes. +--- +**Blog post: https://joinpeertube.org/news/release-8.1** + +### IMPORTANT NOTES + + * You need to manually execute a migration script **after upgrading**, while PeerTube is running and the database migration is complete (`Migrations finished. New migration version schema: 1000` in PeerTube startup logs): + * Classic installation: `cd /var/www/peertube/peertube-latest && sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production node dist/scripts/migrations/peertube-8.1.js` + * Docker installation: `cd /var/www/peertube-docker && docker compose exec -u peertube peertube node dist/scripts/migrations/peertube-8.1.js` + * Running [regenerate-thumbnails](https://docs.joinpeertube.org/maintain/tools#regenerate-video-thumbnails) and [prune-storage](https://docs.joinpeertube.org/maintain/tools#prune-filesystem-object-storage) scripts after the upgrade and migration script is highly recommended + * If you run PostgreSQL or Redis with TLS connection and self signed certificates, you must explicitly set `reject_unauthorized` to `true` or fill `ca`, `cert` and `key` settings in your [production.yaml](https://github.com/Chocobozzz/PeerTube/blob/develop/config/production.yaml.example#L84) + +### Maintenance + + * Migrate to the `sharp` NodeJS dependency to process images. This is a native dependency that provides prebuilt binaries for most system. + FreeBSD systems, however, require an additional step after PeerTube dependencies installation: + * Install `sharp` build dependencies: https://sharp.pixelplumbing.com/install/#building-from-source + * Run `npm explore sharp -- npm run build` in `peertube-latest` directory + * Merge the `previews` directory into the `thumbnails` directory. The migration script will automatically move files + The `previews` directory and configuration are kept for compatibility reasons + * The `cache` directory is no longer deleted at PeerTube startup, to keep files cached from the previous run + +### Configuration + +*This section is not exhaustive* + + * **Important** Generate more thumbnail sizes for videos in `thumbnails.sizes`. We recommend admins apply the same settings + * Update default object storage configuration to use different `prefix` values with the same `bucket_name` for each object type (`web_videos`, `user_exports`, etc.), so it is easier to add more object types in the future + * Use the `lucide` player theme by default + * `import.videos.http.force_ipv4` is now `true` by default to reduce rate limiting on some platforms + * Add *On Primary* color configuration (`theme.customization.on_primary_color`) to choose the foreground color when the background color is *Primary* + +### Docker + + * Add `va-driver-all` to the PeerTube Docker image [#7346](https://github.com/Chocobozzz/PeerTube/pull/7346) + +### Plugins/Themes/Embed/REST APIs + + * REST API: + * Deprecate `previewfile` when publishing a video. Use `thumbnailfile` instead + * Deprecate `thumbnailPath` and `previewPath` `Video` fields. Use the `thumbnails` array instead + * Deprecate the `thumbnailPath` `VideoPlaylist` field. Use the `thumbnails` array instead + * Remove unused `fileUrl` from `UserExport` and `VideoSource` + * Deprecate `/lazy-static/previews/:filename`. Use `/lazy-static/thumbnails/:filename` instead + * Server plugin hooks (https://docs.joinpeertube.org/api/plugins): + * Add `filter:feed.videos.list.result` [#7355](https://github.com/Chocobozzz/PeerTube/pull/7355) + * Replace `torrentPath` with `torrentFilename` and `torrentStream` for remote torrents in `filter:api.download.torrent.allowed.result` context + +### Features + + * :tada: Allow uploaders to restrict domains where their video can be embedded :tada: + * Add an admin config to ensure an optimized podcast audio file is transcoded + * Support 3.0x playback speed for non-premium users :grin: + * Optimize transcoding job queue: + * Do not wait for all transcoding tasks to publish the video + * Do not wait for all transcoding tasks to move video files in object storage + * Lower priority on low video resolutions to avoid blocking video publication during bursts of uploads + * More transcoding job parallelization + * More reliable channel sync: + * Reduce youtube-dl calls to reduce rate limiting + * Handle cases where the video is not available/doesn't exist + * Handle lives that are still being post-processed + * Stop sync on get video info failure to retry at the same point next time + * UX: + * Support raw hex colors in color picker input [#7337](https://github.com/Chocobozzz/PeerTube/pull/7337) + * Group notifications by date + * Display blocked video information on the video manage page + * Add a loading icon when updating the video + * Improve the error message when the user password is too long + * Add `g l` hotkey to go to the login page + * Add ability to display video language on the `My Videos` page (column is hidden by default) + * Improve video SEO + * Support `png` and `webp` video thumbnails + * Support `svg` logos for admins + * Better email notification when a subscribed channel published a video [#7395](https://github.com/Chocobozzz/PeerTube/pull/7395) + * Add compatibility with ActivityPub FEP-1b12 (used by Lemmy, PieFed, Mbin...) + * Introduce a new cache system for remote thumbnails, storyboards, captions, and actor avatars/banners + * Support Redis TLS connections [#7404](https://github.com/Chocobozzz/PeerTube/pull/7404) + * Support PostgreSQL TLS connections [#7366](https://github.com/Chocobozzz/PeerTube/pull/7366) + * Support path style requests for object storage + * Improve channel collaboration: + * An editor can now move a video they can manage to a channel they can manage (owner/editor) + * An editor can send a *change ownership request* for a video they can manage + * Editors can add videos to playlists of collaborated channels + * Add quick actions (*Manage*, *Remove*) to the video dropdown for editors too + * Performance: + * Create video file torrents in a worker thread + * Optimize videos list SQL query with complex sort (trending, hot, etc.) + * When possible, send raw files directly instead of muxing when downloading a video + * Improve podcast feed images compatibility with Apple Podcast + * Add ability to set the default "download enabled" policy in admin configuration + +### Bug fixes + + * Fix videos list inconsistencies when going back to that page + * Do not display an empty details block in embed on error + * Prevent incomplete segment reads for live streams [#7333](https://github.com/Chocobozzz/PeerTube/pull/7333) + * Fix video download filename on Safari + * Fix broken P2P when updating object storage base URL + * Fix Redis sentinel support [#7365](https://github.com/Chocobozzz/PeerTube/pull/7365) + * Correctly use header colors defined by the admin + * Fix broken transcoding on remote runner when split video/audio is enabled + * Fix server config not refreshing after admin settings save [#7413](https://github.com/Chocobozzz/PeerTube/pull/7413) + * Prevent exception when the account is not loaded yet in the user moderation dropdown + * Prevent black borders when embedding a video + * Fix default scope defined by the admin when browsing videos + * Force transcoding even if the video state is not compatible + * Fix broken video studio task when updating video privacy at the same time + * Reset selected rows when loading data in tables + * Take into account channel owner video quota when an editor publishes a video to a collaborated channel + * Fix watching a password protected video as an editor + * Fix video metadata in `filter:api.video.upload.accept.result` context + * Correctly take into account the user language filter when browsing videos + * Fix `.ts` video file upload [#7458](https://github.com/Chocobozzz/PeerTube/pull/7458) + * Fix `.mkv` video file upload on latest Chrome + * Fix deleting all instance logo when deleting a specific logo + * Fix getting unsupported Node.js from PATH with yt-dlp [#7468](https://github.com/Chocobozzz/PeerTube/pull/7468) + * Inherit border color from primary color + * Fix PeerTube client that automatically updates interface language to English diff --git a/services/peertube/review-examples/manual-2.txt b/services/peertube/review-examples/manual-2.txt new file mode 100644 index 0000000..bb94e74 --- /dev/null +++ b/services/peertube/review-examples/manual-2.txt @@ -0,0 +1,97 @@ +action: manual +reason: Major release with long-running database migrations (up to 30 minutes), a required post-upgrade migration script, package manager change from yarn to pnpm that must be installed beforehand, and NodeJS version requirements. +--- +### IMPORTANT NOTES + + * Database migrations of this version can take a long time (up to 30 minutes on an instance with many users/federation actors and a slow database disk) + * You need to manually execute a migration script **after your upgrade** while PeerTube is running and the database migration is complete (`Migrations finished. New migration version schema: 970` in PeerTube startup logs): + * Classic installation: `cd /var/www/peertube/peertube-latest && sudo -u peertube NODE_CONFIG_DIR=/var/www/peertube/config NODE_ENV=production node dist/scripts/migrations/peertube-8.0.js` + * Docker installation: `cd /var/www/peertube-docker && docker compose exec -u peertube peertube node dist/scripts/migrations/peertube-8.0.js` + * `yarn` NodeJS packages manager has been removed in favor of `pnpm`. Follow the [dependencies guide](https://docs.joinpeertube.org/support/doc/dependencies) to install `pnpm` on your system **before the upgrade** + * Ensure `storage.uploads` directory is set in your [production.yaml](https://github.com/Chocobozzz/PeerTube/blob/develop/config/production.yaml.example#L139) + * Supported NodeJS versions are `>= 20.19 and < 21` or `>= 22.12 and <23` + * For Docker users, please read the Docker section below + +### Configuration + + * Remove `http_server` unused section from `.yaml` configuration files + * Introduce `views.videos.local.max_age` configuration to cleanup old views from local videos + * Add more STUN Servers to `webrtc.stun_servers` to improve P2P robustness + * Add ability to increase video transcription timeout in `video_transcription.timeout` + * Add `client.new_features_info` configuration to disable popups explaining new features to users + * Add `user.password_constraints.min_length` config to specify user password minimum length [#6945](https://github.com/Chocobozzz/PeerTube/pull/6945) + +### Docker + + * PeerTube Dockerfile is now based on Debian Trixie. `chocobozzz/peertube:production` can be used instead of `chocobozzz/peertube:production-trixie` (Debian suffix version is deprecated) + * PostgreSQL version has been upgraded in [Docker Compose](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml). Please follow [this guide](https://docs.joinpeertube.org/install/docker#upgrade-postgresql-container) if you want to upgrade PostgreSQL in your Docker Compose + * Redis version has been upgraded in [Docker Compose](https://github.com/Chocobozzz/PeerTube/blob/develop/support/docker/production/docker-compose.yml). No maintenance task is required if you upgrade Redis in your Docker Compose + +### Plugins/Themes/Embed/REST APIs + + * REST API: + * Remove deprecated `filename` field from `VideoSource` object + * Remove deprecated `commentsEnabled` field from `Video` object + * Remove deprecated `redundancies.files`field from `VideoRedundancy` object + * Deprecate `captionPath` field from `VideoCaption` object. Use `fileUrl` instead + * Deprecate `storyboardPath` from `Storyboard` object. Use `fileUrl` instead + * Deprecate `path` from `ActorImage` object (avatars, banners). Use `fileUrl` instead + * The HTTP response code for password-protected videos can be either 401 or 403, depending on the request headers + * Theme: + * Rename `--input-placeholder` CSS variables into `--input-placeholder-color` + * Introduce `--input-placeholder-font-size` CSS variable + +### Features + + * :tada: Add channel collaboration :tada: + * Channel owners can invite users of their instance to become editors of their channel + * Editors can accept or reject the invitation + * Editors can manage videos, playlists & comments of the channel + * An *Activity* page has been added to list actions performed within a channel + * :tada: Video player redesign :tada: + * Introduce a new clean and modern theme named **Lucide** + * Original theme is still used by default, and has been renamed to **Galaxy** + * The player theme can be changed by the admin for the entire instance or by the channel for all its videos. It can also be changed for individual videos. + * Use vertical audio volume control for **Galaxy** player theme + * Improve video imports UX + * Introduce an *Import failed* state to clearly identify failed imports + * Display import state in video manage page and watch page + * Add ability to retry video imports + * Channel synchronization automatically retry failed imports + * Redesign notifications popup and page + * Replace `yarn` package manager by `pnpm` to provide faster PeerTube installation/upgrade and faster plugin installation/upgrade + * Add admin options to customize default *Browse videos* behaviour [#7193](https://github.com/Chocobozzz/PeerTube/pull/7193) + * Add ability to handle storyboard generation job by runners [#7191](https://github.com/Chocobozzz/PeerTube/pull/7191) + * Add *Resend verification email* button to admin users list [#7272](https://github.com/Chocobozzz/PeerTube/pull/7272) + * Improve video manage and admin config forms accessibility + * Add ability to insert a new playlist at first position in the channel + * Add ability to copy codecs, if possible, for HLS transcoding + * Also search by account name when searching for channels + * Faster start time seek on HLS videos + +### Bug fixes + + * Fix avatar max size information + * Fix scroll issue when navigating from homepage + * Fix viewers stats date filter label after a reset + * Fix select languages component label + * Correctly load user video language settings in video filters + * Accept non-HTTPS URLs for the search index + * Fix admin abuse URL in emails + * Show videos to owners even if they are muted on the instance + * Correctly sort scheduled videos when listing my videos + * Fix account mention redirection + * Display all countries/regions labels in viewer stats graph + * Keep videos order after user import + * Fix HTML headings hierarchy to improve SEO + * Users logged-in by an external auth plugin can choose to display their email publicly (required by Apple for the podcast feed) + * Fix podcast feed video bitrate attribute that can be refused by some podcast applications + * Fix video quota information estimation + * Translate RSS feeds title + * Fix transcription CORS issue if the caption file is stored externally + * Do no uppercase video tags + * Fix resetting instance categories/languages + * Fix black screen when updating web video resolution in player + * Fix displaying more than 100 live sessions + * Reload page after login to respect user lang + * Do not run storyboard/transcription jobs without the appropriate stream diff --git a/services/piefed/auto-update.sh b/services/piefed/auto-update.sh new file mode 100755 index 0000000..f2a6299 --- /dev/null +++ b/services/piefed/auto-update.sh @@ -0,0 +1,4 @@ +#!/bin/bash +set -euo pipefail + +ssh jeena@jeena.net 'cd piefed && bash -euo pipefail deploy.sh 2>&1 | tail -5' diff --git a/services/piefed/review-examples/auto-1.txt b/services/piefed/review-examples/auto-1.txt new file mode 100644 index 0000000..b6e63c6 --- /dev/null +++ b/services/piefed/review-examples/auto-1.txt @@ -0,0 +1,6 @@ +action: auto +reason: Minor patch release with a bug fix and a small UI addition. No breaking changes or manual steps required. +--- +- Fix post deletion. + + - Plus icon on main menu to make a post. diff --git a/services/piefed/review-examples/auto-2.txt b/services/piefed/review-examples/auto-2.txt new file mode 100644 index 0000000..77e4a89 --- /dev/null +++ b/services/piefed/review-examples/auto-2.txt @@ -0,0 +1,25 @@ +action: auto +reason: Feature release with new functionality like private communities, pronoun flairs, and emoji improvements. No breaking changes or manual migration steps required. +--- + - Pronouns - when you put pronouns into Extra Fields on your profile that is used as a flair in all communities where you haven't set a flair yet + - Private communities - no federation, only certain roles (depends on the community) can invite new people + - Plain http web UI (no SSL required) with SSL used during federation - see http://retro.piefed.com. Helpful for development, extremely bad internet connections or very old computers. + - Mastodon can now quote-boost PieFed posts + - Downvotes can be turned off completely in a community, not just instance-wide + - Admins can sticky a post on the home page, not just mods in their communities + - Auto-delete of replies on remote instances when reply author has been blocked by parent content author (only works in PieFed communities due to a ActivityPub limitation) + - On home page when showing number of replies a post has, calculate the sum of the replies on all cross-posts and display that + - New users can only do 3 posts in their first 24h, to reduce floods of posts by that guy who keeps deleting his accounts and making new ones + - Improve emoji federation compatibility + - Change order of emoji in picker to present most-used ones first + - Optional daily time limit on usage to help people use PieFed less. Client-side tracking for privacy. + - A way to report posts that need to be tagged as AI generated + - Better accessibility + - Improved handling of bold and italics in markdown parsing + - Don't accept votes on posts from people the author has blocked + - Admins can resend email address verification email + - Admins can add notes to instances to keep track of defederation reasons, etc + - Search form has been simplified + - Option for admins to disable the em-dash detector + - Multiple minor bugfixes and security enhancements + - Translation updates for 5 languages diff --git a/services/piefed/review-examples/auto-3.txt b/services/piefed/review-examples/auto-3.txt new file mode 100644 index 0000000..bbb0505 --- /dev/null +++ b/services/piefed/review-examples/auto-3.txt @@ -0,0 +1,35 @@ +action: auto +reason: Major feature release with post relocation, video uploads, and realtime chat. No database migrations or manual admin action required. +--- +### Big deals, omg + + - Mods can move a post, with replies and votes, to another community. The change federates to other instances (except Lemmy, for now). + - Upload video files while creating a video post - no external host needed. Admin setting to limit who can do this (to save space). + - Realtime chat - conversation immediately updates on screen when a new PM arrives. + +### More good stuff + + - Author-deleted posts are still visible to them and anyone with the url. No more loss of high-value comments with the OP deletes. + - Search filters - nsfw and minimum post score + - Improve speed of cross-posting form on mobile + - Emoji tokens like `:blush:` can be used in post or comment body. No GUI support yet. + - Admin setting to disable local copies of remote images - good for single-user instances + - Replying to a comment marks associated inbox item as read + - Updated HPT-Fruits theme + - 196 no longer excluded from default community import + - Remove unused community rating feature + - Remove unused instance vote weight feature + - Remove ineffective รพ to 'th' replacement + - Improved accessibility - better contrast, fixed many incorrectly-used `aria-label`s + - Updated translations - Basque, Chinese, Japanese + +### API: + - Admins can ban/unban users through the API. piefed.world was maintaining custom code for this, hopefully it'll make their version upgrades faster. + +### Bugs fixed + + - PMs + - Markdown parsing + - Speed up loading of profile pages for admin users + - Friendica post parsing + - Passkeys login UX tweak diff --git a/services/piefed/review-examples/manual-1.txt b/services/piefed/review-examples/manual-1.txt new file mode 100644 index 0000000..7c74766 --- /dev/null +++ b/services/piefed/review-examples/manual-1.txt @@ -0,0 +1,13 @@ +action: manual +reason: Database schema change requires running flask db upgrade manually before restarting. Environment variable rename also needs .env update. +--- +## Breaking changes + +- The `PIEFED_SECRET_KEY` environment variable has been renamed to `SECRET_KEY`. Update your `.env` file before upgrading. +- New database columns have been added. Run `flask db upgrade` before restarting the application. + +## Other changes + +- Improved federation with Lemmy 0.19.x +- Minor UI tweaks to the community sidebar +- Updated translations for 3 languages diff --git a/test_classifier.py b/test_classifier.py index 7d1c260..1251c46 100644 --- a/test_classifier.py +++ b/test_classifier.py @@ -1,8 +1,11 @@ #!/usr/bin/env python3 """ -Test the Ollama model's ability to classify Immich release notes. +Test the Ollama model's ability to classify release notes. Runs leave-one-out: for each example, uses the rest as few-shot context and checks whether the model predicts the correct action. + +Usage: python test_classifier.py [service_name] + service_name defaults to "immich" """ import json @@ -11,9 +14,28 @@ import sys from pathlib import Path from urllib.request import Request, urlopen +import re as _re + OLLAMA_BASE_URL = os.getenv("OLLAMA_BASE_URL", "http://192.168.1.20:11434") OLLAMA_MODEL = os.getenv("OLLAMA_MODEL", "gemma4:26b-64k") -EXAMPLES_DIR = Path(__file__).parent / "services" / "immich" / "review-examples" +SERVICE_NAME = sys.argv[1] if len(sys.argv) > 1 else "immich" +EXAMPLES_DIR = Path(__file__).parent / "services" / SERVICE_NAME / "review-examples" + + +def guess_version_from_notes(notes: str) -> str: + """Extract a version number from release notes (e.g. '# v2.7.0' or '### v8.1.5').""" + match = _re.search(r"v?(\d+\.\d+\.\d+)", notes) + return match.group(1) if match else "1.0.0" + + +def make_previous_version(version: str) -> str: + """Decrement patch to simulate upgrading from the previous patch release.""" + parts = version.split(".") + if len(parts) == 3 and parts[2].isdigit(): + patch = int(parts[2]) + if patch > 0: + return f"{parts[0]}.{parts[1]}.{patch - 1}" + return version def load_examples(directory: Path) -> list[dict]: @@ -43,16 +65,18 @@ def load_examples(directory: Path) -> list[dict]: return examples -def build_messages(examples: list[dict], target_notes: str) -> list[dict]: +def build_messages(examples: list[dict], target_notes: str, current: str = "1.0.0", latest: str = "2.0.0") -> list[dict]: system = ( - "You are an update safety classifier for self-hosted Immich instances.\n" - "Given release notes for an Immich update, decide whether the update can be\n" + 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" "Rules:\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" + "- Conditional notes like 'follow X instructions if upgrading from <= Y' only apply\n" + " if the current running version is <= Y. If we are already past Y, they do not apply.\n" "- Respond ONLY with a JSON object: {\"action\": \"auto\", \"reason\": \"...\"}\n" " or {\"action\": \"manual\", \"reason\": \"...\"}\n" "- Keep reason under 60 words." @@ -67,7 +91,7 @@ def build_messages(examples: list[dict], target_notes: str) -> list[dict]: "content": json.dumps({"action": ex["action"], "reason": ex["reason"]}), }) - messages.append({"role": "user", "content": f"Release notes:\n{target_notes}"}) + messages.append({"role": "user", "content": f"Upgrading from {current} to {latest}.\n\nRelease notes:\n{target_notes}"}) return messages @@ -117,7 +141,9 @@ def main(): for i, target in enumerate(examples): few_shot = [ex for j, ex in enumerate(examples) if j != i] - messages = build_messages(few_shot, target["notes"]) + latest = guess_version_from_notes(target["notes"]) + current = make_previous_version(latest) + messages = build_messages(few_shot, target["notes"], current, latest) try: response = call_ollama(messages) diff --git a/update_monitor/classifier.py b/update_monitor/classifier.py index c39e1a0..1b899fc 100644 --- a/update_monitor/classifier.py +++ b/update_monitor/classifier.py @@ -49,7 +49,7 @@ class Classifier: if not examples: return {"action": "manual", "reason": "No review examples configured; defaulting to manual review."} - messages = self._build_messages(service_dir.name, examples, release_notes) + messages = self._build_messages(service_dir.name, examples, release_notes, current, latest) try: payload = json.dumps({ @@ -83,6 +83,8 @@ class Classifier: service_name: str, examples: List[Dict[str, str]], release_notes: str, + current: str, + latest: str, ) -> List[Dict[str, str]]: system_prompt = ( f"You are an update safety classifier for self-hosted {service_name} instances.\n" @@ -93,6 +95,8 @@ class Classifier: "- 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" + "- Conditional notes like 'follow X instructions if upgrading from <= Y' only apply\n" + " if the current running version is <= Y. If we are already past Y, they do not apply.\n" '- Respond ONLY with a JSON object: {"action": "auto", "reason": "..."}\n' ' or {"action": "manual", "reason": "..."}\n' "- Keep reason under 60 words." @@ -104,5 +108,8 @@ class Classifier: "role": "assistant", "content": json.dumps({"action": ex["action"], "reason": ex["reason"]}), }) - messages.append({"role": "user", "content": f"Release notes:\n{release_notes}"}) + messages.append({ + "role": "user", + "content": f"Upgrading from {current} to {latest}.\n\nRelease notes:\n{release_notes}", + }) return messages