umf-access 0.1.0.dev8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- umf_access/__init__.py +109 -0
- umf_access/adoption.py +41 -0
- umf_access/build/__init__.py +2 -0
- umf_access/build/approximate.py +34 -0
- umf_access/build/catalog.py +1626 -0
- umf_access/build/commands.py +394 -0
- umf_access/build/pg_privileges.py +1544 -0
- umf_access/build/privileges.py +134 -0
- umf_access/build/search.py +365 -0
- umf_access/build/unity_search.py +104 -0
- umf_access/bulk.py +227 -0
- umf_access/canonical.py +23 -0
- umf_access/capture.py +410 -0
- umf_access/catalog.py +325 -0
- umf_access/codec_support.py +427 -0
- umf_access/commands.py +93 -0
- umf_access/delta_read.py +758 -0
- umf_access/dsl/__init__.py +148 -0
- umf_access/dsl/_context.py +36 -0
- umf_access/dsl/_expressions.py +625 -0
- umf_access/dsl/_joined.py +4 -0
- umf_access/dsl/_nodes.py +207 -0
- umf_access/dsl/_query.py +5559 -0
- umf_access/dsl/_selection.py +143 -0
- umf_access/dsl/navigation.py +302 -0
- umf_access/dsl/render.py +516 -0
- umf_access/dsl/search.py +343 -0
- umf_access/engine_catalog.py +563 -0
- umf_access/generated_core.py +5 -0
- umf_access/lifecycle/__init__.py +46 -0
- umf_access/lifecycle/_darwin_process_observer.c +306 -0
- umf_access/lifecycle/approval.py +366 -0
- umf_access/lifecycle/backfills.py +79 -0
- umf_access/lifecycle/catalog.py +289 -0
- umf_access/lifecycle/cli.py +231 -0
- umf_access/lifecycle/concurrent.py +196 -0
- umf_access/lifecycle/conversion_policy.py +188 -0
- umf_access/lifecycle/correspondence.py +203 -0
- umf_access/lifecycle/generation_authority_bootstrap.py +1491 -0
- umf_access/lifecycle/generation_authority_session.py +125 -0
- umf_access/lifecycle/generation_enrollment_authority.py +1108 -0
- umf_access/lifecycle/generation_enrollment_ledger.py +698 -0
- umf_access/lifecycle/generation_ingress.py +185 -0
- umf_access/lifecycle/generation_root_registry.py +138 -0
- umf_access/lifecycle/head.py +250 -0
- umf_access/lifecycle/head_view.py +81 -0
- umf_access/lifecycle/host.py +1183 -0
- umf_access/lifecycle/ingress_custody.py +750 -0
- umf_access/lifecycle/ingress_local_postgres.py +7990 -0
- umf_access/lifecycle/ingress_store.py +1488 -0
- umf_access/lifecycle/ledger.py +276 -0
- umf_access/lifecycle/ledger_schema.py +116 -0
- umf_access/lifecycle/mixed.py +593 -0
- umf_access/lifecycle/outcome_schema.py +136 -0
- umf_access/lifecycle/owner_approval_core.py +1810 -0
- umf_access/lifecycle/owner_authority.py +472 -0
- umf_access/lifecycle/owner_bootstrap.py +2077 -0
- umf_access/lifecycle/owner_wire.py +161 -0
- umf_access/lifecycle/phase_fence.py +52 -0
- umf_access/lifecycle/phase_policy.py +422 -0
- umf_access/lifecycle/privileges.py +145 -0
- umf_access/lifecycle/probe.py +39 -0
- umf_access/lifecycle/progress.py +497 -0
- umf_access/lifecycle/roles.py +96 -0
- umf_access/lifecycle/row_originals.py +1712 -0
- umf_access/lifecycle/row_originals_creation.py +759 -0
- umf_access/lifecycle/row_originals_receipt.py +413 -0
- umf_access/lifecycle/seeds.py +99 -0
- umf_access/lifecycle/sql_containment.py +358 -0
- umf_access/lifecycle/sql_containment_cli.py +33 -0
- umf_access/lifecycle/sql_containment_parser.py +20 -0
- umf_access/lifecycle/supervisor_journal_codec.py +1251 -0
- umf_access/lifecycle/table_boundary.py +22 -0
- umf_access/lifecycle/target_custody_codec.py +788 -0
- umf_access/lifecycle/witness.py +72 -0
- umf_access/managed_actions.py +271 -0
- umf_access/managed_bulk.py +353 -0
- umf_access/managed_delta.py +150 -0
- umf_access/managed_support.py +166 -0
- umf_access/manifest_commands.py +278 -0
- umf_access/native_actions.py +1007 -0
- umf_access/native_program.py +570 -0
- umf_access/pages.py +125 -0
- umf_access/postgres_bulk.py +509 -0
- umf_access/postgres_read.py +1230 -0
- umf_access/postgres_search.py +639 -0
- umf_access/protocols.py +665 -0
- umf_access/py.typed +0 -0
- umf_access/related_keys.py +233 -0
- umf_access/reviewed.py +706 -0
- umf_access/search_catalog.py +122 -0
- umf_access/targets.py +312 -0
- umf_access/types.py +220 -0
- umf_access/unified/__init__.py +187 -0
- umf_access/unified/_binding.py +654 -0
- umf_access/unified/head_session.py +144 -0
- umf_access/unified/native_binding.py +143 -0
- umf_access/unified/operation_values.py +173 -0
- umf_access/unified/outcome_values.py +76 -0
- umf_access/unified/session_async.py +161 -0
- umf_access/unified/session_binding.py +108 -0
- umf_access/unified/session_policy.py +152 -0
- umf_access/unified/session_psycopg2.py +70 -0
- umf_access/unified/session_sqlalchemy.py +161 -0
- umf_access/unified/session_sync.py +148 -0
- umf_access/unified/table_reads.py +314 -0
- umf_access/unified/table_writes.py +193 -0
- umf_access/unity_search.py +312 -0
- umf_access/values.py +280 -0
- umf_access/verification.py +64 -0
- umf_access-0.1.0.dev8.dist-info/METADATA +15 -0
- umf_access-0.1.0.dev8.dist-info/RECORD +117 -0
- umf_access-0.1.0.dev8.dist-info/WHEEL +4 -0
- umf_access-0.1.0.dev8.dist-info/entry_points.txt +4 -0
- umf_access-0.1.0.dev8.dist-info/licenses/LICENSE-APACHE +201 -0
- umf_access-0.1.0.dev8.dist-info/licenses/LICENSE-MIT +21 -0
- umf_access-0.1.0.dev8.dist-info/licenses/LICENSE.md +239 -0
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
# SPDX-License-Identifier: MIT OR Apache-2.0
|
|
2
|
+
"""Inert original CONTRACT-902 programs and engine-owned manifest dispatch.
|
|
3
|
+
|
|
4
|
+
Registry JSON contains original artifacts only. Native registration, actual-value
|
|
5
|
+
recompilation, attempts, publication and recovery belong to the engine provider.
|
|
6
|
+
"""
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import hashlib
|
|
10
|
+
import re
|
|
11
|
+
from collections.abc import Awaitable, Mapping
|
|
12
|
+
from dataclasses import dataclass
|
|
13
|
+
from datetime import timedelta
|
|
14
|
+
from typing import Any, Protocol, TypeVar, overload
|
|
15
|
+
|
|
16
|
+
from .adoption import TargetIdentity
|
|
17
|
+
from .catalog import Argument, CatalogError, NotCompiledForTarget, TargetPin
|
|
18
|
+
from .commands import AsyncBulkTarget, BulkTarget, CommandVariant
|
|
19
|
+
from .native_program import canonical_json, program_json
|
|
20
|
+
from .types import MISSING, ActionRef
|
|
21
|
+
|
|
22
|
+
PlanT = TypeVar("PlanT", covariant=True) # noqa: PLC0105
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
class ManifestBuildError(ValueError):
|
|
26
|
+
"""Original manifest compilation or retained-source custody refused."""
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class ManifestCompilationError(ManifestBuildError):
|
|
30
|
+
"""Exact bounded original compiler refusal, including its diagnostics."""
|
|
31
|
+
def __init__(self, original_json: str):
|
|
32
|
+
self.original_json = original_json
|
|
33
|
+
super().__init__("WEFT_BLOCKED: " + original_json)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
def _framing(text: str) -> None:
|
|
37
|
+
"""Bound JSON nesting and Unicode framing before the first JSON parse."""
|
|
38
|
+
stack: list[str] = []
|
|
39
|
+
quoted = False
|
|
40
|
+
index = 0
|
|
41
|
+
while index < len(text):
|
|
42
|
+
char = text[index]
|
|
43
|
+
if quoted:
|
|
44
|
+
if char == "\\":
|
|
45
|
+
index += 1
|
|
46
|
+
if index >= len(text) or text[index] not in '\\"/bfnrtu':
|
|
47
|
+
raise ManifestBuildError("MANIFEST_JSON_FRAMING")
|
|
48
|
+
if text[index] == "u":
|
|
49
|
+
token = text[index + 1:index + 5]
|
|
50
|
+
if len(token) != 4 or re.fullmatch(r"[0-9a-fA-F]{4}", token) is None:
|
|
51
|
+
raise ManifestBuildError("MANIFEST_JSON_FRAMING")
|
|
52
|
+
code = int(token, 16)
|
|
53
|
+
index += 4
|
|
54
|
+
if 0xD800 <= code <= 0xDBFF:
|
|
55
|
+
pair = text[index + 1:index + 7]
|
|
56
|
+
low_token = pair[2:]
|
|
57
|
+
if (len(pair) != 6 or pair[:2] != "\\u"
|
|
58
|
+
or re.fullmatch(r"[0-9a-fA-F]{4}", low_token) is None
|
|
59
|
+
or not 0xDC00 <= int(low_token, 16) <= 0xDFFF):
|
|
60
|
+
raise ManifestBuildError("MANIFEST_JSON_UNICODE")
|
|
61
|
+
index += 6
|
|
62
|
+
elif 0xDC00 <= code <= 0xDFFF:
|
|
63
|
+
raise ManifestBuildError("MANIFEST_JSON_UNICODE")
|
|
64
|
+
elif char == '"':
|
|
65
|
+
quoted = False
|
|
66
|
+
elif ord(char) < 0x20:
|
|
67
|
+
raise ManifestBuildError("MANIFEST_JSON_FRAMING")
|
|
68
|
+
elif char == '"':
|
|
69
|
+
quoted = True
|
|
70
|
+
elif char in "[{":
|
|
71
|
+
stack.append(char)
|
|
72
|
+
if len(stack) > 64:
|
|
73
|
+
raise ManifestBuildError("MANIFEST_JSON_DEPTH_LIMIT")
|
|
74
|
+
elif char in "]}" and (not stack or stack.pop() != ("[" if char == "]" else "{")):
|
|
75
|
+
raise ManifestBuildError("MANIFEST_JSON_FRAMING")
|
|
76
|
+
index += 1
|
|
77
|
+
if quoted or stack:
|
|
78
|
+
raise ManifestBuildError("MANIFEST_JSON_FRAMING")
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
def _object(text: str) -> dict[str, Any]:
|
|
82
|
+
if type(text) is not str:
|
|
83
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_INPUT_INVALID")
|
|
84
|
+
try:
|
|
85
|
+
size = len(text.encode("utf-8"))
|
|
86
|
+
except UnicodeError as error:
|
|
87
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_INPUT_INVALID") from error
|
|
88
|
+
if size > 4 * 1024 * 1024:
|
|
89
|
+
raise ManifestBuildError("MANIFEST_JSON_LIMIT")
|
|
90
|
+
_framing(text)
|
|
91
|
+
try:
|
|
92
|
+
value = program_json(text)
|
|
93
|
+
if type(value) is not dict:
|
|
94
|
+
raise ValueError("original object required")
|
|
95
|
+
return value
|
|
96
|
+
except (ValueError, UnicodeError, RecursionError) as error:
|
|
97
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_INPUT_INVALID") from error
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
def _artifact(value: Any) -> dict[str, Any]:
|
|
101
|
+
if (type(value) is not dict or set(value) != {"mediaType", "utf8", "sha256"}
|
|
102
|
+
or value.get("mediaType") != "application/json" or type(value.get("utf8")) is not str):
|
|
103
|
+
raise ManifestBuildError("MANIFEST_ARTIFACT_REQUIRED")
|
|
104
|
+
text = value["utf8"]
|
|
105
|
+
try:
|
|
106
|
+
data = text.encode("utf-8")
|
|
107
|
+
except UnicodeError as error:
|
|
108
|
+
raise ManifestBuildError("MANIFEST_ARTIFACT_INTEGRITY") from error
|
|
109
|
+
if len(data) > 1024 * 1024:
|
|
110
|
+
raise ManifestBuildError("MANIFEST_ARTIFACT_LIMIT")
|
|
111
|
+
if hashlib.sha256(data).hexdigest() != value.get("sha256"):
|
|
112
|
+
raise ManifestBuildError("MANIFEST_ARTIFACT_INTEGRITY")
|
|
113
|
+
return _object(text)
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
def manifest_registry(text: str) -> dict[str, Any]:
|
|
117
|
+
"""Closed original in-memory registry data, never executable host code."""
|
|
118
|
+
registry = _object(text)
|
|
119
|
+
if (set(registry) != {"actions", "selectionBackends"}
|
|
120
|
+
or type(registry["actions"]) is not list or registry["selectionBackends"] != []):
|
|
121
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_REGISTRY_REQUIRED")
|
|
122
|
+
return registry
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
@dataclass(frozen=True)
|
|
126
|
+
class ManifestProgram:
|
|
127
|
+
configuration_json: str
|
|
128
|
+
request_json: str
|
|
129
|
+
response_json: str
|
|
130
|
+
bundle_input_digest: str
|
|
131
|
+
|
|
132
|
+
@classmethod
|
|
133
|
+
def build(cls, compiler: Any, configuration: str, request: Mapping[str, Any], *, bundle_input_digest: str) -> ManifestProgram:
|
|
134
|
+
manifest_registry(configuration)
|
|
135
|
+
factory = getattr(compiler, "MutationCompiler", None)
|
|
136
|
+
if not callable(factory):
|
|
137
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_COMPILER_REQUIRED")
|
|
138
|
+
request_json = canonical_json(dict(request))
|
|
139
|
+
_object(request_json)
|
|
140
|
+
response = factory(configuration).compile_json(request_json)
|
|
141
|
+
program = cls(configuration, request_json, response, bundle_input_digest)
|
|
142
|
+
program.checked()
|
|
143
|
+
return program
|
|
144
|
+
|
|
145
|
+
def checked(self) -> dict[str, Any]:
|
|
146
|
+
if type(self.bundle_input_digest) is not str or re.fullmatch(r"[0-9a-f]{64}", self.bundle_input_digest) is None:
|
|
147
|
+
raise ManifestBuildError("MANIFEST_BUNDLE_DIGEST_REQUIRED")
|
|
148
|
+
try:
|
|
149
|
+
if sum(len(text.encode("utf-8")) for text in (self.configuration_json, self.request_json, self.response_json)) > 4 * 1024 * 1024:
|
|
150
|
+
raise ManifestBuildError("MANIFEST_RETAINED_INPUT_LIMIT")
|
|
151
|
+
except (AttributeError, UnicodeError) as error:
|
|
152
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_INPUT_INVALID") from error
|
|
153
|
+
manifest_registry(self.configuration_json)
|
|
154
|
+
request, response = _object(self.request_json), _object(self.response_json)
|
|
155
|
+
if (request.get("interfaceVersion") != "weft-mutation-compile/0.1.0"
|
|
156
|
+
or response.get("interfaceVersion") != request["interfaceVersion"]):
|
|
157
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_INTERFACE_DIFFERS")
|
|
158
|
+
if response.get("status") != "compiled" or response.get("diagnostics") != []:
|
|
159
|
+
raise ManifestCompilationError(self.response_json)
|
|
160
|
+
plan = _artifact(response.get("plan"))
|
|
161
|
+
model = _artifact(request.get("model"))
|
|
162
|
+
model_pin = request.get("modelPin")
|
|
163
|
+
if type(model_pin) is not dict:
|
|
164
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_SOURCE_DIFFERS")
|
|
165
|
+
if (plan.get("protocol") != "umf.actions.plan/1"
|
|
166
|
+
or plan.get("model") != request.get("modelPin")
|
|
167
|
+
or plan.get("action") != request.get("action")
|
|
168
|
+
or plan.get("target") != request.get("target")
|
|
169
|
+
or request["model"]["sha256"] != model_pin.get("sha256")
|
|
170
|
+
or model.get("id") != model_pin.get("documentId")):
|
|
171
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_SOURCE_DIFFERS")
|
|
172
|
+
selection = plan.get("selection")
|
|
173
|
+
if type(selection) is not dict:
|
|
174
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_SELECTION_REQUIRED")
|
|
175
|
+
_artifact(selection.get("artifact"))
|
|
176
|
+
source = _artifact(plan.get("source"))
|
|
177
|
+
if source != {key: request.get(key) for key in ("dialect", "sql", "parameters")}:
|
|
178
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_SOURCE_DIFFERS")
|
|
179
|
+
provenance = response.get("provenance")
|
|
180
|
+
if (type(provenance) is not dict or provenance.get("action") != request["action"]
|
|
181
|
+
or provenance.get("sourceSha256") != plan["source"]["sha256"]
|
|
182
|
+
or _artifact(provenance.get("parameters")) != request.get("parameters")):
|
|
183
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_PROVENANCE_DIFFERS")
|
|
184
|
+
return response["plan"]
|
|
185
|
+
|
|
186
|
+
def bind(self, action: ActionRef[Any, Any]) -> None:
|
|
187
|
+
self.checked()
|
|
188
|
+
request = _object(self.request_json)
|
|
189
|
+
source = action.source
|
|
190
|
+
if any(getattr(model, "UMF_BUNDLE_INPUT_DIGEST", None) != self.bundle_input_digest
|
|
191
|
+
for model in (action.input_type, action.output_type) if model is not type(None)):
|
|
192
|
+
raise ManifestBuildError("MANIFEST_GENERATED_BUNDLE_DIFFERS")
|
|
193
|
+
expected = {"identity": {"module": source.module, "action": source.action},
|
|
194
|
+
"documentSha256": source.document_sha256,
|
|
195
|
+
"invocation": {"id": source.invocation_id, "version": source.invocation_version}}
|
|
196
|
+
model_pin = request.get("modelPin", {})
|
|
197
|
+
if (request.get("action") != expected
|
|
198
|
+
or model_pin.get("documentId") != source.document_id
|
|
199
|
+
or model_pin.get("umfVersion") != source.core_version
|
|
200
|
+
or model_pin.get("sha256") != source.document_sha256):
|
|
201
|
+
raise ManifestBuildError("MANIFEST_ACTION_SOURCE_DIFFERS")
|
|
202
|
+
|
|
203
|
+
def verify_original(self, compiler: Any) -> None:
|
|
204
|
+
"""Recompile retained witness inputs; this still grants no authority."""
|
|
205
|
+
self.checked()
|
|
206
|
+
factory = getattr(compiler, "MutationCompiler", None)
|
|
207
|
+
if not callable(factory) or factory(self.configuration_json).compile_json(self.request_json) != self.response_json:
|
|
208
|
+
raise ManifestBuildError("MANIFEST_ORIGINAL_RECOMPILATION_DIFFERS")
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
@dataclass(frozen=True)
|
|
212
|
+
class ManifestCommandVariant:
|
|
213
|
+
presence: tuple[str, ...]
|
|
214
|
+
pin: TargetPin
|
|
215
|
+
program: ManifestProgram
|
|
216
|
+
action: ActionRef[Any, Any]
|
|
217
|
+
parameters: tuple[tuple[str, str, str | None], ...]
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class ManifestBulkTarget(Protocol[PlanT]):
|
|
221
|
+
"""Engine provider; recompile original source with actual validated params.
|
|
222
|
+
|
|
223
|
+
A retained witness plan is never patched or submitted as actual intent.
|
|
224
|
+
Native attempts and the returned plan lifecycle remain engine-owned.
|
|
225
|
+
"""
|
|
226
|
+
def identity(self) -> TargetIdentity: ...
|
|
227
|
+
def plan(self, entry: ManifestCommandVariant, params: Mapping[str, object], *, timeout: timedelta | None = None) -> PlanT: ...
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
class AsyncManifestBulkTarget(Protocol[PlanT]):
|
|
231
|
+
"""Async engine provider with the same original-value compilation contract."""
|
|
232
|
+
def identity(self) -> TargetIdentity: ...
|
|
233
|
+
async def plan(self, entry: ManifestCommandVariant, params: Mapping[str, object], *, timeout: timedelta | None = None) -> PlanT: ...
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
@dataclass(frozen=True)
|
|
237
|
+
class ManifestCommandPlan:
|
|
238
|
+
name: str
|
|
239
|
+
arguments: tuple[Argument, ...]
|
|
240
|
+
variants: tuple[ManifestCommandVariant, ...]
|
|
241
|
+
|
|
242
|
+
@overload
|
|
243
|
+
def run(self, target: AsyncManifestBulkTarget[PlanT], values: Mapping[str, object], *, timeout: timedelta | None = None) -> Awaitable[PlanT]: ...
|
|
244
|
+
@overload
|
|
245
|
+
def run(self, target: ManifestBulkTarget[PlanT], values: Mapping[str, object], *, timeout: timedelta | None = None) -> PlanT: ...
|
|
246
|
+
def run(self, target: Any, values: Mapping[str, object], *, timeout: timedelta | None = None) -> Any:
|
|
247
|
+
return _run(self, target, values, timeout)
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
@dataclass(frozen=True)
|
|
251
|
+
class MixedManifestCommandPlan:
|
|
252
|
+
"""One catalog dispatching distinct original raw and manifest variants."""
|
|
253
|
+
name: str
|
|
254
|
+
arguments: tuple[Argument, ...]
|
|
255
|
+
variants: tuple[CommandVariant | ManifestCommandVariant, ...]
|
|
256
|
+
|
|
257
|
+
@overload
|
|
258
|
+
def run(self, target: AsyncBulkTarget[PlanT] | AsyncManifestBulkTarget[PlanT], values: Mapping[str, object], *, timeout: timedelta | None = None) -> Awaitable[PlanT]: ...
|
|
259
|
+
@overload
|
|
260
|
+
def run(self, target: BulkTarget[PlanT] | ManifestBulkTarget[PlanT], values: Mapping[str, object], *, timeout: timedelta | None = None) -> PlanT: ...
|
|
261
|
+
def run(self, target: Any, values: Mapping[str, object], *, timeout: timedelta | None = None) -> Any:
|
|
262
|
+
return _run(self, target, values, timeout)
|
|
263
|
+
|
|
264
|
+
|
|
265
|
+
def _run(plan: ManifestCommandPlan | MixedManifestCommandPlan, target: Any, values: Mapping[str, object], timeout: timedelta | None) -> Any:
|
|
266
|
+
if set(values) != {a.name for a in plan.arguments}:
|
|
267
|
+
raise CatalogError("exact command argument inventory required")
|
|
268
|
+
checked = {a.name: a.validate(values[a.name]) for a in plan.arguments}
|
|
269
|
+
presence = tuple(a.name for a in plan.arguments if a.optional and checked[a.name] is not MISSING)
|
|
270
|
+
identity = target.identity()
|
|
271
|
+
matches = [v for v in plan.variants if v.presence == presence and v.pin.matches(identity)]
|
|
272
|
+
if len(matches) != 1:
|
|
273
|
+
raise NotCompiledForTarget("no unique original manifest command for target and presence")
|
|
274
|
+
entry = matches[0]
|
|
275
|
+
entry.program.bind(entry.action)
|
|
276
|
+
params = {name: getattr(checked[source], component) if component is not None else checked[source]
|
|
277
|
+
for name, source, component in entry.parameters}
|
|
278
|
+
return target.plan(entry, params, timeout=timeout)
|