Files
ai-contract-platform/project-docs/V2-phase3-ai-platform-tenant-trace-governance-smoke-verification-2026-07-02.md
yuqei a3bb78e06b
Security Quality Gate / npm audit, Bandit, pip-audit, detect-secrets (pull_request) Failing after 16m35s
release: freeze V2 release candidate
2026-07-12 15:32:24 +08:00

3.8 KiB

V2 Phase 3 AI Platform Tenant And Trace Governance Smoke Verification

Date: 2026-07-02

Status

Passed on the 192.168.3.90 V2 smoke environment.

Smoke URLs:

  • Contract Web: http://192.168.3.90:13000
  • Contract API: http://192.168.3.90:18100
  • AI Platform API: http://192.168.3.90:18101

Final deploy artifact:

  • project-docs/qa-artifacts/v2-smoke-docker-deploy/2026-07-02T19-49-49

Deployment

Command:

$env:SSHPASS='***'
powershell.exe -NoProfile -ExecutionPolicy Bypass -File yuqei-infra\scripts\deploy-v2-smoke-docker.ps1 `
  -UseSshpass `
  -AllowDirtyWorktree `
  -KeepRemoteBackup

Result:

V2_SMOKE_DOCKER_DEPLOY_PASS project-docs/qa-artifacts/v2-smoke-docker-deploy/2026-07-02T19-49-49

Runtime Schema Check

Endpoint:

GET http://192.168.3.90:18101/api/v1/runtime/schema-check

Result:

{
  "status": "ok",
  "alembic": {
    "actual": "20260624_0019",
    "expected_head": "20260624_0019"
  },
  "tenant_columns": "ok",
  "trace_governance_columns": "ok"
}

API Verification

Verified endpoints:

  • GET /api/v1/audit/ai-runs?limit=1
  • GET /api/v1/audit/ai-runs/{run_id}
  • GET /api/v1/knowledge-import-batches?limit=3
  • GET /api/v1/knowledge-import-batches/{batch_id}/documents?limit=2
  • GET /api/v1/knowledge-documents/search?keyword=合同&limit=2
  • GET /api/v1/audit/quality-improvement-actions?limit=3

Final sample result:

{
  "schema_status": "ok",
  "alembic": {
    "version_table": "ai_platform_alembic_version",
    "actual": "20260624_0019",
    "expected_head": "20260624_0019"
  },
  "tenant_columns": "ok",
  "trace_governance_columns": "ok",
  "ai_runs": {
    "count": 1,
    "first_id": "run-31f385a39ece",
    "tenant_id": "default",
    "redaction_status": "not_required",
    "archive_status": "active"
  },
  "ai_run_detail": {
    "ok": true,
    "tenant_id": "default",
    "redaction_policy": "default",
    "retention_until": null,
    "archived_at": null
  },
  "knowledge_import_batches": {
    "count": 3,
    "first_id": "perf-batch-00001",
    "tenant_id": "default"
  },
  "knowledge_batch_documents": {
    "count": 2,
    "first_id": "perf-doc-001000",
    "tenant_id": "default"
  },
  "knowledge_search": {
    "count": 2,
    "first_id": "perf-doc-000001",
    "tenant_id": "default"
  },
  "quality_actions": {
    "count": 3,
    "first_id": "perf-quality-action-000001",
    "tenant_id": "default",
    "dimension": "prompt_template",
    "action_type": "tune_prompt",
    "status": "in_progress"
  }
}

Compatibility Fixes From Smoke

The smoke database contained older AI Platform JSON payloads that predated the current DTO requirements. The following read-path compatibility fixes were added before the final successful deploy:

  1. Legacy retrieved_sources_json entries without source_type now normalize to a valid RetrievalSource.
  2. Legacy quality_labels_json entries without title or detail now normalize to a valid AiQualityLabel.
  3. Legacy quality action enum aliases are normalized on read:
    • dimension=label -> label_code
    • action_type=handle_false_positive -> mark_false_positive

No database rewrite was required. New writes still use the current strict DTO values.

Local Validation

python -m pytest yuqei-ai-platform\services\ai-platform-api\tests\test_platform_data.py::test_sqlalchemy_quality_actions_tolerate_legacy_retrieval_sources -q
python -m pytest yuqei-ai-platform\services\ai-platform-api\tests -q

Result:

  • Targeted legacy compatibility test: passed.
  • AI Platform API tests: 53 passed.

Notes

  • GET /api/v1/knowledge-documents is not a list endpoint; it is intentionally a POST create endpoint and returns 405 for GET.
  • Read verification should use import batch documents and/or GET /api/v1/knowledge-documents/search.