Skip to content

[Visual Test] Label pagination aborts workflow before screenshot capture #968

Description

@MichaelFisher1997

Workflow run

https://github.com/OpenStaticFish/ZigCraft/actions/runs/30795834741

Head SHA: 8d205ff0b27a951ac7136cb72796ecd8e2e91ed4

Exact failure

The failure is not in Vulkan or screenshot readback. The game command never ran, so build-output.log was never created. Actions reports Ensure visual-test label exists as failed, followed by Setup Lavapipe Vulkan and Run menu screenshot capture as skipped.

The failing branch invokes:

gh label create "run-visual-test" \
  --description "Run deterministic visual regression workflow on a PR" \
  --color "E06C75"

The resulting error is:

label with name "run-visual-test" already exists; use `--force` to update its color and description

Root cause

.github/workflows/visual-test.yml:55 attempts to make label creation conditional by piping gh label list into grep. In particular, .github/workflows/visual-test.yml:62 checks for run-visual-test, then .github/workflows/visual-test.yml:63 creates it when the check misses.

gh label list returns only 30 labels by default. This repository currently has 41 labels, and run-visual-test is after the first 30. The check therefore reports it as absent even though it exists. The subsequent duplicate create fails and, because the step runs with -e, aborts the job before Lavapipe setup or the screenshot command.

There is consequently no Vulkan instance/device, swapchain, shader, panic, or screenshot-capture error to diagnose. The Zig paths were never entered: VulkanSwapchain.createSwapchain at modules/engine-graphics/src/vulkan_swapchain.zig:127, screenshot-mode initialization at src/game/app.zig:268, and screenshot.requestCapture at modules/engine-graphics/src/vulkan/screenshot.zig:24 were not executed.

The diagnosis prompt is also stale but did not cause this run failure: .github/prompts/visual-test-diagnose.md:7 says screenshot.ppm, while the actual command at .github/workflows/visual-test.yml:81 uses the supported screenshot.png; the current encoder rejects .ppm at modules/engine-graphics/src/vulkan/screenshot.zig:39.

Suggested fix

Make the bootstrap idempotent without relying on paginated list output:

- name: Ensure visual-test labels exist
  run: |
    gh label create "visual-test" \
      --description "Issues from automated visual regression tests" \
      --color "E06C75" \
      --force
    gh label create "run-visual-test" \
      --description "Run deterministic visual regression workflow on a PR" \
      --color "E06C75" \
      --force
  env:
    GH_TOKEN: ${{ secrets.OPENCODE_PAT }}

Alternatively, query each exact label through gh api repos/$GITHUB_REPOSITORY/labels/<name> before creating it. Adding --limit 100 would fix the current repository but retains a future pagination threshold.

Also update .github/prompts/visual-test-diagnose.md to describe PNG output and the current HomeScreen path (modules/game-ui/src/screens/home.zig).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghotfixvisual-testIssues from automated visual regression tests

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions