Skip to content

Validate artifact contracts after an expected nonzero program exit #712

Closed

Description

@LunaStev

Problem

In classify_program in tools/run_tests.py, the expected-nonzero success branch returns before validate_compiled_artifact. A matching exit code can therefore pass a case whose assembly/object requirements fail.

Reproduction

Run this focused unit reproduction from the repository root:

import sys
from dataclasses import replace
from unittest.mock import patch
from tools import run_tests as r
metadata = replace(
    r.parse_test_metadata("tests/cases/shared/test1.wave"), expected_exit=42
)
with patch.object(r, "validate_compiled_artifact", return_value="missing assembly marker") as check:
    result = r.classify_program(
        "audit", "tests/cases/shared/test1.wave",
        [sys.executable, "-c", "raise SystemExit(42)"], metadata, None,
    )
    print(result[0], check.call_count)

Save as /tmp/repro.py; run PYTHONPATH=. python3 /tmp/repro.py. The mock represents a failing artifact requirement.

Tested at 01955d715dda275de993948037091140bb859174 on Fedora Linux 43, x86_64, with Python 3.14.

Actual: PASS (expected exit=42) followed by 3 0, indicating a pass and no validator call. Expected: failure classification 0 and one validator call. Setting both exit values to 0 already produces that expected result.

Completion criteria

  • Validate artifact requirements before accepting either expected-zero or expected-nonzero execution.
  • Retain the runner's distinct success classifications and actual/expected exit diagnostics.
  • Add a unit regression for the skipped branch and an integration case with a real missing assembly marker.
  • Keep matching-exit cases with valid artifacts passing.

Compile-only object-presence checking in #514 is separate.

Difficulty: easy.

Activity

  1. added
    bug
    good first issue
    needs testing
    ci
    on Sep 24, 2026
  2. changed the title [-][Bug]: Validate artifact contracts after an expected nonzero program exit[/-] [+]Validate artifact contracts after an expected nonzero program exit[/+] on Sep 24, 2026
  3. self-assigned this
    on Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcigood first issueneeds testing

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions