Skip to content

Formal states in tables#1246

Draft
MichaelTimbert wants to merge 11 commits into
zonemaster:developfrom
MichaelTimbert:formalstates
Draft

Formal states in tables#1246
MichaelTimbert wants to merge 11 commits into
zonemaster:developfrom
MichaelTimbert:formalstates

Conversation

@MichaelTimbert

@MichaelTimbert MichaelTimbert commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Purpose

Introduce a formal state column to the test_results table, replacing the implicit state inference from the progress integer with explicit, well-defined lifecycle states.

Context

#960

Previously, the state of a test was derived from the progress value (0 = waiting, 1-99 = running, 100 = completed). This made it impossible to distinguish between different terminal states (e.g., completed normally vs. cancelled vs. crashed). This PR adds a proper state column with five formal states.

Changes

  • Database schema (MySQL, PostgreSQL, SQLite): Added state VARCHAR(20) NOT NULL DEFAULT "waiting" column with a CHECK constraint limiting values to waiting, running, completed, cancelled, crashed.

  • State constants (DB.pm): Lowercased existing constants (WAITING → waiting, RUNNING → running, COMPLETED → completed) and added two new ones: $TEST_CANCELLED and $TEST_CRASHED.

How to test this PR

  • Run the existing test suite to verify all state transitions work correctly.
  • Verify database schema creation includes the new state column and CHECK constraint on all three backends (MySQL, PostgreSQL, SQLite).
  • Confirm that cancelled and crashed tests are properly distinguished in the state column.

@tgreenx tgreenx changed the title Formalstates Formal states in tables Jun 11, 2026
@tgreenx tgreenx marked this pull request as draft June 11, 2026 12:43
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