Skip to content
This repository was archived by the owner on May 5, 2025. It is now read-only.

Commit 512da39

Browse files
authored
Stop advertising ATS (#1132)
1 parent 84bc06e commit 512da39

File tree

2 files changed

+4
-60
lines changed

2 files changed

+4
-60
lines changed

services/notification/notifiers/mixins/message/sections.py

Lines changed: 4 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -211,54 +211,19 @@ def do_write_section(self, comparison, diff, changes, links, behind_by=None):
211211

212212

213213
class AnnouncementSectionWriter(BaseSectionWriter):
214-
ats_message = (
215-
"We’re building smart automated test selection to slash your CI/CD build times. [Learn more](https://about.codecov.io/iterative-testing/)",
216-
)
217214
current_active_messages = [
218215
"Codecov offers a browser extension for seamless coverage viewing on GitHub. Try it in [Chrome](https://chrome.google.com/webstore/detail/codecov/gedikamndpbemklijjkncpnolildpbgo) or [Firefox](https://addons.mozilla.org/en-US/firefox/addon/codecov/) today!"
219216
# "Codecov can now indicate which changes are the most critical in Pull Requests. [Learn more](https://about.codecov.io/product/feature/runtime-insights/)" # This is disabled as of CODE-1885. But we might bring it back later.
220217
]
221218

222219
def do_write_section(self, comparison: ComparisonProxy, *args, **kwargs):
223-
if self._potential_ats_user(comparison):
224-
message_to_display = AnnouncementSectionWriter.ats_message
225-
else:
226-
# This allows us to shift through active messages while respecting the annoucement limit.
227-
message_to_display = random.choice(
228-
AnnouncementSectionWriter.current_active_messages
229-
)
220+
# This allows us to shift through active messages while respecting the annoucement limit.
221+
message_to_display = random.choice(
222+
AnnouncementSectionWriter.current_active_messages
223+
)
230224

231225
yield f":mega: {message_to_display}"
232226

233-
def _has_ats_configured(self):
234-
if not self.current_yaml:
235-
return False
236-
flags = self.current_yaml.read_yaml_field(
237-
"flag_management", "individual_flags", _else=[]
238-
)
239-
for flag_info in flags:
240-
if flag_info.get("carryforward_mode") == "labels":
241-
return True
242-
return False
243-
244-
def _potential_ats_user(self, comparison: ComparisonProxy) -> bool:
245-
if self.repository and self.repository.language == "python":
246-
if not self._has_ats_configured() and comparison.has_head_report():
247-
report = comparison.head.report
248-
249-
# we're using the total chunks size as a proxy for potential CI
250-
# runtime - assuming that if you have more files + uploads then
251-
# perhaps your CI is running longer
252-
#
253-
# this value was just chosen empirically by looking at some of our
254-
# own repos and relating chunks size to CI time - ideally we'd like
255-
# to target repos w/ CI time > 20 min but we don't really have that
256-
# info available
257-
if report.size > 80_000_000:
258-
return True
259-
260-
return False
261-
262227

263228
class FooterSectionWriter(BaseSectionWriter):
264229
def do_write_section(self, comparison, diff, changes, links, behind_by=None):

services/notification/notifiers/tests/unit/test_comment.py

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
)
1717
from shared.utils.sessions import Session
1818
from shared.validation.types import CoverageCommentRequiredChanges
19-
from shared.yaml import UserYaml
2019

2120
from database.models.core import Commit, GithubAppInstallation, Pull, Repository
2221
from database.tests.factories import RepositoryFactory
@@ -3558,26 +3557,6 @@ def test_announcement_section_writer(self, mocker):
35583557
message = line[7:]
35593558
assert message in AnnouncementSectionWriter.current_active_messages
35603559

3561-
def test_announcement_section_writer_ats(self, mocker, create_sample_comparison):
3562-
comparison = create_sample_comparison()
3563-
current_yaml = UserYaml({})
3564-
3565-
writer = AnnouncementSectionWriter(
3566-
repository=comparison.head.commit.repository,
3567-
layout=mocker.MagicMock(),
3568-
show_complexity=mocker.MagicMock(),
3569-
settings=mocker.MagicMock(),
3570-
current_yaml=current_yaml,
3571-
)
3572-
writer.repository.language = "python"
3573-
comparison.head.report._chunks = ["xx"] * 80_000_000
3574-
3575-
res = list(writer.write_section(comparison))
3576-
assert len(res) == 1
3577-
line = res[0]
3578-
assert line.startswith(":mega: ")
3579-
assert "smart automated test selection" in line
3580-
35813560

35823561
class TestNewFooterSectionWriter(object):
35833562
def test_footer_section_writer_in_github(self, mocker):

0 commit comments

Comments
 (0)