Authorize upo test mutations and resolve SQL layers

This commit is contained in:
2026-07-22 03:19:34 +03:00
parent 38373409d3
commit 1af36292f7
3 changed files with 22 additions and 11 deletions
+5
View File
@@ -16,6 +16,11 @@
- For training/download containers on `docker-gpu`, sync the current repo into `Z:\LLM\model-chat-app` first. These containers should read code from the synced app directory, not directly from `Z:\codex\LLM`. - For training/download containers on `docker-gpu`, sync the current repo into `Z:\LLM\model-chat-app` first. These containers should read code from the synced app directory, not directly from `Z:\codex\LLM`.
- Do not store credentials, tokens, model secrets, or host passwords in repositories or project files. - Do not store credentials, tokens, model secrets, or host passwords in repositories or project files.
## `upo_test` mutation scope
- `upo_test` is an isolated test infobase. The user has authorized full read/write adapter checks there, including controlled SQL saved-state changes and rollback.
- This authorization does not turn an adapter-side marker into a native repository lock. When repository coordination is enabled, keep the configured request/confirmation scope and never claim automatic lock verification in the SQL-only adapter version.
## Test-system security profile ## Test-system security profile
- This project currently runs as an isolated test system; use the minimum security profile unless the user explicitly requests production hardening. - This project currently runs as an isolated test system; use the minimum security profile unless the user explicitly requests production hardening.
+16 -11
View File
@@ -46852,20 +46852,23 @@ def validate_repository_request_objects_sql(payload: dict[str, Any]) -> tuple[di
return payload, {"schema": "onec_repository_lock_request.v1", "method": repository_control.METHOD_LOCK_REQUEST, **object_error} return payload, {"schema": "onec_repository_lock_request.v1", "method": repository_control.METHOD_LOCK_REQUEST, **object_error}
base_id = str(payload.get("base_id") or "").strip() base_id = str(payload.get("base_id") or "").strip()
canonical_objects: list[str] = [] canonical_objects: list[str] = []
resolutions: list[dict[str, Any]] = []
for public_ref in objects or []: for public_ref in objects or []:
kind_text, separator, name = public_ref.partition(".") kind_text, separator, name = public_ref.partition(".")
if not separator or not kind_text.strip() or not name.strip(): if not separator or not kind_text.strip() or not name.strip():
return payload, invalid_argument(repository_control.METHOD_LOCK_REQUEST, "objects", f"Repository object '{public_ref}' must use a public Kind.Name reference.") return payload, invalid_argument(repository_control.METHOD_LOCK_REQUEST, "objects", f"Repository object '{public_ref}' must use a public Kind.Name reference.")
result = get_object( result: dict[str, Any] = {}
canonical_kind(kind_text), resolved_table = ""
name, attempts: list[dict[str, Any]] = []
base_id=base_id, for table in ("Config", "ConfigSave", "ConfigCASSave"):
view="effective", result = get_object(
limit=20, canonical_kind(kind_text), name, base_id=base_id, view="effective", limit=20,
timeout_seconds=int(payload.get("timeout_seconds") or 60), timeout_seconds=int(payload.get("timeout_seconds") or 60), table=table, include_semantic=False,
table="Config", )
include_semantic=False, attempts.append({"table": table, "status": result.get("status")})
) if result.get("status") == "ok" and isinstance(result.get("object"), dict):
resolved_table = table
break
if result.get("status") != "ok" or not isinstance(result.get("object"), dict): if result.get("status") != "ok" or not isinstance(result.get("object"), dict):
return payload, { return payload, {
"schema": "onec_repository_lock_request.v1", "schema": "onec_repository_lock_request.v1",
@@ -46874,14 +46877,16 @@ def validate_repository_request_objects_sql(payload: dict[str, Any]) -> tuple[di
"status": "not_found", "status": "not_found",
"error": "repository_object_not_found_in_sql", "error": "repository_object_not_found_in_sql",
"object": public_ref, "object": public_ref,
"diagnostics": result, "diagnostics": {"attempts": attempts, "last_result": result},
} }
card = result["object"] card = result["object"]
resolved_kind = str(card.get("kind_ru") or card.get("public_kind") or card.get("kind") or kind_text).strip() resolved_kind = str(card.get("kind_ru") or card.get("public_kind") or card.get("kind") or kind_text).strip()
resolved_name = str(card.get("name") or name).strip() resolved_name = str(card.get("name") or name).strip()
canonical_objects.append(f"{resolved_kind}.{resolved_name}") canonical_objects.append(f"{resolved_kind}.{resolved_name}")
resolutions.append({"requested_object": public_ref, "resolved_object": canonical_objects[-1], "table": resolved_table, "source": "live_sql"})
normalized = dict(payload) normalized = dict(payload)
normalized["objects"] = canonical_objects normalized["objects"] = canonical_objects
normalized["sql_resolution"] = resolutions
return normalized, None return normalized, None
@@ -358,6 +358,7 @@ def create_lock_request(payload: dict[str, Any]) -> dict[str, Any]:
"created_at": time.time(), "created_at": time.time(),
"status": "pending_user_lock", "status": "pending_user_lock",
"execution": "manual", "execution": "manual",
"sql_resolution": payload.get("sql_resolution") if isinstance(payload.get("sql_resolution"), list) else [],
} }
_audit(state, "lock_request_created", request_id=request_id, base_id=base_id, objects=plan["lock_objects"]) _audit(state, "lock_request_created", request_id=request_id, base_id=base_id, objects=plan["lock_objects"])
_write_state(state) _write_state(state)