Files
kefu/deploy/model-usage-20260917/ledger-api-tests.log
T
2026-09-21 10:34:06 +08:00

170 lines
21 KiB
Plaintext

test_admin_can_query_all_usage_and_filter_model (test_model_usage_ledger.ModelUsageApiTests.test_admin_can_query_all_usage_and_filter_model) ... ok
test_invalid_query_ranges_are_rejected (test_model_usage_ledger.ModelUsageApiTests.test_invalid_query_ranges_are_rejected) ... ok
test_scoped_admin_all_means_only_authorized_accounts (test_model_usage_ledger.ModelUsageApiTests.test_scoped_admin_all_means_only_authorized_accounts) ... ok
test_stats_and_log_require_login_and_stats_read (test_model_usage_ledger.ModelUsageApiTests.test_stats_and_log_require_login_and_stats_read) ... ok
test_all_purposes_default_and_precise_provider_model_filters (test_model_usage_ledger.ModelUsageLedgerTests.test_all_purposes_default_and_precise_provider_model_filters) ... ok
test_answer_candidates_judge_retry_and_error_are_all_charged (test_model_usage_ledger.ModelUsageLedgerTests.test_answer_candidates_judge_retry_and_error_are_all_charged) ... ok
test_batch_retry_only_inserts_new_events (test_model_usage_ledger.ModelUsageLedgerTests.test_batch_retry_only_inserts_new_events) ... ok
test_concurrent_duplicate_writers_insert_once (test_model_usage_ledger.ModelUsageLedgerTests.test_concurrent_duplicate_writers_insert_once) ... ok
test_default_specific_and_multi_account_scopes_are_isolated (test_model_usage_ledger.ModelUsageLedgerTests.test_default_specific_and_multi_account_scopes_are_isolated) ... ok
test_empty_statistics_are_zero_with_all_requested_calendar_days (test_model_usage_ledger.ModelUsageLedgerTests.test_empty_statistics_are_zero_with_all_requested_calendar_days) ... ok
test_event_id_is_idempotent_and_first_record_is_immutable (test_model_usage_ledger.ModelUsageLedgerTests.test_event_id_is_idempotent_and_first_record_is_immutable) ... ok
test_invalid_metadata_and_noninteger_tokens_are_rejected (test_model_usage_ledger.ModelUsageLedgerTests.test_invalid_metadata_and_noninteger_tokens_are_rejected) ... ok
test_legacy_logs_are_not_fabricated_and_only_unmatched_tasks_are_counted (test_model_usage_ledger.ModelUsageLedgerTests.test_legacy_logs_are_not_fabricated_and_only_unmatched_tasks_are_counted) ... ok
test_legacy_task_match_does_not_cross_tenants_and_default_alias_matches (test_model_usage_ledger.ModelUsageLedgerTests.test_legacy_task_match_does_not_cross_tenants_and_default_alias_matches) ... ok
test_migration_preserves_old_rows_and_is_repeatable (test_model_usage_ledger.ModelUsageLedgerTests.test_migration_preserves_old_rows_and_is_repeatable) ... ok
test_missing_usage_stays_null_and_is_not_counted_as_known (test_model_usage_ledger.ModelUsageLedgerTests.test_missing_usage_stays_null_and_is_not_counted_as_known) ... ok
test_only_allowlisted_metadata_is_persisted (test_model_usage_ledger.ModelUsageLedgerTests.test_only_allowlisted_metadata_is_persisted) ... ok
test_pagination_is_stable_and_database_limit_is_capped (test_model_usage_ledger.ModelUsageLedgerTests.test_pagination_is_stable_and_database_limit_is_capped) ... ok
test_partial_usage_is_never_filled_or_total_estimated (test_model_usage_ledger.ModelUsageLedgerTests.test_partial_usage_is_never_filled_or_total_estimated) ... ok
test_utc_window_includes_today_excludes_tomorrow_and_normalizes_offsets (test_model_usage_ledger.ModelUsageLedgerTests.test_utc_window_includes_today_excludes_tomorrow_and_normalizes_offsets) ... ok
test_validation_or_storage_failure_raises_and_batch_does_not_partially_write (test_model_usage_ledger.ModelUsageLedgerTests.test_validation_or_storage_failure_raises_and_batch_does_not_partially_write) ... ok
test_zero_reported_tokens_are_known (test_model_usage_ledger.ModelUsageLedgerTests.test_zero_reported_tokens_are_known) ... ok
test_a_rule_without_keywords_is_rejected (test_admin_api.AgentApiTest.test_a_rule_without_keywords_is_rejected) ... ok
test_agents_are_pushed_to_the_desktop_with_the_config (test_admin_api.AgentApiTest.test_agents_are_pushed_to_the_desktop_with_the_config)
客户端只认 config 里的键——不放进 config 就等于新配置静默不生效。 ... ok
test_an_agent_on_duty_cannot_be_deleted (test_admin_api.AgentApiTest.test_an_agent_on_duty_cannot_be_deleted)
删掉在岗的角色,那份方案就指向一个不存在的人。 ... ok
test_default_agents_are_seeded_and_on_duty (test_admin_api.AgentApiTest.test_default_agents_are_seeded_and_on_duty) ... ok
test_saving_and_switching_an_agent (test_admin_api.AgentApiTest.test_saving_and_switching_an_agent) ... ok
test_the_plan_cannot_reference_an_unknown_agent (test_admin_api.AgentApiTest.test_the_plan_cannot_reference_an_unknown_agent) ... ok
test_the_plan_is_versioned_not_overwritten (test_admin_api.AgentApiTest.test_the_plan_is_versioned_not_overwritten)
和角色编排一样按版本追加:回滚就是指回旧版本。 ... ok
test_the_seeded_rule_forbids_the_encoding_excuse (test_admin_api.AgentApiTest.test_the_seeded_rule_forbids_the_encoding_excuse)
线上翻过的那条车:客户发血糖值「13」,模型回"这串像系统编码"。 ... ok
test_viewer_can_read_agents_but_not_change_them (test_admin_api.AgentApiTest.test_viewer_can_read_agents_but_not_change_them) ... ok
test_a_garbage_token_is_rejected (test_admin_api.AuthTest.test_a_garbage_token_is_rejected) ... ok
test_a_second_device_revokes_the_first_desktop_session (test_admin_api.AuthTest.test_a_second_device_revokes_the_first_desktop_session) ... ok
test_a_weak_new_password_is_refused (test_admin_api.AuthTest.test_a_weak_new_password_is_refused) ... ok
test_a_wrong_password_is_rejected (test_admin_api.AuthTest.test_a_wrong_password_is_rejected) ... ok
test_account_backup_policy_overrides_the_global_desktop_config (test_admin_api.AuthTest.test_account_backup_policy_overrides_the_global_desktop_config) ... ok
test_admin_force_logout_revokes_session_and_device (test_admin_api.AuthTest.test_admin_force_logout_revokes_session_and_device) ... ok
test_desktop_account_appears_in_the_management_api (test_admin_api.AuthTest.test_desktop_account_appears_in_the_management_api) ... ok
test_desktop_auth_config_is_public_and_has_the_effective_login_domain (test_admin_api.AuthTest.test_desktop_auth_config_is_public_and_has_the_effective_login_domain) ... ok
test_desktop_session_is_long_lived_and_slides_on_heartbeat (test_admin_api.AuthTest.test_desktop_session_is_long_lived_and_slides_on_heartbeat) ... ok
test_first_login_can_still_reach_the_password_endpoint (test_admin_api.AuthTest.test_first_login_can_still_reach_the_password_endpoint)
老实现首登一律 403,连改密接口都调不通,只能去网页后台改。 ... ok
test_login_returns_the_permission_list (test_admin_api.AuthTest.test_login_returns_the_permission_list) ... ok
test_logout_actually_kills_the_token (test_admin_api.AuthTest.test_logout_actually_kills_the_token) ... ok
test_no_token_means_401_not_403 (test_admin_api.AuthTest.test_no_token_means_401_not_403) ... ok
test_scoped_manager_cannot_reach_an_unassigned_desktop_account (test_admin_api.AuthTest.test_scoped_manager_cannot_reach_an_unassigned_desktop_account) ... ok
test_auto_backup_policy_round_trips_to_desktop_clients (test_admin_api.ConfigApiTest.test_auto_backup_policy_round_trips_to_desktop_clients) ... ok
test_config_read_and_write_are_separate_permissions (test_admin_api.ConfigApiTest.test_config_read_and_write_are_separate_permissions)
排查线上问题的人要能看配置,但不该能改。 ... ok
test_invalid_values_are_refused_with_a_usable_reason (test_admin_api.ConfigApiTest.test_invalid_values_are_refused_with_a_usable_reason) ... ok
test_login_domain_is_saved_and_returned_to_desktop_before_login (test_admin_api.ConfigApiTest.test_login_domain_is_saved_and_returned_to_desktop_before_login) ... ok
test_model_settings_are_gone_from_the_config (test_admin_api.ConfigApiTest.test_model_settings_are_gone_from_the_config)
服务类型 / API 地址 / 密钥 / 模型名 / 温度 / tokens / 超时都搬去了角色编排。 ... ok
test_no_api_key_value_is_ever_returned (test_admin_api.ConfigApiTest.test_no_api_key_value_is_ever_returned)
库里可能还留着老记录的密钥,但一个字节都不能出接口。 ... ok
test_saving_bumps_the_version_so_clients_notice (test_admin_api.ConfigApiTest.test_saving_bumps_the_version_so_clients_notice) ... ok
test_smuggling_a_retired_field_back_in_does_not_take_effect (test_admin_api.ConfigApiTest.test_smuggling_a_retired_field_back_in_does_not_take_effect)
老客户端或手工调接口的人可能还带着这些字段。 ... ok
test_the_config_payload_matches_the_legacy_key_set (test_admin_api.ConfigApiTest.test_the_config_payload_matches_the_legacy_key_set)
字段少一个,桌面端就少读一个设置——而且是静悄悄地少。 ... ok
test_a_deliberately_set_false_is_not_mistaken_for_unset (test_admin_api.ConfigNullPoisoningTest.test_a_deliberately_set_false_is_not_mistaken_for_unset)
补默认值的判据必须是"None",不能是"假值"——否则关掉的开关会被强制打开。 ... ok
test_a_stale_cached_page_that_still_sends_null_is_tolerated (test_admin_api.ConfigNullPoisoningTest.test_a_stale_cached_page_that_still_sends_null_is_tolerated)
浏览器里开着修复之前拉取的旧页面,表单里还揣着当时的 null。 ... ok
test_get_config_never_leaks_null_for_a_missing_or_null_field (test_admin_api.ConfigNullPoisoningTest.test_get_config_never_leaks_null_for_a_missing_or_null_field) ... ok
test_round_tripping_what_get_returns_never_422s (test_admin_api.ConfigNullPoisoningTest.test_round_tripping_what_get_returns_never_422s)
这就是这个 bug 真实发生的顺序:前端 GET 拿表单初值,原样 POST 回去。 ... ok
test_the_legacy_desktop_sync_endpoint_is_covered_too (test_admin_api.ConfigNullPoisoningTest.test_the_legacy_desktop_sync_endpoint_is_covered_too)
下发给桌面端的那一份,也走同一段"透传 CONFIG_KEYS"的代码。 ... ok
test_the_v2_desktop_sync_endpoint_is_covered_too (test_admin_api.ConfigNullPoisoningTest.test_the_v2_desktop_sync_endpoint_is_covered_too) ... ok
test_a_published_release_reaches_the_desktop_payload (test_admin_api.DesktopSyncApiTest.test_a_published_release_reaches_the_desktop_payload)
后台点了发布,客户端下一次同步就该看到——这条链断了没人会立刻发现。 ... ok
test_a_wrong_sync_key_is_rejected (test_admin_api.DesktopSyncApiTest.test_a_wrong_sync_key_is_rejected) ... ok
test_model_keys_go_out_masked_never_in_the_clear (test_admin_api.DesktopSyncApiTest.test_model_keys_go_out_masked_never_in_the_clear)
桌面端拿到的是遮罩值;真正的调用要走模型网关。 ... ok
test_payload_preserves_legacy_fields_and_adds_tenant_knowledge_summary (test_admin_api.DesktopSyncApiTest.test_payload_preserves_legacy_fields_and_adds_tenant_knowledge_summary) ... ok
test_a_missing_model_is_404 (test_admin_api.ModelTestApiTest.test_a_missing_model_is_404) ... ok
test_a_test_is_written_to_the_audit_log (test_admin_api.ModelTestApiTest.test_a_test_is_written_to_the_audit_log) ... ok
test_an_unreachable_endpoint_reports_200_with_a_failed_result (test_admin_api.ModelTestApiTest.test_an_unreachable_endpoint_reports_200_with_a_failed_result)
测试跑成功了、结论是"连不上"——这是 200,不是 5xx。 ... ok
test_claude_says_why_instead_of_pretending_to_test (test_admin_api.ModelTestApiTest.test_claude_says_why_instead_of_pretending_to_test)
老后台的测试器只认 openai/dify/comfyui。硬套 claude 只会得到误导性的 404。 ... ok
test_testing_a_catalog_model_never_needs_the_key_from_the_browser (test_admin_api.ModelTestApiTest.test_testing_a_catalog_model_never_needs_the_key_from_the_browser)
前端只送 id,密钥由后端从库里解密——明文不在网络上多走一趟。 ... ok
test_testing_requires_write_because_it_spends_money (test_admin_api.ModelTestApiTest.test_testing_requires_write_because_it_spends_money)
只读用户能看模型清单,但不该能拿着公司的密钥往外发请求。 ... ok
test_operator_can_change_models_but_not_touch_roles (test_admin_api.PermissionEnforcementTest.test_operator_can_change_models_but_not_touch_roles) ... ok
test_revoking_a_permission_takes_effect_immediately (test_admin_api.PermissionEnforcementTest.test_revoking_a_permission_takes_effect_immediately)
权限存在库里,不在代码里——改完不用重启,也不用重新登录。 ... ok
test_the_error_says_which_permission_is_missing (test_admin_api.PermissionEnforcementTest.test_the_error_says_which_permission_is_missing) ... ok
test_viewer_can_read_models_but_not_change_them (test_admin_api.PermissionEnforcementTest.test_viewer_can_read_models_but_not_change_them) ... ok
test_viewer_cannot_manage_users (test_admin_api.PermissionEnforcementTest.test_viewer_cannot_manage_users) ... ok
test_viewer_cannot_read_the_audit_log (test_admin_api.PermissionEnforcementTest.test_viewer_cannot_read_the_audit_log) ... ok
test_a_v_prefix_is_stripped_not_rejected (test_admin_api.ReleaseApiTest.test_a_v_prefix_is_stripped_not_rejected)
人习惯写 v2.5.0。存进去必须是 2.5.0,否则客户端比对版本号永远不相等。 ... ok
test_bad_versions_and_urls_are_refused (test_admin_api.ReleaseApiTest.test_bad_versions_and_urls_are_refused) ... ok
test_desktop_can_report_update_progress (test_admin_api.ReleaseApiTest.test_desktop_can_report_update_progress) ... ok
test_force_upgrade_without_a_download_url_is_refused (test_admin_api.ReleaseApiTest.test_force_upgrade_without_a_download_url_is_refused)
开了强制升级又没给下载地址,等于把所有客户端堵死在原地。 ... ok
test_package_upload_builds_a_verified_public_manifest (test_admin_api.ReleaseApiTest.test_package_upload_builds_a_verified_public_manifest) ... ok
test_paused_release_is_not_offered_and_history_is_retained (test_admin_api.ReleaseApiTest.test_paused_release_is_not_offered_and_history_is_retained) ... ok
test_publishing_a_version_records_it (test_admin_api.ReleaseApiTest.test_publishing_a_version_records_it) ... ok
test_reading_needs_config_read_but_writing_needs_release_write (test_admin_api.ReleaseApiTest.test_reading_needs_config_read_but_writing_needs_release_write) ... ok
test_an_invalid_rule_is_rejected_with_a_readable_reason (test_admin_api.ReviewRuleConfigApiTest.test_an_invalid_rule_is_rejected_with_a_readable_reason) ... ok
test_saving_a_rule_set_round_trips_through_the_api (test_admin_api.ReviewRuleConfigApiTest.test_saving_a_rule_set_round_trips_through_the_api) ... ok
test_the_desktop_sync_endpoints_ship_the_rules_too (test_admin_api.ReviewRuleConfigApiTest.test_the_desktop_sync_endpoints_ship_the_rules_too) ... ok
test_the_seeded_defaults_come_with_three_starter_rules (test_admin_api.ReviewRuleConfigApiTest.test_the_seeded_defaults_come_with_three_starter_rules)
全新的库不该是空的——刚上线这个功能时,起步规则不能一条都没有。 ... ok
test_a_normal_rule_round_trips (test_admin_api.ReviewRuleValidationTest.test_a_normal_rule_round_trips) ... ok
test_a_rule_with_no_keywords_is_refused (test_admin_api.ReviewRuleValidationTest.test_a_rule_with_no_keywords_is_refused)
空关键词的规则不是"温和一点",是"这条规则永远不会命中"——必须当错误处理。 ... ok
test_a_rule_without_a_label_is_refused (test_admin_api.ReviewRuleValidationTest.test_a_rule_without_a_label_is_refused) ... ok
test_an_absurdly_long_label_is_refused (test_admin_api.ReviewRuleValidationTest.test_an_absurdly_long_label_is_refused) ... ok
test_an_item_that_is_not_an_object_is_refused (test_admin_api.ReviewRuleValidationTest.test_an_item_that_is_not_an_object_is_refused) ... ok
test_enabled_defaults_to_true_when_omitted (test_admin_api.ReviewRuleValidationTest.test_enabled_defaults_to_true_when_omitted) ... ok
test_enabled_false_is_respected (test_admin_api.ReviewRuleValidationTest.test_enabled_false_is_respected) ... ok
test_keywords_must_be_a_list (test_admin_api.ReviewRuleValidationTest.test_keywords_must_be_a_list) ... ok
test_keywords_that_are_all_blank_strings_still_count_as_empty (test_admin_api.ReviewRuleValidationTest.test_keywords_that_are_all_blank_strings_still_count_as_empty) ... ok
test_missing_ids_are_auto_generated_and_deduplicated (test_admin_api.ReviewRuleValidationTest.test_missing_ids_are_auto_generated_and_deduplicated) ... ok
test_the_root_must_be_a_list (test_admin_api.ReviewRuleValidationTest.test_the_root_must_be_a_list) ... ok
test_too_many_keywords_on_one_rule_is_refused (test_admin_api.ReviewRuleValidationTest.test_too_many_keywords_on_one_rule_is_refused) ... ok
test_too_many_rules_is_refused (test_admin_api.ReviewRuleValidationTest.test_too_many_rules_is_refused) ... ok
test_a_legacy_database_migrates_without_losing_anything (test_admin_api.RoleCheckMigrationTest.test_a_legacy_database_migrates_without_losing_anything) ... [RBAC] users.role 已从写死的 CHECK 迁移为角色表外键
ok
test_an_unknown_role_is_downgraded_instead_of_crashing (test_admin_api.RoleCheckMigrationTest.test_an_unknown_role_is_downgraded_instead_of_crashing)
手工改库或早期版本会留下角色表里没有的值。收紧权限,不是崩掉服务。 ... ok
test_leftovers_from_a_failed_run_are_cleaned_up (test_admin_api.RoleCheckMigrationTest.test_leftovers_from_a_failed_run_are_cleaned_up) ... [RBAC] users.role 已从写死的 CHECK 迁移为角色表外键
ok
test_running_it_twice_is_harmless (test_admin_api.RoleCheckMigrationTest.test_running_it_twice_is_harmless) ... [RBAC] users.role 已从写死的 CHECK 迁移为角色表外键
ok
test_a_custom_role_can_be_created_and_used (test_admin_api.RoleManagementTest.test_a_custom_role_can_be_created_and_used) ... ok
test_a_role_still_in_use_cannot_be_deleted (test_admin_api.RoleManagementTest.test_a_role_still_in_use_cannot_be_deleted) ... ok
test_an_unknown_permission_code_is_refused (test_admin_api.RoleManagementTest.test_an_unknown_permission_code_is_refused) ... ok
test_assigning_a_nonexistent_role_is_refused (test_admin_api.RoleManagementTest.test_assigning_a_nonexistent_role_is_refused) ... ok
test_builtin_roles_cannot_be_deleted (test_admin_api.RoleManagementTest.test_builtin_roles_cannot_be_deleted) ... ok
test_granting_replaces_rather_than_appends (test_admin_api.RoleManagementTest.test_granting_replaces_rather_than_appends)
界面是一组勾选框,提交的是最终状态。增量语义会让"取消勾选"静默失效。 ... ok
test_the_admin_role_cannot_be_stripped_of_its_powers (test_admin_api.RoleManagementTest.test_the_admin_role_cannot_be_stripped_of_its_powers)
把 admin 削权之后就没人能再加回来了,只能改库。 ... ok
test_a_build_without_an_assets_folder_still_boots (test_admin_api.StaticMountTest.test_a_build_without_an_assets_folder_still_boots)
vite 默认输出 js/ 和 css/,没有 assets/。这种产物必须能起来。 ... ok
test_all_of_the_usual_asset_folders_get_mounted (test_admin_api.StaticMountTest.test_all_of_the_usual_asset_folders_get_mounted) ... ok
test_an_empty_dist_directory_is_ignored (test_admin_api.StaticMountTest.test_an_empty_dist_directory_is_ignored)
只有一个空 dist 目录时不挂 SPA 兜底路由。 ... ok
test_an_unknown_api_path_is_404_not_the_spa_page (test_admin_api.StaticMountTest.test_an_unknown_api_path_is_404_not_the_spa_page)
兜底路由不能把打错的接口地址伪装成一个正常页面。 ... ok
test_a_malformed_call_report_never_500s (test_admin_api.StatsTest.test_a_malformed_call_report_never_500s)
观测数据出问题不能让桌面端以为回复流程失败了。 ... ok
test_model_call_logs_are_isolated_by_desktop_account (test_admin_api.StatsTest.test_model_call_logs_are_isolated_by_desktop_account) ... ok
test_model_call_stats_answers_the_cost_question (test_admin_api.StatsTest.test_model_call_stats_answers_the_cost_question) ... ok
test_reporting_a_call_without_the_sync_key_is_refused (test_admin_api.StatsTest.test_reporting_a_call_without_the_sync_key_is_refused) ... ok
test_the_audit_log_records_who_changed_what (test_admin_api.StatsTest.test_the_audit_log_records_who_changed_what) ... ok
test_the_call_log_is_gated_behind_stats_read (test_admin_api.StatsTest.test_the_call_log_is_gated_behind_stats_read) ... ok
test_the_call_log_lists_individual_calls_for_tracing (test_admin_api.StatsTest.test_the_call_log_lists_individual_calls_for_tracing)
聚合统计答不了"这一条到底怎么回的"——这个接口按条翻,供排查问题用。 ... ok
test_the_call_log_search_filters_by_keyword (test_admin_api.StatsTest.test_the_call_log_search_filters_by_keyword) ... ok
test_the_desktop_can_report_a_model_call_to_the_new_api (test_admin_api.StatsTest.test_the_desktop_can_report_a_model_call_to_the_new_api)
8766 得能收调用留痕,否则桌面端改指过来就会静悄悄丢掉全部调用记录。 ... ok
test_a_weak_password_is_refused_on_create (test_admin_api.UserApiTest.test_a_weak_password_is_refused_on_create) ... ok
test_the_listing_never_leaks_password_material (test_admin_api.UserApiTest.test_the_listing_never_leaks_password_material) ... ok
----------------------------------------------------------------------
Ran 127 tests in 157.595s
OK