refactor: use enums instead of raw strings for job/health status - #685
Open
AkhilVipparla wants to merge 1 commit into
Open
AkhilVipparla wants to merge 1 commit into
AkhilVipparla wants to merge 1 commit into
Conversation
Job.status/job_type were still typed as plain str while every other v1 model (Input, Extraction, Incident, Form, Report) already uses the generated JobStatus/JobType/etc enums. Retype Job to match and fix the four call sites that assigned/compared raw string literals instead (routes/jobs.py, services/input.py, tasks/fill.py, tasks/transcribe.py). Also adds a HealthState enum (healthy/degraded/unhealthy) — this value was compared/assigned as a raw string in routes/system.py with no backing enum in enums.yaml at all. Contract-side, BatchStatus.status in form-record.yaml now references the shared JobStatus enum instead of duplicating its own inline copy. All of these are still str subclasses, so JSON responses are byte-for-byte unchanged. Part of fireform-core#684.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Part of #684 — Job.status/job_type were still typed as plain
strwhile everyother v1 model (Input, Extraction, Incident, Form, Report) already uses the
generated enums. This retypes Job to match and fixes the raw-string call sites
in routes/jobs.py, services/input.py, tasks/fill.py, and tasks/transcribe.py.
Also adds a
HealthStateenum (healthy/degraded/unhealthy) forroutes/system.py, which had no backing enum in enums.yaml at all. On the
contract side,
BatchStatus.statusin form-record.yaml now points at theshared
JobStatusenum instead of duplicating its own inline copy.All of these are still
strsubclasses, so JSON responses are unchanged.Out of scope for this PR: the
sortparam enum incontracts/path/incidents.yaml— there's no
incidents.pyroute implemented yet, so there's no actualstring-comparison bug there to fix.
Test plan
pytest tests/— 145 passed, 0 failuresruff check app/— same 50 pre-existing findings as development, 0 new ones introduced