feat(DCT-51): map audio fields and add a batch preview command#457
feat(DCT-51): map audio fields and add a batch preview command#457cemprolific wants to merge 5 commits into
Conversation
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Pull request overview
This PR extends the AI Task Builder CLI to support audio_url typed dataset schema fields (including schema validation and upload-time validation), and adds a new aitaskbuilder batch preview subcommand to open a persisted batch preview in the Prolific web app.
Changes:
- Add
audio_urlas a valid dataset schema field type, updating help text/examples and tests. - Validate uploaded dataset data against
audio_urlschema fields (CSV + JSONL), enforcing supported file extensions. - Introduce
prolific aitaskbuilder batch preview <batch-id>, including new client endpoints for dataset lookup and batch task group lookup.
Reviewed changes
Copilot reviewed 17 out of 18 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| scripts/manual-tests/test_audio_batch_preview.go | Manual end-to-end script for creating an audio-enabled dataset/batch and exercising preview + validation flows |
| mock_client/mock_client.go | Regenerated mocks to include new API methods (dataset + task groups) |
| docs/examples/dataset-schema.json | Add audio_url example field to the sample dataset schema |
| contract_test/contract_test.go | Update contract coverage to call the new dataset GET operation; add an additional skip |
| cmd/aitaskbuilder/upload_dataset.go | Fetch dataset before upload and validate audio_url columns in CSV/JSONL |
| cmd/aitaskbuilder/upload_dataset_test.go | Add tests for rejecting unsupported audio URL extensions (CSV + JSONL helper) |
| cmd/aitaskbuilder/get_dataset_status_test.go | Update shared test mock setup to stub the new dataset lookup call |
| cmd/aitaskbuilder/get_batch_test.go | Introduce shared testBatchUUID constant for reuse across tests |
| cmd/aitaskbuilder/dataset_schema.go | Allow audio_url as a schema field type and update validation error text |
| cmd/aitaskbuilder/dataset_schema_test.go | Extend schema parsing tests for audio_url and updated allowed-types messaging |
| cmd/aitaskbuilder/create_dataset.go | Update --schema help text and examples to include audio_url |
| cmd/aitaskbuilder/constants.go | Add an error constant for the “no task groups found” case |
| cmd/aitaskbuilder/batches.go | Register the new batch preview subcommand and add preview URL helpers |
| cmd/aitaskbuilder/batch_setup_test.go | Reuse testBatchUUID constant in setup tests |
| cmd/aitaskbuilder/batch_preview.go | New batch preview command implementation with browser opener injection |
| cmd/aitaskbuilder/batch_preview_test.go | Tests for preview command behavior and URL/path helpers |
| client/responses.go | Add response types for task groups and dataset GET |
| client/client.go | Add API interface + client implementations for dataset GET and batch task-groups endpoints |
Files not reviewed (1)
- mock_client/mock_client.go: Generated file
| Args: func(cmd *cobra.Command, args []string) error { | ||
| if len(args) == 0 && opts.BatchID == "" { | ||
| return errors.New("please provide a batch ID") | ||
| } | ||
| if len(args) > 1 { | ||
| return errors.New("accepts at most 1 arg(s), received " + fmt.Sprint(len(args))) | ||
| } | ||
| return nil | ||
| }, |
There was a problem hiding this comment.
suggestion(non blocking): I think @copilot is right here, bit of a nit but keeps consistency?
There was a problem hiding this comment.
Addressed in b06f604.
batch preview now rejects conflicting input when both --batch-id and a positional batch ID are provided, while still allowing either input mode independently.
There was a problem hiding this comment.
Yeah, I removed the --batch_id flag now. It was the complexity. Now it uses positional arg only. Consistent with the other commands
| } | ||
| } | ||
|
|
||
| func ValidateAudioURLFieldsInJSONL(filePath string, audioFields map[string]struct{}) error { |
SeanAlexanderHarris
left a comment
There was a problem hiding this comment.
One of the two copilot coments I think worth addressing though minor.
| Args: func(cmd *cobra.Command, args []string) error { | ||
| if len(args) == 0 && opts.BatchID == "" { | ||
| return errors.New("please provide a batch ID") | ||
| } | ||
| if len(args) > 1 { | ||
| return errors.New("accepts at most 1 arg(s), received " + fmt.Sprint(len(args))) | ||
| } | ||
| return nil | ||
| }, |
There was a problem hiding this comment.
suggestion(non blocking): I think @copilot is right here, bit of a nit but keeps consistency?
Adds AI Task Builder support for
audio_urldataset fields and introduces a newbatch previewcommand so researchers can inspect persisted batches from the CLI before launch.What changed
audio_urldataset schema supportaudio_urlto the allowed dataset schema field typesaudio_urlaitaskbuilder dataset create --schemahelp text and inline examplesaudio_urltodocs/examples/dataset-schema.jsonaudio_urlAudio URL validation on dataset upload
audio_urlcolumns in both CSV and JSONL uploads.aac.m4a.mp3.wavaitaskbuilder batch previewprolific aitaskbuilder batch preview <batch-id>/data-collection-tool/batches/{batchId}/task-groups/{taskGroupId}?preview=true