Skip to content

Commit

Permalink
chore: cleanup rollout of bundle analysis notify changes
Browse files Browse the repository at this point in the history
This replaces the `notify` for `new_notify` officially (we are already using it anyway,
but just to cleanup old code).
Changes are mostly renaming things, but I found some tests for the old notify and ported then
to the new one. And I've found a "bug", details below.

So the comment table currently displays all bundles, even if there's no change.
The old comment didn't display the table if ALL bundles had no change.

The way I changed it now it will only display bundles that have had a change in size (or removed).
I think the goal of the table is a quick glance at what changed, so it makes sense. But I should double check with design, possibly.

closes: codecov/engineering-team#2087
  • Loading branch information
giovanni-guidini committed Aug 30, 2024
1 parent 748d759 commit 82a4a6b
Show file tree
Hide file tree
Showing 32 changed files with 218 additions and 909 deletions.
2 changes: 1 addition & 1 deletion django_scaffold/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
]

BUNDLE_ANALYSIS_NOTIFY_MESSAGE_TEMPLATES = (
BASE_DIR / "services" / "bundle_analysis" / "new_notify" / "messages" / "templates"
BASE_DIR / "services" / "bundle_analysis" / "notify" / "messages" / "templates"
)
TEMPLATES = [
{
Expand Down
2 changes: 1 addition & 1 deletion django_scaffold/tests_settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
BASE_DIR = Path(__file__).resolve().parent.parent

BUNDLE_ANALYSIS_NOTIFY_MESSAGE_TEMPLATES = (
BASE_DIR / "services" / "bundle_analysis" / "new_notify" / "messages" / "templates"
BASE_DIR / "services" / "bundle_analysis" / "notify" / "messages" / "templates"
)
TEMPLATES = [
{
Expand Down
293 changes: 0 additions & 293 deletions services/bundle_analysis/notify.py

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,28 +7,28 @@
from shared.yaml import UserYaml

from database.models.core import GITHUB_APP_INSTALLATION_DEFAULT_NAME, Commit, Owner
from services.bundle_analysis.new_notify.contexts import (
from services.bundle_analysis.notify.contexts import (
BaseBundleAnalysisNotificationContext,
NotificationContextBuilder,
NotificationContextBuildError,
)
from services.bundle_analysis.new_notify.contexts.comment import (
from services.bundle_analysis.notify.contexts.comment import (
BundleAnalysisPRCommentContextBuilder,
)
from services.bundle_analysis.new_notify.contexts.commit_status import (
from services.bundle_analysis.notify.contexts.commit_status import (
CommitStatusNotificationContextBuilder,
)
from services.bundle_analysis.new_notify.helpers import (
from services.bundle_analysis.notify.helpers import (
get_notification_types_configured,
)
from services.bundle_analysis.new_notify.messages import MessageStrategyInterface
from services.bundle_analysis.new_notify.messages.comment import (
from services.bundle_analysis.notify.messages import MessageStrategyInterface
from services.bundle_analysis.notify.messages.comment import (
BundleAnalysisCommentMarkdownStrategy,
)
from services.bundle_analysis.new_notify.messages.commit_status import (
from services.bundle_analysis.notify.messages.commit_status import (
CommitStatusMessageStrategy,
)
from services.bundle_analysis.new_notify.types import (
from services.bundle_analysis.notify.types import (
NotificationSuccess,
NotificationType,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ def get_enriched_pull_setting_up_mocks(dbsession, mocker, commit_pair) -> Enrich
provider_pull={},
)
fake_pull_patches_to_apply = [
"services.bundle_analysis.new_notify.contexts.comment.fetch_and_update_pull_request_information_from_commit",
"services.bundle_analysis.new_notify.contexts.commit_status.fetch_and_update_pull_request_information_from_commit",
"services.bundle_analysis.notify.contexts.comment.fetch_and_update_pull_request_information_from_commit",
"services.bundle_analysis.notify.contexts.commit_status.fetch_and_update_pull_request_information_from_commit",
]
for patch_to_apply in fake_pull_patches_to_apply:
mocker.patch(
Expand All @@ -58,7 +58,7 @@ def get_enriched_pull_setting_up_mocks(dbsession, mocker, commit_pair) -> Enrich
)
fake_repo_service = mocker.MagicMock(name="fake_repo_service")
mocker.patch(
"services.bundle_analysis.new_notify.contexts.get_repo_provider_service",
"services.bundle_analysis.notify.contexts.get_repo_provider_service",
return_value=fake_repo_service,
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
from database.models.core import Commit, Repository
from database.models.reports import CommitReport
from services.archive import ArchiveService
from services.bundle_analysis.new_notify.helpers import to_BundleThreshold
from services.bundle_analysis.new_notify.types import (
from services.bundle_analysis.notify.helpers import to_BundleThreshold
from services.bundle_analysis.notify.types import (
NotificationType,
NotificationUserConfig,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,16 @@
MissingHeadCommit,
MissingHeadReport,
)
from services.bundle_analysis.new_notify.contexts import (
from services.bundle_analysis.notify.contexts import (
BaseBundleAnalysisNotificationContext,
NotificationContextBuilder,
NotificationContextBuildError,
NotificationContextField,
)
from services.bundle_analysis.new_notify.helpers import (
from services.bundle_analysis.notify.helpers import (
is_bundle_change_within_bundle_threshold,
)
from services.bundle_analysis.new_notify.types import NotificationType
from services.bundle_analysis.notify.types import NotificationType
from services.repository import (
EnrichedPull,
fetch_and_update_pull_request_information_from_commit,
Expand Down
Loading

0 comments on commit 82a4a6b

Please sign in to comment.