Skip to content

feat(aitaskbuilder): support star_rating instruction type - #477

Open
Adam1451991B wants to merge 1 commit into
mainfrom
feat/aitb-star-rating-instruction
Open

feat(aitaskbuilder): support star_rating instruction type#477
Adam1451991B wants to merge 1 commit into
mainfrom
feat/aitb-star-rating-instruction

Conversation

@Adam1451991B

Copy link
Copy Markdown
Contributor

Context

AI Task Builder is gaining a star rating instruction type: a distinct question where participants pick a rating by clicking stars. It is being added end-to-end (backend schema + web client), and the CLI needs to accept and validate it so batches created via the CLI can include star-rating questions.

star_rating takes an optional max_stars integer — the number of stars offered. It is 1-10 and defaults to 5 on the API when omitted (mirroring the backend schema), so CLI users can send { "type": "star_rating", "created_by": "...", "description": "..." } with an optional "max_stars".

What this changes

  • Recognises star_rating as a valid instruction type in aitaskbuilder batch instructions (help text, valid-types set, error message).
  • Client-side validation of max_stars (must be 1-10 when provided; optional otherwise).
  • Adds max_stars to the request/response payloads and models, and a display case for star-rating answers in get task responses.
  • Documents the type in the bundled example instructions file and the changelog.

Behaviour for all existing instruction types is unchanged.

Rollback

Pure additive change (a new enum member, an optional field, and a validation branch). If it misbehaves, revert the commit — no persisted state or migrations are involved. The API remains the source of truth for validation; the CLI check is a convenience that fails fast before the request is sent.

Adds the star_rating AI Task Builder instruction type to the CLI so
batches can include star-rating questions. Participants pick a rating
from 1 to max_stars, where max_stars is an optional integer (1-10,
defaults to 5 on the API).

Covers the batch instructions command (help text, valid-types set,
per-type validation of max_stars), the request/response payloads and
models, response display in get task responses, the example
instructions file, and the changelog.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@Adam1451991B
Adam1451991B requested review from a team as code owners August 3, 2026 07:13
@prolific-snyk

prolific-snyk commented Aug 3, 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.

}

// Validate star rating fields for star_rating
if instruction.Type == client.InstructionTypeStarRating {

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.

comment: this kind of validation logic sits server side, we don't duplicate it in the client - the rule of thumb means we keep validation in one place and do risk it getting out of sync between server and different clients. Remove the validateStarRating related code.

fmt.Fprintf(w, " Uploaded Files: \n")
}
case model.AITaskBuilderResponseTypeStarRating:
if len(resp.Response.Answer) > 0 && resp.Response.Answer[0].Value != "" {

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): make this a little more readable or add comments

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants