fix(prompts): fix three infrastructure bugs in prompt dependency resolution
- ContentMacro: add __post_init__ to auto-derive raw_text when built
programmatically, preventing str.replace("", X) corruption
- MacroParser: add @{target} shorthand syntax support mapped to REQUIRED kind,
updating parse, has_macros, count_macros, and find_macro_positions
- Artifact: store content in model and SQLite DB, replace resolver placeholder
with actual artifact content, add migration for existing databases
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -259,3 +259,32 @@ class TestSQLiteArtifactRepository:
|
||||
assert retrieved.metadata.author == "test-author"
|
||||
assert retrieved.metadata.version == "1.0.0"
|
||||
assert retrieved.metadata.custom == {"key": "value"}
|
||||
|
||||
def test_content_round_trip(self, repository):
|
||||
"""Test that artifact content survives store and retrieve."""
|
||||
original_content = "# Test Content\n\nThis is the full content."
|
||||
artifact = Artifact.create(
|
||||
space_id="test-space",
|
||||
name="content-test",
|
||||
content=original_content,
|
||||
)
|
||||
|
||||
repository.create(artifact)
|
||||
retrieved = repository.get_by_id(artifact.id)
|
||||
|
||||
assert retrieved.content == original_content
|
||||
|
||||
def test_content_persisted_after_update(self, repository):
|
||||
"""Test that updated content is persisted."""
|
||||
artifact = Artifact.create(
|
||||
space_id="test-space",
|
||||
name="update-test",
|
||||
content="Original content",
|
||||
)
|
||||
repository.create(artifact)
|
||||
|
||||
artifact.update_content("Updated content")
|
||||
repository.update(artifact)
|
||||
|
||||
retrieved = repository.get_by_id(artifact.id)
|
||||
assert retrieved.content == "Updated content"
|
||||
|
||||
Reference in New Issue
Block a user