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

Commit 8fec23c

Browse files
authored
Stop writing ReportDetails/files_array (#840)
1 parent 25b28c4 commit 8fec23c

8 files changed

Lines changed: 19 additions & 443 deletions

File tree

requirements.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
https://github.com/codecov/opentelem-python/archive/refs/tags/v0.0.4a1.tar.gz#egg=codecovopentelem
2-
https://github.com/codecov/shared/archive/cde98920fbec05ad7f71f934fed35a5eebab4dd3.tar.gz#egg=shared
2+
https://github.com/codecov/shared/archive/6e68957eb90e234cbec237ede814e1d36b170291.tar.gz#egg=shared
33
https://github.com/codecov/test-results-parser/archive/ef39a0888acd62d02a316a852a15d755c74e78c6.tar.gz#egg=test-results-parser
44
https://github.com/codecov/timestring/archive/d37ceacc5954dff3b5bd2f887936a98a668dda42.tar.gz#egg=timestring
55
asgiref>=3.7.2

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ sentry-sdk[celery]==2.13.0
361361
# via
362362
# -r requirements.in
363363
# shared
364-
shared @ https://github.com/codecov/shared/archive/cde98920fbec05ad7f71f934fed35a5eebab4dd3.tar.gz
364+
shared @ https://github.com/codecov/shared/archive/6e68957eb90e234cbec237ede814e1d36b170291.tar.gz
365365
# via -r requirements.in
366366
six==1.16.0
367367
# via

services/report/__init__.py

Lines changed: 1 addition & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import copy
22
import itertools
33
import logging
4-
import sys
54
import uuid
65
from dataclasses import dataclass
76
from time import time
@@ -27,7 +26,6 @@
2726
from database.models import Commit, Repository, Upload, UploadError
2827
from database.models.reports import (
2928
CommitReport,
30-
ReportDetails,
3129
ReportLevelTotals,
3230
RepositoryFlag,
3331
UploadLevelTotals,
@@ -181,8 +179,7 @@ def initialize_and_save_report(
181179
182180
183181
This is one of the main entrypoint of this class. It takes care of:
184-
- Creating the most basic models relating to that commit
185-
report (CommitReport and ReportDetails), if needed
182+
- Creating the `CommitReport`, if needed
186183
- If that commit is old-style (was created before the report models were installed),
187184
it takes care of backfilling all the information from the report into the new
188185
report models
@@ -215,19 +212,6 @@ def initialize_and_save_report(
215212
)
216213
db_session.add(current_report_row)
217214
db_session.flush()
218-
report_details = (
219-
db_session.query(ReportDetails)
220-
.filter_by(report_id=current_report_row.id_)
221-
.first()
222-
)
223-
if report_details is None:
224-
report_details = ReportDetails(
225-
report_id=current_report_row.id_,
226-
_files_array=[],
227-
report=current_report_row,
228-
)
229-
db_session.add(report_details)
230-
db_session.flush()
231215

232216
actual_report = self.get_existing_report_for_commit(
233217
commit, report_code=report_code
@@ -241,15 +225,6 @@ def initialize_and_save_report(
241225
# yet into the new models therefore it needs backfilling
242226
self.save_full_report(commit, actual_report)
243227

244-
elif current_report_row.details is None:
245-
report_details = ReportDetails(
246-
report_id=current_report_row.id_,
247-
_files_array=[],
248-
report=current_report_row,
249-
)
250-
db_session.add(report_details)
251-
db_session.flush()
252-
253228
if not self.has_initialized_report(commit):
254229
report = self.create_new_report_for_commit(commit)
255230
if not report.is_empty():
@@ -859,28 +834,8 @@ def save_report(self, commit: Commit, report: Report, report_code=None):
859834

860835
# `report` is an accessor which implicitly queries `CommitReport`
861836
if commit_report := commit.report:
862-
files_array = [
863-
{
864-
"filename": k,
865-
"file_index": v.file_index,
866-
"file_totals": v.file_totals,
867-
"diff_totals": v.diff_totals,
868-
}
869-
for k, v in report._files.items()
870-
]
871-
log.info(
872-
"Calling update to reports_reportdetails.files_array",
873-
extra=dict(
874-
size=sys.getsizeof(files_array),
875-
ownerid=commit.repository.ownerid,
876-
repoid=commit.repoid,
877-
commitid=commit.commitid,
878-
),
879-
)
880837
db_session = commit.get_db_session()
881838

882-
# `files_array` is an `ArchiveField`, so this will trigger an upload
883-
commit_report.details.files_array = files_array
884839
report_totals = commit_report.totals
885840
if report_totals is None:
886841
report_totals = ReportLevelTotals(report_id=commit_report.id)

0 commit comments

Comments
 (0)