Skip to content

Hypergraph is more powerful. Transform unstructured text into structured knowledge with LLMs. Graphs, hypergraphs, and spatio-temporal extractions — with one command.

fix: retag workflow_graph preset to graph; clean validator test allowlist

yifanfeng97c3bf004bcd84
diff --git a/hyperextract/templates/presets/general/workflow_graph.yaml b/hyperextract/templates/presets/general/workflow_graph.yaml
index 6da97ca..52a189e 100644
--- a/hyperextract/templates/presets/general/workflow_graph.yaml
+++ b/hyperextract/templates/presets/general/workflow_graph.yaml
@@ -1,7 +1,7 @@
language: [zh, en]
name: workflow_graph
-type: temporal_graph
+type: graph
tags: [general, workflow, process, agent, skill]
description:
diff --git a/tests/cli/test_template_validate.py b/tests/cli/test_template_validate.py
index cee35a3..6143df2 100644
--- a/tests/cli/test_template_validate.py
+++ b/tests/cli/test_template_validate.py
@@ -126,26 +126,18 @@ class TestTemplateValidateCli:
result = runner.invoke(app, ["template", "validate", str(tmp_path), "--all"])
assert result.exit_code == 0, result.output
- def test_batch_presets_only_known_error(self):
+ def test_batch_presets_are_clean(self):
result = runner.invoke(
app, ["template", "validate", str(PRESETS_DIR), "--all", "--json"]
)
- # general/workflow_graph.yaml is temporal_graph without time_field.
- # Education presets added in v0.5.0 must not fail.
- assert result.exit_code == 1
+ # All bundled presets pass error-level checks. workflow_graph was
+ # retagged from temporal_graph to graph (it has no time fields);
+ # education presets added in v0.5.0 must not fail either.
+ assert result.exit_code == 0, result.output
payload = json.loads(result.output)
- assert payload["ok"] is False
+ assert payload["ok"] is True
failed = [item for item in payload["results"] if not item["ok"]]
- assert len(failed) == 1
- assert failed[0]["file"].replace("\\", "/").endswith(
- "general/workflow_graph.yaml"
- )
- error_codes = {
- diagnostic["code"]
- for diagnostic in failed[0]["diagnostics"]
- if diagnostic["severity"] == "error"
- }
- assert error_codes == {"HE-T006"}
+ assert failed == []
education = [
item
for item in payload["results"]
diff --git a/tests/cli/test_verbose.py b/tests/cli/test_verbose.py
index 09caa20..bf37811 100644
--- a/tests/cli/test_verbose.py
+++ b/tests/cli/test_verbose.py
@@ -4,11 +4,10 @@ import logging
import os
from unittest.mock import patch
-import pytest
from typer.testing import CliRunner
from hyperextract.cli.cli import app
-from hyperextract.utils.logging import configure_logging, ENV_LOG_LEVEL
+from hyperextract.utils.logging import ENV_LOG_LEVEL, configure_logging
runner = CliRunner()
diff --git a/tests/template_engine/test_factory.py b/tests/template_engine/test_factory.py
index 141b0bd..cbea921 100644
--- a/tests/template_engine/test_factory.py
+++ b/tests/template_engine/test_factory.py
@@ -1,9 +1,9 @@
"""Unit tests for TemplateFactory."""
+
import pytest
-from pathlib import Path
-from hyperextract.utils.template_engine import TemplateFactory, Gallery
+from hyperextract.utils.template_engine import Gallery, TemplateFactory
class TestTemplateFactoryCreate:
diff --git a/tests/template_engine/test_gallery.py b/tests/template_engine/test_gallery.py
index 5532c69..808c745 100644
--- a/tests/template_engine/test_gallery.py
+++ b/tests/template_engine/test_gallery.py
@@ -143,5 +143,5 @@ class TestGalleryMultiple:
templates = Gallery.list(filter_by_type=template.type)
assert len(templates) > 0
- for key, t in templates.items():
+ for t in templates.values():
assert t.type == template.type
diff --git a/tests/template_engine/test_parser_loader.py b/tests/template_engine/test_parser_loader.py
index db4b354..d267b07 100644
--- a/tests/template_engine/test_parser_loader.py
+++ b/tests/template_engine/test_parser_loader.py
@@ -1,9 +1,7 @@
"""Unit tests for template parsers - loader."""
+
import pytest
-import tempfile
-import yaml
-from pathlib import Path
from hyperextract.utils.template_engine.parsers import (
load_template,
diff --git a/tests/template_engine/test_parser_output.py b/tests/template_engine/test_parser_output.py
index 128b899..fb1d3cf 100644
--- a/tests/template_engine/test_parser_output.py
+++ b/tests/template_engine/test_parser_output.py
@@ -1,14 +1,6 @@
"""Unit tests for template parsers - output."""
-import pytest
-import tempfile
-import yaml
-from pathlib import Path
-from pydantic import BaseModel
-
-from hyperextract.utils.template_engine.parsers import (
- load_template,
-)
+
class TestParseOutputBasic:
diff --git a/tests/template_engine/test_validator.py b/tests/template_engine/test_validator.py
index 099f125..515b1c3 100644
--- a/tests/template_engine/test_validator.py
+++ b/tests/template_engine/test_validator.py
@@ -332,11 +332,9 @@ class TestJsonShape:
assert set(item) == {"code", "severity", "path", "message"}
-# Bundled presets that currently fail error-level checks. Do not "fix" them in
-# this change — record and keep the allowlist tight so new errors still fail.
-KNOWN_PRESET_ERRORS = {
- "general/workflow_graph.yaml": {HE_T006},
-}
+# Bundled presets that currently fail error-level checks. Keep the allowlist
+# tight so new errors still fail; empty means every preset passes clean.
+KNOWN_PRESET_ERRORS: dict = {}
class TestPresetBootstrap: