Add incremental adapter compiler boundary
This commit is contained in:
parent
82b3b90521
commit
696b62f9f8
20 changed files with 1592 additions and 122 deletions
|
|
@ -268,6 +268,46 @@ class DocForgeChangesetTests(unittest.TestCase):
|
|||
with self.assertRaisesRegex(DocForgeError, "Canonical project changed"):
|
||||
service.apply("apply-all", str(final["changeset_hash"]))
|
||||
|
||||
def test_relationship_only_update_is_hash_bound_and_does_not_rewrite_node(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = self.copy_fixture(Path(directory))
|
||||
project = Project.open(root)
|
||||
store = ChangesetStore(project, "alpha-editor")
|
||||
workflow = next(
|
||||
node for node in project.load().nodes if node.node_id == "guide.workflow"
|
||||
)
|
||||
created = store.create("relationship-only")
|
||||
proposed = store.propose_relationship_update(
|
||||
changeset_id="relationship-only",
|
||||
expected_changeset_hash=str(created["changeset_hash"]),
|
||||
node_id="guide.workflow",
|
||||
expected_content_hash=workflow.content_hash,
|
||||
relationship_changes=[
|
||||
{
|
||||
"action": "remove",
|
||||
"source_id": "guide.workflow",
|
||||
"relation": "depends_on",
|
||||
"target_id": "guide.foundation",
|
||||
}
|
||||
],
|
||||
rationale="Queue one relationship correction without changing node content.",
|
||||
)
|
||||
|
||||
change = store.diff("relationship-only")["changes"][0]
|
||||
self.assertEqual("update", change["operation"])
|
||||
self.assertEqual("", change["content_diff"])
|
||||
self.assertEqual({}, change["metadata"])
|
||||
self.assertEqual(1, proposed["projected_edge_count"])
|
||||
with self.assertRaisesRegex(DocForgeError, "at least one"):
|
||||
store.propose_relationship_update(
|
||||
changeset_id="relationship-only",
|
||||
expected_changeset_hash=str(proposed["changeset_hash"]),
|
||||
node_id="guide.foundation",
|
||||
expected_content_hash=self.node_hash(project, "guide.foundation"),
|
||||
relationship_changes=[],
|
||||
rationale="Reject an empty relationship operation.",
|
||||
)
|
||||
|
||||
def test_optimistic_and_cross_changeset_conflicts_preserve_both_proposals(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = self.copy_fixture(Path(directory))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue