Michael Rabinovich commited on
Commit
0501689
·
1 Parent(s): 91244c6

submit: move handle_submit into its own module + add validation pipeline

Browse files

Step 6 (E) chunk 2 of the async submit work. Lifts the UI-only stub
out of app.py into submit.py and grows it into the real cheap-sync
validation pipeline. Still no Hub writes and no eval kick-off; the
handler returns "would queue here" placeholder text. Async write +
worker thread land in later chunks.

Validation gates, in order:
1. Form: zip attached, agree-checkbox ticked.
2. Zip safety: valid zip, no absolute / parent-traversing entry
names, no symlinks (Python 3.12's extractall normalises unsafe
paths silently; we reject so submitters see a clear error).
3. meta.json schema: required keys, types, agree_to_publish is
literal true, notes within the 500-char cap. meta.json is the
source of truth for submitter / submission identity; the other
form fields are advisory for now and kept only so the gr.click
signature stays stable.
4. Fixture set: top-level dirs in the zip equal the fixture set
reported by cadgenbench.common.paths.data_inputs_dir(), no
missing, no extras.
5. STEP parseability: each <fixture>/output.step loads via the new
cadgenbench parse_step() helper. Per-fixture validity (BRepCheck,
watertight, mesh-manifold) stays the evaluator's job, where
class-3 ("submission accepted, fixture invalid, scored zero")
is the right failure mode.

submit.py is side-effect-free at this point so the validation logic
can be shaken out against real uploads without committing rows to
results.jsonl. Sanity-checked locally against 13 scenarios (happy
path, missing/extra fixtures, corrupted/empty STEPs, missing/bad
meta.json, oversized notes, zip-slip, bad-zip) before pushing.

Dockerfile bumps CADGENBENCH_SHA to d88e39c to pull in the new
cadgenbench.common.validity.parse_step (separate commit on the
benchmark repo). The cadgenbench layer rebuild costs ~3 min cold.

3 files changed +269 -35
Files changed (3)
Dockerfile+1-1
app.py+7-34
submit.pyAdded+261