feat(ql3): execute copilot diagnosis tools

This commit is contained in:
whyour
2026-08-15 16:39:19 +08:00
parent 0163c94be7
commit 9c90c6ce82
25 changed files with 2952 additions and 27 deletions
@@ -20,6 +20,7 @@ const {
LOCAL_MODEL_PRICE_CATALOG_AUTHORIZATION_MIGRATION_ID,
LOCAL_MODEL_PRICE_CATALOG_MIGRATION_ID,
POSTGRES_COPILOT_FAILURE_DIAGNOSIS_ADMISSION_MIGRATION_ID,
POSTGRES_COPILOT_FAILURE_DIAGNOSIS_TOOL_UNLOCK_MIGRATION_ID,
POSTGRES_MODEL_INVOCATION_MIGRATION_ID,
POSTGRES_MODEL_INVOCATION_MIGRATION_HISTORY_TABLE,
POSTGRES_MODEL_INVOCATION_MIGRATION_STREAM_ID,
@@ -426,6 +427,10 @@ test('PostgreSQL AI schema is an independent reviewed feature stream', async ()
POSTGRES_COPILOT_FAILURE_DIAGNOSIS_ADMISSION_MIGRATION_ID,
'pg-9018-ai-copilot-failure-diagnosis-admissions',
);
assert.equal(
POSTGRES_COPILOT_FAILURE_DIAGNOSIS_TOOL_UNLOCK_MIGRATION_ID,
'pg-9019-ai-copilot-failure-diagnosis-tool-unlocks',
);
assert.equal(
POSTGRES_MODEL_INVOCATION_MIGRATION_HISTORY_TABLE,
'ai_schema_migrations',
@@ -507,9 +512,13 @@ test('PostgreSQL AI schema is an independent reviewed feature stream', async ()
postgresModelInvocationMigrationDefinition.migrations[17].checksum,
'cd0837c68ecc6c2bce58d048308d0239397b6347b4483f02372f966c05ae7ad6',
);
assert.equal(
postgresModelInvocationMigrationDefinition.migrations[18].checksum,
'341733fde691e81efafabc9749197514d83af6c851e91ea55d85074d2dec6b4f',
);
assert.equal(
postgresModelInvocationMigrationDefinition.migrations.length,
18,
19,
);
const diagnosisAdmissionStatements = [];
@@ -537,6 +546,25 @@ test('PostgreSQL AI schema is an independent reviewed feature stream', async ()
assert.match(diagnosisAdmissionSql, /TO ql3_runtime/);
assert.doesNotMatch(diagnosisAdmissionSql, /GRANT[^;]*(?:UPDATE|DELETE)/);
const diagnosisToolUnlockStatements = [];
await postgresModelInvocationMigrationDefinition.migrations[18].up({
async query(statement) {
diagnosisToolUnlockStatements.push(statement);
return { rows: [] };
},
});
const diagnosisToolUnlockSql = diagnosisToolUnlockStatements.join('\n');
assert.match(
diagnosisToolUnlockSql,
/CREATE TABLE "ql3_ai"\."copilot_failure_diagnosis_tool_unlocks"/,
);
assert.match(
diagnosisToolUnlockSql,
/FOREIGN KEY \(start_id\)[\s\S]*tool_execution_completions/,
);
assert.match(diagnosisToolUnlockSql, /TO ql3_runtime/);
assert.doesNotMatch(diagnosisToolUnlockSql, /GRANT[^;]*(?:UPDATE|DELETE)/);
const retirementStatements = [];
await postgresModelInvocationMigrationDefinition.migrations[10].up({
async query(statement) {