Skip to content
Open
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
1 change: 1 addition & 0 deletions evalai/challenges.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ def submit(ctx, file, annotation, large, public, private):
submission_meta_attributes = get_submission_meta_attributes(
ctx.challenge_id, ctx.phase_id
)
submission_metadata['from_cli'] = True

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Search the codebase for backend handling of from_cli field
rg -n -C3 --type=py 'from_cli' -g '!evalai/challenges.py'

Repository: Cloud-CV/evalai-cli

Length of output: 45


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Show the submit command section and the requests.post call for context
sed -n '230,330p' evalai/challenges.py | nl -ba | sed -n '1,120p'

# Narrowly locate is_public/from_cli assignments and request call
rg -n "is_public|from_cli|requests\.post|submission_metadata\[" evalai/challenges.py -n -C2

Repository: Cloud-CV/evalai-cli

Length of output: 106


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== evalai/challenges.py lines 230-330 ==="
sed -n '230,330p' evalai/challenges.py | cat -n -w3 -s'	' | sed -n '1,120p'

echo "=== Focused matches in evalai/challenges.py ==="
rg -n --context=2 "requests\.post|is_public|from_cli|submission_metadata" evalai/challenges.py

Repository: Cloud-CV/evalai-cli

Length of output: 190


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== evalai/challenges.py lines 230-330 (with cat -n) ==="
sed -n '230,330p' evalai/challenges.py | cat -n

echo "=== Focused matches in evalai/challenges.py (with context) ==="
rg -n -C3 "requests\.post|is_public|from_cli|submission_metadata" evalai/challenges.py

Repository: Cloud-CV/evalai-cli

Length of output: 7686


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find where helpers are defined
rg -n "def make_submission|def upload_file_using_presigned_url|make_submission\(|upload_file_using_presigned_url\(" evalai/challenges.py

# Show relevant sections around those function definitions
# (use sed ranges based on discovered line numbers)
rg -n "def make_submission" evalai/challenges.py | head -n 5
rg -n "def upload_file_using_presigned_url" evalai/challenges.py | head -n 5

Repository: Cloud-CV/evalai-cli

Length of output: 235


🏁 Script executed:

#!/bin/bash
set -euo pipefail

# Find function definitions across repo
rg -n "def make_submission" -S .
rg -n "def upload_file_using_presigned_url" -S .

# Also look for where make_submission is imported/used
rg -n "make_submission\(" -S evalai | head -n 50
rg -n "upload_file_using_presigned_url\(" -S evalai | head -n 50

Repository: Cloud-CV/evalai-cli

Length of output: 656


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== evalai/utils/submissions.py: make_submission ==="
sed -n '1,220p' evalai/utils/submissions.py | cat -n | sed -n '40,140p'

echo "=== evalai/utils/common.py: upload_file_using_presigned_url ==="
sed -n '1,260p' evalai/utils/common.py | cat -n | sed -n '130,240p'

echo "=== requests.post usage in these files ==="
rg -n "requests\.post" evalai/utils/submissions.py evalai/utils/common.py

Repository: Cloud-CV/evalai-cli

Length of output: 9241


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "=== evalai/utils/submissions.py (around make_submission) ==="
rg -n "def make_submission" evalai/utils/submissions.py
start=$(rg -n "def make_submission" evalai/utils/submissions.py | head -n1 | cut -d: -f1)
# Print a reasonable window around the function
sed -n "$((start-20)),$((start+120))p" evalai/utils/submissions.py

echo "=== evalai/utils/common.py (around upload_file_using_presigned_url) ==="
rg -n "def upload_file_using_presigned_url" evalai/utils/common.py
start2=$(rg -n "def upload_file_using_presigned_url" evalai/utils/common.py | head -n1 | cut -d: -f1)
sed -n "$((start2-20)),$((start2+160))p" evalai/utils/common.py

echo "=== requests.post calls in those files ==="
rg -n "requests\.post|post\(" evalai/utils/submissions.py evalai/utils/common.py

Repository: Cloud-CV/evalai-cli

Length of output: 10761


Fix from_cli boolean serialization to match is_public

  • evalai/challenges.py:299 sets submission_metadata['from_cli'] = True, but both submission flows send submission_metadata as form data (requests.post(..., data=...)), so the backend receives "True"; meanwhile is_public is sent as JSON-stringified "true"/"false", creating an inconsistency that can break backend parsing.
🔧 Proposed fix
-            submission_metadata['from_cli'] = True
+            submission_metadata['from_cli'] = json.dumps(True)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
submission_metadata['from_cli'] = True
submission_metadata['from_cli'] = json.dumps(True)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@evalai/challenges.py` at line 299, submission_metadata is currently set with
submission_metadata['from_cli'] = True which becomes the string "True" when sent
as form data and mismatches how is_public is serialized; change the assignment
to mirror is_public's JSON-style serialization (e.g.
submission_metadata['from_cli'] = json.dumps(True)) and ensure json is imported
in the module so the backend receives "true"/"false" consistently with
is_public.

submission_attribute_metadata = []
if (
submission_meta_attributes
Expand Down