Skip to content

feat: forward durationWeeks from course.json to the deploy payload - #33

Merged
rryoung98 merged 4 commits into
mainfrom
feat/course-duration-weeks
Sep 25, 2026
Merged

rryoung98 merged 4 commits into
mainfrom
feat/course-duration-weeks

Conversation

@TheGupta2012

@TheGupta2012 TheGupta2012 commented Sep 16, 2026 •

Copy link
Copy Markdown
Member

Summary of changes

qBraid/qbraid-api#1135 adds an optional durationWeeks field (author-declared course length in weeks, integer 1 to 52) to the course document. This action was silently dropping it: the validate step rewrites the deploy payload via Course.model_dump(), and pydantic ignores fields the model does not declare, so nothing extra in course.json ever reached the API.

  • Course model gains durationWeeks: Optional[int] = Field(None, ge=1, le=52) — the same bounds the API enforces, so a bad value fails validation with a clear field-level message instead of a 400 at deploy time.
  • The payload is dumped as-is: a course.json without the field serializes it as null, and qbraid-api#1135 treats an explicit null the same as an absent field, so no key-stripping is needed here.
  • Tests: declared value survives into the payload; absent field serializes as null; 0, -3, 53, 2.5 and "two" fail validation.

Validation run: full unit suite (171 passed, rerun after the null simplification), make format-check (clean). make lint-check fails identically on unmodified main (pre-existing findings in untouched files; none introduced here).

Coordinated PRs

  • qBraid/qbraid-api#1135 — adds and validates the field (merge first; until it is live, a forwarded field is stripped harmlessly by the API's request validation).
  • qBraid/qbraid-account#741 — displays it on catalog cards.
  • qBraid/Quantum-Club-Thailand#12 — declares values in the course specs. Without this action PR those spec values never reach the API, since the Thailand workflow pins upload-course-action@main. No Thailand-side change needed once this merges.

Merge order: qbraid-api#1135 first, then this, then deploy the courses. Violations degrade gracefully: this PR before the API change forwards a field the API strips; specs deployed before this PR keep today's guessed labels.

🤖 Generated with Claude Code

TheGupta2012 and others added 4 commits September 16, 2026 14:51
The validate step rewrites the deploy payload from its pydantic Course
model, so any field the model does not declare is silently dropped before
the create/update request. That blocked the new optional durationWeeks
field (an author-declared course length in weeks) that qBraid/qbraid-api
now accepts.

Declare the field on the model with the same bounds the API enforces
(integer, 1 to 52), so a bad value fails the validate step with a clear
message instead of a 400 at deploy time. A course.json without the field
keeps today's behavior: the key is removed from the payload rather than
sent as null, which the API would reject.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
qbraid-api now treats an explicit null the same as an absent field, so
the payload no longer needs the key stripped before posting: dump the
model as-is and drop the course_payload helper.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Pydantic's lax mode turned "3" into 3 and forwarded it, where the qBraid
API's validator rejects a string with 400. strict=True makes the action
fail the same input at validation time with a field-level message, which is
what the changelog already promised.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
@rryoung98

Copy link
Copy Markdown
Member

Ran this branch for real from a qBraid-tutorial workflow into the pr-741 preview API (create and update mode) and locally against 0, 53, 2.5, "two", null, absent, 1 and 52; all behaved as described. Pushed 1420762: durationWeeks is now strict=True, because pydantic's lax mode coerced "3" to 3 and forwarded a value the API rejects with 400. Test parametrization and changelog updated.

Unrelated but you will hit it: the documented "Stage 0: validate API key" is not wired into action.yml, so an expired key only surfaces after validation, notebook and image stages have run.

@rryoung98
rryoung98 merged commit 187d68d into main Sep 25, 2026
6 checks passed
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.

2 participants