Add versioned task context capsules
This commit is contained in:
parent
34cd5f74c1
commit
4cc6277054
18 changed files with 2834 additions and 10 deletions
|
|
@ -55,8 +55,10 @@ from docforge.visualization import VisualizationIndexSnapshot
|
|||
class Loader:
|
||||
def __init__(self, projection: AdapterProjection) -> None:
|
||||
self.projection = projection
|
||||
self.load_calls = 0
|
||||
|
||||
def load_projection(self) -> AdapterProjection:
|
||||
self.load_calls += 1
|
||||
return self.projection
|
||||
|
||||
|
||||
|
|
@ -866,8 +868,9 @@ class AdapterReadOnlyMcpTests(unittest.IsolatedAsyncioTestCase):
|
|||
with tempfile.TemporaryDirectory() as directory:
|
||||
root = Path(directory).resolve()
|
||||
fixture = AdapterContractTests()
|
||||
loader = Loader(fixture.projection(root))
|
||||
project = AdapterProject(
|
||||
Loader(fixture.projection(root)),
|
||||
loader,
|
||||
cache_root=root / ".cache" / "adapter-read-only",
|
||||
)
|
||||
index = ProjectIndex(project)
|
||||
|
|
@ -903,6 +906,14 @@ class AdapterReadOnlyMcpTests(unittest.IsolatedAsyncioTestCase):
|
|||
context = await session.call_tool(
|
||||
"docforge_get_context", {"profile": "fixture", "budget": 321}
|
||||
)
|
||||
load_calls = loader.load_calls
|
||||
task_context = await session.call_tool(
|
||||
"docforge_get_task_context",
|
||||
{
|
||||
"task_kind": "change",
|
||||
"task": "Do not load the legacy projection for this capability error",
|
||||
},
|
||||
)
|
||||
|
||||
self.assertEqual(READ_TOOLS, tuple(tool.name for tool in tools.tools))
|
||||
self.assertEqual("adapter-fixture", info.structuredContent["project_id"])
|
||||
|
|
@ -915,6 +926,12 @@ class AdapterReadOnlyMcpTests(unittest.IsolatedAsyncioTestCase):
|
|||
self.assertFalse(contract.structuredContent["isolated_changeset_writes_allowed"])
|
||||
self.assertEqual("fixture", context.structuredContent["profile"])
|
||||
self.assertEqual([("fixture", 321)], calls)
|
||||
self.assertEqual("error", task_context.structuredContent["status"])
|
||||
self.assertEqual(
|
||||
"task_context_unavailable",
|
||||
task_context.structuredContent["error"]["code"],
|
||||
)
|
||||
self.assertEqual(load_calls, loader.load_calls)
|
||||
self.assertFalse(project.descriptor.changeset_root.exists())
|
||||
|
||||
async def test_adapter_project_proposals_require_explicit_policy_and_stay_isolated(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue