Skip to content

Fix #4347: Flag for submissions UI and CLI#365

Open
Harshit28j wants to merge 3 commits into
Cloud-CV:masterfrom
Harshit28j:submission_flag_cli
Open

Fix #4347: Flag for submissions UI and CLI#365
Harshit28j wants to merge 3 commits into
Cloud-CV:masterfrom
Harshit28j:submission_flag_cli

Conversation

@Harshit28j

@Harshit28j Harshit28j commented Apr 21, 2024

Copy link
Copy Markdown
Contributor

This PR follows up on the previous one: Cloud-CV/EvalAI#4349

Summary by CodeRabbit

  • Chores
    • CLI submissions are now tracked with metadata to indicate their origin from the command-line interface.

@coderabbitai

coderabbitai Bot commented Jun 13, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds a single flag to track submission origin. The CLI's submit command now marks submissions with from_cli: True in the submission metadata before processing submission attributes or creating the submission.

Changes

CLI submission origin tracking

Layer / File(s) Summary
Mark CLI submissions
evalai/challenges.py
The submit command adds a from_cli: True flag to submission metadata for non-annotation submissions, enabling the system to distinguish CLI submissions from other sources.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

🐰 A tiny flag, so small yet bright,
from_cli: True marks the light,
Now submissions know their name—
CLI-born, forever the same! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'Fix #4347: Flag for submissions UI and CLI' clearly indicates the main change is adding a flag for submissions in both UI and CLI, which aligns with the code change adding submission_metadata['from_cli'] = True.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with 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.

Inline comments:
In `@evalai/challenges.py`:
- 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.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 92a5f03a-fdad-42ca-9c16-4fa4bf9b7995

📥 Commits

Reviewing files that changed from the base of the PR and between 6426f26 and 727f90e.

📒 Files selected for processing (1)
  • evalai/challenges.py

Comment thread evalai/challenges.py
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants