richer normalized structure, permission context preservation

This commit is contained in:
2026-05-06 13:43:16 +02:00
parent a4a4759ac4
commit 24cb3c5b6a
10 changed files with 636 additions and 15 deletions

View File

@@ -36,6 +36,11 @@ def test_markitect_markdown_extractor_delegates_to_markitect_tool(
return SimpleNamespace(
to_dict=lambda: {
"frontmatter": {"status": "accepted"},
"blocks": [
{"type": "heading", "text": "Decision", "line_start": 1, "heading_level": 1},
{"type": "paragraph", "text": "Use Markitect.", "line_start": 3},
{"type": "table", "text": "| A |\n| - |", "line_start": 5, "line_end": 6},
],
"headings": [{"level": 1, "text": "Decision", "line": 1}],
"sections": [
{
@@ -43,6 +48,17 @@ def test_markitect_markdown_extractor_delegates_to_markitect_tool(
"blocks": [{"type": "paragraph", "text": "Use Markitect.", "line_start": 3}],
}
],
"tokens": [
{
"type": "inline",
"children": [
{
"type": "link_open",
"attrs": {"href": "https://example.test/decision"},
}
],
}
],
}
)
@@ -73,8 +89,16 @@ def test_markitect_markdown_extractor_delegates_to_markitect_tool(
("snapshot_identity_for_file", f"{source}:default"),
]
assert result.normalized.structure["frontmatter"] == {"status": "accepted"}
assert result.normalized.structure["blocks"][1]["type"] == "paragraph"
assert result.normalized.links == [
{"url": "https://example.test/decision", "kind": "markdown_link"}
]
assert result.normalized.tables[0]["text"] == "| A |\n| - |"
assert result.normalized.fields["block_count"] == 3
assert result.normalized.fields["heading_count"] == 1
assert result.normalized.fields["section_count"] == 1
assert result.normalized.fields["link_count"] == 1
assert result.normalized.fields["table_count"] == 1
assert result.metadata["snapshot"]["snapshot_id"] == "snapshot:decision"
assert result.normalized.extractor_metadata["snapshot"]["parser"] == "markdown-it-py/commonmark"