For AI agents: the complete documentation index is available at https://docs.phax.run/llms.txt, the full documentation bundle is available at https://docs.phax.run/llms-full.txt, and this page is available as Markdown at https://docs.phax.run/releases/0-39-0.md.

phax 0.39.0

Changes since 0.38.0: v0.38.0...v0.39.0.

Highlights

  • Property-based tests over phax's input boundaries — A property states a promise phax already makes at an input boundary; a generator searches for the input that breaks it, and every failure replays from its seed.

What's new

Property-based tests over phax's input boundaries

A property states a promise phax already makes at an input boundary; a generator searches for the input that breaks it, and every failure replays from its seed.

  • A failing property in pnpm test:unit prints its seed, its shrunk counter-example and the command that replays it. pnpm test:unit

    Now:

    $ pnpm test:unit
     FAIL  tests/unit/property/persistedFormats.property.test.ts > run-status > reads its written encoding back
    Property failed after 37 runs (seed 1849203311, path "36:0:2"), shrunk 12 times
    Counter-example:
      {"$schema":"https://docs.phax.run/schemas/run-status/0.36.0.json", …}
    Replay:
      PHAX_PROPERTY_SEED=1849203311 PHAX_PROPERTY_PATH=36:0:2 pnpm test:unit tests/unit/property/persistedFormats.property.test.ts
    Before
    $ pnpm test:unit
     ✓ tests/unit/renderPlan.test.ts (24 tests)
     ✓ tests/unit/parsePlanMarkdown.test.ts (61 tests)
     Test Files  412 passed
  • Three environment variables set the seed, the replay path and the run count of every property test. PHAX_PROPERTY_SEED, PHAX_PROPERTY_PATH, PHAX_PROPERTY_RUNS

    Now:

    PHAX_PROPERTY_SEED=1849203311   # generate from this seed; unset: a fixed seed; random: a fresh, printed seed
    PHAX_PROPERTY_PATH=36:0:2       # with the seed, go straight to the shrunk counter-example
    PHAX_PROPERTY_RUNS=2000         # generated inputs per property; unset: 100
  • The daily Security workflow runs a deeper pass of every property test with a fresh seed. .github/workflows/security.yml

    Now:

    jobs:
      security-audit:
        runs-on: ubuntu-latest
      semgrep:
        runs-on: ubuntu-latest
      property-tests:
        if: github.event_name == 'schedule' || github.event_name == 'workflow_dispatch'
        runs-on: ubuntu-latest
        steps:
          # checkout, pnpm, mise and pnpm install, as in security-audit
          - name: Property tests, deep pass
            env:
              PHAX_PROPERTY_RUNS: "2000"
              PHAX_PROPERTY_SEED: random
            run: pnpm test:unit tests/unit/property
    Before
    jobs:
      security-audit:
        runs-on: ubuntu-latest
      semgrep:
        runs-on: ubuntu-latest