telepost-bot 2.84.4__tar.gz → 2.84.6__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.6}/CHANGELOG.md +15 -0
- {telepost_bot-2.84.4/telepost_bot.egg-info → telepost_bot-2.84.6}/PKG-INFO +1 -1
- telepost_bot-2.84.6/handlers/recovery.py +145 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/main.py +7 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/services/review_service.py +21 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/recovery.py +151 -28
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/review_queue.py +329 -154
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/build_info.py +1 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/observability/doctor.py +58 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/recovery.py +14 -2
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/reviews.py +32 -2
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/review_keyboard.py +5 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/review_stager.py +47 -11
- {telepost_bot-2.84.4 → telepost_bot-2.84.6/telepost_bot.egg-info}/PKG-INFO +1 -1
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost_bot.egg-info/SOURCES.txt +2 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_api_server.py +26 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_recovery.py +22 -6
- telepost_bot-2.84.6/tests/test_recovery_answer_first.py +294 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review.py +18 -5
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_service.py +45 -0
- telepost_bot-2.84.6/tests/test_staging_recovery.py +466 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_submission_timeout_idempotency.py +17 -7
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/ui/locales/en/LC_MESSAGES/telepost.mo +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/ui/locales/en/LC_MESSAGES/telepost.po +6 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/api_server.py +46 -2
- telepost_bot-2.84.4/handlers/recovery.py +0 -90
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/LICENSE +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/MANIFEST.in +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/README.en.md +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/README.md +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/config/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/config/fly-telepost-policy.example.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/config/review_policy.md +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/config/settings.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/config.ini.example +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/database/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/database/db_manager.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/api_commands.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/botconfig.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/callback_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/channel_listener.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/command_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/conversation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/error_handler.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/index_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/mode_selection.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/moderation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/preview_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/publish.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/reaction_stats.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/review.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/schedule_status.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/search_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/stats_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/handlers/upload.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/mcp_server/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/mcp_server/review_client.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/mcp_server/server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/models/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/models/state.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/SOURCES.sha256 +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/error-mapping.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/ackresult.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/capabilities.pixivflow.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/event.job.expired.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/event.job.succeeded.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/eventpage.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/job.cancelled.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/job.failed.no_candidate.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/job.queued.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/job.running.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/job.succeeded.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/jobpage.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/task.candidate_search.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/fixtures/task.candidate_search.target_only.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/protocol/v1/protocol.schema.json +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/pyproject.toml +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/run.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/services/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/setup.cfg +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/api/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/admin_ops.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/delivery_planner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/hot.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/novel_fallback_card.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/pixivflow_jobs.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/post_media.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/posts.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/publication.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/reaction_backfill.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/refetch.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/rerender.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/resubmit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/submitter_notify.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/application/telepress_provider.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/delivery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/errors.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/hot.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/media.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/navigation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/packing.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/presentation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/presentation_policy.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/refetch_state.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/review.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/review_chat.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/domain/submission.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/miniapp/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/miniapp/auth.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/miniapp/rbac.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/miniapp/role_bindings.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/miniapp/session.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/observability/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/observability/audit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/observability/cli.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/observability/errors.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/observability/redact.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/columns.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/inbox.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/ledger.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/media_assets.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/moderation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/posts.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/protocol_events.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/refetch.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/storage/sqlite/submitter_notifications.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/callback_feedback.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/capture.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/discussion.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/executor.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/gateway.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/legacy_runner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/planner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/preparation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/registry.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/delivery/sender.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/inbox_worker.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/review_expiry.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost/telegram/review_media.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost_bot.egg-info/dependency_links.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost_bot.egg-info/entry_points.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost_bot.egg-info/requires.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/telepost_bot.egg-info/top_level.txt +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_admin_api.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_anonymous.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_api_commands.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_api_version.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_architecture_application.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_architecture_core.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_automation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_backfill_attribution.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_blacklist.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_bot_language.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_bot_token_logging.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_botconfig.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_boundary.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_callback_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_caption_mentions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_compatibility.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_config_encoding.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_console_encoding.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_conversation_flow.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_data_class_cleanup.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_database.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_database_first_start.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_database_operations.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_delivery_planner.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_discussion_uncertainty.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_disposition.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_doctor.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_editorial.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_file_validator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_fly_deploy_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_frozen_support.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_handlers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_heat_calculator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_helper_functions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_hot_domain.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_identity_provenance.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_install_scripts.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_integration.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_legacy_delivery_port_navigation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_logic_flow.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_logical_submissions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_maintenance_jobs.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_manager_notifications.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_media_decision_audit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_media_delivery_pipeline.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_media_domain.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_media_preparation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_media_proxy_delivery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_menu_shortcut_single_reply.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_miniapp_api.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_miniapp_auth.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_miniapp_content.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_miniapp_entries.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_miniapp_history.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_miniapp_rbac.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_mixed_media_integrity.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_moderation_and_admin_ux.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_navigation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_no_owner_probe.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_novel_cover_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_novel_delivery_semantics.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_novel_preview.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_observability.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_observability_lifecycle.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_online_reading_root_button.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_packing_ssot.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_polling_server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_preview_pagination.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_production_handler_graph.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_protocol_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_publication_presentation.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_publish_idempotency.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_publish_regressions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_publish_reply.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_reaction_backfill.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_reaction_stats.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_refetch.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_refetch_card_state.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_refetch_events.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_refetch_job_lifecycle.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_refetch_reason_normalization.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_refetch_replacement.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_remote_fetch_fallback.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_rerender.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_resubmit.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_album_payload.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_card_recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_chat_contract.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_consistency.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_expiry_recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_http_mcp.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_review_media_lifecycle.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_robustness.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_run_dispatcher.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_run_mode.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_run_supervisor.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_schedule_outcomes.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_search_disabled_hint.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_search_recovery.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_security.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_security_headers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_session_database_handles.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_shutdown.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_streaming_uploads.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_telegram_golden_messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_telegram_media_cache.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_update_inbox.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_upload.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_user_friendly_messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_webhook_payload_admission.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_webhook_ready.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_webhook_router.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_webhook_secret.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_webhook_secret_logging.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_webhook_static.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/tests/test_work_id_wire.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/ui/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/ui/i18n.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/ui/keyboards.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/ui/messages.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/api_tokens.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/blacklist.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/cache.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/config_wizard.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/console.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/database.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/file_validator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/heat_calculator.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/helper_functions.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/index_manager.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/logging_config.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/maintenance_jobs.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/polling_server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/run_mode.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/runtime_policy.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/schedule_watchdog.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/search_engine.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/security_headers.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/submission.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/utils/webhook_server.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/webapp/__init__.py +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/webapp/dist/assets/2d82b92e720462f8dd3b-Bh4Fahcw.svg +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/webapp/dist/assets/index-CLfkW8eZ.css +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/webapp/dist/assets/index-CfjBQN_e.js +0 -0
- {telepost_bot-2.84.4 → telepost_bot-2.84.6}/webapp/dist/index.html +0 -0
|
@@ -8,6 +8,21 @@
|
|
|
8
8
|
> 发布说明面向普通用户:写「对用户有什么改变」,不写内部实现细节(模块名、函数名、配置键);
|
|
9
9
|
> 技术细节放进代码注释或 `docs/`。每个 Release 的正文由本文件对应版本段自动生成。
|
|
10
10
|
|
|
11
|
+
## [2.84.6](https://github.com/redtidev1918/TelePost/compare/v2.84.5...v2.84.6) (2026-10-25)
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
* answer recovery callbacks before any remote wait (inbox HOL) ([#354](https://github.com/redtidev1918/TelePost/issues/354)) ([8e4883b](https://github.com/redtidev1918/TelePost/commit/8e4883ba835bd28dfc3390c51bf81252102b701c))
|
|
17
|
+
* refuse publish attempts on never-staged review rows ([#352](https://github.com/redtidev1918/TelePost/issues/352)) ([3b71b30](https://github.com/redtidev1918/TelePost/commit/3b71b30823c6fd57d7be3e3ff27faa6675692010))
|
|
18
|
+
|
|
19
|
+
## [2.84.5](https://github.com/redtidev1918/TelePost/compare/v2.84.4...v2.84.5) (2026-10-25)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* bounded Telegram staging retries with controlled failure recovery ([#350](https://github.com/redtidev1918/TelePost/issues/350)) ([c9be5d6](https://github.com/redtidev1918/TelePost/commit/c9be5d66225e844be9a560a2456761c75775164f))
|
|
25
|
+
|
|
11
26
|
## [2.84.4](https://github.com/redtidev1918/TelePost/compare/v2.84.3...v2.84.4) (2026-10-24)
|
|
12
27
|
|
|
13
28
|
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
"""Review-group manual recovery button handler (§manual-recovery).
|
|
2
|
+
|
|
3
|
+
``sched_recover|<target_id>|<normal|relaxed>`` — one button row per FAILED
|
|
4
|
+
target on the terminal schedule message. Clicking admits a durable recovery
|
|
5
|
+
attempt (idempotent per callback id; one active recovery per target), shows the
|
|
6
|
+
operator a business-friendly "accepted/queued" answer, and removes the buttons
|
|
7
|
+
so the same outcome cannot be re-clicked into a second attempt.
|
|
8
|
+
"""
|
|
9
|
+
from __future__ import annotations
|
|
10
|
+
from ui.i18n import tr
|
|
11
|
+
|
|
12
|
+
import logging
|
|
13
|
+
|
|
14
|
+
from telegram import Update
|
|
15
|
+
from telegram.ext import CallbackContext
|
|
16
|
+
|
|
17
|
+
logger = logging.getLogger(__name__)
|
|
18
|
+
|
|
19
|
+
ACCEPTED_TEXT = tr('已受理,系统会自动继续处理。')
|
|
20
|
+
ALREADY_TEXT = tr('该目标已在处理中,请稍候。')
|
|
21
|
+
MODE_LABEL = {"normal": tr('再试一次'), "relaxed": tr('放宽条件重试')}
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
async def _answer(query, text: str = "", **kwargs) -> None:
|
|
25
|
+
try:
|
|
26
|
+
if text or kwargs:
|
|
27
|
+
await query.answer(text=text, **kwargs)
|
|
28
|
+
else:
|
|
29
|
+
await query.answer()
|
|
30
|
+
except Exception as exc: # pragma: no cover - best effort
|
|
31
|
+
logger.debug("回调应答失败: %s", exc)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
def _failure_lines(exc) -> str:
|
|
35
|
+
lines = [tr('❌ 恢复请求失败'), "", tr('原因:{p0}').format(p0=exc)]
|
|
36
|
+
code = getattr(exc, "code", "recovery_error")
|
|
37
|
+
if code:
|
|
38
|
+
lines.append(tr('错误码:{p0}').format(p0=code))
|
|
39
|
+
retryable = getattr(exc, "retryable", None)
|
|
40
|
+
if isinstance(retryable, bool):
|
|
41
|
+
lines.append(tr('后续处理:可重试') if retryable else tr('后续处理:需先人工处理'))
|
|
42
|
+
hint = getattr(exc, "hint", "")
|
|
43
|
+
if hint:
|
|
44
|
+
lines.append(tr('建议:{p0}').format(p0=hint))
|
|
45
|
+
return "\n".join(lines)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
async def schedule_recover(update: Update, context: CallbackContext) -> None:
|
|
49
|
+
query = update.callback_query
|
|
50
|
+
data = query.data or ""
|
|
51
|
+
try:
|
|
52
|
+
_, target_id, mode = data.split("|", 2)
|
|
53
|
+
except ValueError:
|
|
54
|
+
await _answer(query, tr('无效的恢复请求'))
|
|
55
|
+
return
|
|
56
|
+
mode = mode.strip().lower()
|
|
57
|
+
if mode not in ("normal", "relaxed"):
|
|
58
|
+
await _answer(query, tr('无效的恢复方式'))
|
|
59
|
+
return
|
|
60
|
+
|
|
61
|
+
from telepost.application.recovery import (
|
|
62
|
+
RELAXED_EXPLANATION,
|
|
63
|
+
RecoveryAlreadyRunningError,
|
|
64
|
+
RecoveryError,
|
|
65
|
+
admit_recovery,
|
|
66
|
+
submit_recovery,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
# Answer-first (2026-10-25): this handler runs inside the strictly-serial
|
|
70
|
+
# Durable Inbox worker. The admission below touches ONLY the local DB; the
|
|
71
|
+
# remote POST to PixivFlow (cold start ~8s+, worst case the submit timeout)
|
|
72
|
+
# happens in a background task with the 300s resubmit sweep as its crash
|
|
73
|
+
# net — waiting on it inline blew Telegram's ~10s callback-answer window
|
|
74
|
+
# AND head-of-line blocked every later update of this bot.
|
|
75
|
+
try:
|
|
76
|
+
result = await admit_recovery(
|
|
77
|
+
target_id,
|
|
78
|
+
retry_mode=mode,
|
|
79
|
+
callback_key=str(query.id),
|
|
80
|
+
)
|
|
81
|
+
except RecoveryAlreadyRunningError as exc:
|
|
82
|
+
await _answer(query, str(exc))
|
|
83
|
+
return
|
|
84
|
+
except RecoveryError as exc:
|
|
85
|
+
await _answer(query, _failure_lines(exc), show_alert=True)
|
|
86
|
+
return
|
|
87
|
+
except Exception:
|
|
88
|
+
# Any unexpected local failure must still answer: a silent raise here
|
|
89
|
+
# leaves the operator with a dead spinner and dead-letters the update.
|
|
90
|
+
logger.exception("恢复请求处理异常: target=%s", target_id)
|
|
91
|
+
await _answer(query, tr('恢复请求处理异常,请稍后重试'), show_alert=True)
|
|
92
|
+
return
|
|
93
|
+
|
|
94
|
+
label = MODE_LABEL.get(mode, tr('重试'))
|
|
95
|
+
reply = tr('✅ 已提交{p0}:系统会自动继续处理。').format(p0=label)
|
|
96
|
+
if mode == "relaxed":
|
|
97
|
+
reply += f"\n{RELAXED_EXPLANATION}"
|
|
98
|
+
await _answer(query, reply)
|
|
99
|
+
if result.get("already_running"):
|
|
100
|
+
await _answer(query, ALREADY_TEXT)
|
|
101
|
+
return
|
|
102
|
+
# Remove the buttons: the outcome message is terminal history; the recovery
|
|
103
|
+
# itself reports through its own schedule-outcome notification.
|
|
104
|
+
try:
|
|
105
|
+
await query.edit_message_reply_markup(reply_markup=None)
|
|
106
|
+
except Exception as exc:
|
|
107
|
+
logger.debug("移除恢复按钮失败: %s", exc)
|
|
108
|
+
# Out-of-band remote submission (same requestId; idempotent on PixivFlow).
|
|
109
|
+
# Only for rows still awaiting submission — a replayed/terminal row must
|
|
110
|
+
# not be resurrected by a second submit.
|
|
111
|
+
if result.get("state") == "requested" and result.get("request_id"):
|
|
112
|
+
message = getattr(query, "message", None)
|
|
113
|
+
notify_chat_id = getattr(message, "chat_id", None)
|
|
114
|
+
|
|
115
|
+
async def _submit() -> None:
|
|
116
|
+
try:
|
|
117
|
+
await submit_recovery(
|
|
118
|
+
target_id, result["request_id"], mode,
|
|
119
|
+
terminal_on_failure=False,
|
|
120
|
+
)
|
|
121
|
+
except Exception as exc:
|
|
122
|
+
# Terminal (non-retryable) failure: the ✅ answer already used
|
|
123
|
+
# the callback window, so the operator is told in-chat instead.
|
|
124
|
+
logger.error("后台提交恢复请求失败: target=%s request=%s",
|
|
125
|
+
target_id, result.get("request_id"), exc_info=True)
|
|
126
|
+
from telepost.application.recovery import RecoveryError
|
|
127
|
+
if isinstance(exc, RecoveryError) and notify_chat_id:
|
|
128
|
+
bot = getattr(context, "bot", None)
|
|
129
|
+
if bot is not None:
|
|
130
|
+
try:
|
|
131
|
+
await bot.send_message(
|
|
132
|
+
chat_id=notify_chat_id,
|
|
133
|
+
text=_failure_lines(exc),
|
|
134
|
+
)
|
|
135
|
+
except Exception:
|
|
136
|
+
logger.warning("恢复失败通知发送失败", exc_info=True)
|
|
137
|
+
|
|
138
|
+
try:
|
|
139
|
+
import asyncio
|
|
140
|
+
tasks = context.bot_data.setdefault("_recovery_submit_tasks", set())
|
|
141
|
+
task = asyncio.create_task(_submit())
|
|
142
|
+
tasks.add(task)
|
|
143
|
+
task.add_done_callback(tasks.discard)
|
|
144
|
+
except Exception:
|
|
145
|
+
logger.exception("创建恢复后台提交任务失败: target=%s", target_id)
|
|
@@ -881,6 +881,13 @@ def setup_application(application):
|
|
|
881
881
|
await clean_review_preview_media(context.bot)
|
|
882
882
|
await poll_refetch_jobs(context.bot, force=True)
|
|
883
883
|
await reconcile_incomplete_reviews(context.bot)
|
|
884
|
+
# §manual-recovery answer-first 兜底:后台提交任务随进程死掉时,
|
|
885
|
+
# 按 requestId 幂等重投 'requested' 恢复行;超龄终态化(带审计)。
|
|
886
|
+
from telepost.application.recovery import resubmit_pending_recoveries
|
|
887
|
+
try:
|
|
888
|
+
await resubmit_pending_recoveries()
|
|
889
|
+
except Exception:
|
|
890
|
+
logger.warning("恢复提交兜底重扫失败", exc_info=True)
|
|
884
891
|
from telepost.application.submitter_notify import (
|
|
885
892
|
flush_manager_notifications,
|
|
886
893
|
flush_submitter_notifications,
|
|
@@ -921,6 +921,27 @@ class ReviewService:
|
|
|
921
921
|
review_id, True, current_spoiler,
|
|
922
922
|
len(_as_list(row["media_json"])), len(_as_list(row["documents_json"])),
|
|
923
923
|
)
|
|
924
|
+
# A claimed row with NO publishable payload can only be a staging
|
|
925
|
+
# failure that never completed: admission requires media/documents,
|
|
926
|
+
# and a row that reached pending always has staged payload. Running
|
|
927
|
+
# the doomed publish (the 2026-10-25 #209 phantom-card clicks) just
|
|
928
|
+
# flips the row publishing→failed on every click while inviting
|
|
929
|
+
# 「可重试」 on a row that can never publish. Release the claim and
|
|
930
|
+
# refuse honestly. Rows WITH staged payload (#208-class recovery)
|
|
931
|
+
# and chain-asset rows are untouched.
|
|
932
|
+
if not _as_list(row["media_json"]) and not _as_list(row["documents_json"]):
|
|
933
|
+
try:
|
|
934
|
+
has_chain = bool(str(row["review_chain_id"] or ""))
|
|
935
|
+
except (KeyError, IndexError):
|
|
936
|
+
has_chain = False
|
|
937
|
+
if not has_chain:
|
|
938
|
+
await self._repo.mark_failed(
|
|
939
|
+
review_id, "无可发布内容:审核暂存从未完成",
|
|
940
|
+
)
|
|
941
|
+
_audit("approve", review_id, actor, "failed",
|
|
942
|
+
source=source, error="no_publishable_payload")
|
|
943
|
+
raise ReviewStateError(
|
|
944
|
+
"该审核从未完成暂存,无可发布内容;请等待投稿方重新投递。")
|
|
924
945
|
if on_claim is not None:
|
|
925
946
|
try:
|
|
926
947
|
await on_claim(row)
|
|
@@ -23,7 +23,9 @@ import asyncio
|
|
|
23
23
|
import json
|
|
24
24
|
import logging
|
|
25
25
|
import os
|
|
26
|
+
import time
|
|
26
27
|
import uuid
|
|
28
|
+
from typing import Optional
|
|
27
29
|
from urllib.error import HTTPError
|
|
28
30
|
from urllib.parse import quote, urlparse
|
|
29
31
|
from urllib.request import Request, urlopen
|
|
@@ -90,21 +92,26 @@ def _normalize_mode(retry_mode: str) -> str:
|
|
|
90
92
|
return mode if mode in (NORMAL, RELAXED) else NORMAL
|
|
91
93
|
|
|
92
94
|
|
|
93
|
-
async def
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
retry_mode: str = NORMAL,
|
|
97
|
-
callback_key: str = "",
|
|
98
|
-
schedule_id: str = "",
|
|
99
|
-
) -> dict:
|
|
100
|
-
"""Admit one manual recovery attempt for a failed target (idempotent).
|
|
95
|
+
async def admit_recovery(target_id: str, *, retry_mode: str = NORMAL,
|
|
96
|
+
callback_key: str = "", schedule_id: str = "") -> dict:
|
|
97
|
+
"""DURABLY admit one recovery attempt — local DB only, no remote I/O.
|
|
101
98
|
|
|
102
|
-
|
|
99
|
+
Split from the remote submission (2026-10-25): the Telegram callback
|
|
100
|
+
handler runs inside the strictly-serial Durable Inbox worker, where a
|
|
101
|
+
remote wait (PixivFlow cold start ~8s+, worst case the submit timeout)
|
|
102
|
+
both blows Telegram's ~10s callback-answer window and head-of-line blocks
|
|
103
|
+
every later update of that bot. Callers answer the user from THIS result
|
|
104
|
+
and submit out-of-band via :func:`submit_recovery` (immediate background
|
|
105
|
+
task + the periodic resubmit sweep).
|
|
106
|
+
|
|
107
|
+
Returns the admission dict (``state`` is ``requested`` for a fresh admit,
|
|
108
|
+
or the replayed row's state) with the same shape as before::
|
|
103
109
|
|
|
104
110
|
{"state", "request_id", "replayed", "already_running",
|
|
105
111
|
"retry_mode", "target_id", "schedule_id"}
|
|
106
112
|
|
|
107
|
-
Raises RecoveryError subclasses
|
|
113
|
+
Raises RecoveryError subclasses for configuration/admission failures
|
|
114
|
+
exactly as before.
|
|
108
115
|
"""
|
|
109
116
|
target_id = str(target_id or "").strip()
|
|
110
117
|
if not target_id:
|
|
@@ -164,7 +171,29 @@ async def request_target_recovery(
|
|
|
164
171
|
)
|
|
165
172
|
except Exception:
|
|
166
173
|
pass
|
|
167
|
-
|
|
174
|
+
return {
|
|
175
|
+
"state": "requested",
|
|
176
|
+
"request_id": request_id,
|
|
177
|
+
"replayed": False,
|
|
178
|
+
"already_running": False,
|
|
179
|
+
"retry_mode": mode,
|
|
180
|
+
"target_id": target_id,
|
|
181
|
+
"schedule_id": schedule_id,
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
async def submit_recovery(target_id: str, request_id: str,
|
|
186
|
+
retry_mode: str, *,
|
|
187
|
+
terminal_on_failure: bool = True) -> dict:
|
|
188
|
+
"""POST the durable recovery to PixivFlow and settle the attempt row.
|
|
189
|
+
|
|
190
|
+
``terminal_on_failure=False`` (the background/sweep path) keeps TRANSIENT
|
|
191
|
+
failures in state ``requested`` so the periodic sweep retries them with
|
|
192
|
+
the SAME requestId (PixivFlow converges); non-retryable failures
|
|
193
|
+
terminalize either way. The synchronous default preserves the historical
|
|
194
|
+
contract of :func:`request_target_recovery` for non-inbox callers.
|
|
195
|
+
"""
|
|
196
|
+
mode = _normalize_mode(retry_mode)
|
|
168
197
|
# Remote submission is async: the endpoint answers once the attempt is
|
|
169
198
|
# DURABLE; PixivFlow queues/runs under its own resource admission.
|
|
170
199
|
try:
|
|
@@ -178,7 +207,7 @@ async def request_target_recovery(
|
|
|
178
207
|
try:
|
|
179
208
|
await _record_recovery_event(
|
|
180
209
|
"schedule.recovery_remote_accepted", target_id=target_id,
|
|
181
|
-
request_id=request_id, retry_mode=mode, schedule_id=
|
|
210
|
+
request_id=request_id, retry_mode=mode, schedule_id="",
|
|
182
211
|
detail_slot=result.get("slotId"),
|
|
183
212
|
)
|
|
184
213
|
except Exception:
|
|
@@ -190,32 +219,126 @@ async def request_target_recovery(
|
|
|
190
219
|
"already_running": False,
|
|
191
220
|
"retry_mode": mode,
|
|
192
221
|
"target_id": target_id,
|
|
193
|
-
"schedule_id":
|
|
222
|
+
"schedule_id": "",
|
|
194
223
|
}
|
|
195
224
|
except Exception as exc:
|
|
196
225
|
failure = _classify_recovery_error(exc)
|
|
197
226
|
code = failure["code"]
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
227
|
+
terminal = terminal_on_failure or not failure.get("retryable", False)
|
|
228
|
+
if terminal:
|
|
229
|
+
async with db_manager.get_db() as conn:
|
|
230
|
+
from telepost.storage.sqlite.recovery import RecoveryRepository
|
|
231
|
+
repo = RecoveryRepository(conn)
|
|
232
|
+
await repo.mark_failed(request_id, code)
|
|
233
|
+
try:
|
|
234
|
+
await _record_recovery_event(
|
|
235
|
+
"schedule.recovery_failed", target_id=target_id,
|
|
236
|
+
request_id=request_id, retry_mode=mode, schedule_id="",
|
|
237
|
+
error_class=code,
|
|
238
|
+
)
|
|
239
|
+
except Exception:
|
|
240
|
+
pass
|
|
241
|
+
cause = str(exc).strip().rstrip("。") or ""
|
|
242
|
+
reason = f":{cause[:200]}" if cause else ""
|
|
243
|
+
raise RecoveryError(
|
|
244
|
+
f"恢复请求提交失败{reason},请稍后重试",
|
|
245
|
+
code=code or failure["code"],
|
|
246
|
+
stage="recovery_request",
|
|
247
|
+
retryable=failure["retryable"],
|
|
248
|
+
hint=failure["hint"],
|
|
249
|
+
) from exc
|
|
202
250
|
try:
|
|
203
251
|
await _record_recovery_event(
|
|
204
|
-
"schedule.
|
|
205
|
-
request_id=request_id, retry_mode=mode, schedule_id=
|
|
252
|
+
"schedule.recovery_submit_deferred", target_id=target_id,
|
|
253
|
+
request_id=request_id, retry_mode=mode, schedule_id="",
|
|
206
254
|
error_class=code,
|
|
207
255
|
)
|
|
208
256
|
except Exception:
|
|
209
257
|
pass
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
258
|
+
return {
|
|
259
|
+
"state": "requested",
|
|
260
|
+
"request_id": request_id,
|
|
261
|
+
"replayed": False,
|
|
262
|
+
"already_running": True,
|
|
263
|
+
"retry_mode": mode,
|
|
264
|
+
"target_id": target_id,
|
|
265
|
+
"schedule_id": "",
|
|
266
|
+
"submit_error": code,
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
async def request_target_recovery(
|
|
271
|
+
target_id: str,
|
|
272
|
+
*,
|
|
273
|
+
retry_mode: str = NORMAL,
|
|
274
|
+
callback_key: str = "",
|
|
275
|
+
schedule_id: str = "",
|
|
276
|
+
) -> dict:
|
|
277
|
+
"""Admit + synchronously submit (historical contract, non-inbox callers)."""
|
|
278
|
+
admitted = await admit_recovery(
|
|
279
|
+
target_id, retry_mode=retry_mode, callback_key=callback_key,
|
|
280
|
+
schedule_id=schedule_id,
|
|
281
|
+
)
|
|
282
|
+
if admitted.get("replayed") or admitted.get("state") != "requested":
|
|
283
|
+
return admitted
|
|
284
|
+
return await submit_recovery(
|
|
285
|
+
target_id, admitted["request_id"], admitted["retry_mode"],
|
|
286
|
+
)
|
|
287
|
+
|
|
288
|
+
|
|
289
|
+
#: A 'requested' row younger than this is owned by its background submit task;
|
|
290
|
+
#: older ones are fair game for the periodic sweep.
|
|
291
|
+
RECOVERY_SUBMIT_SWEEP_MIN_AGE = 60.0
|
|
292
|
+
#: Give up (terminalize with audit) after this total age — a recovery admit
|
|
293
|
+
#: must never run forever.
|
|
294
|
+
RECOVERY_SUBMIT_MAX_AGE = 15 * 60.0
|
|
295
|
+
|
|
296
|
+
|
|
297
|
+
async def resubmit_pending_recoveries(*, now: Optional[float] = None) -> int:
|
|
298
|
+
"""Crash/transient safety net for admitted-but-unsubmitted recoveries.
|
|
299
|
+
|
|
300
|
+
The answer-first callback flow admits durably and submits in a background
|
|
301
|
+
task; if that task died with the process (or its transient failure kept
|
|
302
|
+
the row 'requested'), this sweep — wired into the 300s runtime cleanup —
|
|
303
|
+
re-POSTs with the SAME requestId (idempotent on PixivFlow). Past
|
|
304
|
+
``RECOVERY_SUBMIT_MAX_AGE`` the row terminalizes with an audit instead of
|
|
305
|
+
retrying forever.
|
|
306
|
+
"""
|
|
307
|
+
now = time.time() if now is None else now
|
|
308
|
+
if not os.getenv("PIXIVFLOW_REFETCH_BASE_URL") or not os.getenv("PIXIVFLOW_REFETCH_TOKEN"):
|
|
309
|
+
return 0
|
|
310
|
+
from telepost.storage.sqlite.recovery import RecoveryRepository
|
|
311
|
+
rows = []
|
|
312
|
+
async with db_manager.get_db() as conn:
|
|
313
|
+
repo = RecoveryRepository(conn)
|
|
314
|
+
rows = await repo.list_requested_before(now - RECOVERY_SUBMIT_SWEEP_MIN_AGE)
|
|
315
|
+
for row in rows:
|
|
316
|
+
if float(row["created_at"]) < now - RECOVERY_SUBMIT_MAX_AGE:
|
|
317
|
+
await repo.mark_failed(
|
|
318
|
+
row["request_id"], "submit_retry_exhausted")
|
|
319
|
+
await _record_recovery_event(
|
|
320
|
+
"schedule.recovery_failed", target_id=row["target_id"],
|
|
321
|
+
request_id=row["request_id"],
|
|
322
|
+
retry_mode=row["retry_mode"] or NORMAL,
|
|
323
|
+
schedule_id=row["schedule_id"] or "",
|
|
324
|
+
error_class="submit_retry_exhausted",
|
|
325
|
+
)
|
|
326
|
+
for row in rows:
|
|
327
|
+
if float(row["created_at"]) < now - RECOVERY_SUBMIT_MAX_AGE:
|
|
328
|
+
continue
|
|
329
|
+
try:
|
|
330
|
+
await submit_recovery(
|
|
331
|
+
row["target_id"], row["request_id"],
|
|
332
|
+
row["retry_mode"] or NORMAL,
|
|
333
|
+
terminal_on_failure=False,
|
|
334
|
+
)
|
|
335
|
+
except RecoveryError:
|
|
336
|
+
# Non-retryable: already terminalized + audited inside.
|
|
337
|
+
pass
|
|
338
|
+
except Exception:
|
|
339
|
+
logger.warning("恢复提交兜底重投失败: request_id=%s",
|
|
340
|
+
row["request_id"], exc_info=True)
|
|
341
|
+
return len(rows)
|
|
219
342
|
|
|
220
343
|
|
|
221
344
|
def _submit_pixivflow_recover(target_id: str, request_id: str,
|