Michael Rabinovich commited on
Commit ·
f571140
1
Parent(s): 1748c76
submit: drop dead form fields, meta.json is the only source
Browse filesBefore: the Submit tab carried four text inputs (submission name,
submitter name, agent URL, notes) alongside the zip upload, and
handle_submit took them as args but ignored everything except the
agree checkbox. They survived chunk 2's move from "form-driven
stub" to "meta.json contract" only to keep the gr.click signature
stable across one commit; chunk 3 didn't touch them either.
After: Submit tab is just zip upload + agree checkbox + submit
button. handle_submit signature is (zip_file, agree). All five
submission fields come from meta.json inside the zip, full stop.
Cuts 30 lines of UI + 4 unused handler params; removes a real
user-confusion source (filling the form did nothing).
app.py
CHANGED
|
@@ -74,25 +74,12 @@ stack, put it here or in `notes`.
|
|
| 74 |
and stripped to a single line. Shown in the per-submission detail view,
|
| 75 |
not in the main leaderboard table.
|
| 76 |
|
| 77 |
-
`meta.json` inside the zip
|
| 78 |
-
|
| 79 |
-
|
| 80 |
-
the handler today.
|
| 81 |
"""
|
| 82 |
)
|
| 83 |
zip_in = gr.File(label="Submission ZIP", file_types=[".zip"])
|
| 84 |
-
with gr.Row():
|
| 85 |
-
submission_name_in = gr.Textbox(
|
| 86 |
-
label="Submission name",
|
| 87 |
-
placeholder='e.g. "MyAgent v2.3" or "build123d baseline (Claude Opus 4.7)"',
|
| 88 |
-
)
|
| 89 |
-
submitter_in = gr.Textbox(label="Submitter name")
|
| 90 |
-
with gr.Row():
|
| 91 |
-
agent_url_in = gr.Textbox(
|
| 92 |
-
label="Agent / paper URL (optional)",
|
| 93 |
-
placeholder="https://github.com/...",
|
| 94 |
-
)
|
| 95 |
-
notes_in = gr.Textbox(label="Notes (optional)")
|
| 96 |
agree_in = gr.Checkbox(
|
| 97 |
label="I agree to publish this result on the public leaderboard."
|
| 98 |
)
|
|
@@ -100,14 +87,7 @@ the handler today.
|
|
| 100 |
submit_out = gr.Markdown()
|
| 101 |
submit_btn.click(
|
| 102 |
fn=handle_submit,
|
| 103 |
-
inputs=[
|
| 104 |
-
zip_in,
|
| 105 |
-
submission_name_in,
|
| 106 |
-
submitter_in,
|
| 107 |
-
agent_url_in,
|
| 108 |
-
notes_in,
|
| 109 |
-
agree_in,
|
| 110 |
-
],
|
| 111 |
outputs=submit_out,
|
| 112 |
)
|
| 113 |
|
|
|
|
| 74 |
and stripped to a single line. Shown in the per-submission detail view,
|
| 75 |
not in the main leaderboard table.
|
| 76 |
|
| 77 |
+
All five fields come from `meta.json` inside the zip, no separate
|
| 78 |
+
form to fill in. The agree-checkbox below is the in-UI confirmation
|
| 79 |
+
on top of `meta.json`'s `agree_to_publish: true`.
|
|
|
|
| 80 |
"""
|
| 81 |
)
|
| 82 |
zip_in = gr.File(label="Submission ZIP", file_types=[".zip"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 83 |
agree_in = gr.Checkbox(
|
| 84 |
label="I agree to publish this result on the public leaderboard."
|
| 85 |
)
|
|
|
|
| 87 |
submit_out = gr.Markdown()
|
| 88 |
submit_btn.click(
|
| 89 |
fn=handle_submit,
|
| 90 |
+
inputs=[zip_in, agree_in],
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
outputs=submit_out,
|
| 92 |
)
|
| 93 |
|
submit.py
CHANGED
|
@@ -15,8 +15,8 @@ Validation gates, in order:
|
|
| 15 |
3. ``meta.json`` schema: required keys present, types sane,
|
| 16 |
``agree_to_publish`` is literally ``true``, ``notes`` is non-empty
|
| 17 |
when present and within the per-submission cap. Single source of
|
| 18 |
-
truth for submitter / submission identity; the form
|
| 19 |
-
|
| 20 |
4. Fixture-set match: the set of folders inside the zip equals the
|
| 21 |
set of fixture directories in :func:`cadgenbench.common.paths.data_inputs_dir`
|
| 22 |
(no missing, no extras).
|
|
@@ -93,27 +93,17 @@ class _HubWriteError(Exception):
|
|
| 93 |
"""Raised when a Hub upload fails after validation succeeded."""
|
| 94 |
|
| 95 |
|
| 96 |
-
def handle_submit(
|
| 97 |
-
zip_file,
|
| 98 |
-
submission_name: str, # noqa: ARG001 - kept for UI compat; meta.json wins
|
| 99 |
-
submitter: str, # noqa: ARG001 - kept for UI compat; meta.json wins
|
| 100 |
-
agent_url: str, # noqa: ARG001 - kept for UI compat; meta.json wins
|
| 101 |
-
notes: str, # noqa: ARG001 - kept for UI compat; meta.json wins
|
| 102 |
-
agree: bool,
|
| 103 |
-
) -> str:
|
| 104 |
"""Validate a submission upload and return a markdown UI message.
|
| 105 |
|
| 106 |
Returns one of:
|
| 107 |
- An error string starting with ``**Error:**`` for form-level
|
| 108 |
rejects (missing zip, unticked agree box).
|
| 109 |
- A rejection string starting with ``**Submission rejected.**``
|
| 110 |
-
for any of the deeper validation gates.
|
| 111 |
-
- A success string starting with ``**
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
The form fields other than ``agree`` are accepted to keep the
|
| 115 |
-
Gradio click signature stable, but ``meta.json`` inside the zip
|
| 116 |
-
is the source of truth for submitter / submission identity.
|
| 117 |
"""
|
| 118 |
form_err = _validate_form(zip_file, agree)
|
| 119 |
if form_err is not None:
|
|
|
|
| 15 |
3. ``meta.json`` schema: required keys present, types sane,
|
| 16 |
``agree_to_publish`` is literally ``true``, ``notes`` is non-empty
|
| 17 |
when present and within the per-submission cap. Single source of
|
| 18 |
+
truth for submitter / submission identity; the Gradio form only
|
| 19 |
+
carries the zip and the in-UI agree checkbox.
|
| 20 |
4. Fixture-set match: the set of folders inside the zip equals the
|
| 21 |
set of fixture directories in :func:`cadgenbench.common.paths.data_inputs_dir`
|
| 22 |
(no missing, no extras).
|
|
|
|
| 93 |
"""Raised when a Hub upload fails after validation succeeded."""
|
| 94 |
|
| 95 |
|
| 96 |
+
def handle_submit(zip_file, agree: bool) -> str:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 97 |
"""Validate a submission upload and return a markdown UI message.
|
| 98 |
|
| 99 |
Returns one of:
|
| 100 |
- An error string starting with ``**Error:**`` for form-level
|
| 101 |
rejects (missing zip, unticked agree box).
|
| 102 |
- A rejection string starting with ``**Submission rejected.**``
|
| 103 |
+
for any of the deeper validation gates or Hub-write failures.
|
| 104 |
+
- A success string starting with ``**Queued.**`` carrying the
|
| 105 |
+
minted ``submission_id`` once the pending row + zip are on
|
| 106 |
+
the Hub.
|
|
|
|
|
|
|
|
|
|
| 107 |
"""
|
| 108 |
form_err = _validate_form(zip_file, agree)
|
| 109 |
if form_err is not None:
|