#!/usr/bin/env python3 """Regroup a GitHub release's generated notes by component. GitHub's generated notes are one flat list of PRs in merge order. This keeps every line as GitHub wrote it, but sorts the PRs under component headings (S3 API, Filer, Mount, Volume Server, ...), with dependency bumps folded at the end. The component comes from the PR title prefix, which nearly every PR has ("s3api: ...", "fix(mount): ...", "filer.sync: ...", "rust volume: ..."). A PR with no recognised prefix is placed by the files it changes. Usage: release_notes_by_component.py --tag 4.54 # print the regrouped notes release_notes_by_component.py --tag 4.54 --write # also update the release Running it again on notes it already regrouped gives the same result. """ import argparse import json import re import subprocess import sys # Display order. Each PR lands in exactly one section. SECTIONS = [ "S3 API", "S3 Tables and Iceberg", "Vectors", "Filer", "Mount", "Volume Server", "Rust Volume Server", "Erasure Coding", "Master and Topology", "Admin UI and Workers", "Shell", "Security", "Message Queue", "Kubernetes, Helm and Deployment", "Core and CLI", "Documentation", "Tests and CI", "Other", "Dependencies", ] # Title scope -> section, first match wins. Matched against each lower-cased scope # token, e.g. "filer.sync", "s3 lifecycle", "weed/s3api" (a "weed/" prefix is # dropped first). Order matters: specific scopes come before the general ones # they start with (s3tables before s3, volume.fsck before volume). SCOPE_RULES = [ (r"(build\(deps\)|deps|dependabot)\b", "Dependencies"), (r"(test|tests|e2e|integration)\b|.*\btests?$|test/", "Tests and CI"), (r"(rust[ -]?volume|seaweed-volume|volume\(rust\)|rust)\b", "Rust Volume Server"), (r"(s3 ?vectors?|vectors?|seaweed-vector|weed-vector|lance)\b", "Vectors"), (r"(s3 ?tables|iceberg)\b", "S3 Tables and Iceberg"), (r"(s3 sink|remote|remote_storage|filer|webdav|sftp|ftp|notification|replication|" r"redis\d*|leveldb\d*|backup)\b", "Filer"), (r"(s3|s3api|iam|oidc|sts|credential|sse|cors|policy|object ?lock)\b", "S3 API"), (r"(mount|fuse)\b", "Mount"), (r"(ec|ec_\w+|ec\.\w+|erasure[ _-]?coding|worker/ec)\b", "Erasure Coding"), (r"(master|topology|wdclient|cluster|raft|placement)\b", "Master and Topology"), (r"(admin|worker|weed-worker|plugin|plugin worker|maintenance)\b", "Admin UI and Workers"), (r"(shell|fsck|volume\.\w+|fs\.\w+|collection\.\w+|bucket\.\w+)", "Shell"), (r"(volume|volume_\w+|storage|vacuum|operation|compression|needle)\b", "Volume Server"), (r"(security|tls|mtls|jwt|grpc|kms)\b", "Security"), (r"(mq|kafka|messaging)\b", "Message Queue"), (r"(helm|k8s|kubernetes|operator|csi|docker|grafana|install\.sh|chart|snap|terraform)\b", "Kubernetes, Helm and Deployment"), (r"(docs?|readme|wiki)\b", "Documentation"), (r"(ci|release|build|github|workflow|actions)\b", "Tests and CI"), (r"(server|command|mini|weed-db|weed|util|pb|cmd|glog|stats|telemetry|query|config)\b", "Core and CLI"), ] # Changed path prefix -> section, for PRs whose title has no usable prefix. # Longest prefix wins. PATH_RULES = { "weed/s3api/s3tables/": "S3 Tables and Iceberg", "weed/s3api/iceberg/": "S3 Tables and Iceberg", "weed/s3api/s3vectors/": "Vectors", "weed/s3api/lance/": "Vectors", "seaweed-vector/": "Vectors", "weed/s3api/": "S3 API", "weed/iam/": "S3 API", "weed/iamapi/": "S3 API", "weed/credential/": "S3 API", "weed/filer/": "Filer", "weed/filer_client/": "Filer", "weed/server/filer": "Filer", "weed/server/webdav": "Filer", "weed/sftpd/": "Filer", "weed/replication/": "Filer", "weed/notification/": "Filer", "weed/remote_storage/": "Filer", "weed/mount/": "Mount", "weed/storage/erasure_coding/": "Erasure Coding", "weed/ec/": "Erasure Coding", "weed/worker/tasks/erasure_coding/": "Erasure Coding", "weed/storage/": "Volume Server", "weed/server/volume": "Volume Server", "weed/operation/": "Volume Server", "seaweed-volume/": "Rust Volume Server", "weed/topology/": "Master and Topology", "weed/server/master": "Master and Topology", "weed/wdclient/": "Master and Topology", "weed/cluster/": "Master and Topology", "weed/placement/": "Master and Topology", "weed/admin/": "Admin UI and Workers", "weed/worker/": "Admin UI and Workers", "weed/plugin/": "Admin UI and Workers", "seaweed-worker/": "Admin UI and Workers", "weed/shell/": "Shell", "weed/security/": "Security", "weed/kms/": "Security", "weed/mq/": "Message Queue", "k8s/": "Kubernetes, Helm and Deployment", "docker/": "Kubernetes, Helm and Deployment", "snap/": "Kubernetes, Helm and Deployment", "terraform/": "Kubernetes, Helm and Deployment", "weed/": "Core and CLI", "test/": "Tests and CI", ".github/": "Tests and CI", } PR_LINE = re.compile(r"^\* (?P