Files
crank/crates/crank-registry/src/migrations/schema_guard/required_tables.rs
T
bsodfather 54ce770682
CI / Rust Checks (pull_request) Failing after 13m41s
CI / UI Checks (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Deploy (pull_request) Skipped
Community Release / release (push) Failing after 13m33s
feat(epic3): deliver the accepted Epic 3 scope through Story 3.17
Recovery delivery of the accumulated, TL-accepted Epic 3 work that had never been
committed to Git (stories 3.6-3.17, see the crank board). Story 3.18 is not accepted
yet and is deliberately excluded: its logging surface, its capability registration,
its oracle projections and its tests are not part of this tree.

Accepted scope
- 3.6 typed static Resource Drafts; 3.7 publication and exact binding of static
  Resource Versions; 3.8 MCP discovery/read and revocation of static Resources;
- 3.9 Resource import/export in API and UI plus TLS dependency maintenance;
  3.10 REST-backed Resource templates; 3.11 shared REST read runtime and the MCP
  revision/capability foundation;
- 3.12 parameterised Prompt Drafts with preview; 3.13 Prompt publication and exact
  version binding to Agents; 3.14 MCP prompts; 3.15 Prompt import/export;
- 3.16 composite Prompts with published Resources (dependency content scan plus
  dynamic read through the accepted 3.11 runtime, admin preview and MCP prompts/get);
- 3.17 bounded MCP completion suggestions from typed published schemas and the
  resources/list admission fix for bound template publications.

Accepted evidence being reused (unchanged code paths)
- 3.16 candidate: core 7, admin-api 22, registry 4, mcp-server 4, UI 6; one final
  `just verify` run 1651 passed / 0 failed / 2 ignored.
- 3.17 candidate: full run 1672 passed / 0 failed / 2 ignored, QA targeted reruns and
  a real MCP Inspector 2.12.0 client smoke.

Delivery engineering in this commit
- CI: one event per change (feature branches are gated by their pull request, push
  runs only on main), story events run the changed packages, the full workspace suite
  stays the feature/release gate; no cache/sharding without a measured runner check.
- Release: the packaged archives, checksums and SBOM are now uploaded to the Gitea
  release entry of the tag instead of dying with the runner workspace.

Not included on purpose: Story 3.18 work, build caches, runtime databases, local
credentials and scratch evidence.

Refs: crank kanban t_e39d7263; baseline 1b6db09bd1.
2026-10-25 09:08:22 +00:00

415 lines
11 KiB
Rust

//! Статические таблицы ожидаемой схемы (вынесены из `schema_guard.rs`, чтобы
//! файл оставался в пределах rust-code-health); поведение guard не меняется.
pub(crate) const OWNED_RELATIONS: &[&str] = &[
"__crank_core_migrations",
"__crank_migrations",
"__crank_migration_legacy_audit",
"__crank_mcp_migrations",
"__crank_ext_migrations",
"mcp_transport_sessions",
"workspaces",
"users",
"memberships",
"user_sessions",
"invitation_tokens",
"platform_api_keys",
"operations",
"operation_versions",
"published_operations",
"operation_samples",
"descriptors",
"agents",
"agent_versions",
"published_agents",
"agent_operation_bindings",
"secrets",
"secret_versions",
"master_key_identities",
"master_key_rotations",
"auth_profiles",
"workspace_upstreams",
"yaml_import_jobs",
"import_jobs",
"approval_requests",
"invocation_logs",
"usage_rollups",
"artifact_blobs",
"artifact_sources",
"import_plans",
"import_plan_applications",
"onboarding_import_selections",
"resources",
"resource_versions",
"resource_publications",
"agent_resource_bindings",
"resource_security_revocations",
"resource_template_sources",
"prompts",
"prompt_versions",
"prompt_arguments",
"prompt_messages",
"prompt_dependencies",
"prompt_message_resource_refs",
];
pub(crate) const REQUIRED_COLUMNS: &[(&str, &[&str])] = &[
(
"__crank_core_migrations",
&["version", "description", "checksum", "applied_at"],
),
(
"__crank_migrations",
&[
"version",
"name",
"checksum",
"phase",
"compatibility",
"applied_at",
],
),
(
"__crank_migration_legacy_audit",
&["source", "source_version", "source_checksum", "imported_at"],
),
(
"__crank_mcp_migrations",
&["version", "checksum", "applied_at"],
),
(
"__crank_ext_migrations",
&["extension_name", "version", "checksum", "applied_at"],
),
(
"mcp_transport_sessions",
&[
"id",
"protocol_version",
"initialized",
"supports_elicitation",
"workspace_slug",
"agent_slug",
"created_at",
"updated_at",
"expires_at",
],
),
(
"master_key_identities",
&[
"epoch",
"fingerprint",
"cipher_contract",
"status",
"backup_ref",
"created_at",
"activated_at",
"retired_at",
],
),
(
"master_key_rotations",
&[
"id",
"source_epoch",
"target_epoch",
"target_fingerprint",
"state",
"backup_ref",
"checkpoint_secret_id",
"total_secret_versions",
"processed_secret_versions",
"verified_secret_versions",
"failure_code",
"created_at",
"updated_at",
],
),
(
"prompts",
&[
"workspace_id",
"prompt_id",
"name",
"description",
"status",
"sensitivity",
"current_draft_version",
"latest_published_version",
"created_at",
"updated_at",
],
),
(
"prompt_versions",
&["workspace_id", "prompt_id", "version", "created_at"],
),
(
"prompt_arguments",
&[
"workspace_id",
"prompt_id",
"version",
"argument_name",
"argument_type",
"required",
"default_value",
"enumeration",
"position",
],
),
(
"prompt_messages",
&[
"workspace_id",
"prompt_id",
"version",
"position",
"role",
"content",
],
),
(
"prompt_dependencies",
&[
"workspace_id",
"prompt_id",
"version",
"dependency_position",
"resource_id",
"resource_version",
"digest",
"kind",
"mime_type",
"source_class",
"sensitivity",
],
),
(
"prompt_message_resource_refs",
&[
"workspace_id",
"prompt_id",
"version",
"message_position",
"ref_position",
"dependency_position",
],
),
];
pub(crate) const REQUIRED_COLUMN_TYPES: &[(&str, &str, &str, bool)] = &[
("__crank_core_migrations", "version", "integer", false),
("__crank_core_migrations", "description", "text", false),
("__crank_core_migrations", "checksum", "text", false),
(
"__crank_core_migrations",
"applied_at",
"timestamp with time zone",
false,
),
("__crank_migrations", "version", "bigint", false),
("__crank_migrations", "name", "text", false),
("__crank_migrations", "checksum", "text", false),
("__crank_migrations", "phase", "text", false),
("__crank_migrations", "compatibility", "text", false),
(
"__crank_migrations",
"applied_at",
"timestamp with time zone",
false,
),
("__crank_migration_legacy_audit", "source", "text", false),
(
"__crank_migration_legacy_audit",
"source_version",
"bigint",
false,
),
(
"__crank_migration_legacy_audit",
"source_checksum",
"text",
false,
),
(
"__crank_migration_legacy_audit",
"imported_at",
"timestamp with time zone",
false,
),
("__crank_mcp_migrations", "version", "integer", false),
("__crank_mcp_migrations", "checksum", "text", false),
(
"__crank_mcp_migrations",
"applied_at",
"timestamp with time zone",
false,
),
("__crank_ext_migrations", "extension_name", "text", false),
("__crank_ext_migrations", "version", "integer", false),
("__crank_ext_migrations", "checksum", "text", true),
(
"__crank_ext_migrations",
"applied_at",
"timestamp with time zone",
false,
),
("mcp_transport_sessions", "id", "text", false),
("mcp_transport_sessions", "protocol_version", "text", false),
("mcp_transport_sessions", "initialized", "boolean", false),
(
"mcp_transport_sessions",
"supports_elicitation",
"boolean",
false,
),
("mcp_transport_sessions", "workspace_slug", "text", false),
("mcp_transport_sessions", "agent_slug", "text", false),
(
"mcp_transport_sessions",
"created_at",
"timestamp with time zone",
false,
),
(
"mcp_transport_sessions",
"updated_at",
"timestamp with time zone",
false,
),
(
"mcp_transport_sessions",
"expires_at",
"timestamp with time zone",
true,
),
("master_key_identities", "epoch", "bigint", false),
("master_key_identities", "fingerprint", "text", false),
("master_key_identities", "cipher_contract", "text", false),
("master_key_identities", "status", "text", false),
("master_key_identities", "backup_ref", "text", true),
(
"master_key_identities",
"created_at",
"timestamp with time zone",
false,
),
(
"master_key_identities",
"activated_at",
"timestamp with time zone",
true,
),
(
"master_key_identities",
"retired_at",
"timestamp with time zone",
true,
),
("master_key_rotations", "id", "text", false),
("master_key_rotations", "source_epoch", "bigint", false),
("master_key_rotations", "target_epoch", "bigint", false),
("master_key_rotations", "target_fingerprint", "text", false),
("master_key_rotations", "state", "text", false),
("master_key_rotations", "backup_ref", "text", true),
("master_key_rotations", "checkpoint_secret_id", "text", true),
(
"master_key_rotations",
"total_secret_versions",
"bigint",
false,
),
(
"master_key_rotations",
"processed_secret_versions",
"bigint",
false,
),
(
"master_key_rotations",
"verified_secret_versions",
"bigint",
false,
),
("master_key_rotations", "failure_code", "text", true),
(
"master_key_rotations",
"created_at",
"timestamp with time zone",
false,
),
(
"master_key_rotations",
"updated_at",
"timestamp with time zone",
false,
),
("prompts", "workspace_id", "text", false),
("prompts", "prompt_id", "text", false),
("prompts", "name", "text", false),
("prompts", "description", "text", false),
("prompts", "status", "text", false),
("prompts", "sensitivity", "text", false),
("prompts", "current_draft_version", "integer", false),
("prompts", "created_at", "timestamp with time zone", false),
("prompts", "updated_at", "timestamp with time zone", false),
("prompt_versions", "workspace_id", "text", false),
("prompt_versions", "prompt_id", "text", false),
("prompt_versions", "version", "integer", false),
(
"prompt_versions",
"created_at",
"timestamp with time zone",
false,
),
("prompt_arguments", "workspace_id", "text", false),
("prompt_arguments", "prompt_id", "text", false),
("prompt_arguments", "version", "integer", false),
("prompt_arguments", "argument_name", "text", false),
("prompt_arguments", "argument_type", "text", false),
("prompt_arguments", "required", "boolean", false),
("prompt_arguments", "default_value", "jsonb", true),
("prompt_arguments", "enumeration", "jsonb", true),
("prompt_arguments", "position", "integer", false),
("prompt_messages", "workspace_id", "text", false),
("prompt_messages", "prompt_id", "text", false),
("prompt_messages", "version", "integer", false),
("prompt_messages", "position", "integer", false),
("prompt_messages", "role", "text", false),
("prompt_messages", "content", "text", false),
("prompt_dependencies", "workspace_id", "text", false),
(
"prompt_dependencies",
"dependency_position",
"integer",
false,
),
("prompt_dependencies", "resource_id", "text", false),
("prompt_dependencies", "resource_version", "integer", false),
("prompt_dependencies", "digest", "text", false),
("prompt_dependencies", "kind", "text", false),
("prompt_dependencies", "mime_type", "text", false),
("prompt_dependencies", "source_class", "text", false),
("prompt_dependencies", "sensitivity", "text", false),
(
"prompt_message_resource_refs",
"message_position",
"integer",
false,
),
(
"prompt_message_resource_refs",
"ref_position",
"integer",
false,
),
(
"prompt_message_resource_refs",
"dependency_position",
"integer",
false,
),
];