Skip to content

Conversation

@ajmalkhan-eng
Copy link
Contributor

@ajmalkhan-eng ajmalkhan-eng commented Dec 7, 2025

Summary

This PR simplifies error handling across the CLI by removing redundant "error: " prefixes from error messages. This improves consistency and readability of error output throughout the codebase.

Changes

  • Remove fmt.Errorf("error: %s", err.Error()) pattern
  • Return errors directly where appropriate
  • Update corresponding test assertions to match new error format

Impact

  • 64 files changed
  • More consistent error messaging
  • Cleaner, more idiomatic Go error handling

Testing

All existing tests have been updated and pass with the new error format.


Note

Removes "error:" prefixes across commands/tests, enhances AITB workflow and study models/docs, and improves CLI output styling.

  • Refactor: Error handling
    • Return errors directly (no "error: " prefix) across commands; update tests accordingly.
  • AI Task Builder (AITB)
    • client.Instruction.AnswerLimit changed to *int; examples include answer_limit.
    • Instructions command: supports array or object payloads, adds strict validation, and improved messages/examples.
    • Batch commands (create/setup/tasks/responses): refined flags/outputs; new dataset upload flow with presigned URL.
  • Study model/UI
    • Add data_collection_method, data_collection_id, and data_collection_metadata; render method in study view.
    • Make external_study_url optional in create payload.
  • CLI UX
    • Use ui.Bold/Dim/Highlight in list views (campaigns, projects, workspaces) and dimmed record counters.
    • Success outputs for project/workspace creation via ui.WriteSuccess; improved user whoami styling.
  • Docs/Examples
    • Add docs/examples/example-instructions.json and update AITB study example (standard-sample-aitaskbuilder.json).
  • Dependencies
    • Update go.mod (promote termenv/isatty to direct requirements).

Written by Cursor Bugbot for commit 4b1ffb2. This will update automatically on new commits. Configure here.

@ajmalkhan-eng ajmalkhan-eng requested a review from a team as a code owner December 7, 2025 22:48
@prolific-snyk
Copy link

prolific-snyk commented Dec 7, 2025

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

Status Scanner 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.

@ajmalkhan-eng ajmalkhan-eng changed the title refactor: simplify error messages across commands and tests DCP-2215 refactor: simplify error messages across commands and tests Dec 7, 2025
Remove redundant "error: " prefix from error messages throughout the codebase.
This improves consistency and readability of error output.

Changes:
- Remove fmt.Errorf("error: %s", err.Error()) pattern
- Return errors directly where appropriate
- Update corresponding test assertions
@ajmalkhan-eng ajmalkhan-eng force-pushed the DCP-2215-prolific-cli-error-handling-refactor branch from 78b9ed7 to 11ce80f Compare December 7, 2025 23:03
@ajmalkhan-eng ajmalkhan-eng changed the base branch from main to DCP-2216-prolific-cli-ui-helpers-and-color-support December 7, 2025 23:03
Add support for configuring studies with AI Task Builder data collection:
- Add AITaskBuilderDataCollection field to Study model
- Add AITaskBuilderPayload to CreateStudyPayload
- Render AITB batch ID in study view
- Update go.mod dependencies
Add comprehensive instruction examples for AITB:
- Add example-instructions.json with multiple question types
- Update standard-sample-aitaskbuilder.json with proper formatting
- Update batch instructions command help with answer_limit example
- Improve dataset upload command description
Add support for creating studies with AITB configuration:
- Add --aitb-batch-id flag to study create command
- Add --auto-publish flag for automatic study publication
- Automatically transition studies to PUBLISHED state when --auto-publish is set
- Update tests to cover new AITB and auto-publish functionality
if !cmd.Flags().Changed("batch-id") {
expected := aitaskbuilder.ErrBatchIDRequired
if err.Error() != "error: "+expected {
if err.Error() != ""+expected {
Copy link
Contributor

@benmatselby benmatselby Dec 8, 2025

Choose a reason for hiding this comment

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

question: Do we need the empty string concatenation? Same question in a few test files

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree. Seems redundant.

…core-features

DCP-2217 feat: add AI Task Builder core features
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.

5 participants