Repository navigation
feat(harbor): dataset-level task_data.py validated at materialize, seed and collate (M32) - #4864
Conversation
|
/ok to test 7cd9d6c |
7cd9d6c to
ca80274
Compare
|
/ok to test ca80274 |
ca80274 to
96ff98c
Compare
|
/ok to test 96ff98c |
|
/ok to test be30ebc |
ffrujeri
left a comment
There was a problem hiding this comment.
Thanks for working through yuhezhang-ai's findings; all five look addressed at be30ebc, and the focused core and server tests pass locally. The main open question is type conversion: validation accepts converted values but the rows keep the raw ones, so a typed field can reach the verifier with the wrong type. The rest are smaller questions about collate's warn mode and compatibility notes.
One more, on a line outside this diff: since task_data.py now decides whether a dataset's rows are accepted, would it make sense to include it in the dataset digest (manifest.py), so _ng_dataset_digest provenance records the schema version too?
|
/ok to test 3ec4a4f |
|
/ok to test 0dc8e2c |
|
/ok to test df66675 |
|
/ok to test e0574e1 |
|
/ok to test a6d31c0 |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Thanks for the fixes. Rechecked a6d31c0 against its current stack parent: all five original findings are addressed, and the targeted regressions pass. Approving this layer.
Two nonblocking follow-ups: the strict-model/date edge case noted inline, and refreshing the PR description to match the current alias handling, warn/error behavior, and compatibility note for manually edited rows. Neither needs to hold up this approval. I did not rerun live model or sandbox validation in this follow-up.
|
/ok to test 82530d2 |
|
/ok to test 64e9881 |
ffrujeri
left a comment
There was a problem hiding this comment.
LGTM. Server suite shard 0 failed on test_a_seed_slower_than_the_ready_timeout_leaves_the_turns_their_budget (1s deadline), which looks like a timing flake; worth a rerun.
|
/ok to test 807cc4a |
|
Re the shard-0 flake: |
|
/ok to test 197a654 |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
Thanks for the updates. Rechecked 197a654 against its current stack parent, 9ea1b8f: all five original findings and the strict-model/date follow-up are addressed. The focused regression tests pass, including valid JSON date strings with an explicitly strict model.
LGTM for this layer. One nonblocking follow-up: please refresh the PR description to reflect the current alias handling, warn/error behavior, and compatibility note for manually edited rows.
I did not rerun live model or sandbox validation in this follow-up.
|
/ok to test 671454f |
|
/ok to test 7cc0869 |
|
/ok to test 0bc9b65 |
|
/ok to test ba2b396 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40537277312 |
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40546203857 |
…ed and collate (M32) A Gym-authored dataset may ship task_data.py beside dataset.toml, a module exporting one Pydantic model TaskData that types the task-owned fields of its rows. A task carries those fields in task_data.json in its folder (the file enters the task digest); the loader writes them into the row's task_data beside the reserved _ng_* keys. The same check runs at the three points a row crosses a boundary: - prepare imports the module once per dataset and checks every task folder's task_data.json against it before any image is recorded or built (the loaded tasks again before a row is written), and refuses the whole dataset naming the task whose fields do not satisfy the model, carry an undeclared key (whatever the model's `extra` setting; a field's name and every name its aliases admit, AliasChoices and AliasPath included, are declared) or when the module does not import; - the harbor environment server imports each taskset's module at startup and validates every row at seed: a row the model rejects, or whose fields are not the pinned folder's task_data.json, is a terminal seed failure (422) before anything is provisioned; a module that does not import refuses every episode of its taskset; - gym dataset collate validates the taskset's rows against the server's reserved keys and the dataset's TaskData in one report (DatasetRowValidator), without reporting the dataset's declared fields as unknown keys. A dataset without task_data.py (every hub dataset) behaves as before. The module is imported, not parsed, with no static import guard (decision: it is a plain Pydantic class loaded by Gym). Co-Authored-By: Claude Fable 5.1 <[email protected]> Signed-off-by: Adil Asif <[email protected]>
|
/ok to test e44fbfa |
1 similar comment
|
/ok to test e44fbfa |
yuhezhang-ai
left a comment
There was a problem hiding this comment.
LGTM. Rechecked e44fbfa against its current stack parent, 0678258. This PR's changes are unchanged from the previously reviewed layer, and the fixes for all five original findings and the strict-model/date follow-up remain intact.
The PR-description refresh remains a nonblocking follow-up: alias handling, warn/error behavior, and the compatibility note for manually edited rows should reflect the current implementation.
This was an incremental source recheck using the earlier focused test results; I did not rerun the full stack or live model/sandbox validation.
|
🔄 Merge queue validation started! You can track the progress here: https://github.com/NVIDIA-NeMo/Gym/actions/runs/40609236053 |
Summary
A Gym-authored Harbor dataset may ship
task_data.pybesidedataset.toml, a module exporting one Pydantic modelTaskDatathat types the task-owned fields of its rows (RFC M32). A task carries those fields intask_data.jsonin its folder; the loader writes them into the row'stask_databeside the reserved_ng_*keys. The same check runs at the three points a row crosses a boundary: materialize refuses the dataset naming the task, the environment server refuses the episode at seed, andgym dataset collatereports the row. A dataset without the module (every hub dataset) behaves as before.What changes
nemo_gym/tasks/harbor/task_data.py(new):load_task_data_schemaimports the dataset's module once (path-derived module name) and returns aTaskDataSchema;TaskDataSchema.validatestrips the reserved keys, refuses undeclared keys whatever the model'sextrasetting (a field's name and every name its aliases admit,AliasChoicesandAliasPathincluded, are declared), and names the task, the file and the failing fields (a validator that raises something pydantic does not wrap, such as aKeyErrorfrom a lookup, is the sameTaskDataErrorwith the exception named, so prepare refuses the dataset, the seed fails terminally and collate reports the row instead of a traceback or a retry);check_task_folderschecks the folders'task_data.jsonbefore the tasks load;read_task_fieldsreads a task'stask_data.json(JSON object, reserved keys refused);check_row_matches_folderpins a row's fields to its folder's;DatasetRowValidatoris the collator's validator.HarborTask.task_data;task_data.jsonenters the task digest (a folder without one keeps its digest).task_datacarries the task's fields under the reserved keys.prepare_targetimports the schema after the manifest check and checks every task folder'stask_data.jsonagainst it before any base image is recorded or built (and the loaded tasks again before the rows are written): a violating task refuses the whole dataset, named, with no image resolved, built or pushed; a module that does not import refuses it too.harborenvironment server imports each taskset's module at startup (logged once when it fails) and validates every row before anything is provisioned: a row the model rejects, or whose fields differ from the pinned folder'stask_data.json, is a terminal seed failure (422); a taskset whose module does not import refuses every episode with the import error._task_data_validator_forwraps the server's validator in aDatasetRowValidatorwhen the dataset ships a model, validatingtask_input.task_datainto the same report without reporting the dataset's declared fields as unknown keys; a module that does not import fails the collation.Test plan
tests/unit_tests/test_harbor_task_data.py(37 new): loading, validation messages (aliases of every kind declared; a validator raisingKeyErrorwrapped atvalidate,check_task_folders, prepare and collate), the loader'stask_data.json,prepare_targetrefusals (a non-importing module and a violating row both refused before any image is recorded or built), row/folder pinning, and collate through the generated run config blocks. Core files together: 847 passed (plus the twoenv.yaml-dependent validation tests, 34 passed without it).environment_servers/harbor/tests/test_task_data.py(10 new): typed row seeds and scores; wrong type, undeclared key, missing field, edited row, plain task with fields, a non-importing module and a validator that raisesKeyErrorare terminal seed failures before any sandbox; the digest still wins. Env server + oracle suites: 441 passed.ruff check,ruff format --check, pre-commit on the changed files.task_data, seeds and scores 1.0 (oracle solved), as does a copy whoseansweris declared throughAliasChoicesand written asexpected_answer; a copy with an undeclared key is refused bygym dataset validateat prepare before any base image is resolved, as is one whose validator raisesKeyError(exit 2, the task named, no traceback);gym dataset collate +task_data_validation=errorpasses the rows and fails an edited row naming the task.🤖 Generated with Claude Code