qwen-code/docs/archive/managed-agent-schema/sql/V21__managed_tool_publication_objects.sql
jinye 1f39a80bf0
feat(managed-agent): consolidate persistence into a 32-table baseline (#14069)
* feat(managed-agent): consolidate persistence into a 32-table baseline

Preserve journal, idempotency, runtime, physical storage and recovery boundaries in a shared fresh-database schema. Add fixed snapshots, typed operations, scoped resource collection and atomic automation projections with MySQL fault and load coverage.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(managed-agent): restore schema CI and channel claim fencing

Avoid nested snapshot connection borrowing while preserving committed read-lease expiry and retirement checks. Carry reserved channel reconciliation identities into private journal commands and retain UNKNOWN no-resend behavior.

Update canonical-schema fixtures, migration discovery and application packaging. Preserve the 32-table fresh-database boundary and record local versus pending CI acceptance in both languages.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(managed-agent): refuse system catalogs before schema initialization

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(managed-agent): restore fresh-schema E2E and MariaDB validation

Port the real-stack runner and its audits to canonical tables, retain stream and approval scopes, and register fresh Linux storage before Harness admission.

Validate MariaDB CHECK enforcement and InnoDB without relying on MySQL-only metadata or negative-test syntax. Add regression coverage and document current platform and acceptance boundaries.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(managed-agent): normalize boolean CASE catalog literals

Accept MariaDB's numeric representation of bare SQL boolean literals while retaining structural CHECK validation, quoted values and enforcement guards.

Add alias and tamper regression coverage and synchronize the bilingual verification evidence.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(ci): raise managed schema MariaDB packet budget

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(managed-agent): support MariaDB load-test query plans

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(managed-agent): Restore native storage fixtures and const read witnesses

Preserve measured row counts while bounding MariaDB optimization-stage page reads, and register Linux Hosted test storage through the production guard before tool admission. Keep recovery registration across restarts and resolve physical owners through aliases.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(managed-agent): Await snapshot publication in retraction checks

Keep the strict terminal snapshot watermark assertion while allowing after-commit publication to finish under the concurrent materializer.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
2026-10-14 00:58:38 +00:00

66 lines
3.1 KiB
SQL

ALTER TABLE qwen_tool_publication ADD COLUMN producer_phase VARCHAR(32) NOT NULL DEFAULT 'OPEN';
ALTER TABLE qwen_tool_publication ADD COLUMN quarantined BOOLEAN NOT NULL DEFAULT FALSE;
ALTER TABLE qwen_tool_publication ADD COLUMN active_operation_id VARCHAR(128);
ALTER TABLE qwen_tool_publication ADD COLUMN finish_operation_id VARCHAR(128);
ALTER TABLE qwen_tool_publication ADD COLUMN finish_predecessor_id VARCHAR(128);
ALTER TABLE qwen_tool_publication ADD COLUMN finish_digest CHAR(64);
ALTER TABLE qwen_tool_publication ADD COLUMN terminal_resource_id VARCHAR(128);
ALTER TABLE qwen_tool_publication ADD COLUMN admission_resource_id VARCHAR(128);
ALTER TABLE qwen_tool_publication ADD COLUMN receipt_sequence BIGINT;
ALTER TABLE qwen_tool_publication ADD COLUMN receipt_revision BIGINT;
ALTER TABLE qwen_tool_publication ADD COLUMN capture_held_bytes BIGINT NOT NULL DEFAULT 0;
ALTER TABLE qwen_tool_publication ADD COLUMN producer_held_bytes BIGINT NOT NULL DEFAULT 0;
ALTER TABLE qwen_tool_publication ADD COLUMN admission_held_bytes BIGINT NOT NULL DEFAULT 0;
ALTER TABLE qwen_tool_publication ADD COLUMN capture_used_bytes BIGINT NOT NULL DEFAULT 0;
ALTER TABLE qwen_tool_publication ADD COLUMN producer_used_bytes BIGINT NOT NULL DEFAULT 0;
ALTER TABLE qwen_tool_publication ADD COLUMN admission_used_bytes BIGINT NOT NULL DEFAULT 0;
UPDATE qwen_tool_publication SET capture_held_bytes = capture_bytes,
producer_held_bytes = producer_bytes,
admission_held_bytes = admission_bytes
WHERE state <> 'NOT_STARTED';
CREATE TABLE qwen_tool_publication_object (
scope_key CHAR(64) NOT NULL,
publication_id VARCHAR(128) NOT NULL,
slot_key VARCHAR(256) NOT NULL,
resource_id VARCHAR(128),
resource_kind VARCHAR(128),
byte_length BIGINT NOT NULL,
sha256 CHAR(64) NOT NULL,
object_key VARCHAR(512),
inline_bytes MEDIUMBLOB,
state VARCHAR(32) NOT NULL,
operation_id VARCHAR(128) NOT NULL,
created_at DATETIME(6) NOT NULL,
PRIMARY KEY (scope_key, publication_id, slot_key),
CONSTRAINT uq_tool_publication_resource
UNIQUE (scope_key, resource_id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE TABLE qwen_tool_publication_operation (
scope_key CHAR(64) NOT NULL,
publication_id VARCHAR(128) NOT NULL,
operation_id VARCHAR(128) NOT NULL,
request_digest CHAR(64) NOT NULL,
slot_key VARCHAR(256),
state VARCHAR(32) NOT NULL,
claim_owner VARCHAR(128),
claim_epoch BIGINT NOT NULL,
claim_until DATETIME(6),
deadline DATETIME(6) NOT NULL,
receipt_json MEDIUMTEXT,
created_at DATETIME(6) NOT NULL,
PRIMARY KEY (scope_key, publication_id, operation_id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
CREATE TABLE qwen_tool_publication_seal (
scope_key CHAR(64) NOT NULL,
publication_id VARCHAR(128) NOT NULL,
stream_id VARCHAR(16) NOT NULL,
segment_count INT NOT NULL,
byte_length BIGINT NOT NULL,
sha256 CHAR(64) NOT NULL,
operation_id VARCHAR(128) NOT NULL,
PRIMARY KEY (scope_key, publication_id, stream_id)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;