telepost-bot 2.84.4__tar.gz → 2.84.5__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/CHANGELOG.md +7 -0
- {telepost_bot-2.84.4/telepost_bot.egg-info → telepost_bot-2.84.5}/PKG-INFO +1 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/review_queue.py +329 -154
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/build_info.py +1 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/observability/doctor.py +58 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/reviews.py +32 -2
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/review_keyboard.py +5 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/review_stager.py +47 -11
- {telepost_bot-2.84.4 → telepost_bot-2.84.5/telepost_bot.egg-info}/PKG-INFO +1 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost_bot.egg-info/SOURCES.txt +1 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review.py +10 -2
- telepost_bot-2.84.5/tests/test_staging_recovery.py +466 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_submission_timeout_idempotency.py +17 -7
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/ui/locales/en/LC_MESSAGES/telepost.mo +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/ui/locales/en/LC_MESSAGES/telepost.po +3 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/api_server.py +10 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/LICENSE +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/MANIFEST.in +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/README.en.md +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/README.md +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/config/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/config/fly-telepost-policy.example.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/config/review_policy.md +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/config/settings.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/config.ini.example +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/database/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/database/db_manager.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/api_commands.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/botconfig.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/callback_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/channel_listener.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/command_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/conversation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/error_handler.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/index_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/mode_selection.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/moderation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/preview_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/publish.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/reaction_stats.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/review.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/schedule_status.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/search_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/stats_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/handlers/upload.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/main.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/mcp_server/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/mcp_server/review_client.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/mcp_server/server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/models/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/models/state.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/SOURCES.sha256 +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/error-mapping.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/ackresult.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/capabilities.pixivflow.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/event.job.expired.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/event.job.succeeded.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/eventpage.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/job.cancelled.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/job.failed.no_candidate.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/job.queued.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/job.running.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/job.succeeded.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/jobpage.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/task.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/fixtures/task.candidate_search.target_only.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/protocol/v1/protocol.schema.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/pyproject.toml +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/run.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/services/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/services/review_service.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/setup.cfg +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/api/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/admin_ops.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/delivery_planner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/hot.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/novel_fallback_card.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/pixivflow_jobs.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/post_media.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/posts.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/publication.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/reaction_backfill.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/refetch.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/rerender.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/resubmit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/submitter_notify.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/application/telepress_provider.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/delivery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/errors.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/hot.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/media.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/navigation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/packing.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/presentation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/presentation_policy.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/refetch_state.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/review.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/review_chat.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/domain/submission.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/miniapp/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/miniapp/auth.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/miniapp/rbac.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/miniapp/role_bindings.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/miniapp/session.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/observability/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/observability/audit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/observability/cli.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/observability/errors.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/observability/redact.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/columns.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/inbox.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/ledger.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/media_assets.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/moderation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/posts.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/protocol_events.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/refetch.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/storage/sqlite/submitter_notifications.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/callback_feedback.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/capture.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/discussion.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/executor.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/gateway.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/legacy_runner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/planner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/preparation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/registry.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/delivery/sender.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/inbox_worker.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/review_expiry.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost/telegram/review_media.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost_bot.egg-info/dependency_links.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost_bot.egg-info/entry_points.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost_bot.egg-info/requires.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/telepost_bot.egg-info/top_level.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_admin_api.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_anonymous.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_api_commands.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_api_server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_api_version.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_architecture_application.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_architecture_core.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_backfill_attribution.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_blacklist.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_bot_language.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_bot_token_logging.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_botconfig.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_boundary.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_callback_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_caption_mentions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_compatibility.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_config_encoding.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_console_encoding.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_conversation_flow.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_data_class_cleanup.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_database.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_database_first_start.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_database_operations.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_delivery_planner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_discussion_uncertainty.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_disposition.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_doctor.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_file_validator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_fly_deploy_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_frozen_support.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_heat_calculator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_helper_functions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_hot_domain.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_identity_provenance.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_install_scripts.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_integration.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_legacy_delivery_port_navigation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_logic_flow.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_logical_submissions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_maintenance_jobs.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_manager_notifications.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_media_decision_audit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_media_delivery_pipeline.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_media_domain.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_media_preparation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_media_proxy_delivery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_menu_shortcut_single_reply.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_miniapp_api.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_miniapp_auth.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_miniapp_content.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_miniapp_entries.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_miniapp_history.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_miniapp_rbac.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_mixed_media_integrity.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_moderation_and_admin_ux.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_navigation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_no_owner_probe.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_novel_cover_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_novel_delivery_semantics.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_observability.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_observability_lifecycle.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_online_reading_root_button.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_packing_ssot.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_polling_server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_preview_pagination.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_production_handler_graph.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_protocol_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_publication_presentation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_publish_idempotency.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_publish_regressions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_publish_reply.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_reaction_backfill.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_reaction_stats.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_refetch.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_refetch_card_state.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_refetch_events.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_refetch_job_lifecycle.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_refetch_reason_normalization.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_refetch_replacement.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_remote_fetch_fallback.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_rerender.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_resubmit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_album_payload.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_card_recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_chat_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_consistency.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_expiry_recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_http_mcp.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_media_lifecycle.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_review_service.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_robustness.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_run_dispatcher.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_run_mode.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_run_supervisor.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_schedule_outcomes.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_search_disabled_hint.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_search_recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_security.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_security_headers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_session_database_handles.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_shutdown.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_streaming_uploads.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_telegram_golden_messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_telegram_media_cache.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_update_inbox.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_upload.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_user_friendly_messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_webhook_payload_admission.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_webhook_ready.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_webhook_router.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_webhook_secret.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_webhook_secret_logging.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_webhook_static.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/tests/test_work_id_wire.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/ui/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/ui/i18n.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/ui/keyboards.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/ui/messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/api_tokens.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/blacklist.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/cache.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/config_wizard.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/console.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/database.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/file_validator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/heat_calculator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/helper_functions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/index_manager.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/logging_config.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/maintenance_jobs.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/polling_server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/run_mode.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/runtime_policy.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/schedule_watchdog.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/search_engine.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/security_headers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/submission.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/utils/webhook_server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/webapp/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/webapp/dist/assets/2d82b92e720462f8dd3b-Bh4Fahcw.svg +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/webapp/dist/assets/index-CLfkW8eZ.css +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/webapp/dist/assets/index-CfjBQN_e.js +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.5}/webapp/dist/index.html +0 -0
|
@@ -8,6 +8,13 @@
|
|
|
8
8
|
> 发布说明面向普通用户:写「对用户有什么改变」,不写内部实现细节(模块名、函数名、配置键);
|
|
9
9
|
> 技术细节放进代码注释或 `docs/`。每个 Release 的正文由本文件对应版本段自动生成。
|
|
10
10
|
|
|
11
|
+
## [2.84.5](https://github.com/redtidev1918/TelePost/compare/v2.84.4...v2.84.5) (2026-10-25)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* bounded Telegram staging retries with controlled failure recovery ([#350](https://github.com/redtidev1918/TelePost/issues/350)) ([c9be5d6](https://github.com/redtidev1918/TelePost/commit/c9be5d66225e844be9a560a2456761c75775164f))
|
|
17
|
+
|
|
11
18
|
## [2.84.4](https://github.com/redtidev1918/TelePost/compare/v2.84.3...v2.84.4) (2026-10-24)
|
|
12
19
|
|
|
13
20
|
|
|
@@ -376,7 +376,33 @@ class ReviewQueueService:
|
|
|
376
376
|
await stager.delete_preview_messages(old_ids)
|
|
377
377
|
await self._repo.delete(existing["id"])
|
|
378
378
|
existing = None
|
|
379
|
+
recovered_review_id: Optional[int] = None
|
|
380
|
+
if (existing is not None and existing["status"] == "failed"
|
|
381
|
+
and not command.refetch_request_id):
|
|
382
|
+
outcome = await self._attempt_failed_recovery(existing, command, stager)
|
|
383
|
+
if isinstance(outcome, int):
|
|
384
|
+
# This request now owns the recovery of the SAME review row;
|
|
385
|
+
# staging below proceeds with the original review identity.
|
|
386
|
+
recovered_review_id = outcome
|
|
387
|
+
existing = None
|
|
388
|
+
elif outcome is not None:
|
|
389
|
+
# A concurrent recovery is already running for this key: the
|
|
390
|
+
# caller must converge later, not record a false success.
|
|
391
|
+
if is_local:
|
|
392
|
+
await stager.cleanup_files(files)
|
|
393
|
+
return outcome
|
|
379
394
|
if existing is not None:
|
|
395
|
+
if (existing["status"] == "preparing"
|
|
396
|
+
and (existing["error"] or "").strip()):
|
|
397
|
+
# The row was staging-failed before and is currently being
|
|
398
|
+
# RECOVERED by a concurrent same-key request (the claim keeps
|
|
399
|
+
# the old error text until re-staging succeeds). Converge
|
|
400
|
+
# later instead of ACKing an outcome that has not happened.
|
|
401
|
+
if is_local:
|
|
402
|
+
await stager.cleanup_files(files)
|
|
403
|
+
return self.result_from_row(
|
|
404
|
+
existing, reused=True, reuse_reason="recovery_in_progress",
|
|
405
|
+
)
|
|
380
406
|
try:
|
|
381
407
|
if existing["target_id"] in (None, "") and command.target_id:
|
|
382
408
|
await self._repo.backfill_target(existing["id"], command.target_id)
|
|
@@ -394,7 +420,7 @@ class ReviewQueueService:
|
|
|
394
420
|
await stager.cleanup_files(files)
|
|
395
421
|
|
|
396
422
|
work_id = command.work_id or work_id_from_link(command.link)
|
|
397
|
-
if work_id:
|
|
423
|
+
if recovered_review_id is None and work_id:
|
|
398
424
|
historical = await self._repo.find_published_work(
|
|
399
425
|
command.target_id, command.work_type, work_id, self._dedup_window
|
|
400
426
|
)
|
|
@@ -409,22 +435,25 @@ class ReviewQueueService:
|
|
|
409
435
|
|
|
410
436
|
caption = _caption_from_command(command, media=media, documents=documents)
|
|
411
437
|
preview_ids: List[int] = []
|
|
412
|
-
|
|
413
|
-
review_id =
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
await stager.cleanup_files(files)
|
|
419
|
-
reused_id = (reused.result or {}).get("review_id")
|
|
420
|
-
if reused_id is not None:
|
|
421
|
-
await _record(
|
|
422
|
-
"submission.duplicate", command, review_id=reused_id,
|
|
423
|
-
detail={"reused_id": reused_id},
|
|
438
|
+
if recovered_review_id is not None:
|
|
439
|
+
review_id = recovered_review_id
|
|
440
|
+
else:
|
|
441
|
+
try:
|
|
442
|
+
review_id = await self._reserve(
|
|
443
|
+
command, work_id=work_id, stager=stager
|
|
424
444
|
)
|
|
425
|
-
|
|
445
|
+
except ReusedReview as reused:
|
|
446
|
+
if is_local:
|
|
447
|
+
await stager.cleanup_files(files)
|
|
448
|
+
reused_id = (reused.result or {}).get("review_id")
|
|
449
|
+
if reused_id is not None:
|
|
450
|
+
await _record(
|
|
451
|
+
"submission.duplicate", command, review_id=reused_id,
|
|
452
|
+
detail={"reused_id": reused_id},
|
|
453
|
+
)
|
|
454
|
+
return reused.result
|
|
426
455
|
|
|
427
|
-
|
|
456
|
+
await _record("review.created", command, review_id=review_id)
|
|
428
457
|
|
|
429
458
|
# A live staging request and a crashed one look identical in the ledger
|
|
430
459
|
# (status='preparing', control_message_id NULL), so the reconciliation
|
|
@@ -432,6 +461,9 @@ class ReviewQueueService:
|
|
|
432
461
|
# window. Renew the row while we work on it, and bound the staging so
|
|
433
462
|
# this request answers before the router's timeout turns it into a
|
|
434
463
|
# synthetic 502 (which hides whether the submission was processed).
|
|
464
|
+
# The heartbeat stays alive through the CONTROL phase too: the row is
|
|
465
|
+
# still 'preparing' until finalize_control, and a slow control send
|
|
466
|
+
# must not be hijacked by the sweep either.
|
|
435
467
|
heartbeat = asyncio.create_task(self._heartbeat_preparing(review_id))
|
|
436
468
|
set_deadline = getattr(stager, "set_staging_deadline", None)
|
|
437
469
|
if callable(set_deadline):
|
|
@@ -450,152 +482,209 @@ class ReviewQueueService:
|
|
|
450
482
|
# media they are being asked to judge. (The reviewer's own on-demand
|
|
451
483
|
# toggle re-edits the already-sent previews via the persisted
|
|
452
484
|
# per-message specs — see handlers.review.toggle_review_spoiler.)
|
|
485
|
+
staging_started = time.monotonic()
|
|
453
486
|
try:
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
487
|
+
try:
|
|
488
|
+
# Pass the id list in-out: when staging fails mid-way, ids of
|
|
489
|
+
# already-uploaded previews survive for rollback deletion. The
|
|
490
|
+
# parallel ``preview_specs`` list records each preview's kind +
|
|
491
|
+
# file_id (aligned with preview_ids) so the spoiler toggle can
|
|
492
|
+
# re-edit every already-sent preview message on demand.
|
|
493
|
+
preview_specs: list = []
|
|
494
|
+
if is_local:
|
|
495
|
+
staged_media, staged_documents, preview_ids, media_decisions = \
|
|
496
|
+
await stager.stage_local(
|
|
497
|
+
files, caption=caption, spoiler=False,
|
|
498
|
+
message_ids=preview_ids, cover_url=cover_url,
|
|
499
|
+
specs=preview_specs,
|
|
500
|
+
)
|
|
501
|
+
else:
|
|
502
|
+
staged_media, staged_documents, preview_ids = await stager.stage_file_ids(
|
|
503
|
+
media or [], documents or [],
|
|
504
|
+
caption=caption, spoiler=False,
|
|
464
505
|
message_ids=preview_ids, cover_url=cover_url,
|
|
465
506
|
specs=preview_specs,
|
|
466
507
|
)
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
508
|
+
except RuntimeError as exc:
|
|
509
|
+
message = str(exc)
|
|
510
|
+
# Best-effort preview deletion, but the ids STAY on the row (no
|
|
511
|
+
# clear_previews): they are the durable evidence of which Telegram
|
|
512
|
+
# messages may exist, for both the reconciler's cleanup pass and
|
|
513
|
+
# any later controlled recovery (§staging-reliability: empty
|
|
514
|
+
# persisted media is not evidence that nothing was sent).
|
|
515
|
+
await stager.delete_preview_messages(preview_ids)
|
|
516
|
+
await self._repo.mark_preparation_failed(
|
|
517
|
+
review_id, message, preview_message_ids=preview_ids
|
|
473
518
|
)
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
await stager.
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
if is_local:
|
|
501
|
-
await stager.cleanup_files(files)
|
|
502
|
-
raise
|
|
503
|
-
finally:
|
|
504
|
-
if callable(set_deadline):
|
|
505
|
-
set_deadline(None)
|
|
506
|
-
await self._stop_heartbeat(heartbeat)
|
|
519
|
+
await _record(
|
|
520
|
+
"review.failed", command, review_id=review_id,
|
|
521
|
+
error_class=classify_error(exc),
|
|
522
|
+
detail=_staging_failure_detail(
|
|
523
|
+
"preview_staging", message, stager, staging_started,
|
|
524
|
+
sent=len(preview_ids),
|
|
525
|
+
),
|
|
526
|
+
)
|
|
527
|
+
if message.startswith("返回消息数") and "与文件数" in message:
|
|
528
|
+
raise RuntimeError(message.replace("返回消息数", "消息数", 1))
|
|
529
|
+
raise
|
|
530
|
+
except Exception as exc:
|
|
531
|
+
await stager.delete_preview_messages(preview_ids)
|
|
532
|
+
await self._repo.mark_preparation_failed(
|
|
533
|
+
review_id, "preview staging failed",
|
|
534
|
+
preview_message_ids=preview_ids,
|
|
535
|
+
)
|
|
536
|
+
await _record(
|
|
537
|
+
"review.failed", command, review_id=review_id,
|
|
538
|
+
error_class=classify_error(exc),
|
|
539
|
+
detail=_staging_failure_detail(
|
|
540
|
+
"preview_staging", str(exc), stager, staging_started,
|
|
541
|
+
sent=len(preview_ids),
|
|
542
|
+
),
|
|
543
|
+
)
|
|
544
|
+
raise
|
|
507
545
|
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if is_local and media_decisions:
|
|
546
|
+
try:
|
|
547
|
+
# The previews are durably staged; the control card still needs its
|
|
548
|
+
# own bounded Telegram budget, and the request must still answer
|
|
549
|
+
# inside the router's window. A fresh deadline also keeps every
|
|
550
|
+
# remaining send observable against a real remaining budget.
|
|
551
|
+
if callable(set_deadline):
|
|
552
|
+
set_deadline(time.monotonic() + self._staging_deadline_seconds)
|
|
553
|
+
staged = await self._repo.update_staged(
|
|
554
|
+
review_id, media=staged_media, documents=staged_documents,
|
|
555
|
+
preview_message_ids=preview_ids,
|
|
556
|
+
preview_message_specs=preview_specs,
|
|
557
|
+
)
|
|
558
|
+
if not staged:
|
|
559
|
+
raise RuntimeError("审核记录在预览完成前被并发修改")
|
|
523
560
|
await _record(
|
|
524
|
-
"
|
|
525
|
-
detail={"
|
|
561
|
+
"review.preview_staged", command, review_id=review_id,
|
|
562
|
+
detail={"media": len(staged_media),
|
|
563
|
+
"documents": len(staged_documents),
|
|
564
|
+
"preview_messages": len(preview_ids)},
|
|
526
565
|
)
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
review_id, control_id,
|
|
539
|
-
refetch_request_id=command.refetch_request_id,
|
|
540
|
-
)
|
|
541
|
-
if not replaced:
|
|
542
|
-
await stager.delete_preview_messages([control_id])
|
|
543
|
-
raise RuntimeError("审核控制消息无法绑定到记录")
|
|
544
|
-
await _record("review.pending", command, review_id=review_id)
|
|
545
|
-
if command.refetch_request_id:
|
|
546
|
-
# The replacement is COMMITTED: the previous generation is now
|
|
547
|
-
# superseded history. Invalidate its review-group card so it can
|
|
548
|
-
# no longer look actionable, and terminalize its editorial
|
|
549
|
-
# drafts. Both are best effort — the backend stale guard is the
|
|
550
|
-
# authority if Telegram delivery fails (§refetch-replacement).
|
|
551
|
-
await self._post_replacement_cleanup(
|
|
552
|
-
stager, review_id=review_id, command=command
|
|
566
|
+
if is_local and media_decisions:
|
|
567
|
+
await _record(
|
|
568
|
+
"media.prepared", command, review_id=review_id,
|
|
569
|
+
detail={"items": media_decisions},
|
|
570
|
+
)
|
|
571
|
+
control_id = await stager.send_control_message_id(
|
|
572
|
+
review_id=review_id, command=command,
|
|
573
|
+
preview_message_ids=preview_ids,
|
|
574
|
+
media_count=_review_media_count(preview_specs, staged_media),
|
|
575
|
+
document_count=len(staged_documents),
|
|
576
|
+
original_count=_original_count(staged_documents),
|
|
553
577
|
)
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
578
|
+
await _record("review.control_created", command,
|
|
579
|
+
review_id=review_id,
|
|
580
|
+
detail={"control_message_id": control_id})
|
|
581
|
+
replaced = await self._repo.finalize_control(
|
|
582
|
+
review_id, control_id,
|
|
583
|
+
refetch_request_id=command.refetch_request_id,
|
|
560
584
|
)
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
585
|
+
if not replaced:
|
|
586
|
+
await stager.delete_preview_messages([control_id])
|
|
587
|
+
raise RuntimeError("审核控制消息无法绑定到记录")
|
|
588
|
+
await _record("review.pending", command, review_id=review_id)
|
|
589
|
+
if command.refetch_request_id:
|
|
590
|
+
# The replacement is COMMITTED: the previous generation is now
|
|
591
|
+
# superseded history. Invalidate its review-group card so it can
|
|
592
|
+
# no longer look actionable, and terminalize its editorial
|
|
593
|
+
# drafts. Both are best effort — the backend stale guard is the
|
|
594
|
+
# authority if Telegram delivery fails (§refetch-replacement).
|
|
595
|
+
await self._post_replacement_cleanup(
|
|
596
|
+
stager, review_id=review_id, command=command
|
|
597
|
+
)
|
|
598
|
+
else:
|
|
599
|
+
# REVIEW_REQUIRED acceptance: the review/control card is now
|
|
600
|
+
# durable. Refetch generations deliberately skip this event.
|
|
601
|
+
from telepost.application.submitter_notify import (
|
|
602
|
+
ManagerAcceptanceContext,
|
|
603
|
+
ManagerNotifyService,
|
|
604
|
+
)
|
|
605
|
+
await ManagerNotifyService().notify_accepted(
|
|
606
|
+
ManagerAcceptanceContext(
|
|
607
|
+
logical_submission_id=f"review:{review_id}",
|
|
608
|
+
review_id=review_id,
|
|
609
|
+
submitter_user_id=command.submitter_user_id or 0,
|
|
610
|
+
submitter_username=command.submitter_username,
|
|
611
|
+
submitter_display_name=command.submitter_display_name,
|
|
612
|
+
anonymous=command.anonymous,
|
|
613
|
+
link=command.link,
|
|
614
|
+
source=command.source,
|
|
615
|
+
review_chat_id=command.review_chat_id,
|
|
616
|
+
control_message_id=control_id,
|
|
617
|
+
status="pending_review",
|
|
618
|
+
actor_kind=command.actor_kind,
|
|
619
|
+
actor_subject=command.actor_subject,
|
|
620
|
+
)
|
|
576
621
|
)
|
|
622
|
+
except Exception as exc:
|
|
623
|
+
await stager.delete_preview_messages(preview_ids)
|
|
624
|
+
await self._repo.mark_preparation_failed(
|
|
625
|
+
review_id, str(exc), clear_previews=True
|
|
577
626
|
)
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
627
|
+
await _record(
|
|
628
|
+
"review.failed", command, review_id=review_id,
|
|
629
|
+
error_class=classify_error(exc),
|
|
630
|
+
detail=_staging_failure_detail(
|
|
631
|
+
"control_message", str(exc), stager, staging_started,
|
|
632
|
+
sent=len(preview_ids),
|
|
633
|
+
),
|
|
634
|
+
)
|
|
635
|
+
raise
|
|
636
|
+
return {
|
|
637
|
+
"status": "pending_review",
|
|
638
|
+
"review_id": review_id,
|
|
639
|
+
"media_count": _review_media_count(preview_specs, staged_media),
|
|
640
|
+
"document_count": len(staged_documents),
|
|
641
|
+
"reused": False,
|
|
642
|
+
}
|
|
589
643
|
finally:
|
|
644
|
+
if callable(set_deadline):
|
|
645
|
+
set_deadline(None)
|
|
646
|
+
await self._stop_heartbeat(heartbeat)
|
|
590
647
|
if is_local:
|
|
591
648
|
await stager.cleanup_files(files)
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
649
|
+
|
|
650
|
+
async def _attempt_failed_recovery(self, row, command: QueueCommand,
|
|
651
|
+
stager: StagingPort):
|
|
652
|
+
"""CAS-claim a staging-failed review for controlled idempotent retry.
|
|
653
|
+
|
|
654
|
+
Eligibility is deliberately narrow (see ``_recoverable_failed_row``):
|
|
655
|
+
the review never became actionable (no control card, nothing
|
|
656
|
+
published, no staged media), so the only Telegram side effects that
|
|
657
|
+
can exist are PRIVATE review-chat preview messages — never a channel
|
|
658
|
+
publication, which stays gated by the pending→approve state machine
|
|
659
|
+
this row never reached. Kept preview ids are cleaned up best-effort
|
|
660
|
+
before re-staging; a residual duplicate preview in the private review
|
|
661
|
+
chat is the bounded, audit-visible cost of recovery, and an empty
|
|
662
|
+
``media_json`` is treated as UNKNOWN external state, not as proof.
|
|
663
|
+
|
|
664
|
+
Returns the claimed ``review_id`` (this request owns the recovery),
|
|
665
|
+
a result dict (a concurrent recovery is mid-flight — converge later),
|
|
666
|
+
or ``None`` (not eligible → normal reuse semantics apply).
|
|
667
|
+
"""
|
|
668
|
+
if not _recoverable_failed_row(row):
|
|
669
|
+
return None
|
|
670
|
+
old_ids = _loads(row["review_message_ids"])
|
|
671
|
+
if old_ids:
|
|
672
|
+
await stager.delete_preview_messages(old_ids)
|
|
673
|
+
if not await self._repo.claim_failed_recovery(int(row["id"])):
|
|
674
|
+
fresh = await self._repo.get(int(row["id"]))
|
|
675
|
+
if fresh is not None and fresh["status"] == "preparing":
|
|
676
|
+
return self.result_from_row(
|
|
677
|
+
fresh, reused=True, reuse_reason="recovery_in_progress",
|
|
678
|
+
)
|
|
679
|
+
return None
|
|
680
|
+
await _record(
|
|
681
|
+
"review.recovery_claimed", command, review_id=int(row["id"]),
|
|
682
|
+
detail={
|
|
683
|
+
"previous_error": (row["error"] or "")[:200],
|
|
684
|
+
"cleaned_preview_ids": old_ids,
|
|
685
|
+
},
|
|
686
|
+
)
|
|
687
|
+
return int(row["id"])
|
|
599
688
|
|
|
600
689
|
async def _reserve(self, command: QueueCommand, *, work_id: str,
|
|
601
690
|
stager: StagingPort) -> int:
|
|
@@ -824,15 +913,36 @@ class ReviewQueueService:
|
|
|
824
913
|
else {"action": action, "error": error}),
|
|
825
914
|
)
|
|
826
915
|
|
|
827
|
-
if not ready
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
916
|
+
if not ready:
|
|
917
|
+
if row["status"] == "preparing":
|
|
918
|
+
# Crash-left partial staging: clean the orphan previews and
|
|
919
|
+
# converge the row to a terminal failure. This also covers
|
|
920
|
+
# a process that died mid-RECOVERY: the reclaimed row is
|
|
921
|
+
# 'preparing' with no staged media yet.
|
|
922
|
+
if preview_ids:
|
|
923
|
+
await stager.delete_preview_messages(preview_ids)
|
|
924
|
+
preview_ids = []
|
|
925
|
+
await self._repo.mark_preparation_failed(
|
|
926
|
+
row["id"],
|
|
927
|
+
"preview preparation interrupted by process restart",
|
|
928
|
+
clear_previews=True,
|
|
929
|
+
)
|
|
930
|
+
await record_reconciled("orphan_preview_removed")
|
|
931
|
+
# A staging-failed row with no staged media must NOT get a
|
|
932
|
+
# control card: an actionable-looking「投稿待审核」card over a
|
|
933
|
+
# 0-media failed row is exactly the DB↔UI divergence seen in
|
|
934
|
+
# the 2026-10-25 incident (#209). The failure is already
|
|
935
|
+
# terminal; same-key retries go through controlled recovery
|
|
936
|
+
# (or the stable 400 reuse answer), not through a phantom card.
|
|
937
|
+
continue
|
|
835
938
|
try:
|
|
939
|
+
# Background repair is bounded too: an unbounded control-card
|
|
940
|
+
# send would stall the whole sweep (and its job-queue slot).
|
|
941
|
+
set_deadline = getattr(stager, "set_staging_deadline", None)
|
|
942
|
+
if callable(set_deadline):
|
|
943
|
+
set_deadline(
|
|
944
|
+
time.monotonic() + self._staging_deadline_seconds
|
|
945
|
+
)
|
|
836
946
|
control_id = await stager.send_control_message_id(
|
|
837
947
|
review_id=row["id"], command=command,
|
|
838
948
|
preview_message_ids=preview_ids,
|
|
@@ -852,6 +962,10 @@ class ReviewQueueService:
|
|
|
852
962
|
await record_reconciled(
|
|
853
963
|
"manual_intervention_required", error=str(exc)[:200]
|
|
854
964
|
)
|
|
965
|
+
finally:
|
|
966
|
+
set_deadline = getattr(stager, "set_staging_deadline", None)
|
|
967
|
+
if callable(set_deadline):
|
|
968
|
+
set_deadline(None)
|
|
855
969
|
return repaired
|
|
856
970
|
|
|
857
971
|
async def _repo_get_by_key(self, key: str):
|
|
@@ -881,6 +995,67 @@ def _loads(value) -> list:
|
|
|
881
995
|
return []
|
|
882
996
|
|
|
883
997
|
|
|
998
|
+
def _recoverable_failed_row(row) -> bool:
|
|
999
|
+
"""Whether a ``failed`` review row may be claimed for controlled recovery.
|
|
1000
|
+
|
|
1001
|
+
The safety argument is about REACHABILITY, not about external effects:
|
|
1002
|
+
a row that never had a control card could never be acted on by a
|
|
1003
|
+
reviewer, and publication is only reachable from ``pending`` (approve
|
|
1004
|
+
CAS), which this row never reached. Rows that DID become actionable —
|
|
1005
|
+
a publish-path failure with staged media (the #208 class), or a card
|
|
1006
|
+
that existed — are excluded: their external state may include channel
|
|
1007
|
+
attempts and they must keep the stable terminal answer instead.
|
|
1008
|
+
Refetch replacements have their own delete-and-recreate path.
|
|
1009
|
+
"""
|
|
1010
|
+
if row is None or row["status"] != "failed":
|
|
1011
|
+
return False
|
|
1012
|
+
if row["refetch_request_id"]:
|
|
1013
|
+
return False
|
|
1014
|
+
if row["control_message_id"] or row["published_message_id"]:
|
|
1015
|
+
return False
|
|
1016
|
+
if _loads(row["media_json"]) or _loads(row["documents_json"]):
|
|
1017
|
+
return False
|
|
1018
|
+
return True
|
|
1019
|
+
|
|
1020
|
+
|
|
1021
|
+
def _staging_failure_detail(stage: str, error: str, stager,
|
|
1022
|
+
started: float, *, sent: int = 0) -> dict:
|
|
1023
|
+
"""Structured audit detail for a staging/control failure (P0-H).
|
|
1024
|
+
|
|
1025
|
+
Correlates the failure with the durable retry timeline so the deadline
|
|
1026
|
+
verdict can be explained from evidence: which ``retry_after`` values
|
|
1027
|
+
Telegram demanded, how much budget was left, how long we ran, and how
|
|
1028
|
+
many preview messages may exist externally.
|
|
1029
|
+
"""
|
|
1030
|
+
detail: dict = {"stage": stage, "error": str(error)[:200], "sent": sent}
|
|
1031
|
+
stats = getattr(stager, "last_staging_stats", None)
|
|
1032
|
+
if isinstance(stats, dict) and stats:
|
|
1033
|
+
elapsed = None
|
|
1034
|
+
if isinstance(stats.get("started"), (int, float)):
|
|
1035
|
+
elapsed = round(time.monotonic() - stats["started"], 3)
|
|
1036
|
+
retries = [
|
|
1037
|
+
{
|
|
1038
|
+
"attempt": entry.get("attempt"),
|
|
1039
|
+
"retry_after": entry.get("retry_after"),
|
|
1040
|
+
"wait": entry.get("wait"),
|
|
1041
|
+
"budget_left": (
|
|
1042
|
+
round(entry["budget_left"], 3)
|
|
1043
|
+
if isinstance(entry.get("budget_left"), (int, float))
|
|
1044
|
+
else entry.get("budget_left")
|
|
1045
|
+
),
|
|
1046
|
+
}
|
|
1047
|
+
for entry in stats.get("retries", [])
|
|
1048
|
+
if isinstance(entry, dict)
|
|
1049
|
+
][:10]
|
|
1050
|
+
detail["staging"] = {
|
|
1051
|
+
"elapsed_s": elapsed,
|
|
1052
|
+
"retries": retries,
|
|
1053
|
+
}
|
|
1054
|
+
if started:
|
|
1055
|
+
detail["elapsed_wall_s"] = round(time.monotonic() - started, 3)
|
|
1056
|
+
return detail
|
|
1057
|
+
|
|
1058
|
+
|
|
884
1059
|
def _original_count(documents) -> int:
|
|
885
1060
|
"""Number of kept 原图 copies among staged/persisted documents."""
|
|
886
1061
|
return sum(
|
|
@@ -8,7 +8,7 @@ to the entry points; when present it overrides these committed defaults.
|
|
|
8
8
|
# Bumped automatically by release-please (extra-files in
|
|
9
9
|
# release-please-config.json). Release bundles and images override it at build
|
|
10
10
|
# time with the exact version/commit; this constant is the local-dev fallback.
|
|
11
|
-
RELEASE_VERSION = "2.84.
|
|
11
|
+
RELEASE_VERSION = "2.84.5" # x-release-please-version
|
|
12
12
|
RELEASE_COMMIT = "dev"
|
|
13
13
|
BUILD_DATE = "dev"
|
|
14
14
|
SERVICE = "telepost"
|