Bind generated clients to product version
This commit is contained in:
parent
47ac329947
commit
dc9500e50e
5 changed files with 40 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ from mcp import ClientSession, StdioServerParameters
|
|||
from mcp.client.stdio import stdio_client
|
||||
from referencing import Registry, Resource
|
||||
|
||||
from docforge._version import __version__
|
||||
from docforge.adapter_contract import AdapterNode, AdapterProject, AdapterProjection
|
||||
from docforge.adapter_launcher import AdapterLauncherV1
|
||||
from docforge.client_config import (
|
||||
|
|
@ -188,6 +189,7 @@ class AdapterLauncherTests(unittest.TestCase):
|
|||
)
|
||||
self.assertEqual(first, second)
|
||||
ADAPTER_CONFIGURATION_VALIDATOR.validate(first)
|
||||
self.assertEqual(__version__, first["docforge_version"])
|
||||
self.assertEqual(launcher.launcher_hash, first["launcher_hash"])
|
||||
self.assertEqual(
|
||||
launcher.launcher_hash,
|
||||
|
|
@ -265,6 +267,15 @@ class AdapterLauncherTests(unittest.TestCase):
|
|||
AdapterLauncherV1(**payload) # type: ignore[arg-type]
|
||||
|
||||
result = generate_adapter_client_configuration(project, launcher, "codex")
|
||||
version_drift = json.loads(json.dumps(result))
|
||||
version_drift["docforge_version"] = "0.0.0"
|
||||
with self.assertRaisesRegex(AssertionError, "product version"):
|
||||
_validate_adapter_configuration_result(
|
||||
version_drift,
|
||||
project=project,
|
||||
launcher=launcher,
|
||||
source_availability=project_source_availability(version_drift),
|
||||
)
|
||||
result["binding"]["args"].append("--arbitrary")
|
||||
with self.assertRaisesRegex(AssertionError, "Generated adapter client"):
|
||||
_validate_adapter_configuration_result(
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ from jsonschema import Draft202012Validator
|
|||
from mcp import ClientSession, StdioServerParameters
|
||||
from mcp.client.stdio import stdio_client
|
||||
|
||||
from docforge._version import __version__
|
||||
from docforge.changeset_contract import document_hash
|
||||
from docforge.cli import _parser, _run, main
|
||||
from docforge.client_config import (
|
||||
|
|
@ -103,6 +104,7 @@ class ClientIntegrationTests(unittest.TestCase):
|
|||
second = generate_client_configuration(project, client, no_ast=True)
|
||||
self.assertEqual(first, second)
|
||||
Draft202012Validator(CONFIGURATION_SCHEMA).validate(first)
|
||||
self.assertEqual(__version__, first["docforge_version"])
|
||||
Draft202012Validator(POLICY_SCHEMA).validate(first["effective_policy"])
|
||||
self.assertEqual("read", first["binding"]["capability_mode"])
|
||||
self.assertEqual(
|
||||
|
|
@ -251,6 +253,11 @@ class ClientIntegrationTests(unittest.TestCase):
|
|||
validator.validate(result)
|
||||
_validate_configuration_result(result)
|
||||
|
||||
version_drift = json.loads(json.dumps(result))
|
||||
version_drift["docforge_version"] = "0.0.0"
|
||||
with self.assertRaisesRegex(AssertionError, "product version"):
|
||||
_validate_configuration_result(version_drift)
|
||||
|
||||
for field, value in (
|
||||
("schema_version", 1),
|
||||
("manual", "on-demand"),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue