Skip to content

feat(consts): mirror the current OpenQA::Jobs::Constants - #22

Merged
mimi1vx merged 2 commits into
mainfrom
ad_i_10
Aug 11, 2026
Merged

feat(consts): mirror the current OpenQA::Jobs::Constants#22
mimi1vx merged 2 commits into
mainfrom
ad_i_10

Conversation

@mimi1vx

@mimi1vx mimi1vx commented Aug 11, 2026

Copy link
Copy Markdown
Owner

Summary

src/consts.rs was a partial port of openQA's Python client const.py
rather than the server's OpenQA::Jobs::Constants. This ports every
constant with a client-side meaning at revision
e72ffeb28b6f77bde9bfcb96f490dd3d7049bf6d.

Changes

  • STATES reordered to lifecycle order (scheduled, assigned, setup, running, uploading, done, cancelled), isolated in its own commit since
    it's a silent behaviour change for any consumer indexing/comparing the
    slice directly.
  • Added PRISTINE_STATES, META_STATES (PRE_EXECUTION/EXECUTION/FINAL).
  • Added META_RESULTS (COMPLETE/NOT_COMPLETE/ABORTED/OK/NOT_OK)
    and the two META_MAPPING_STATE/META_MAPPING_RESULT association tables.
  • Added OVERVIEW_STATUS_PRIORITY, STATUS_PRIORITY, DEFAULT_JOB_PRIORITY,
    and the three result-file lists.
  • Added a new ModuleResult enum + MODULE_RESULTS (its own enum, not a
    JobResult subset, since upstream MODULE_RESULTS mixes JobState
    values with JobResult values).
  • Added meta_state/meta_result/is_ok_result helper functions with
    upstream-faithful semantics, including the deliberate divergence between
    META_MAPPING_RESULT (presentation grouping) and meta_result() (which
    maps complete results to themselves, not to "complete").
  • Extended tests, module docs, AGENTS.md, and README.md's
    #[non_exhaustive] list accordingly.

Not ported: TAG_ID_COLUMN (a SQL fragment for the server's own queries)
and the TEST_NAME_* regex constants (would need a new regex dependency
to duplicate validation the server performs anyway).
SCENARIO_KEYS/SCENARIO_WITH_MACHINE_KEYS have no Constants.pm
counterpart and stay as-is.

Verification

  • cargo fmt --check
  • cargo clippy --all-targets --locked -- -D warnings
  • cargo test --locked
  • cargo check --locked --all-targets
  • cargo deny check
  • cargo doc --no-deps

STATES was ordered scheduled, setup, running, cancelled, done, uploading,
assigned — leftover from the Python client's tuple order. openQA orders it
scheduled, assigned, setup, running, uploading, done, cancelled, which is
lifecycle order and the only reason to expose an ordered list at all.

Not a SemVer-major change under the crate's versioning policy (a const's
value changing isn't listed), but it is a silent behaviour change for any
consumer indexing into or comparing the slice, so it gets its own commit.
src/consts.rs was a partial port of openQA's Python client const.py rather
than the server's OpenQA::Jobs::Constants. Port every constant with a
client-side meaning at revision e72ffeb28b6f77bde9bfcb96f490dd3d7049bf6d:
PRISTINE_STATES, META_STATES, the meta-result scalars, META_RESULTS, the two
META_MAPPING association slices, the priority lists, DEFAULT_JOB_PRIORITY,
the result-file lists, a new ModuleResult enum with MODULE_RESULTS, and the
meta_state/meta_result/is_ok_result helpers.

META_MAPPING_RESULT and meta_result() intentionally disagree: the mapping
table groups COMPLETE_RESULTS under 'complete' for presentation, but the
private table backing meta_result() maps each of those results to itself.
Both behaviours are reproduced and documented so a future reader doesn't
'unify' them and break wire semantics.

ModuleResult is its own enum rather than a JobResult subset because
MODULE_RESULTS mixes JobState values (cancelled, running) with JobResult
values.

Not ported: TAG_ID_COLUMN (a SQL fragment for the server's own queries) and
the TEST_NAME_* regex constants (server-side validation in Perl regex syntax
that would need a new regex dependency to duplicate a check the server
performs anyway). SCENARIO_KEYS/SCENARIO_WITH_MACHINE_KEYS have no
Constants.pm counterpart and stay as-is.
@mimi1vx
mimi1vx merged commit e7ac18f into main Aug 11, 2026
5 of 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.

1 participant