Conversation
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.
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
src/consts.rswas a partial port of openQA's Python clientconst.pyrather than the server's
OpenQA::Jobs::Constants. This ports everyconstant with a client-side meaning at revision
e72ffeb28b6f77bde9bfcb96f490dd3d7049bf6d.Changes
STATESreordered to lifecycle order (scheduled, assigned, setup, running, uploading, done, cancelled), isolated in its own commit sinceit's a silent behaviour change for any consumer indexing/comparing the
slice directly.
PRISTINE_STATES,META_STATES(PRE_EXECUTION/EXECUTION/FINAL).META_RESULTS(COMPLETE/NOT_COMPLETE/ABORTED/OK/NOT_OK)and the two
META_MAPPING_STATE/META_MAPPING_RESULTassociation tables.OVERVIEW_STATUS_PRIORITY,STATUS_PRIORITY,DEFAULT_JOB_PRIORITY,and the three result-file lists.
ModuleResultenum +MODULE_RESULTS(its own enum, not aJobResultsubset, since upstreamMODULE_RESULTSmixesJobStatevalues with
JobResultvalues).meta_state/meta_result/is_ok_resulthelper functions withupstream-faithful semantics, including the deliberate divergence between
META_MAPPING_RESULT(presentation grouping) andmeta_result()(whichmaps complete results to themselves, not to
"complete").AGENTS.md, andREADME.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 newregexdependencyto duplicate validation the server performs anyway).
SCENARIO_KEYS/SCENARIO_WITH_MACHINE_KEYShave noConstants.pmcounterpart and stay as-is.
Verification
cargo fmt --checkcargo clippy --all-targets --locked -- -D warningscargo test --lockedcargo check --locked --all-targetscargo deny checkcargo doc --no-deps