Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: retrieving repoid through commit report can yield error #1132

Merged
merged 3 commits into from
Feb 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion upload/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ def create(self, validated_data: Dict[str, Any]) -> ReportSession | None:
flag_names = (
validated_data.pop("flags") if "flags" in validated_data.keys() else []
)
repoid = validated_data.pop("repo_id", None)

# default is necessary here, or else if the key is not in the dict
# the below will throw a KeyError
Expand All @@ -81,7 +82,6 @@ def create(self, validated_data: Dict[str, Any]) -> ReportSession | None:
flags = []

if upload:
repoid = upload.report.commit.repository.repoid
existing_flags_map = self._create_existing_flags_map(repoid)
for individual_flag in flag_names:
flag_obj = existing_flags_map.get(individual_flag, None)
Expand Down
5 changes: 4 additions & 1 deletion upload/views/uploads.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ def create_upload(
serializer.validated_data["storage_path"] = path
# Create upload record
instance: ReportSession = serializer.save(
report_id=report.id, upload_extras={"format_version": "v1"}, state="started"
repo_id=repository.repoid,
report_id=report.id,
upload_extras={"format_version": "v1"},
state="started",
)

# Inserts mirror upload record into measurements table. CLI hits this endpoint
Expand Down
Loading