Skip to content

feat(DCT-51): map audio fields and add a batch preview command#457

Open
cemprolific wants to merge 5 commits into
mainfrom
dct-51-map-audio-fields-and-add-a-batch-preview-command
Open

feat(DCT-51): map audio fields and add a batch preview command#457
cemprolific wants to merge 5 commits into
mainfrom
dct-51-map-audio-fields-and-add-a-batch-preview-command

Conversation

@cemprolific

Copy link
Copy Markdown
Contributor

Adds AI Task Builder support for audio_url dataset fields and introduces a new batch preview command so researchers can inspect persisted batches from the CLI before launch.

What changed

audio_url dataset schema support

  • Added audio_url to the allowed dataset schema field types
  • Updated dataset schema validation errors to include audio_url
  • Updated aitaskbuilder dataset create --schema help text and inline examples
  • Added audio_url to docs/examples/dataset-schema.json
  • Extended schema validation tests to cover audio_url

Audio URL validation on dataset upload

  • Added dataset lookup before upload so the CLI can validate schema-aware fields
  • Added validation for audio_url columns in both CSV and JSONL uploads
  • Rejects unsupported audio URLs unless they end with one of:
    • .aac
    • .m4a
    • .mp3
    • .wav

aitaskbuilder batch preview

  • Added prolific aitaskbuilder batch preview <batch-id>
  • Validates access by fetching the batch first
  • Fetches task group IDs via the batch task groups API
  • Builds the persisted researcher preview URL:
    • /data-collection-tool/batches/{batchId}/task-groups/{taskGroupId}?preview=true
  • Prints the preview URL and attempts to open it in the browser
  • Falls back gracefully in headless/CI environments if the browser cannot be opened

@cemprolific
cemprolific requested a review from a team as a code owner July 14, 2026 17:08
Copilot AI review requested due to automatic review settings July 14, 2026 17:08
@cemprolific
cemprolific requested a review from a team as a code owner July 14, 2026 17:08
@prolific-snyk

prolific-snyk commented Jul 14, 2026

Copy link
Copy Markdown

Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
Open Source Security 0 0 0 0 0 issues
Licenses 0 0 0 0 0 issues
Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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_url as a valid dataset schema field type, updating help text/examples and tests.
  • Validate uploaded dataset data against audio_url schema 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

Comment thread cmd/aitaskbuilder/batch_preview.go Outdated
Comment on lines +42 to +50
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
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion(non blocking): I think @copilot is right here, bit of a nit but keeps consistency?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

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 SeanAlexanderHarris left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One of the two copilot coments I think worth addressing though minor.

Comment thread cmd/aitaskbuilder/batch_preview.go Outdated
Comment on lines +42 to +50
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
},

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

suggestion(non blocking): I think @copilot is right here, bit of a nit but keeps consistency?

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants