Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ jobs:
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: fruwehq/determa-state-conformance
ref: d6a45d31614ee25de20476ed93f10e14997d882c
ref: 531468c59c7a2dc32f5cbe92cfabf89805d27f6a
path: .pinned/determa-state-conformance
- name: Check out pinned specification
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
repository: fruwehq/determa-state-spec
ref: 7782671b56165a59caa61a65c29fefc63105ebf8
ref: 2e33036563cb966b07124197db672159b4b7e1f4
path: .pinned/determa-state-spec
- uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
Expand Down
13 changes: 6 additions & 7 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,14 @@ This is the Python implementation of Determa State. The distribution is
package so it can coexist with the umbrella `determa` launcher.

The implementation is conformant only when it passes the language-neutral suite.
The synchronized 0.2.0 release uses these immutable inputs:
The implementation uses these immutable inputs:

- specification: `7782671b56165a59caa61a65c29fefc63105ebf8`;
- conformance: `d6a45d31614ee25de20476ed93f10e14997d882c` (111 core cases,
108 persistence vectors, 12 persistence-profile steps, 91 execution-checkpoint
vectors, and 89 closed-code registry entries).
- specification: `2e33036563cb966b07124197db672159b4b7e1f4`;
- conformance: `531468c59c7a2dc32f5cbe92cfabf89805d27f6a` (114 core cases,
108 persistence vectors, 12 persistence-profile steps, 99 execution-checkpoint
vectors, 106 version-2 vectors, and 101 closed-code registry entries).

The package metadata is `0.2.0` for the next synchronized release; the specification,
conformance suite, Python engine, and Rust engine version together.
The package metadata remains `0.2.0`.

## Boundaries

