{
  "ok": true,
  "status": "implementation_readiness_preview",
  "date": "2026-06-14",
  "goal": "turn_role_card_internal_test_api_into_app_and_site_delivery_tasks",
  "migrationDraft": {
    "path": "server/db/migrations/2026-06-14-role-card-core.sql",
    "qaCommand": "node scripts/qa-role-card-migration.cjs",
    "status": "draft_static_checked_before_temp_replay",
    "boundary": "not_executed_against_live_database"
  },
  "policySimulation": {
    "qaCommand": "node scripts/qa-role-card-policy-simulator.cjs",
    "status": "simulation_checked_before_postgresql_rls_replay",
    "cases": [
      "anon_reads_only_published_safe_roles",
      "anon_cannot_read_drafts_or_prompt_versions",
      "admin_can_manage_role_records",
      "user_memory_candidates_are_isolated_by_user_id",
      "memory_insert_requires_authenticated_owner_and_allowed_status"
    ],
    "boundary": "simulation_only_not_real_postgresql_rls"
  },
  "postgresTempReplay": {
    "qaCommand": "node scripts/qa-role-card-postgres-replay.cjs",
    "status": "temporary_postgresql_replay_passed",
    "checked": [
      "migration_applies_on_temporary_postgresql",
      "all_role_tables_exist",
      "rls_enabled_on_role_tables",
      "expected_policies_exist",
      "anon_reads_only_published_safe_role",
      "anon_cannot_read_prompt_versions",
      "admin_can_read_all_role_records",
      "user_memory_candidates_isolated_by_user_id",
      "cross_user_memory_insert_rejected"
    ],
    "boundary": "temporary_database_only_not_live_database"
  },
  "databaseAdapterReadiness": {
    "route": "GET /api/database/role-card-workbench-readiness",
    "adapter": "server/src/adapters/database.js",
    "qaCommand": "node scripts/qa-adapter-boundaries.cjs",
    "status": "blocked_until_live_database_checklist_is_complete",
    "checked": [
      "production_database_url_configured_boolean_only",
      "backup_snapshot_ready_flag",
      "migration_version_confirmed_flag",
      "live_rls_failure_cases_passed_flag",
      "least_privilege_database_role_confirmed_flag",
      "rollback_plan_reviewed_flag",
      "manual_live_execution_approval_recorded_flag",
      "no_database_url_or_secret_in_response"
    ],
    "boundary": "readiness_only_not_live_connection"
  },
  "localWorkbenchStore": {
    "module": "server/src/role-card-workbench-store.js",
    "qaCommand": "node scripts/qa-role-card-workbench-store.cjs",
    "status": "local_json_workbench_ready",
    "checked": [
      "tag_events_can_be_recorded_locally",
      "generation_batch_plans_can_be_recorded_locally",
      "prompt_version_plans_can_be_recorded_locally",
      "prompt_activation_plans_can_be_recorded_locally",
      "memory_delete_requests_can_be_recorded_locally",
      "publish_gate_plans_can_be_recorded_locally",
      "content_safety_plans_can_be_recorded_locally",
      "review_actions_can_be_recorded_locally",
      "second_store_can_read_persisted_state",
      "no_secret_markers_in_workbench_json"
    ],
    "boundary": "local_json_only_not_production_database"
  },
  "localWorkbenchApi": {
    "routes": [
      "GET /api/admin/role-card-workbench/summary",
      "POST /api/admin/role-card-workbench/tag-event",
      "POST /api/admin/role-card-workbench/generation-batch-plan",
      "POST /api/admin/role-card-workbench/prompt-version-plan",
      "POST /api/admin/role-card-workbench/prompt-activation-plan",
      "POST /api/admin/role-card-workbench/memory-delete-request",
      "POST /api/admin/role-card-workbench/publish-gate-plan",
      "POST /api/admin/role-card-workbench/content-safety-plan",
      "POST /api/admin/role-card-workbench/review-action"
    ],
    "qaCommand": "node scripts/qa-role-card-workbench-api.cjs",
    "status": "admin_local_workbench_api_ready",
    "checked": [
      "admin_auth_required_for_workbench_write",
      "workbench_write_rejects_get",
      "tag_event_post_persisted",
      "generation_batch_plan_post_persisted",
      "prompt_version_plan_post_persisted",
      "prompt_activation_plan_post_persisted",
      "memory_delete_request_post_persisted",
      "publish_gate_plan_post_persisted",
      "content_safety_plan_post_persisted",
      "review_action_post_persisted",
      "summary_reads_persisted_counts"
    ],
    "boundary": "local_json_only_not_production_database"
  },
  "localWorkbenchService": {
    "module": "server/src/services/role-card-workbench-service.js",
    "qaCommand": "node scripts/qa-role-card-workbench-service.cjs",
    "status": "service_boundary_ready_for_transaction_layer",
    "checked": [
      "service_payload_shape_checked",
      "local_json_records_flow_through_service",
      "postgres_plan_preview_flows_through_service",
      "transaction_gate_preview_flows_through_service",
      "routes_do_not_import_store_or_sql_plan_directly",
      "no_secret_markers_in_service_payloads"
    ],
    "boundary": "local_json_and_sql_plan_only_not_live_database"
  },
  "transactionGatePreview": {
    "module": "server/src/services/role-card-workbench-transaction-gate.js",
    "route": "POST /api/admin/role-card-workbench/transaction-gate-preview",
    "qaCommand": "node scripts/qa-role-card-workbench-transaction-gate.cjs",
    "status": "transaction_gate_preview_ready",
    "checked": [
      "nested_sql_plan_flattened",
      "live_transaction_blocked_without_database_backup_rls_and_approval",
      "manual_review_ready_when_all_gates_are_present",
      "secret_or_live_db_markers_block_execution_gate",
      "api_route_is_preview_only"
    ],
    "blockersBeforeLive": [
      "production_database_url_missing",
      "backup_snapshot_missing",
      "migration_version_missing",
      "live_rls_failure_cases_not_passed",
      "least_privilege_database_role_not_confirmed",
      "rollback_plan_not_reviewed",
      "manual_live_execution_approval_missing"
    ],
    "boundary": "transaction_gate_only_not_executed"
  },
  "livePreflight": {
    "route": "GET /api/admin/role-card-workbench/live-preflight",
    "module": "server/src/services/role-card-workbench-live-preflight.js",
    "qaCommand": "node scripts/qa-role-card-workbench-api.cjs",
    "status": "blocked_before_live_execution",
    "aggregates": [
      "database_adapter_readiness",
      "transaction_gate_preview",
      "representative_sql_plan_blockers",
      "rollback_checklist"
    ],
    "checked": [
      "admin_auth_required",
      "database_readiness_and_transaction_gate_aggregated",
      "no_database_url_or_secret_in_response",
      "does_not_connect_live_database",
      "does_not_execute_sql"
    ],
    "boundary": "admin_readiness_preview_only"
  },
  "roleChatService": {
    "module": "server/src/services/role-chat-service.js",
    "routes": [
      "GET /api/role-chat/session-preview",
      "GET /api/role-chat/safety-preview",
      "GET /api/role-chat/invocation-preflight",
      "GET /api/role-chat/turn-execution-plan-preview",
      "GET /api/role-chat/points-ledger-plan-preview",
      "GET /api/role-chat/model-adapter-plan-preview",
      "GET /api/role-chat/message-persistence-plan-preview",
      "GET /api/role-chat/history-access-plan-preview",
      "GET /api/role-chat/database-schema-plan-preview",
      "GET /api/role-chat/transaction-gate-preview",
      "GET /api/role-chat/memory-control-preview",
      "GET /api/role-chat/memory-delete-preview"
    ],
    "qaCommand": "node scripts/qa-role-chat-service.cjs",
    "status": "preview_service_boundary_ready",
    "checked": [
      "invocation_preflight_flows_through_service",
      "turn_execution_plan_flows_through_service",
      "points_ledger_plan_flows_through_service",
      "model_adapter_plan_flows_through_service",
      "message_persistence_plan_flows_through_service",
      "history_access_plan_flows_through_service",
      "database_schema_plan_flows_through_service",
      "transaction_gate_flows_through_service",
      "memory_control_and_delete_flow_through_service",
      "routes_do_not_import_role_chat_preview_functions_directly",
      "no_secret_markers_in_service_payloads"
    ],
    "boundary": "preview_service_only_not_live_chat"
  },
  "roleChatLivePreflight": {
    "route": "GET /api/admin/role-chat/live-preflight",
    "module": "server/src/services/role-chat-live-preflight.js",
    "qaCommand": "node scripts/qa-role-chat-live-preflight.cjs",
    "status": "blocked_before_live_chat_api",
    "aggregates": [
      "role_chat_transaction_gate",
      "chat_database_readiness",
      "model_adapter_readiness",
      "points_ledger_and_payment_readiness"
    ],
    "checked": [
      "admin_auth_required",
      "live_chat_api_blocked_before_model_points_and_database",
      "no_database_url_model_key_or_service_role_in_response",
      "does_not_execute_chat_transaction",
      "does_not_call_real_model",
      "does_not_reserve_or_charge_points",
      "does_not_write_production_database"
    ],
    "boundary": "admin_readiness_preview_only"
  },
  "postgresWorkbenchWritePlan": {
    "module": "server/src/role-card-postgres-workbench-plan.js",
    "routes": [
      "POST /api/admin/role-card-workbench/postgres-plan-preview"
    ],
    "qaCommand": "node scripts/qa-role-card-postgres-workbench-plan.cjs",
    "status": "postgres_write_plan_preview_ready",
    "mapsToTables": [
      "role_tag_dictionary",
      "role_generation_batches",
      "role_prompt_versions",
      "role_memory_candidates",
      "role_review_logs",
      "role_cards"
    ],
    "checked": [
      "tag_dictionary_parameterized_write_plan",
      "prompt_version_parameterized_write_plan",
      "prompt_activation_parameterized_write_plan",
      "generation_batch_parameterized_write_plan",
      "review_action_parameterized_write_plan",
      "memory_delete_parameterized_write_plan",
      "publish_gate_parameterized_write_plan",
      "content_safety_parameterized_write_plan",
      "admin_postgres_plan_preview_requires_auth",
      "postgres_plan_preview_rejects_get",
      "direct_publish_blocked",
      "direct_publish_without_gate_blocked",
      "unknown_content_safety_decision_blocked",
      "direct_prompt_activation_blocked",
      "no_live_database_or_secret_markers"
    ],
    "boundary": "sql_plan_only_not_executed"
  },
  "postgresWorkbenchTempReplay": {
    "qaCommand": "node scripts/qa-role-card-postgres-workbench-replay.cjs",
    "status": "temporary_postgresql_workbench_replay_passed",
    "checked": [
      "migration_applied_before_workbench_replay",
      "tag_dictionary_write_plan_executes_on_temporary_postgresql",
      "prompt_version_write_plan_executes_on_temporary_postgresql",
      "prompt_activation_write_plan_executes_on_temporary_postgresql",
      "generation_batch_write_plan_executes_on_temporary_postgresql",
      "review_action_write_plan_executes_on_temporary_postgresql",
      "publish_gate_write_plan_executes_on_temporary_postgresql",
      "content_safety_write_plan_executes_on_temporary_postgresql",
      "memory_delete_request_write_plan_executes_on_temporary_postgresql",
      "review_logs_inserted_for_all_workbench_actions",
      "direct_publish_plan_blocked"
    ],
    "boundary": "temporary_database_only_not_live_database"
  },
  "tracks": [
    {
      "code": "database_and_rls",
      "name": "数据库迁移与权限策略",
      "todayTarget": "把角色主表、标签表、prompt 版本、审核日志和用户记忆候选转成可回放迁移任务。",
      "requiredEvidence": [
        "temporary_database_replay",
        "integrity_check_ok",
        "anon_denied_for_drafts",
        "admin_write_requires_auth"
      ],
      "nextArtifact": "replayable migration draft and permission verification checklist",
      "status": "next"
    },
    {
      "code": "tag_management",
      "name": "标签管理",
      "todayTarget": "先固定风格、性向、关系、情绪底色和安全等级的后台增改停用边界。",
      "requiredEvidence": [
        "admin_auth_required",
        "audit_reason_required",
        "disabled_tag_not_available_for_new_generation"
      ],
      "nextArtifact": "admin tag management preview",
      "status": "in_progress"
    },
    {
      "code": "batch_generation",
      "name": "批量生成批次",
      "todayTarget": "把批次主题、数量、分类、禁用词、生成失败和人工审核流转固定为合同。",
      "requiredEvidence": [
        "drafts_do_not_auto_publish",
        "review_queue_created",
        "failed_generation_has_retry_or_refund_rule"
      ],
      "nextArtifact": "batch draft contract and review queue",
      "status": "in_progress"
    },
    {
      "code": "review_workbench",
      "name": "审核工作台",
      "todayTarget": "审核动作必须有原因、审计日志、下一状态和单独发布确认。",
      "requiredEvidence": [
        "approve_does_not_publish",
        "reject_requires_reason",
        "safety_review_can_hold_role"
      ],
      "nextArtifact": "review action preview and publish readiness gate",
      "status": "in_progress"
    },
    {
      "code": "prompt_version_storage",
      "name": "Prompt 版本落库",
      "todayTarget": "先定义版本计划、必审项、启用状态和回滚目标，不直接启用新 prompt。",
      "requiredEvidence": [
        "manual_review_before_activation",
        "rollback_target_kept",
        "no_external_prompt_copying"
      ],
      "nextArtifact": "prompt version preview and migration fields",
      "status": "in_progress"
    },
    {
      "code": "app_h5_site_structure",
      "name": "App / H5 / 网站上线版结构",
      "todayTarget": "角色列表、角色详情、聊天入口、会员/支付入口和后台管理入口都有可点击壳和 API 对应关系。",
      "requiredEvidence": [
        "role_list_entry",
        "role_detail_contract",
        "chat_entry_uses_role_context",
        "member_payment_blocker_visible",
        "admin_entry_auth_boundary"
      ],
      "nextArtifact": "launch structure preview",
      "status": "partial"
    },
    {
      "code": "customer_materials",
      "name": "客户资料整理",
      "todayTarget": "DNS/备案、支付真实资料、模型账号/API Key 按接收人和用途拆清楚。",
      "requiredEvidence": [
        "dns_records_needed",
        "payment_credentials_missing",
        "model_key_missing",
        "non_technical_customer_actions_only"
      ],
      "nextArtifact": "customer material checklist",
      "status": "waiting_on_customer"
    }
  ],
  "todayPlanSource": "2026-06-14_app_and_site_launch_backlog",
  "completionBoundary": "these are internal implementation tasks and readiness gates, not customer acceptance or production launch",
  "boundaries": [
    "does_not_write_production_database",
    "does_not_run_real_migration",
    "does_not_call_real_model",
    "does_not_connect_real_payment",
    "does_not_create_android_apk",
    "blocks_status_upgrade_until_runtime_evidence_exists"
  ]
}