Skip to content

fix(job): read job state field renamed from status#628

Merged
LinoGiger merged 1 commit into
mainfrom
fix(job)/read-renamed-state-field
Jun 19, 2026
Merged

fix(job): read job state field renamed from status#628
LinoGiger merged 1 commit into
mainfrom
fix(job)/read-renamed-state-field

Conversation

@RapidPoseidon

Copy link
Copy Markdown
Contributor

What

RapidataJob.get_status() read .status off the job endpoint response, but the generated model GetJobByIdEndpointOutput was regenerated in 3.14.2 (commit 38d0a17, "update OpenAPI client to 2026.06.17.1403") with that field renamed:

- status: StrictStr = Field(description="The job status.")
+ state: AudienceJobState = Field(description="The job state.")

So every job status check raised:

AttributeError: 'GetJobByIdEndpointOutput' object has no attribute 'status'. Did you mean: 'state'?

This surfaced in the scheduled rapidata-testing Run SDK Orders workflow — job_test.pydisplay_progress_bar()get_status() (failing run).

Fix

Read .state.value. AudienceJobState is a str enum whose values (Completed, Failed, …) already match the strings _wait_for_status and display_progress_bar compare against, so get_status() keeps its -> str contract and no caller needs changing.

pyright src/rapidata/rapidata_client passes clean.

🔗 Session: https://session-0eb86da9.poseidon.rapidata.internal/

The job endpoint response model (GetJobByIdEndpointOutput) was
regenerated in 3.14.2 with its `status` field renamed to `state`
(now an AudienceJobState enum), but RapidataJob.get_status() still
read `.status`, raising AttributeError on every job status check
(e.g. display_progress_bar, get_results).

Read `.state.value` to restore the str return contract; the enum
values (Completed, Failed, ...) already match the strings the
callers compare against.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: lino <lino@rapidata.ai>
@claude

claude Bot commented Jun 19, 2026

Copy link
Copy Markdown

Code Review

Overview

This is a targeted hotfix for a broken get_status() call. The OpenAPI client was regenerated (v3.14.2, commit 38d0a17) and renamed the field status: StrictStr to state: AudienceJobState, causing an AttributeError on every job status check. The fix reads .state.value to get the plain string value from the enum.


Code Correctness

The fix is correct. AudienceJobState is a str-based enum (class AudienceJobState(str, Enum)) whose values — Completed, Failed, Running, etc. — exactly match the string literals that _wait_for_status and display_progress_bar compare against. The -> str return contract of get_status() is preserved.


Minor Observations (non-blocking)

1. .state.value vs .state directly

Since AudienceJobState extends str, the enum instance is already a string and == comparisons with string literals would work without calling .value. Both are equivalent; .value is slightly more explicit about the return type being a plain str rather than an enum subtype.

2. Magic string comparisons throughout the file

_wait_for_status and display_progress_bar compare against raw string literals such as "Completed" and "Failed". Now that a proper AudienceJobState enum exists, these could use AudienceJobState.COMPLETED (valid since it is a str-enum) to make future field renames detectable by static analysis. That is a separate refactor concern, not a blocker for this PR.

3. Test coverage

No unit tests are added, which is understandable for a hotfix. A simple mock-based test for get_status() that asserts the returned string from a mocked API response would prevent regressions if the model field is renamed again.


Risk Assessment

  • Blast radius: single method, single field access — minimal
  • Pyright: author confirms clean pass
  • Behaviour change: none — callers compare returned strings; enum values match what status previously returned

Verdict

Approve. The fix is correct, minimal, and unambiguous. The observations above are suggestions for follow-up, not blockers.

@LinoGiger LinoGiger merged commit 18cf6a4 into main Jun 19, 2026
2 checks passed
@LinoGiger LinoGiger deleted the fix(job)/read-renamed-state-field branch June 19, 2026 08:56
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