Expand Down
17 changes: 8 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ Python implementation of [Determa State](https://github.com/fruwehq/determa-stat
a language-agnostic statechart engine with a shared normative conformance suite.

This implementation supports Determa State `format: 1` at specification
commit `7782671b56165a59caa61a65c29fefc63105ebf8` (`v0.2.0`). Correctness is
determined by the 111-case core suite, 108 persistence vectors, 12 persistence-profile
steps, 91 execution-checkpoint vectors, and 89 closed-code registry entries at
conformance commit `d6a45d31614ee25de20476ed93f10e14997d882c` (`v0.2.0`).

The package metadata is `0.2.0` for the next synchronized release of the specification,
conformance suite, Python engine, and Rust engine. This release adds the portable
execution-checkpoint host, selected legacy artifact decoding, and authoritative
portable code sets.
commit `2e33036563cb966b07124197db672159b4b7e1f4`. Correctness is determined by
the 114-case core suite, 108 persistence vectors, 12 persistence-profile steps,
99 execution-checkpoint vectors, 106 version-2 vectors, and 101 closed-code registry
entries at conformance commit `531468c59c7a2dc32f5cbe92cfabf89805d27f6a`.

The package metadata remains `0.2.0`. The implementation includes the portable
execution-checkpoint host, selected legacy artifact decoding, and authoritative portable
code sets.

## Install

Expand Down
6 changes: 4 additions & 2 deletions conformance/execution_checkpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,9 @@ def execution_checkpoint_vectors() -> list[ExecutionCheckpointVector]:
return [
ExecutionCheckpointVector(case, vector)
for case in execution_checkpoint_cases()
for vector in case.test["execution_checkpoint_profile"]["vectors"]
for vector in case.test.get("execution_checkpoint_profile", {}).get(
"vectors", []
)
]


Expand All @@ -90,7 +92,7 @@ def _pointer(document: Any, pointer: str) -> Any:
def _resolver(case: ExecutionCheckpointCase) -> MemoryArtifactResolver:
definitions = {}
descriptors = {}
for path in case.path.glob("*.yaml"):
for path in case.path.parent.glob("**/*.yaml"):
try:
bundle = load_bundle(path.read_text(encoding="utf-8"))
except Exception:
Expand Down
4 changes: 4 additions & 0 deletions conformance/harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,7 @@ def _assert_result(
"fault",
"caller_still_owns_input",
"caller_still_owns_state",
"state_bytes_unchanged",
"state",
"config",
"variables",
Expand Down Expand Up @@ -270,6 +271,9 @@ def _assert_result(
assert prior_state_snapshot is not None
assert prior_state == prior_state_snapshot
assert result["state"] is prior_state
if expected.get("state_bytes_unchanged"):
assert prior_state_snapshot is not None
assert result["state"] == prior_state_snapshot
if result["state"] is None:
return
state = result["state"]
Expand Down
4 changes: 2 additions & 2 deletions conformance/pins.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

from pathlib import Path

CONFORMANCE_COMMIT = "d6a45d31614ee25de20476ed93f10e14997d882c"
SPEC_COMMIT = "7782671b56165a59caa61a65c29fefc63105ebf8"
CONFORMANCE_COMMIT = "531468c59c7a2dc32f5cbe92cfabf89805d27f6a"
SPEC_COMMIT = "2e33036563cb966b07124197db672159b4b7e1f4"

ROOT = Path(__file__).resolve().parent.parent
CONFORMANCE_CACHE = ROOT / ".cache" / f"determa-state-conformance-{CONFORMANCE_COMMIT[:12]}"
Expand Down
64 changes: 62 additions & 2 deletions conformance/test_conformance.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from pathlib import Path

import pytest
import yaml
from jsonschema import Draft202012Validator

from determa.state import PORTABLE_CODE_SETS, load_bundle
Expand All @@ -30,6 +31,15 @@
persistence_profile_cases,
run_persistence_profile,
)
from .version2 import (
run_version2_vector,
validate_version2_artifact,
version2_vectors,
)


def _load_case(case: CoreCase) -> dict:
return yaml.safe_load(case.test_file.read_text(encoding="utf-8")) or {}


def _spec_schema() -> dict | None:
Expand All @@ -50,8 +60,9 @@ def _spec_root() -> Path | None:

def test_suite_present() -> None:
assert CORE_DIR.exists(), "pinned conformance suite is unavailable"
assert len(core_cases()) == 111
assert len(execution_checkpoint_vectors()) == 91
assert len(core_cases()) == 114
assert len(execution_checkpoint_vectors()) == 99
assert len(version2_vectors()) == 106


def test_portable_code_sets_match_authoritative_registry() -> None:
Expand Down Expand Up @@ -162,6 +173,11 @@ def test_bundled_schema_matches_pinned_spec() -> None:
("migration-descriptor.schema.json", "migration_descriptor"),
("aggregate-state-package.schema.json", "aggregate_state_package"),
("execution-checkpoint.schema.json", "execution_checkpoint"),
("aggregate-state-v2.schema.json", "aggregate_state_v2"),
("migration-descriptor-v2.schema.json", "migration_descriptor_v2"),
("aggregate-state-package-v2.schema.json", "aggregate_state_package_v2"),
("execution-checkpoint-v2.schema.json", "execution_checkpoint_v2"),
("core-step-result-v2.schema.json", "core_step_result_v2"),
],
)
def test_bundled_artifact_schemas_match_pinned_spec(name: str, kind: str) -> None:
Expand All @@ -178,6 +194,11 @@ def test_bundled_artifact_schemas_match_pinned_spec(name: str, kind: str) -> Non
"migration_descriptor",
"aggregate_state_package",
"execution_checkpoint",
"aggregate_state_v2",
"migration_descriptor_v2",
"aggregate_state_package_v2",
"execution_checkpoint_v2",
"core_step_result_v2",
],
)
def test_bundled_artifact_schema_is_valid_draft_2020_12(kind: str) -> None:
Expand Down Expand Up @@ -224,6 +245,11 @@ def test_execution_checkpoint_profile(item) -> None:
run_execution_checkpoint_vector(item)


@pytest.mark.parametrize("item", version2_vectors(), ids=lambda item: item.name)
def test_version2_vector(item) -> None:
run_version2_vector(item)


@pytest.mark.parametrize(
("case", "artifact"),
[
Expand All @@ -242,3 +268,37 @@ def test_execution_checkpoint_profile(item) -> None:
)
def test_execution_checkpoint_artifact(case, artifact) -> None:
validate_execution_checkpoint_artifact(case, artifact)


@pytest.mark.parametrize(
("case", "artifact"),
[
(case, artifact)
for case in core_cases()
for artifact in (_load_case(case).get("artifacts", {}).get("documents", []))
if artifact["kind"]
in {
"aggregate_state_v2",
"migration_descriptor_v2",
"aggregate_state_package_v2",
"execution_checkpoint_v2",
"core_step_result_v2",
}
]
+ [
(case.path, artifact)
for case in execution_checkpoint_cases()
for artifact in case.test.get("artifacts", {}).get("documents", [])
if artifact["kind"]
in {
"aggregate_state_v2",
"migration_descriptor_v2",
"aggregate_state_package_v2",
"execution_checkpoint_v2",
"core_step_result_v2",
}
],
)
def test_version2_artifact(case, artifact) -> None:
path = case.path if isinstance(case, CoreCase) else case
validate_version2_artifact(path, artifact)
Loading