Skip to content

infra: Port the compatibility-validator's two shell steps to Python and clear its GEN-005 exception #2692

Closed

Description

@zackees

Gap

ci-lint precheck reports two GEN-005 findings on
.github/actions/compatibility-validator/action.yaml:

[GEN-005] APPROVED EXCEPTION .github/actions/compatibility-validator/action.yaml
    what:  runs.steps[0]: run: step violates the shell budget (more than one line)
[GEN-005] APPROVED EXCEPTION .github/actions/compatibility-validator/action.yaml
    what:  runs.steps[2]: run: step violates the shell budget (more than one line; control syntax (;, |); leading if/for/while)
  • steps[0] is the Windows runner guard: a : comment line, echo the reason, exit 2.
  • steps[2] is the schema check: ::group::Schema Validation, if [[ "${RUNNER_DEBUG}" ]]; then set -x; fi,
    shopt -s extglob, PYTHONUNBUFFERED=1 uv run --no-project --with jsonschema --with json_source_map .github/scripts/utils.py/check-jsonschema.py --loglevel INFO plugins/win-capture/data/@(compatibility|package).json,
    ::endgroup::.

The exception is path-scoped, so the action's block leaves the baseline only when
both steps are one call each.

Call sites

Caller Inputs used
.github/workflows/ci.yml (Validate Data 🕵️, Compat Data Validation job) none (defaults)
.github/workflows/push.yaml (Validate Data 🕵️) repositorySecret

The action installs its own pinned astral-sh/setup-uv (with the CACHE-013 pr-<N>
cache-suffix), so the port needs nothing from the caller. The guard step runs before
that install today, which is why it could be plain shell; a port that calls uv has to
install the toolchain first, so Set Up uv moves above the guard and the guard still
fails an unsupported runner before the check runs.

steps[2] writes validation_errors.json into its working directory, which the
following yuzutech/annotations-action step reads from
${{ inputs.workingDirectory }}/validation_errors.json; the port keeps the step's
working-directory: attribute so the file lands in the same place.

Work

  • ci/compatibility_validate.py (uv run --no-project --script, standard library only)
    with two subcommands: guard --notice … (print the notice, exit 2 — the action's own
    if: runner.os == 'Windows' still selects it) and validate <files…> (run
    .github/scripts/utils.py/check-jsonschema.py through uv run --no-project --with jsonschema --with json_source_map, return its status, bracketing the output in
    ::group::Schema Validation / ::endgroup::).
  • Both run: steps become one line each; the two JSON paths (compatibility.json,
    package.json) are listed explicitly instead of the @(compatibility|package) extglob,
    which is the only shell construct the step used.
  • ci/test_compatibility_validator.py pins the guard's notice and exit code, the
    checker's exit status for a valid file, a schema violation (exit 1 + validation_errors.json)
    and a missing file (exit 2), the group annotations, the action's one-line steps with uv
    installed before both calls, and the absence of the GEN-005 [[exceptions]] block.
  • The GEN-005 exception for the action is deleted with the port.

Noticed while porting, left alone: the guard's notice text says "services-validation
action requires a macOS-based or Linux-based runner." (copied from services-validator),
and the step's : Validate services file JSON schema label names the wrong action.

Evidence

  • ci/test_compatibility_validator.py: RED on origin/master (module absent, both steps
    still shell blocks, exception still in ci.toml), GREEN after the port.
  • ci-lint precheck before: 11 violation(s), 489 approved exception(s), 10 needs_review;
    after: the compatibility-validator findings gone, 489 -> 487 approved exceptions.
  • ci/test_ci_toml.py, ci/test_uv_run.py, ruff check clean.
  • No docs/features.md line: build tooling only.

Activity

  1. added
    infra
    on Oct 27, 2026
  2. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Claiming: investigation

    Scoping only: the two GEN-005 findings are the Windows guard and the schema check, both in .github/actions/compatibility-validator/action.yaml; the fix is one Python module plus one line per step, mirroring the flatpak-manifest-validator port (#2687/#2688). I will /ready it when the scope is confirmed.

  3. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    /ready

    Scope confirmed: two run: blocks in .github/actions/compatibility-validator/action.yaml (steps[0] Windows guard, steps[2] schema check), callers ci.yml and push.yaml, no other shell left in the action. RED is ci/test_compatibility_validator.py; GREEN is ci/compatibility_validate.py + one line per step + the GEN-005 [[exceptions]] block deleted from ci.toml.

  4. added
    needs-investigation
    on Oct 27, 2026
  5. added
    ready
    and removed
    needs-investigation
    on Oct 27, 2026
  6. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    Claiming: compatibility-validator GEN-005 port

    1. RED: ci/test_compatibility_validator.py (fails on master: module absent, both steps still shell blocks, exception still in ci.toml).
    2. GREEN: ci/compatibility_validate.py (guard --notice, validate <files…>), one line per run: step, ci.toml GEN-005 block deleted.
    3. Local gate, then a PR into master (one PR).
  7. zackees commented on Oct 27, 2026

    @zackees
    MemberAuthor

    PR #2694 (ready, not draft): RED dea36b6ba (11 failures + 2 errors), GREEN a38b4c73b (15 OK, ci/test_ci_toml.py 41 OK, ci/test_uv_run.py 5 OK, ruff clean, ./lint ok, ci-lint precheck 489 -> 487 approved exceptions with no compatibility-validator finding left). Waiting on PR CI.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

infraready

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions