Extension framework optimization
This commit is contained in:
parent
32f4af8359
commit
33fa602fe5
7 changed files with 208 additions and 18 deletions
|
|
@ -33,6 +33,13 @@ def test_processing_request_serializes_context_and_cache_key():
|
|||
options={"format": "json"},
|
||||
capabilities=[ProcessingCapability(id="ast", description="Read parsed AST")],
|
||||
).cache_key
|
||||
assert request.cache_key != ProcessingRequest(
|
||||
operation="query.selector",
|
||||
input={"selector": "sections[heading=Decision]"},
|
||||
context=ProcessingContext(source_path=Path("other.md")),
|
||||
options={"format": "json"},
|
||||
capabilities=[ProcessingCapability(id="ast", description="Read parsed AST")],
|
||||
).cache_key
|
||||
|
||||
|
||||
def test_processing_result_validity_provenance_and_trace():
|
||||
|
|
@ -58,6 +65,21 @@ def test_processing_result_validity_provenance_and_trace():
|
|||
assert data["trace"][0]["metadata"]["engine"] == "selector"
|
||||
|
||||
|
||||
def test_processing_result_with_trace_preserves_envelope_fields():
|
||||
result = ProcessingResult(
|
||||
output={"count": 1},
|
||||
dependencies=["doc.md"],
|
||||
metadata={"engine": "selector"},
|
||||
)
|
||||
|
||||
traced = result.with_trace(ProcessingTrace(event="query.done"))
|
||||
|
||||
assert traced.output == result.output
|
||||
assert traced.dependencies == ["doc.md"]
|
||||
assert traced.metadata == {"engine": "selector"}
|
||||
assert traced.trace[0].event == "query.done"
|
||||
|
||||
|
||||
def test_processing_result_from_error_normalizes_diagnostics():
|
||||
result = ProcessingResult.from_error(
|
||||
code="extension.missing_dependency",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue