Bind generated clients to product version
This commit is contained in:
parent
47ac329947
commit
dc9500e50e
5 changed files with 40 additions and 0 deletions
|
|
@ -16,6 +16,7 @@ from dataclasses import dataclass
|
|||
from pathlib import Path
|
||||
from typing import Literal, cast
|
||||
|
||||
from ._version import __version__ as DOCFORGE_VERSION
|
||||
from .adapter_launcher import (
|
||||
AdapterLauncherV1,
|
||||
AdapterSourceAvailabilityV1,
|
||||
|
|
@ -617,6 +618,8 @@ def _validate_configuration_result(
|
|||
*,
|
||||
trusted_descriptor: ProjectDescriptor | None = None,
|
||||
) -> None:
|
||||
if result.get("docforge_version") != DOCFORGE_VERSION:
|
||||
raise AssertionError("Generated client product version drifted")
|
||||
artifact = cast(dict[str, object], result["artifact"])
|
||||
binding = cast(dict[str, object], result["binding"])
|
||||
policy = cast(dict[str, object], result["effective_policy"])
|
||||
|
|
@ -797,6 +800,7 @@ def _validate_configuration_result(
|
|||
expected_hash = document_hash(
|
||||
{
|
||||
"schema_version": 1,
|
||||
"docforge_version": result["docforge_version"],
|
||||
"client": result["client"],
|
||||
"server_name": result["server_name"],
|
||||
"project": project,
|
||||
|
|
@ -1041,6 +1045,7 @@ def generate_client_configuration(
|
|||
plan_hash = document_hash(
|
||||
{
|
||||
"schema_version": 1,
|
||||
"docforge_version": DOCFORGE_VERSION,
|
||||
"client": selected_client,
|
||||
"server_name": selected_name,
|
||||
"project": project_binding,
|
||||
|
|
@ -1061,6 +1066,7 @@ def generate_client_configuration(
|
|||
result: dict[str, object] = {
|
||||
"status": "ok",
|
||||
"schema_version": 1,
|
||||
"docforge_version": DOCFORGE_VERSION,
|
||||
"operation": "client.configure",
|
||||
"action": "write" if output is not None else "preview",
|
||||
"client": selected_client,
|
||||
|
|
@ -1278,6 +1284,7 @@ def generate_adapter_client_configuration(
|
|||
result: dict[str, object] = {
|
||||
"status": "ok",
|
||||
"schema_version": 1,
|
||||
"docforge_version": DOCFORGE_VERSION,
|
||||
"operation": "adapter_client.configure",
|
||||
"action": "write" if output is not None else "preview",
|
||||
"client": selected_client,
|
||||
|
|
@ -1351,6 +1358,7 @@ def _adapter_configuration_hash_payload(result: dict[str, object]) -> dict[str,
|
|||
artifact = cast(dict[str, object], result["artifact"])
|
||||
return {
|
||||
"schema_version": 1,
|
||||
"docforge_version": result["docforge_version"],
|
||||
"client": result["client"],
|
||||
"server_name": result["server_name"],
|
||||
"project": result["project"],
|
||||
|
|
@ -1375,6 +1383,8 @@ def _validate_adapter_configuration_result(
|
|||
launcher: AdapterLauncherV1,
|
||||
source_availability: AdapterSourceAvailabilityV1,
|
||||
) -> None:
|
||||
if result.get("docforge_version") != DOCFORGE_VERSION:
|
||||
raise AssertionError("Generated adapter client product version drifted")
|
||||
validate_adapter_launcher(project, launcher)
|
||||
descriptor = project.descriptor
|
||||
project_binding = cast(dict[str, object], result["project"])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue