Skip to content

Commit

Permalink
feat(release-notes): improve exclusion filters (#855)
Browse files Browse the repository at this point in the history
Co-authored-by: CI Automation <[email protected]>
  • Loading branch information
LittleChimera and sa-github-api authored Sep 3, 2024
1 parent 65e1de7 commit c5940e8
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 15 deletions.
45 changes: 33 additions & 12 deletions release-controller/release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,15 +130,24 @@ class Team:


EXCLUDE_CHANGES_FILTERS = [
r".+\/sns\/.+",
r".+\/ckbtc\/.+",
r".+\/cketh\/.+",
r"sns",
r"ckbtc",
r"cketh",
r"rs\/nns.+",
r".+test.+",
r"^bazel$",
r".*boundary.*",
r".*rosetta.*",
r".*pocket[_-]ic.*",
r"test",
r"^bazel",
r"boundary",
r"rosetta",
r"pocket[_-]ic",
r"^Cargo.lock$",
r"registry\/admin",
r"canister",
]

EXCLUDED_SCOPES = [
"ic-admin",
"nns",
"sns",
]

INCLUDE_CHANGES = ["bazel/external_crates.bzl"]
Expand Down Expand Up @@ -312,8 +321,16 @@ def get_change_description_for_commit(
file_changes = ic_repo.file_changes_for_commit(commit_hash)
exclusion_reason = None
guestos_change = is_guestos_change(ic_repo, commit_hash)
if guestos_change and not any(
f for f in file_changes if not any(re.match(filter, f["file_path"]) for filter in EXCLUDE_CHANGES_FILTERS)
if (
guestos_change
and not exclusion_reason
and not any(
f
for f in file_changes
if not any(
f not in INCLUDE_CHANGES and re.search(filter, f["file_path"]) for filter in EXCLUDE_CHANGES_FILTERS
)
)
):
exclusion_reason = "Changed files are excluded by file path filter"

Expand Down Expand Up @@ -363,9 +380,13 @@ def get_change_description_for_commit(
commit_type = conventional["type"].lower()
commit_type = commit_type if commit_type in TYPE_PRETTY_MAP else "other"

if guestos_change and not REPLICA_TEAMS.intersection(teams):
if guestos_change and not exclusion_reason and not REPLICA_TEAMS.intersection(teams):
exclusion_reason = "The change is not owned by any replica team"

scope = conventional["scope"] if conventional["scope"] else ""
if guestos_change and not exclusion_reason and scope in EXCLUDED_SCOPES:
exclusion_reason = f"Scope of the change ({scope}) is not related to GuestOS"

teams = sorted(list(teams))

commiter_parts = commiter.split()
Expand All @@ -378,7 +399,7 @@ def get_change_description_for_commit(
commit=commit_hash,
teams=list(teams),
type=commit_type,
scope=conventional["scope"] if conventional["scope"] else "",
scope=scope,
message=conventional["message"],
commiter=commiter,
exclusion_reason=exclusion_reason,
Expand Down
90 changes: 87 additions & 3 deletions release-controller/test_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import pytest


# @pytest.mark.skip(reason="expensive, will be removed")
def test_get_change_description_for_commit():
with tempfile.TemporaryDirectory() as repo_cache_dir:
ic_repo = GitRepo(
Expand Down Expand Up @@ -78,6 +77,91 @@ def test_get_change_description_for_commit():
exclusion_reason=None,
guestos_change=False,
)
# modifies ic-admin
assert get_change_description_for_commit(commit_hash="d436a526d", ic_repo=ic_repo) == Change(
commit="d436a526d",
teams=[
"ic-interface-owners",
],
type="feat",
scope="ic-admin",
message="Print hashes rather than entire blobs when submitting InstallCode proposals ([#1093](https://github.com/dfinity/ic/pull/1093))",
commiter="jaso ",
exclusion_reason="Changed files are excluded by file path filter",
guestos_change=True,
)
assert get_change_description_for_commit(commit_hash="92e0f4a55", ic_repo=ic_repo) == Change(
commit="92e0f4a55",
teams=[
"ic-interface-owners",
],
type="feat",
scope="nns",
message="Store `wasm_metadata` in SNS-W's stable memory (attempt #2) ([#977](https://github.com/dfinity/ic/pull/977))",
commiter="Arsh Ter-",
exclusion_reason="Scope of the change (nns) is not related to GuestOS",
guestos_change=True,
)
assert get_change_description_for_commit(commit_hash="0aa15a5be", ic_repo=ic_repo) == Change(
commit="0aa15a5be",
teams=[
"ic-interface-owners",
],
type="feat",
scope="nns",
message="Automatically set SNS Governance, Ledger, Index, Archive canisters memory limits once ([#1004](https://github.com/dfinity/ic/pull/1004))",
commiter="Andr Popo",
exclusion_reason="Changed files are excluded by file path filter",
guestos_change=True,
)
assert get_change_description_for_commit(commit_hash="974f22dc1", ic_repo=ic_repo) == Change(
commit="974f22dc1",
teams=[
"ic-interface-owners",
],
type="feat",
scope="sns",
message="Expose the wasm_memory_limit in sns_canisters_summary's settings ([#1054](https://github.com/dfinity/ic/pull/1054))",
commiter="Andr Popo",
exclusion_reason="Changed files are excluded by file path filter",
guestos_change=True,
)
assert get_change_description_for_commit(commit_hash="05b02520f", ic_repo=ic_repo) == Change(
commit="05b02520f",
teams=[
"ic-interface-owners",
],
type="feat",
scope="sns",
message="Reject new participants if the maximum number of required SNS neurons has been reached ([#924](https://github.com/dfinity/ic/pull/924))",
commiter="Arsh Ter-",
exclusion_reason="Scope of the change (sns) is not related to GuestOS",
guestos_change=True,
)
assert get_change_description_for_commit(commit_hash="57293157d", ic_repo=ic_repo) == Change(
commit="57293157d",
teams=[
"ic-interface-owners",
],
type="chore",
scope="sns",
message="Remove migration code for setting SNS memory limits ([#1159](https://github.com/dfinity/ic/pull/1159))",
commiter="Andr Popo",
exclusion_reason="Changed files are excluded by file path filter",
guestos_change=True,
)
assert get_change_description_for_commit(commit_hash="f4242cbcf", ic_repo=ic_repo) == Change(
commit="f4242cbcf",
teams=[
"ic-interface-owners",
],
type="chore",
scope="",
message="add decoding quota to http_request in NNS root canister ([#1031](https://github.com/dfinity/ic/pull/1031))",
commiter="mras ",
exclusion_reason="Changed files are excluded by file path filter",
guestos_change=True,
)


def test_release_notes():
Expand Down Expand Up @@ -107,7 +191,7 @@ def test_release_notes():
* author: Adri Alic | [`5e319b9de`](https://github.com/dfinity/ic/commit/5e319b9de) Consensus,Interface(consensus): Change definition of better to exclude disqualified block makers ([#673](https://github.com/dfinity/ic/pull/673))
* author: Alex Uta | [`736beea98`](https://github.com/dfinity/ic/commit/736beea98) Execution,Interface,Message Routing,Runtime: Enable transparent huge pages for the page allocator ([#665](https://github.com/dfinity/ic/pull/665))
* author: Dimi Sarl | [`96035ca4c`](https://github.com/dfinity/ic/commit/96035ca4c) Execution,Interface,Networking,Runtime: Reduce DTS slice limit for regular messages on system subnets ([#621](https://github.com/dfinity/ic/pull/621))
* author: Alex | [`f0093242d`](https://github.com/dfinity/ic/commit/f0093242d) Execution,Interface,Runtime: Enforce taking a canister snapshot only when canister is not empty ([#452](https://github.com/dfinity/ic/pull/452))
* ~~author: Alex | [`f0093242d`](https://github.com/dfinity/ic/commit/f0093242d) Execution,Interface,Runtime: Enforce taking a canister snapshot only when canister is not empty ([#452](https://github.com/dfinity/ic/pull/452)) [AUTO-EXCLUDED:Changed files are excluded by file path filter]~~
* ~~author: dani | [`a89a2e17c`](https://github.com/dfinity/ic/commit/a89a2e17c) Interface(nns): Metrics for public neurons. ([#685](https://github.com/dfinity/ic/pull/685)) [AUTO-EXCLUDED:Changed files are excluded by file path filter]~~
* ~~author: dani | [`448c85ccc`](https://github.com/dfinity/ic/commit/448c85ccc) Interface(nns): Added include_public_neurons_in_full_neurons to ListNeurons. ([#589](https://github.com/dfinity/ic/pull/589)) [AUTO-EXCLUDED:Changed files are excluded by file path filter]~~
* ~~author: jaso | [`2b109fb9b`](https://github.com/dfinity/ic/commit/2b109fb9b) Interface(nns): Define update_canister_settings proposal type without execution ([#529](https://github.com/dfinity/ic/pull/529)) [AUTO-EXCLUDED:Changed files are excluded by file path filter]~~
Expand All @@ -120,7 +204,7 @@ def test_release_notes():
## Chores:
* author: kpop | [`204542c15`](https://github.com/dfinity/ic/commit/204542c15) Consensus,Interface(consensus): change the associated `Error` type of `TryFrom<pb>` from `String` to `ProxyDecodeError` for some consensus types ([#695](https://github.com/dfinity/ic/pull/695))
* author: Drag Djur | [`4bebd6f6a`](https://github.com/dfinity/ic/commit/4bebd6f6a) Execution,Interface: Add Wasm memory threshold field to canister settings ([#475](https://github.com/dfinity/ic/pull/475))
* author: Andr Popo | [`9bc6e18ac`](https://github.com/dfinity/ic/commit/9bc6e18ac) Interface(neurons_fund): Populate hotkeys when necessary in the NNS Governance → Swap → SNS Governance dataflow ([#688](https://github.com/dfinity/ic/pull/688))
* ~~author: Andr Popo | [`9bc6e18ac`](https://github.com/dfinity/ic/commit/9bc6e18ac) Interface(neurons_fund): Populate hotkeys when necessary in the NNS Governance → Swap → SNS Governance dataflow ([#688](https://github.com/dfinity/ic/pull/688)) [AUTO-EXCLUDED:Changed files are excluded by file path filter]~~
* author: Dani Shar | [`b4be567dc`](https://github.com/dfinity/ic/commit/b4be567dc) Interface: Bump rust version to 1.80 ([#642](https://github.com/dfinity/ic/pull/642))
* author: mras | [`dbfbeceea`](https://github.com/dfinity/ic/commit/dbfbeceea) Interface: bump jemallocator v0.3 to tikv-jemallocator v0.5 ([#654](https://github.com/dfinity/ic/pull/654))
* author: Leo Eich | [`668fbe08f`](https://github.com/dfinity/ic/commit/668fbe08f) Interface: Rename ECDSA metrics ([#535](https://github.com/dfinity/ic/pull/535))
Expand Down

0 comments on commit c5940e8

Please sign in to comment.