@resolveio/server-lib 22.3.221 → 22.3.222
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.
- package/ai/assistant-core-heuristics.d.ts +11 -0
- package/ai/assistant-core-heuristics.js +356 -0
- package/ai/assistant-core-heuristics.js.map +1 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.d.ts +3 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.js +214 -0
- package/ai/resolveio-platform-intelligence-memory-corpus.js.map +1 -0
- package/ai/resolveio-platform-intelligence-memory.d.ts +20 -0
- package/ai/resolveio-platform-intelligence-memory.js +341 -0
- package/ai/resolveio-platform-intelligence-memory.js.map +1 -0
- package/{src/ai/resolveio-platform-intelligence-types.ts → ai/resolveio-platform-intelligence-types.d.ts} +15 -20
- package/ai/resolveio-platform-intelligence-types.js +4 -0
- package/ai/resolveio-platform-intelligence-types.js.map +1 -0
- package/ai/resolveio-platform-intelligence.d.ts +6 -0
- package/ai/resolveio-platform-intelligence.js +463 -0
- package/ai/resolveio-platform-intelligence.js.map +1 -0
- package/client-server-app.d.ts +1 -0
- package/client-server-app.js +68 -0
- package/client-server-app.js.map +1 -0
- package/collections/ai-run.collection.d.ts +3 -0
- package/collections/ai-run.collection.js +170 -0
- package/collections/ai-run.collection.js.map +1 -0
- package/collections/ai-terminal-conversation.collection.d.ts +2 -0
- package/collections/ai-terminal-conversation.collection.js +140 -0
- package/collections/ai-terminal-conversation.collection.js.map +1 -0
- package/collections/ai-terminal-issue-report.collection.d.ts +2 -0
- package/collections/ai-terminal-issue-report.collection.js +148 -0
- package/collections/ai-terminal-issue-report.collection.js.map +1 -0
- package/collections/ai-terminal-message.collection.d.ts +2 -0
- package/collections/ai-terminal-message.collection.js +121 -0
- package/collections/ai-terminal-message.collection.js.map +1 -0
- package/collections/app-setting.collection.d.ts +3 -0
- package/collections/app-setting.collection.js +103 -0
- package/collections/app-setting.collection.js.map +1 -0
- package/collections/app-status.collection.d.ts +3 -0
- package/collections/app-status.collection.js +57 -0
- package/collections/app-status.collection.js.map +1 -0
- package/collections/communication-metric.collection.d.ts +2 -0
- package/collections/communication-metric.collection.js +133 -0
- package/collections/communication-metric.collection.js.map +1 -0
- package/collections/counter.collection.d.ts +3 -0
- package/collections/counter.collection.js +56 -0
- package/collections/counter.collection.js.map +1 -0
- package/collections/cron-job-history.collection.d.ts +3 -0
- package/collections/cron-job-history.collection.js +137 -0
- package/collections/cron-job-history.collection.js.map +1 -0
- package/collections/cron-job.collection.d.ts +3 -0
- package/collections/cron-job.collection.js +92 -0
- package/collections/cron-job.collection.js.map +1 -0
- package/collections/customer-notification.collection.d.ts +3 -0
- package/collections/customer-notification.collection.js +130 -0
- package/collections/customer-notification.collection.js.map +1 -0
- package/collections/customer-portal-password.collection.d.ts +3 -0
- package/collections/customer-portal-password.collection.js +75 -0
- package/collections/customer-portal-password.collection.js.map +1 -0
- package/collections/email-history.collection.d.ts +3 -0
- package/collections/email-history.collection.js +134 -0
- package/collections/email-history.collection.js.map +1 -0
- package/collections/email-verified.collection.d.ts +3 -0
- package/collections/email-verified.collection.js +62 -0
- package/collections/email-verified.collection.js.map +1 -0
- package/collections/file.collection.d.ts +3 -0
- package/collections/file.collection.js +74 -0
- package/collections/file.collection.js.map +1 -0
- package/collections/flag-update.collection.d.ts +3 -0
- package/collections/flag-update.collection.js +57 -0
- package/collections/flag-update.collection.js.map +1 -0
- package/collections/flag.collection.d.ts +3 -0
- package/collections/flag.collection.js +57 -0
- package/collections/flag.collection.js.map +1 -0
- package/collections/log-method-latency.collection.d.ts +3 -0
- package/collections/log-method-latency.collection.js +77 -0
- package/collections/log-method-latency.collection.js.map +1 -0
- package/collections/log-subscription.collection.d.ts +3 -0
- package/collections/log-subscription.collection.js +80 -0
- package/collections/log-subscription.collection.js.map +1 -0
- package/collections/log.collection.d.ts +3 -0
- package/collections/log.collection.js +93 -0
- package/collections/log.collection.js.map +1 -0
- package/collections/logged-in-users.collection.d.ts +3 -0
- package/collections/logged-in-users.collection.js +67 -0
- package/collections/logged-in-users.collection.js.map +1 -0
- package/collections/monitor-cpu.collection.d.ts +3 -0
- package/collections/monitor-cpu.collection.js +65 -0
- package/collections/monitor-cpu.collection.js.map +1 -0
- package/collections/monitor-function.collection.d.ts +3 -0
- package/collections/monitor-function.collection.js +74 -0
- package/collections/monitor-function.collection.js.map +1 -0
- package/collections/monitor-memory.collection.d.ts +3 -0
- package/collections/monitor-memory.collection.js +77 -0
- package/collections/monitor-memory.collection.js.map +1 -0
- package/collections/monitor-mongo.collection.d.ts +3 -0
- package/collections/monitor-mongo.collection.js +71 -0
- package/collections/monitor-mongo.collection.js.map +1 -0
- package/collections/notification.collection.d.ts +3 -0
- package/collections/notification.collection.js +57 -0
- package/collections/notification.collection.js.map +1 -0
- package/collections/openai-usage-ledger.collection.d.ts +2 -0
- package/collections/openai-usage-ledger.collection.js +188 -0
- package/collections/openai-usage-ledger.collection.js.map +1 -0
- package/collections/report-builder-dashboard-builder.collection.d.ts +3 -0
- package/collections/report-builder-dashboard-builder.collection.js +109 -0
- package/collections/report-builder-dashboard-builder.collection.js.map +1 -0
- package/collections/report-builder-library.collection.d.ts +3 -0
- package/collections/report-builder-library.collection.js +87 -0
- package/collections/report-builder-library.collection.js.map +1 -0
- package/collections/report-builder-report.collection.d.ts +4 -0
- package/collections/report-builder-report.collection.js +184 -0
- package/collections/report-builder-report.collection.js.map +1 -0
- package/collections/user-group.collection.d.ts +4 -0
- package/collections/user-group.collection.js +89 -0
- package/collections/user-group.collection.js.map +1 -0
- package/collections/user-guide.collection.d.ts +3 -0
- package/collections/user-guide.collection.js +57 -0
- package/collections/user-guide.collection.js.map +1 -0
- package/collections/user.collection.d.ts +4 -0
- package/collections/user.collection.js +180 -0
- package/collections/user.collection.js.map +1 -0
- package/cron/cron.d.ts +14 -0
- package/cron/cron.js +216 -0
- package/cron/cron.js.map +1 -0
- package/fixtures/cron-jobs.d.ts +1 -0
- package/fixtures/cron-jobs.js +150 -0
- package/fixtures/cron-jobs.js.map +1 -0
- package/fixtures/init.d.ts +1 -0
- package/fixtures/init.js +91 -0
- package/fixtures/init.js.map +1 -0
- package/http/auth.d.ts +2 -0
- package/http/auth.js +951 -0
- package/http/auth.js.map +1 -0
- package/http/health.d.ts +1 -0
- package/http/health.js +11 -0
- package/http/health.js.map +1 -0
- package/http/home.d.ts +1 -0
- package/http/home.js +134 -0
- package/http/home.js.map +1 -0
- package/http/slow-query-publication.d.ts +2 -0
- package/http/slow-query-publication.js +99 -0
- package/http/slow-query-publication.js.map +1 -0
- package/index.d.ts +1 -0
- package/index.js +19 -0
- package/index.js.map +1 -0
- package/managers/ai-assistant-codex-manager.manager.d.ts +67 -0
- package/managers/ai-assistant-codex-manager.manager.js +1113 -0
- package/managers/ai-assistant-codex-manager.manager.js.map +1 -0
- package/managers/ai-run-evidence.manager.d.ts +36 -0
- package/managers/ai-run-evidence.manager.js +377 -0
- package/managers/ai-run-evidence.manager.js.map +1 -0
- package/managers/communication-metric.manager.d.ts +16 -0
- package/managers/communication-metric.manager.js +134 -0
- package/managers/communication-metric.manager.js.map +1 -0
- package/managers/cron.manager.d.ts +20 -0
- package/managers/cron.manager.js +534 -0
- package/managers/cron.manager.js.map +1 -0
- package/managers/customer-notification-content.manager.d.ts +55 -0
- package/managers/customer-notification-content.manager.js +158 -0
- package/managers/customer-notification-content.manager.js.map +1 -0
- package/managers/diagnostic-manager-bootstrap.d.ts +9 -0
- package/managers/diagnostic-manager-bootstrap.js +260 -0
- package/managers/diagnostic-manager-bootstrap.js.map +1 -0
- package/managers/error-auto-fix.manager.d.ts +149 -0
- package/managers/error-auto-fix.manager.js +3064 -0
- package/managers/error-auto-fix.manager.js.map +1 -0
- package/managers/local-log.manager.d.ts +18 -0
- package/managers/local-log.manager.js +88 -0
- package/managers/local-log.manager.js.map +1 -0
- package/managers/method.manager.d.ts +84 -0
- package/managers/method.manager.js +1964 -0
- package/managers/method.manager.js.map +1 -0
- package/managers/mongo.manager.d.ts +224 -0
- package/managers/mongo.manager.js +5000 -0
- package/managers/mongo.manager.js.map +1 -0
- package/managers/monitor.manager.d.ts +70 -0
- package/managers/monitor.manager.js +550 -0
- package/managers/monitor.manager.js.map +1 -0
- package/managers/openai-usage-ledger.manager.d.ts +30 -0
- package/managers/openai-usage-ledger.manager.js +142 -0
- package/managers/openai-usage-ledger.manager.js.map +1 -0
- package/managers/slow-query-verifier.manager.d.ts +144 -0
- package/managers/slow-query-verifier.manager.js +3857 -0
- package/managers/slow-query-verifier.manager.js.map +1 -0
- package/managers/slow-query.manager.d.ts +28 -0
- package/managers/slow-query.manager.js +468 -0
- package/managers/slow-query.manager.js.map +1 -0
- package/managers/subscription.manager.d.ts +169 -0
- package/managers/subscription.manager.js +3434 -0
- package/managers/subscription.manager.js.map +1 -0
- package/managers/websocket.manager.d.ts +73 -0
- package/managers/websocket.manager.js +673 -0
- package/managers/websocket.manager.js.map +1 -0
- package/managers/worker-dispatcher.manager.d.ts +120 -0
- package/managers/worker-dispatcher.manager.js +1266 -0
- package/managers/worker-dispatcher.manager.js.map +1 -0
- package/managers/worker-server.manager.d.ts +35 -0
- package/managers/worker-server.manager.js +582 -0
- package/managers/worker-server.manager.js.map +1 -0
- package/methods/accounts.d.ts +2 -0
- package/methods/accounts.js +624 -0
- package/methods/accounts.js.map +1 -0
- package/methods/ai-terminal.d.ts +458 -0
- package/methods/ai-terminal.js +27991 -0
- package/methods/ai-terminal.js.map +1 -0
- package/methods/app-settings.d.ts +2 -0
- package/methods/app-settings.js +169 -0
- package/methods/app-settings.js.map +1 -0
- package/methods/aws.d.ts +2 -0
- package/methods/aws.js +877 -0
- package/methods/aws.js.map +1 -0
- package/methods/collections.d.ts +2 -0
- package/methods/collections.js +719 -0
- package/methods/collections.js.map +1 -0
- package/methods/counters.d.ts +2 -0
- package/methods/counters.js +113 -0
- package/methods/counters.js.map +1 -0
- package/methods/cron-jobs.d.ts +2 -0
- package/methods/cron-jobs.js +2475 -0
- package/methods/cron-jobs.js.map +1 -0
- package/methods/customer-notifications.d.ts +2 -0
- package/methods/customer-notifications.js +528 -0
- package/methods/customer-notifications.js.map +1 -0
- package/methods/diagnostics.d.ts +2 -0
- package/methods/diagnostics.js +703 -0
- package/methods/diagnostics.js.map +1 -0
- package/methods/flag-updates.d.ts +2 -0
- package/methods/flag-updates.js +8 -0
- package/methods/flag-updates.js.map +1 -0
- package/methods/flags.d.ts +2 -0
- package/methods/flags.js +8 -0
- package/methods/flags.js.map +1 -0
- package/methods/logs.d.ts +2 -0
- package/methods/logs.js +751 -0
- package/methods/logs.js.map +1 -0
- package/methods/mongo-explorer.d.ts +2 -0
- package/methods/mongo-explorer.js +1808 -0
- package/methods/mongo-explorer.js.map +1 -0
- package/methods/monitor.d.ts +2 -0
- package/methods/monitor.js +543 -0
- package/methods/monitor.js.map +1 -0
- package/methods/pdf.d.ts +2 -0
- package/methods/pdf.js +1216 -0
- package/methods/pdf.js.map +1 -0
- package/methods/publications.d.ts +1 -0
- package/methods/publications.js +183 -0
- package/methods/publications.js.map +1 -0
- package/methods/report-builder.d.ts +2 -0
- package/methods/report-builder.js +3094 -0
- package/methods/report-builder.js.map +1 -0
- package/methods/support.d.ts +2 -0
- package/methods/support.js +430 -0
- package/methods/support.js.map +1 -0
- package/models/ai-run.model.d.ts +19 -0
- package/models/ai-run.model.js +4 -0
- package/models/ai-run.model.js.map +1 -0
- package/models/ai-terminal-conversation.model.d.ts +17 -0
- package/models/ai-terminal-conversation.model.js +4 -0
- package/models/ai-terminal-conversation.model.js.map +1 -0
- package/models/ai-terminal-issue-report.model.d.ts +19 -0
- package/models/ai-terminal-issue-report.model.js +4 -0
- package/models/ai-terminal-issue-report.model.js.map +1 -0
- package/models/ai-terminal-message.model.d.ts +22 -0
- package/models/ai-terminal-message.model.js +4 -0
- package/models/ai-terminal-message.model.js.map +1 -0
- package/models/app-setting.model.d.ts +16 -0
- package/models/app-setting.model.js +4 -0
- package/models/app-setting.model.js.map +1 -0
- package/{src/models/app-status.model.ts → models/app-status.model.d.ts} +2 -3
- package/models/app-status.model.js +4 -0
- package/models/app-status.model.js.map +1 -0
- package/{src/models/billing-logged-in-users.model.ts → models/billing-logged-in-users.model.d.ts} +4 -5
- package/models/billing-logged-in-users.model.js +4 -0
- package/models/billing-logged-in-users.model.js.map +1 -0
- package/models/collection-document.model.d.ts +21 -0
- package/models/collection-document.model.js +4 -0
- package/models/collection-document.model.js.map +1 -0
- package/models/communication-metric.model.d.ts +20 -0
- package/models/communication-metric.model.js +4 -0
- package/models/communication-metric.model.js.map +1 -0
- package/{src/models/counter.model.ts → models/counter.model.d.ts} +3 -4
- package/models/counter.model.js +4 -0
- package/models/counter.model.js.map +1 -0
- package/models/cron-job-history.model.d.ts +15 -0
- package/models/cron-job-history.model.js +4 -0
- package/models/cron-job-history.model.js.map +1 -0
- package/models/cron-job.model.d.ts +14 -0
- package/models/cron-job.model.js +4 -0
- package/models/cron-job.model.js.map +1 -0
- package/models/customer-notification.model.d.ts +26 -0
- package/models/customer-notification.model.js +4 -0
- package/models/customer-notification.model.js.map +1 -0
- package/models/customer-portal-password.model.d.ts +11 -0
- package/models/customer-portal-password.model.js +4 -0
- package/models/customer-portal-password.model.js.map +1 -0
- package/models/dialog.model.d.ts +23 -0
- package/models/dialog.model.js +4 -0
- package/models/dialog.model.js.map +1 -0
- package/models/email-history.model.d.ts +32 -0
- package/{src/models/email-history.model.ts → models/email-history.model.js} +4 -36
- package/models/email-history.model.js.map +1 -0
- package/{src/models/email-verified.model.ts → models/email-verified.model.d.ts} +5 -6
- package/models/email-verified.model.js +4 -0
- package/models/email-verified.model.js.map +1 -0
- package/{src/models/file.model.ts → models/file.model.d.ts} +7 -8
- package/models/file.model.js +4 -0
- package/models/file.model.js.map +1 -0
- package/{src/models/flag-update.model.ts → models/flag-update.model.d.ts} +3 -4
- package/models/flag-update.model.js +4 -0
- package/models/flag-update.model.js.map +1 -0
- package/{src/models/flag.model.ts → models/flag.model.d.ts} +3 -4
- package/models/flag.model.js +4 -0
- package/models/flag.model.js.map +1 -0
- package/models/log-method-latency.model.d.ts +10 -0
- package/models/log-method-latency.model.js +4 -0
- package/models/log-method-latency.model.js.map +1 -0
- package/{src/models/log-subscription.model.ts → models/log-subscription.model.d.ts} +9 -11
- package/models/log-subscription.model.js +4 -0
- package/models/log-subscription.model.js.map +1 -0
- package/models/log.model.d.ts +17 -0
- package/models/log.model.js +4 -0
- package/models/log.model.js.map +1 -0
- package/{src/models/logged-in-users.model.ts → models/logged-in-users.model.d.ts} +5 -6
- package/models/logged-in-users.model.js +4 -0
- package/models/logged-in-users.model.js.map +1 -0
- package/{src/models/method-response.model.ts → models/method-response.model.d.ts} +6 -7
- package/models/method-response.model.js +4 -0
- package/models/method-response.model.js.map +1 -0
- package/models/method.model.d.ts +26 -0
- package/models/method.model.js +4 -0
- package/models/method.model.js.map +1 -0
- package/{src/models/monitor-cpu.model.ts → models/monitor-cpu.model.d.ts} +7 -9
- package/models/monitor-cpu.model.js +4 -0
- package/models/monitor-cpu.model.js.map +1 -0
- package/models/monitor-function.model.d.ts +14 -0
- package/models/monitor-function.model.js +4 -0
- package/models/monitor-function.model.js.map +1 -0
- package/models/monitor-memory.model.d.ts +15 -0
- package/models/monitor-memory.model.js +4 -0
- package/models/monitor-memory.model.js.map +1 -0
- package/models/monitor-mongo.model.d.ts +13 -0
- package/models/monitor-mongo.model.js +4 -0
- package/models/monitor-mongo.model.js.map +1 -0
- package/{src/models/notification.model.ts → models/notification.model.d.ts} +4 -6
- package/models/notification.model.js +4 -0
- package/models/notification.model.js.map +1 -0
- package/models/openai-usage-ledger.model.d.ts +30 -0
- package/models/openai-usage-ledger.model.js +4 -0
- package/models/openai-usage-ledger.model.js.map +1 -0
- package/models/pagination.model.d.ts +11 -0
- package/models/pagination.model.js +28 -0
- package/models/pagination.model.js.map +1 -0
- package/models/permission.model.d.ts +12 -0
- package/models/permission.model.js +4 -0
- package/models/permission.model.js.map +1 -0
- package/models/report-builder-dashboard-builder.model.d.ts +25 -0
- package/models/report-builder-dashboard-builder.model.js +4 -0
- package/models/report-builder-dashboard-builder.model.js.map +1 -0
- package/models/report-builder-library.model.d.ts +17 -0
- package/models/report-builder-library.model.js +4 -0
- package/models/report-builder-library.model.js.map +1 -0
- package/models/report-builder-report.model.d.ts +121 -0
- package/models/report-builder-report.model.js +4 -0
- package/models/report-builder-report.model.js.map +1 -0
- package/models/report-builder.model.d.ts +61 -0
- package/models/report-builder.model.js +4 -0
- package/models/report-builder.model.js.map +1 -0
- package/models/select-data-label.model.d.ts +9 -0
- package/models/select-data-label.model.js +4 -0
- package/models/select-data-label.model.js.map +1 -0
- package/models/server-message.model.d.ts +32 -0
- package/models/server-message.model.js +4 -0
- package/models/server-message.model.js.map +1 -0
- package/models/slow-query-report.model.d.ts +23 -0
- package/models/slow-query-report.model.js +4 -0
- package/models/slow-query-report.model.js.map +1 -0
- package/models/subscription.model.d.ts +31 -0
- package/models/subscription.model.js +4 -0
- package/models/subscription.model.js.map +1 -0
- package/models/support-ticket.model.d.ts +87 -0
- package/models/support-ticket.model.js +4 -0
- package/models/support-ticket.model.js.map +1 -0
- package/models/user-group.model.d.ts +20 -0
- package/models/user-group.model.js +4 -0
- package/models/user-group.model.js.map +1 -0
- package/{src/models/user-guide.model.ts → models/user-guide.model.d.ts} +4 -5
- package/models/user-guide.model.js +4 -0
- package/models/user-guide.model.js.map +1 -0
- package/models/user.model.d.ts +84 -0
- package/models/user.model.js +4 -0
- package/models/user.model.js.map +1 -0
- package/package.json +1 -1
- package/private/images/ResolveIO.png +0 -0
- package/public_api.js +127 -0
- package/public_api.js.map +1 -0
- package/publications/ai-terminal.d.ts +1 -0
- package/publications/ai-terminal.js +122 -0
- package/publications/ai-terminal.js.map +1 -0
- package/publications/app-settings.d.ts +2 -0
- package/publications/app-settings.js +28 -0
- package/publications/app-settings.js.map +1 -0
- package/publications/app-status.d.ts +2 -0
- package/publications/app-status.js +16 -0
- package/publications/app-status.js.map +1 -0
- package/publications/cron-jobs.d.ts +2 -0
- package/publications/cron-jobs.js +88 -0
- package/publications/cron-jobs.js.map +1 -0
- package/publications/customer-notifications.d.ts +2 -0
- package/publications/customer-notifications.js +161 -0
- package/publications/customer-notifications.js.map +1 -0
- package/publications/files.d.ts +2 -0
- package/publications/files.js +36 -0
- package/publications/files.js.map +1 -0
- package/publications/flags-update.d.ts +2 -0
- package/publications/flags-update.js +22 -0
- package/publications/flags-update.js.map +1 -0
- package/publications/flags.d.ts +2 -0
- package/publications/flags.js +22 -0
- package/publications/flags.js.map +1 -0
- package/publications/logs.d.ts +2 -0
- package/publications/logs.js +164 -0
- package/publications/logs.js.map +1 -0
- package/publications/notifications.d.ts +2 -0
- package/publications/notifications.js +16 -0
- package/publications/notifications.js.map +1 -0
- package/publications/report-builder-dashboard-builders.d.ts +2 -0
- package/publications/report-builder-dashboard-builders.js +42 -0
- package/publications/report-builder-dashboard-builders.js.map +1 -0
- package/publications/report-builder-libraries.d.ts +2 -0
- package/publications/report-builder-libraries.js +90 -0
- package/publications/report-builder-libraries.js.map +1 -0
- package/publications/report-builder-reports.d.ts +2 -0
- package/publications/report-builder-reports.js +50 -0
- package/publications/report-builder-reports.js.map +1 -0
- package/publications/super-admin.d.ts +2 -0
- package/publications/super-admin.js +16 -0
- package/publications/super-admin.js.map +1 -0
- package/publications/user-groups.d.ts +1 -0
- package/publications/user-groups.js +16 -0
- package/publications/user-groups.js.map +1 -0
- package/publications/user-guides.d.ts +1 -0
- package/publications/user-guides.js +16 -0
- package/publications/user-guides.js.map +1 -0
- package/resolveio-server-app.d.ts +70 -0
- package/resolveio-server-app.js +801 -0
- package/resolveio-server-app.js.map +1 -0
- package/server-app.d.ts +228 -0
- package/server-app.js +3566 -0
- package/server-app.js.map +1 -0
- package/services/codex-client.d.ts +128 -0
- package/services/codex-client.js +1629 -0
- package/services/codex-client.js.map +1 -0
- package/services/openai-client.d.ts +46 -0
- package/services/openai-client.js +318 -0
- package/services/openai-client.js.map +1 -0
- package/types/error-report.d.ts +25 -0
- package/types/error-report.js +4 -0
- package/types/error-report.js.map +1 -0
- package/types/slow-query-report.d.ts +27 -0
- package/types/slow-query-report.js +6 -0
- package/types/slow-query-report.js.map +1 -0
- package/util/ai-qa-policy.d.ts +124 -0
- package/util/ai-qa-policy.js +736 -0
- package/util/ai-qa-policy.js.map +1 -0
- package/util/ai-run-evidence-adapters.d.ts +109 -0
- package/util/ai-run-evidence-adapters.js +7234 -0
- package/util/ai-run-evidence-adapters.js.map +1 -0
- package/util/ai-run-evidence-dashboard.d.ts +88 -0
- package/util/ai-run-evidence-dashboard.js +343 -0
- package/util/ai-run-evidence-dashboard.js.map +1 -0
- package/util/ai-run-evidence-eval.d.ts +86 -0
- package/util/ai-run-evidence-eval.js +1018 -0
- package/util/ai-run-evidence-eval.js.map +1 -0
- package/util/ai-run-evidence.d.ts +244 -0
- package/util/ai-run-evidence.js +1096 -0
- package/util/ai-run-evidence.js.map +1 -0
- package/util/ai-runner-artifacts.d.ts +82 -0
- package/util/ai-runner-artifacts.js +713 -0
- package/util/ai-runner-artifacts.js.map +1 -0
- package/util/ai-runner-manager-autopilot.d.ts +210 -0
- package/util/ai-runner-manager-autopilot.js +642 -0
- package/util/ai-runner-manager-autopilot.js.map +1 -0
- package/util/ai-runner-manager-policy.d.ts +807 -0
- package/util/ai-runner-manager-policy.js +3501 -0
- package/util/ai-runner-manager-policy.js.map +1 -0
- package/util/ai-runner-qa-auth.d.ts +5 -0
- package/util/ai-runner-qa-auth.js +839 -0
- package/util/ai-runner-qa-auth.js.map +1 -0
- package/util/ai-runner-qa-tools.d.ts +26 -0
- package/util/ai-runner-qa-tools.js +3520 -0
- package/util/ai-runner-qa-tools.js.map +1 -0
- package/util/aicoder-runner-v6.d.ts +426 -0
- package/util/aicoder-runner-v6.js +2464 -0
- package/util/aicoder-runner-v6.js.map +1 -0
- package/util/common.d.ts +31 -0
- package/util/common.js +683 -0
- package/util/common.js.map +1 -0
- package/util/customer-portal-password.d.ts +13 -0
- package/util/customer-portal-password.js +209 -0
- package/util/customer-portal-password.js.map +1 -0
- package/util/error-reporter.d.ts +52 -0
- package/util/error-reporter.js +326 -0
- package/util/error-reporter.js.map +1 -0
- package/util/error-tracking.d.ts +13 -0
- package/util/error-tracking.js +120 -0
- package/util/error-tracking.js.map +1 -0
- package/util/openai-usage-cost.d.ts +6 -0
- package/util/openai-usage-cost.js +103 -0
- package/util/openai-usage-cost.js.map +1 -0
- package/util/report-builder-unwinds.d.ts +15 -0
- package/util/report-builder-unwinds.js +156 -0
- package/util/report-builder-unwinds.js.map +1 -0
- package/util/runner-process-janitor.d.ts +27 -0
- package/util/runner-process-janitor.js +208 -0
- package/util/runner-process-janitor.js.map +1 -0
- package/util/schema-report-builder.d.ts +6 -0
- package/util/schema-report-builder.js +481 -0
- package/util/schema-report-builder.js.map +1 -0
- package/util/slow-query-reporter.d.ts +28 -0
- package/util/slow-query-reporter.js +226 -0
- package/util/slow-query-reporter.js.map +1 -0
- package/util/subscription-dependency-context.d.ts +34 -0
- package/util/subscription-dependency-context.js +1283 -0
- package/util/subscription-dependency-context.js.map +1 -0
- package/util/support-runner-v5.d.ts +1426 -0
- package/util/support-runner-v5.js +7643 -0
- package/util/support-runner-v5.js.map +1 -0
- package/util/tokenizer.d.ts +5 -0
- package/util/tokenizer.js +41 -0
- package/util/tokenizer.js.map +1 -0
- package/workers/codex-runner.worker.d.ts +1 -0
- package/workers/codex-runner.worker.js +192 -0
- package/workers/codex-runner.worker.js.map +1 -0
- package/.nodemon.json +0 -5
- package/.vscode/settings.json +0 -21
- package/AGENTS.md +0 -195
- package/README.md +0 -22
- package/build_package.sh +0 -5
- package/compileDTS.pl +0 -64
- package/docs/ai-assistant-nightly-eval.md +0 -65
- package/docs/ai-assistant-preflight-checklist.md +0 -23
- package/docs/ai-assistant-report-builder-bridge-playbook.md +0 -115
- package/eslint-plugin-custom/index.js +0 -7
- package/eslint-plugin-custom/rules/no-filter-zero-index.js +0 -44
- package/eslint.config.js +0 -103
- package/gulpfile.js +0 -216
- package/methodAndPublicationListGenerator.py +0 -375
- package/mongodbensurers.js +0 -2
- package/mongostop.js +0 -3
- package/scripts/cleanup-bypassed-callmethod-logs.js +0 -616
- package/settings.development.json +0 -25
- package/settings.development.redacted.json +0 -25
- package/src/.env +0 -12
- package/src/ai/assistant-core-heuristics.ts +0 -379
- package/src/ai/resolveio-platform-intelligence-memory-corpus.ts +0 -185
- package/src/ai/resolveio-platform-intelligence-memory.ts +0 -325
- package/src/ai/resolveio-platform-intelligence.ts +0 -462
- package/src/client-server-app.ts +0 -12
- package/src/collections/ai-run.collection.ts +0 -117
- package/src/collections/ai-terminal-conversation.collection.ts +0 -91
- package/src/collections/ai-terminal-issue-report.collection.ts +0 -99
- package/src/collections/ai-terminal-message.collection.ts +0 -77
- package/src/collections/app-setting.collection.ts +0 -104
- package/src/collections/app-status.collection.ts +0 -58
- package/src/collections/communication-metric.collection.ts +0 -84
- package/src/collections/counter.collection.ts +0 -56
- package/src/collections/cron-job-history.collection.ts +0 -94
- package/src/collections/cron-job.collection.ts +0 -92
- package/src/collections/customer-notification.collection.ts +0 -131
- package/src/collections/customer-portal-password.collection.ts +0 -76
- package/src/collections/email-history.collection.ts +0 -134
- package/src/collections/email-verified.collection.ts +0 -62
- package/src/collections/file.collection.ts +0 -74
- package/src/collections/flag-update.collection.ts +0 -57
- package/src/collections/flag.collection.ts +0 -57
- package/src/collections/log-method-latency.collection.ts +0 -77
- package/src/collections/log-subscription.collection.ts +0 -80
- package/src/collections/log.collection.ts +0 -93
- package/src/collections/logged-in-users.collection.ts +0 -67
- package/src/collections/monitor-cpu.collection.ts +0 -65
- package/src/collections/monitor-function.collection.ts +0 -74
- package/src/collections/monitor-memory.collection.ts +0 -77
- package/src/collections/monitor-mongo.collection.ts +0 -71
- package/src/collections/notification.collection.ts +0 -57
- package/src/collections/openai-usage-ledger.collection.ts +0 -131
- package/src/collections/report-builder-dashboard-builder.collection.ts +0 -109
- package/src/collections/report-builder-library.collection.ts +0 -89
- package/src/collections/report-builder-report.collection.ts +0 -184
- package/src/collections/user-group.collection.ts +0 -89
- package/src/collections/user-guide.collection.ts +0 -57
- package/src/collections/user.collection.ts +0 -181
- package/src/cron/cron.ts +0 -117
- package/src/fixtures/cron-jobs.ts +0 -95
- package/src/fixtures/init.ts +0 -35
- package/src/http/auth.ts +0 -818
- package/src/http/health.ts +0 -7
- package/src/http/home.ts +0 -90
- package/src/http/slow-query-publication.ts +0 -49
- package/src/index.ts +0 -1
- package/src/managers/ai-assistant-codex-manager.manager.ts +0 -1131
- package/src/managers/ai-run-evidence.manager.ts +0 -264
- package/src/managers/communication-metric.manager.ts +0 -82
- package/src/managers/cron.manager.ts +0 -333
- package/src/managers/customer-notification-content.manager.ts +0 -236
- package/src/managers/diagnostic-manager-bootstrap.ts +0 -165
- package/src/managers/error-auto-fix.manager.ts +0 -2767
- package/src/managers/local-log.manager.ts +0 -113
- package/src/managers/method.manager.ts +0 -1857
- package/src/managers/mongo.manager.ts +0 -4575
- package/src/managers/monitor.manager.ts +0 -507
- package/src/managers/openai-usage-ledger.manager.ts +0 -112
- package/src/managers/slow-query-verifier.manager.ts +0 -3590
- package/src/managers/slow-query.manager.ts +0 -519
- package/src/managers/subscription.manager.ts +0 -3128
- package/src/managers/websocket.manager.ts +0 -746
- package/src/managers/worker-dispatcher.manager.ts +0 -1360
- package/src/managers/worker-server.manager.ts +0 -536
- package/src/methods/accounts.ts +0 -532
- package/src/methods/ai-terminal.ts +0 -29070
- package/src/methods/app-settings.ts +0 -114
- package/src/methods/aws.ts +0 -649
- package/src/methods/collections.ts +0 -641
- package/src/methods/counters.ts +0 -69
- package/src/methods/cron-jobs.ts +0 -2614
- package/src/methods/customer-notifications.ts +0 -458
- package/src/methods/diagnostics.ts +0 -616
- package/src/methods/flag-updates.ts +0 -7
- package/src/methods/flags.ts +0 -7
- package/src/methods/logs.ts +0 -657
- package/src/methods/mongo-explorer.ts +0 -1880
- package/src/methods/monitor.ts +0 -540
- package/src/methods/pdf.ts +0 -1236
- package/src/methods/publications.ts +0 -129
- package/src/methods/report-builder.ts +0 -3300
- package/src/methods/support.ts +0 -335
- package/src/models/ai-run.model.ts +0 -27
- package/src/models/ai-terminal-conversation.model.ts +0 -19
- package/src/models/ai-terminal-issue-report.model.ts +0 -21
- package/src/models/ai-terminal-message.model.ts +0 -24
- package/src/models/app-setting.model.ts +0 -17
- package/src/models/collection-document.model.ts +0 -24
- package/src/models/communication-metric.model.ts +0 -23
- package/src/models/cron-job-history.model.ts +0 -16
- package/src/models/cron-job.model.ts +0 -15
- package/src/models/customer-notification.model.ts +0 -28
- package/src/models/customer-portal-password.model.ts +0 -12
- package/src/models/dialog.model.ts +0 -25
- package/src/models/log-method-latency.model.ts +0 -11
- package/src/models/log.model.ts +0 -19
- package/src/models/method.model.ts +0 -25
- package/src/models/monitor-function.model.ts +0 -16
- package/src/models/monitor-memory.model.ts +0 -17
- package/src/models/monitor-mongo.model.ts +0 -15
- package/src/models/openai-usage-ledger.model.ts +0 -56
- package/src/models/pagination.model.ts +0 -35
- package/src/models/permission.model.ts +0 -14
- package/src/models/report-builder-dashboard-builder.model.ts +0 -29
- package/src/models/report-builder-library.model.ts +0 -20
- package/src/models/report-builder-report.model.ts +0 -136
- package/src/models/report-builder.model.ts +0 -68
- package/src/models/select-data-label.model.ts +0 -9
- package/src/models/server-message.model.ts +0 -31
- package/src/models/slow-query-report.model.ts +0 -23
- package/src/models/subscription.model.ts +0 -73
- package/src/models/support-ticket.model.ts +0 -104
- package/src/models/user-group.model.ts +0 -24
- package/src/models/user.model.ts +0 -96
- package/src/private/images/ResolveIO.png +0 -0
- package/src/publications/ai-terminal.ts +0 -73
- package/src/publications/app-settings.ts +0 -25
- package/src/publications/app-status.ts +0 -13
- package/src/publications/cron-jobs.ts +0 -40
- package/src/publications/customer-notifications.ts +0 -101
- package/src/publications/files.ts +0 -33
- package/src/publications/flags-update.ts +0 -19
- package/src/publications/flags.ts +0 -19
- package/src/publications/logs.ts +0 -163
- package/src/publications/notifications.ts +0 -13
- package/src/publications/report-builder-dashboard-builders.ts +0 -39
- package/src/publications/report-builder-libraries.ts +0 -41
- package/src/publications/report-builder-reports.ts +0 -47
- package/src/publications/super-admin.ts +0 -13
- package/src/publications/user-groups.ts +0 -12
- package/src/publications/user-guides.ts +0 -12
- package/src/resolveio-server-app.ts +0 -617
- package/src/server-app.ts +0 -3354
- package/src/services/codex-client.ts +0 -1231
- package/src/services/openai-client.ts +0 -265
- package/src/types/error-report.ts +0 -26
- package/src/types/js-tiktoken.d.ts +0 -11
- package/src/types/slow-query-report.ts +0 -28
- package/src/util/ai-qa-policy.ts +0 -925
- package/src/util/ai-run-evidence-adapters.ts +0 -8347
- package/src/util/ai-run-evidence-dashboard.ts +0 -323
- package/src/util/ai-run-evidence-eval.ts +0 -1057
- package/src/util/ai-run-evidence.ts +0 -1430
- package/src/util/ai-runner-artifacts.ts +0 -586
- package/src/util/ai-runner-manager-autopilot.ts +0 -961
- package/src/util/ai-runner-manager-policy.ts +0 -5011
- package/src/util/ai-runner-qa-auth.ts +0 -838
- package/src/util/ai-runner-qa-tools.ts +0 -3536
- package/src/util/aicoder-runner-v6.ts +0 -3121
- package/src/util/common.ts +0 -649
- package/src/util/customer-portal-password.ts +0 -183
- package/src/util/error-reporter.ts +0 -332
- package/src/util/error-tracking.ts +0 -79
- package/src/util/openai-usage-cost.ts +0 -114
- package/src/util/report-builder-unwinds.ts +0 -180
- package/src/util/runner-process-janitor.ts +0 -219
- package/src/util/schema-report-builder.ts +0 -448
- package/src/util/slow-query-reporter.ts +0 -216
- package/src/util/subscription-dependency-context.ts +0 -1096
- package/src/util/support-runner-v5.ts +0 -10040
- package/src/util/tokenizer.ts +0 -38
- package/src/workers/codex-runner.worker.ts +0 -142
- package/start_server.sh +0 -5
- package/tests/ai-assistant-corpus-build.ts +0 -484
- package/tests/ai-assistant-corpus-replay-e2e.ts +0 -774
- package/tests/ai-assistant-data-parity-e2e.ts +0 -1989
- package/tests/ai-assistant-eval-triage.ts +0 -831
- package/tests/ai-assistant-openai-e2e.ts +0 -1061
- package/tests/ai-assistant-openai-git-e2e.ts +0 -155
- package/tests/ai-assistant-preflight-matrix.ts +0 -215
- package/tests/ai-assistant-routing-eval.test.ts +0 -585
- package/tests/ai-assistant-snf-live-eval.ts +0 -975
- package/tests/ai-assistant-utils.test.ts +0 -4834
- package/tests/ai-manager-autopilot-snapshot.test.ts +0 -193
- package/tests/ai-manager-recovery-checkpoint.test.ts +0 -1383
- package/tests/ai-run-eval.test.ts +0 -132
- package/tests/ai-run-evidence.test.ts +0 -3773
- package/tests/ai-runner-contract.test.ts +0 -515
- package/tests/aicoder-runner-v6.test.ts +0 -822
- package/tests/error-reporter.test.ts +0 -145
- package/tests/method-publication-generator.test.ts +0 -46
- package/tests/report-builder-linking.test.ts +0 -79
- package/tests/resolveio-platform-intelligence.test.ts +0 -352
- package/tests/server-app-cron-owner.test.ts +0 -127
- package/tests/subscription-connect-race.test.ts +0 -158
- package/tests/subscription-dependency-context.test.ts +0 -324
- package/tests/subscription-manager-collection-tracking.test.ts +0 -86
- package/tests/subscription-manager-invalidation.test.ts +0 -86
- package/tests/support-runner-v5.test.ts +0 -3201
- package/tsconfig.json +0 -34
- /package/{src/private → private}/email-templates/enrollment.html +0 -0
- /package/{src/private → private}/email-templates/forgot-password.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket-deleted.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket-modified.html +0 -0
- /package/{src/private → private}/email-templates/support-ticket.html +0 -0
- /package/{src/public_api.ts → public_api.d.ts} +0 -0
|
@@ -0,0 +1,3501 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __assign = (this && this.__assign) || function () {
|
|
3
|
+
__assign = Object.assign || function(t) {
|
|
4
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
5
|
+
s = arguments[i];
|
|
6
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
7
|
+
t[p] = s[p];
|
|
8
|
+
}
|
|
9
|
+
return t;
|
|
10
|
+
};
|
|
11
|
+
return __assign.apply(this, arguments);
|
|
12
|
+
};
|
|
13
|
+
var __values = (this && this.__values) || function(o) {
|
|
14
|
+
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
|
|
15
|
+
if (m) return m.call(o);
|
|
16
|
+
if (o && typeof o.length === "number") return {
|
|
17
|
+
next: function () {
|
|
18
|
+
if (o && i >= o.length) o = void 0;
|
|
19
|
+
return { value: o && o[i++], done: !o };
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
|
|
23
|
+
};
|
|
24
|
+
var __read = (this && this.__read) || function (o, n) {
|
|
25
|
+
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
|
26
|
+
if (!m) return o;
|
|
27
|
+
var i = m.call(o), r, ar = [], e;
|
|
28
|
+
try {
|
|
29
|
+
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
|
30
|
+
}
|
|
31
|
+
catch (error) { e = { error: error }; }
|
|
32
|
+
finally {
|
|
33
|
+
try {
|
|
34
|
+
if (r && !r.done && (m = i["return"])) m.call(i);
|
|
35
|
+
}
|
|
36
|
+
finally { if (e) throw e.error; }
|
|
37
|
+
}
|
|
38
|
+
return ar;
|
|
39
|
+
};
|
|
40
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
41
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
42
|
+
if (ar || !(i in from)) {
|
|
43
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
44
|
+
ar[i] = from[i];
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
48
|
+
};
|
|
49
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
50
|
+
exports.estimateResolveIOAIManagerRetryExpectedValue = estimateResolveIOAIManagerRetryExpectedValue;
|
|
51
|
+
exports.decideResolveIOAIManagerAutonomyPolicy = decideResolveIOAIManagerAutonomyPolicy;
|
|
52
|
+
exports.normalizeResolveIOAIManagerHotfixEvidence = normalizeResolveIOAIManagerHotfixEvidence;
|
|
53
|
+
exports.evaluateResolveIOAIManagerHotfixGitProof = evaluateResolveIOAIManagerHotfixGitProof;
|
|
54
|
+
exports.validateResolveIOAIManagerHotfixEvidence = validateResolveIOAIManagerHotfixEvidence;
|
|
55
|
+
exports.buildResolveIOAIManagerHotfixEvidenceRecord = buildResolveIOAIManagerHotfixEvidenceRecord;
|
|
56
|
+
exports.buildResolveIOAIManagerHotfixDurabilityContract = buildResolveIOAIManagerHotfixDurabilityContract;
|
|
57
|
+
exports.decideResolveIOAIManagerHotfixContinuation = decideResolveIOAIManagerHotfixContinuation;
|
|
58
|
+
exports.decideResolveIOAIManagerHotfixCommitGuard = decideResolveIOAIManagerHotfixCommitGuard;
|
|
59
|
+
exports.buildResolveIOAIManagerHotfixFirstReleasePolicy = buildResolveIOAIManagerHotfixFirstReleasePolicy;
|
|
60
|
+
exports.isResolveIOAIManagerSafeAutoDispatch = isResolveIOAIManagerSafeAutoDispatch;
|
|
61
|
+
exports.normalizeResolveIOAIManagerFailureClass = normalizeResolveIOAIManagerFailureClass;
|
|
62
|
+
exports.fingerprintResolveIOAIManagerBlocker = fingerprintResolveIOAIManagerBlocker;
|
|
63
|
+
exports.hashResolveIOAIManagerEvidence = hashResolveIOAIManagerEvidence;
|
|
64
|
+
exports.buildResolveIOAIManagerRecoveryCheckpoint = buildResolveIOAIManagerRecoveryCheckpoint;
|
|
65
|
+
exports.buildResolveIOAIManagerRecoveryEvidenceProbe = buildResolveIOAIManagerRecoveryEvidenceProbe;
|
|
66
|
+
exports.buildResolveIOAIManagerRecoveryActionPacket = buildResolveIOAIManagerRecoveryActionPacket;
|
|
67
|
+
exports.decideResolveIOAIManagerRecoveryActionDispatch = decideResolveIOAIManagerRecoveryActionDispatch;
|
|
68
|
+
exports.appendResolveIOAIManagerRecoveryActionDispatch = appendResolveIOAIManagerRecoveryActionDispatch;
|
|
69
|
+
exports.buildResolveIOAIManagerRecoveryExecutionDirective = buildResolveIOAIManagerRecoveryExecutionDirective;
|
|
70
|
+
exports.buildResolveIOAIManagerRecoveryExecutionProofContract = buildResolveIOAIManagerRecoveryExecutionProofContract;
|
|
71
|
+
exports.validateResolveIOAIManagerRecoveryExecutionProofContract = validateResolveIOAIManagerRecoveryExecutionProofContract;
|
|
72
|
+
exports.assessResolveIOAIManagerEvidenceChange = assessResolveIOAIManagerEvidenceChange;
|
|
73
|
+
exports.decideResolveIOAIManagerRecoveryGate = decideResolveIOAIManagerRecoveryGate;
|
|
74
|
+
exports.buildResolveIOAIManagerRecoveryPlan = buildResolveIOAIManagerRecoveryPlan;
|
|
75
|
+
exports.decideResolveIOAIManagerPolicy = decideResolveIOAIManagerPolicy;
|
|
76
|
+
exports.buildResolveIOAIManagerRecoveryReplayMatrix = buildResolveIOAIManagerRecoveryReplayMatrix;
|
|
77
|
+
function cleanText(value, max) {
|
|
78
|
+
if (max === void 0) { max = 2000; }
|
|
79
|
+
return String(value || '').replace(/\s+/g, ' ').trim().slice(0, max);
|
|
80
|
+
}
|
|
81
|
+
function cleanList(values, limit, max) {
|
|
82
|
+
var e_1, _a;
|
|
83
|
+
if (limit === void 0) { limit = 40; }
|
|
84
|
+
if (max === void 0) { max = 500; }
|
|
85
|
+
if (!Array.isArray(values)) {
|
|
86
|
+
return [];
|
|
87
|
+
}
|
|
88
|
+
var result = [];
|
|
89
|
+
try {
|
|
90
|
+
for (var values_1 = __values(values), values_1_1 = values_1.next(); !values_1_1.done; values_1_1 = values_1.next()) {
|
|
91
|
+
var value = values_1_1.value;
|
|
92
|
+
var normalized = cleanText(value, max);
|
|
93
|
+
if (normalized && !result.includes(normalized)) {
|
|
94
|
+
result.push(normalized);
|
|
95
|
+
}
|
|
96
|
+
if (result.length >= limit) {
|
|
97
|
+
break;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
102
|
+
finally {
|
|
103
|
+
try {
|
|
104
|
+
if (values_1_1 && !values_1_1.done && (_a = values_1.return)) _a.call(values_1);
|
|
105
|
+
}
|
|
106
|
+
finally { if (e_1) throw e_1.error; }
|
|
107
|
+
}
|
|
108
|
+
return result;
|
|
109
|
+
}
|
|
110
|
+
var HOTFIX_CHANNELS = new Set([
|
|
111
|
+
'static_ui',
|
|
112
|
+
'backend_js',
|
|
113
|
+
'config',
|
|
114
|
+
'seed_data',
|
|
115
|
+
'cache_invalidation',
|
|
116
|
+
'service_restart',
|
|
117
|
+
'release_artifact',
|
|
118
|
+
'force_deploy_review',
|
|
119
|
+
'new_artifact_deploy',
|
|
120
|
+
'artifact_build'
|
|
121
|
+
]);
|
|
122
|
+
function cleanObject(value) {
|
|
123
|
+
return value && typeof value === 'object' && !Array.isArray(value) ? value : {};
|
|
124
|
+
}
|
|
125
|
+
function normalizeAutonomyMode(value) {
|
|
126
|
+
var normalized = cleanText(value, 120).toLowerCase().replace(/[\s-]+/g, '_');
|
|
127
|
+
if (/^(monitor|monitor_only|watch|watch_only)$/.test(normalized)) {
|
|
128
|
+
return 'monitor_only';
|
|
129
|
+
}
|
|
130
|
+
if (/^(auto|auto_retry|auto_retry_within_budget|autonomous|within_budget)$/.test(normalized)) {
|
|
131
|
+
return 'auto_retry_within_budget';
|
|
132
|
+
}
|
|
133
|
+
return 'manual_only';
|
|
134
|
+
}
|
|
135
|
+
function normalizeManagerEvidenceStrength(value) {
|
|
136
|
+
var normalized = cleanText(value, 40).toLowerCase().replace(/[\s-]+/g, '_');
|
|
137
|
+
if (normalized === 'proof') {
|
|
138
|
+
return 'proof';
|
|
139
|
+
}
|
|
140
|
+
if (normalized === 'material' || normalized === 'strong') {
|
|
141
|
+
return 'material';
|
|
142
|
+
}
|
|
143
|
+
if (normalized === 'weak') {
|
|
144
|
+
return 'weak';
|
|
145
|
+
}
|
|
146
|
+
return 'none';
|
|
147
|
+
}
|
|
148
|
+
function nonNegativeMoney(value) {
|
|
149
|
+
var parsed = Number(value);
|
|
150
|
+
return Number.isFinite(parsed) && parsed > 0 ? parsed : 0;
|
|
151
|
+
}
|
|
152
|
+
function finiteNumber(value) {
|
|
153
|
+
var parsed = Number(value);
|
|
154
|
+
return Number.isFinite(parsed) ? parsed : undefined;
|
|
155
|
+
}
|
|
156
|
+
function clampNumber(value, min, max) {
|
|
157
|
+
return Math.min(max, Math.max(min, value));
|
|
158
|
+
}
|
|
159
|
+
function isCheapEvidenceAutonomyAction(value) {
|
|
160
|
+
var action = cleanText(value, 120);
|
|
161
|
+
return !action || /^(run_evidence_probe|run_read_only_diagnosis|advance|continue_gate|park_manual)$/.test(action);
|
|
162
|
+
}
|
|
163
|
+
function estimateResolveIOAIManagerRetryExpectedValue(input) {
|
|
164
|
+
var e_2, _a;
|
|
165
|
+
if (input === void 0) { input = {}; }
|
|
166
|
+
var dispatchAction = cleanText(input.dispatchAction, 120);
|
|
167
|
+
var failureClass = normalizeResolveIOAIManagerFailureClass(input.failureClass);
|
|
168
|
+
var recoveryClass = cleanText(input.recoveryClass, 120);
|
|
169
|
+
var evidenceStrength = normalizeManagerEvidenceStrength(input.evidenceStrength);
|
|
170
|
+
var evidenceSignals = cleanList(input.evidenceSignals, 12, 120);
|
|
171
|
+
var projectedActionCostUsd = nonNegativeMoney(input.projectedActionCostUsd);
|
|
172
|
+
var budgetHardUsd = nonNegativeMoney(input.budgetHardUsd);
|
|
173
|
+
var materialEvidence = input.materialEvidence === true || evidenceStrength === 'material' || evidenceStrength === 'proof';
|
|
174
|
+
var newEvidence = input.newEvidence === true;
|
|
175
|
+
var signals = [];
|
|
176
|
+
var score = 0.1;
|
|
177
|
+
if (dispatchAction === 'run_evidence_probe') {
|
|
178
|
+
score = 0.75;
|
|
179
|
+
signals.push('cheap_evidence_probe');
|
|
180
|
+
}
|
|
181
|
+
else if (dispatchAction === 'run_read_only_diagnosis') {
|
|
182
|
+
score = 0.65;
|
|
183
|
+
signals.push('read_only_diagnosis');
|
|
184
|
+
}
|
|
185
|
+
else if (dispatchAction === 'advance' || dispatchAction === 'continue_gate') {
|
|
186
|
+
score = 0.55;
|
|
187
|
+
signals.push('gate_continuation');
|
|
188
|
+
}
|
|
189
|
+
else if (dispatchAction === 'run_infra_repair') {
|
|
190
|
+
score = 0.4;
|
|
191
|
+
signals.push('bounded_infra_repair');
|
|
192
|
+
}
|
|
193
|
+
else if (dispatchAction === 'run_compile_repair') {
|
|
194
|
+
score = 0.4;
|
|
195
|
+
signals.push('bounded_compile_repair');
|
|
196
|
+
}
|
|
197
|
+
else if (dispatchAction === 'run_release_repair') {
|
|
198
|
+
score = 0.3;
|
|
199
|
+
signals.push('bounded_release_repair');
|
|
200
|
+
}
|
|
201
|
+
else if (dispatchAction === 'run_journey_contract_repair' || dispatchAction === 'run_business_assertion_repair') {
|
|
202
|
+
score = 0.25;
|
|
203
|
+
signals.push('bounded_workflow_or_proof_repair');
|
|
204
|
+
}
|
|
205
|
+
else if (dispatchAction === 'run_targeted_product_repair') {
|
|
206
|
+
score = 0.15;
|
|
207
|
+
signals.push('targeted_product_repair');
|
|
208
|
+
}
|
|
209
|
+
if (evidenceStrength === 'proof') {
|
|
210
|
+
score += 0.3;
|
|
211
|
+
signals.push('proof_evidence');
|
|
212
|
+
}
|
|
213
|
+
else if (materialEvidence) {
|
|
214
|
+
score += 0.2;
|
|
215
|
+
signals.push('material_evidence');
|
|
216
|
+
}
|
|
217
|
+
else if (newEvidence) {
|
|
218
|
+
score += 0.1;
|
|
219
|
+
signals.push('new_evidence');
|
|
220
|
+
}
|
|
221
|
+
else if (evidenceStrength === 'weak') {
|
|
222
|
+
score -= 0.15;
|
|
223
|
+
signals.push('weak_evidence');
|
|
224
|
+
}
|
|
225
|
+
else if (!isCheapEvidenceAutonomyAction(dispatchAction)) {
|
|
226
|
+
score -= 0.25;
|
|
227
|
+
signals.push('no_material_evidence');
|
|
228
|
+
}
|
|
229
|
+
if ((failureClass === 'infra' || /infra/i.test(recoveryClass)) && dispatchAction === 'run_infra_repair') {
|
|
230
|
+
score += 0.15;
|
|
231
|
+
signals.push('failure_matches_infra_repair');
|
|
232
|
+
}
|
|
233
|
+
if ((failureClass === 'compile' || /compile/i.test(recoveryClass)) && dispatchAction === 'run_compile_repair') {
|
|
234
|
+
score += 0.15;
|
|
235
|
+
signals.push('failure_matches_compile_repair');
|
|
236
|
+
}
|
|
237
|
+
if (/release|publish|deploy/i.test("".concat(failureClass, " ").concat(recoveryClass)) && dispatchAction === 'run_release_repair') {
|
|
238
|
+
score += 0.1;
|
|
239
|
+
signals.push('failure_matches_release_repair');
|
|
240
|
+
}
|
|
241
|
+
if (projectedActionCostUsd >= 5) {
|
|
242
|
+
score -= 0.3;
|
|
243
|
+
signals.push('high_projected_cost');
|
|
244
|
+
}
|
|
245
|
+
else if (projectedActionCostUsd >= 2) {
|
|
246
|
+
score -= 0.18;
|
|
247
|
+
signals.push('medium_projected_cost');
|
|
248
|
+
}
|
|
249
|
+
else if (projectedActionCostUsd >= 1) {
|
|
250
|
+
score -= 0.08;
|
|
251
|
+
signals.push('low_projected_cost');
|
|
252
|
+
}
|
|
253
|
+
if (budgetHardUsd > 0 && projectedActionCostUsd > budgetHardUsd * 0.5) {
|
|
254
|
+
score -= 0.2;
|
|
255
|
+
signals.push('large_fraction_of_remaining_budget');
|
|
256
|
+
}
|
|
257
|
+
if (input.sameEvidenceAlreadyAttempted === true) {
|
|
258
|
+
score -= 0.35;
|
|
259
|
+
signals.push('same_evidence_already_attempted');
|
|
260
|
+
}
|
|
261
|
+
try {
|
|
262
|
+
for (var evidenceSignals_1 = __values(evidenceSignals), evidenceSignals_1_1 = evidenceSignals_1.next(); !evidenceSignals_1_1.done; evidenceSignals_1_1 = evidenceSignals_1.next()) {
|
|
263
|
+
var signal = evidenceSignals_1_1.value;
|
|
264
|
+
if (/passing_outcome|business|proof|diagnosis|compile|infra|release|artifact|fingerprint_changed|evidence_hash_changed/i.test(signal)) {
|
|
265
|
+
score += 0.03;
|
|
266
|
+
signals.push("evidence_signal:".concat(signal));
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
271
|
+
finally {
|
|
272
|
+
try {
|
|
273
|
+
if (evidenceSignals_1_1 && !evidenceSignals_1_1.done && (_a = evidenceSignals_1.return)) _a.call(evidenceSignals_1);
|
|
274
|
+
}
|
|
275
|
+
finally { if (e_2) throw e_2.error; }
|
|
276
|
+
}
|
|
277
|
+
var rounded = Number(clampNumber(score, -1, 1).toFixed(2));
|
|
278
|
+
var minScore = 0;
|
|
279
|
+
return {
|
|
280
|
+
score: rounded,
|
|
281
|
+
minScore: minScore,
|
|
282
|
+
positive: rounded >= minScore,
|
|
283
|
+
source: 'estimated',
|
|
284
|
+
confidence: evidenceStrength === 'proof' || materialEvidence ? 'medium' : 'low',
|
|
285
|
+
reason: rounded >= minScore
|
|
286
|
+
? 'estimated_retry_value_is_non_negative'
|
|
287
|
+
: 'estimated_retry_value_is_negative',
|
|
288
|
+
signals: Array.from(new Set(signals)).slice(0, 16)
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
function decideResolveIOAIManagerAutonomyPolicy(input) {
|
|
292
|
+
var _a;
|
|
293
|
+
if (input === void 0) { input = {}; }
|
|
294
|
+
var mode = normalizeAutonomyMode(input.mode);
|
|
295
|
+
var currentSpendUsd = nonNegativeMoney(input.currentSpendUsd);
|
|
296
|
+
var projectedActionCostUsd = nonNegativeMoney(input.projectedActionCostUsd);
|
|
297
|
+
var projectedSpendUsd = currentSpendUsd + projectedActionCostUsd;
|
|
298
|
+
var budgetSoftUsd = nonNegativeMoney(input.budgetSoftUsd);
|
|
299
|
+
var budgetHardUsd = nonNegativeMoney(input.budgetHardUsd);
|
|
300
|
+
var softBudgetExceeded = budgetSoftUsd > 0 && projectedSpendUsd >= budgetSoftUsd;
|
|
301
|
+
var hardBudgetExceeded = budgetHardUsd > 0 && projectedSpendUsd > budgetHardUsd;
|
|
302
|
+
var dispatchAction = cleanText(input.dispatchAction, 120);
|
|
303
|
+
var evidenceStrength = normalizeManagerEvidenceStrength(input.evidenceStrength);
|
|
304
|
+
var evidenceSignals = cleanList(input.evidenceSignals, 12, 120);
|
|
305
|
+
var materialEvidence = input.materialEvidence === true || evidenceStrength === 'material' || evidenceStrength === 'proof';
|
|
306
|
+
var newEvidence = input.newEvidence === true;
|
|
307
|
+
var evidenceBacked = materialEvidence || newEvidence || evidenceSignals.some(function (signal) { return /material|proof|business|compile|infra|release|diagnosis|journey|workflow|artifact|hash_changed|fingerprint_changed/i.test(signal); });
|
|
308
|
+
var cheapEvidenceAction = isCheapEvidenceAutonomyAction(dispatchAction);
|
|
309
|
+
var expectedValueEstimate = estimateResolveIOAIManagerRetryExpectedValue({
|
|
310
|
+
dispatchAction: dispatchAction,
|
|
311
|
+
projectedActionCostUsd: projectedActionCostUsd,
|
|
312
|
+
currentSpendUsd: currentSpendUsd,
|
|
313
|
+
budgetHardUsd: budgetHardUsd,
|
|
314
|
+
evidenceStrength: evidenceStrength,
|
|
315
|
+
materialEvidence: materialEvidence,
|
|
316
|
+
newEvidence: newEvidence,
|
|
317
|
+
evidenceSignals: evidenceSignals,
|
|
318
|
+
sameEvidenceAlreadyAttempted: input.sameEvidenceAlreadyAttempted === true
|
|
319
|
+
});
|
|
320
|
+
var providedExpectedValue = finiteNumber(input.expectedValueScore);
|
|
321
|
+
var expectedValueKnown = providedExpectedValue !== undefined;
|
|
322
|
+
var expectedValueScore = expectedValueKnown ? providedExpectedValue : expectedValueEstimate.score;
|
|
323
|
+
var minExpectedValue = (_a = finiteNumber(input.minExpectedValueScore)) !== null && _a !== void 0 ? _a : expectedValueEstimate.minScore;
|
|
324
|
+
var expectedValuePositive = expectedValueScore >= minExpectedValue;
|
|
325
|
+
var expectedValueSource = expectedValueKnown ? 'provided' : 'estimated';
|
|
326
|
+
var requiredEvidence = __spreadArray(__spreadArray(__spreadArray(__spreadArray([
|
|
327
|
+
'mode',
|
|
328
|
+
'projectedActionCostUsd'
|
|
329
|
+
], __read((budgetHardUsd > 0 ? ['budgetHardUsd'] : [])), false), __read((budgetSoftUsd > 0 ? ['budgetSoftUsd'] : [])), false), __read((dispatchAction ? ['dispatchAction'] : [])), false), __read((cheapEvidenceAction ? [] : ['materialEvidence or newEvidence', 'expectedValueScore when available'])), false);
|
|
330
|
+
var forbiddenActions = [];
|
|
331
|
+
var canAutoDispatch = false;
|
|
332
|
+
var canManualDispatch = true;
|
|
333
|
+
var blocked = false;
|
|
334
|
+
var requiresHumanApproval = true;
|
|
335
|
+
var reason = '';
|
|
336
|
+
var recommendedControl = mode;
|
|
337
|
+
if (mode === 'monitor_only') {
|
|
338
|
+
canManualDispatch = false;
|
|
339
|
+
reason = 'monitor_only_blocks_runner_dispatch';
|
|
340
|
+
forbiddenActions.push('Do not run recovery, repair, QA, publish, deploy, or customer reply actions while in Monitor Only mode.');
|
|
341
|
+
}
|
|
342
|
+
else if (mode === 'manual_only') {
|
|
343
|
+
reason = 'manual_only_requires_operator_dispatch';
|
|
344
|
+
forbiddenActions.push('Do not auto-dispatch manager recovery actions in Manual Only mode.');
|
|
345
|
+
}
|
|
346
|
+
else if (hardBudgetExceeded) {
|
|
347
|
+
blocked = true;
|
|
348
|
+
canAutoDispatch = false;
|
|
349
|
+
canManualDispatch = input.operatorApproved === true;
|
|
350
|
+
reason = 'auto_retry_budget_hard_cap_would_be_exceeded';
|
|
351
|
+
recommendedControl = 'increase_budget_or_manual';
|
|
352
|
+
forbiddenActions.push('Do not auto-dispatch because projected spend exceeds the hard budget.');
|
|
353
|
+
}
|
|
354
|
+
else if (!cheapEvidenceAction && !evidenceBacked) {
|
|
355
|
+
canAutoDispatch = false;
|
|
356
|
+
requiresHumanApproval = true;
|
|
357
|
+
reason = 'auto_retry_requires_material_evidence';
|
|
358
|
+
forbiddenActions.push('Do not auto-dispatch repair work until a deterministic artifact, changed blocker fingerprint, or material proof is recorded.');
|
|
359
|
+
}
|
|
360
|
+
else if (!cheapEvidenceAction && !expectedValuePositive) {
|
|
361
|
+
canAutoDispatch = false;
|
|
362
|
+
requiresHumanApproval = true;
|
|
363
|
+
reason = 'auto_retry_expected_value_not_positive';
|
|
364
|
+
forbiddenActions.push('Do not auto-dispatch repair work when the expected value score is below the configured minimum.');
|
|
365
|
+
}
|
|
366
|
+
else {
|
|
367
|
+
canAutoDispatch = true;
|
|
368
|
+
requiresHumanApproval = softBudgetExceeded;
|
|
369
|
+
reason = softBudgetExceeded
|
|
370
|
+
? 'auto_retry_soft_budget_warning_requires_review'
|
|
371
|
+
: 'auto_retry_within_budget_allows_auto_dispatch';
|
|
372
|
+
if (softBudgetExceeded) {
|
|
373
|
+
forbiddenActions.push('Do not escalate to a more expensive model or broader repair without operator review after soft budget warning.');
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
return {
|
|
377
|
+
mode: mode,
|
|
378
|
+
canAutoDispatch: canAutoDispatch,
|
|
379
|
+
canManualDispatch: canManualDispatch,
|
|
380
|
+
blocked: blocked,
|
|
381
|
+
requiresHumanApproval: requiresHumanApproval,
|
|
382
|
+
reason: reason,
|
|
383
|
+
currentSpendUsd: currentSpendUsd,
|
|
384
|
+
projectedActionCostUsd: projectedActionCostUsd,
|
|
385
|
+
projectedSpendUsd: projectedSpendUsd,
|
|
386
|
+
budgetSoftUsd: budgetSoftUsd,
|
|
387
|
+
budgetHardUsd: budgetHardUsd,
|
|
388
|
+
softBudgetExceeded: softBudgetExceeded,
|
|
389
|
+
hardBudgetExceeded: hardBudgetExceeded,
|
|
390
|
+
dispatchAction: dispatchAction,
|
|
391
|
+
expectedValueScore: expectedValueScore,
|
|
392
|
+
minExpectedValueScore: minExpectedValue,
|
|
393
|
+
expectedValueKnown: expectedValueKnown,
|
|
394
|
+
expectedValueSource: expectedValueSource,
|
|
395
|
+
expectedValuePositive: expectedValuePositive,
|
|
396
|
+
evidenceStrength: evidenceStrength,
|
|
397
|
+
materialEvidence: materialEvidence,
|
|
398
|
+
newEvidence: newEvidence,
|
|
399
|
+
evidenceBacked: evidenceBacked,
|
|
400
|
+
evidenceSignals: evidenceSignals,
|
|
401
|
+
recommendedControl: recommendedControl,
|
|
402
|
+
forbiddenActions: forbiddenActions,
|
|
403
|
+
requiredEvidence: requiredEvidence
|
|
404
|
+
};
|
|
405
|
+
}
|
|
406
|
+
function cleanDateString(value) {
|
|
407
|
+
var date = value instanceof Date ? value : new Date(value || Date.now());
|
|
408
|
+
return Number.isNaN(date.getTime()) ? new Date().toISOString() : date.toISOString();
|
|
409
|
+
}
|
|
410
|
+
function normalizeHotfixChannel(value) {
|
|
411
|
+
var normalized = cleanText(value, 120).toLowerCase().replace(/[\s-]+/g, '_');
|
|
412
|
+
return HOTFIX_CHANNELS.has(normalized) ? normalized : '';
|
|
413
|
+
}
|
|
414
|
+
function normalizeHotfixStatus(value) {
|
|
415
|
+
var normalized = cleanText(value, 120).toLowerCase().replace(/[\s-]+/g, '_');
|
|
416
|
+
if (/^(pass|passed|success|succeeded|complete|completed|accepted)$/.test(normalized)) {
|
|
417
|
+
return 'passed';
|
|
418
|
+
}
|
|
419
|
+
if (/^(block|blocked|failed|fail|error|denied)$/.test(normalized)) {
|
|
420
|
+
return 'blocked';
|
|
421
|
+
}
|
|
422
|
+
if (/^(missing|none)$/.test(normalized)) {
|
|
423
|
+
return 'missing';
|
|
424
|
+
}
|
|
425
|
+
return 'incomplete';
|
|
426
|
+
}
|
|
427
|
+
function hotfixStatusPassed(value) {
|
|
428
|
+
return normalizeHotfixStatus(value) === 'passed';
|
|
429
|
+
}
|
|
430
|
+
function normalizeHotfixEvidenceTarget(value) {
|
|
431
|
+
var source = cleanObject(value);
|
|
432
|
+
return {
|
|
433
|
+
surface: cleanText(source.surface, 160),
|
|
434
|
+
host: cleanText(source.host || source.hostname || source.domain, 240),
|
|
435
|
+
path: cleanText(source.path || source.remotePath || source.remote_path, 500),
|
|
436
|
+
artifactPath: cleanText(source.artifactPath || source.artifact_path || source.localPath || source.local_path, 500),
|
|
437
|
+
bucket: cleanText(source.bucket || source.s3Bucket || source.s3_bucket, 240),
|
|
438
|
+
distributionId: cleanText(source.distributionId || source.distribution_id || source.cloudfrontDistributionId || source.cloudfront_distribution_id, 240),
|
|
439
|
+
processName: cleanText(source.processName || source.process_name || source.service || source.serviceName, 160),
|
|
440
|
+
configKey: cleanText(source.configKey || source.config_key || source.key, 240),
|
|
441
|
+
cacheKey: cleanText(source.cacheKey || source.cache_key, 240),
|
|
442
|
+
seedKey: cleanText(source.seedKey || source.seed_key || source.fixture, 240)
|
|
443
|
+
};
|
|
444
|
+
}
|
|
445
|
+
function normalizeHotfixEvidenceTargets(value, fallback) {
|
|
446
|
+
var rawTargets = Array.isArray(value) ? value : [];
|
|
447
|
+
var targets = rawTargets
|
|
448
|
+
.map(normalizeHotfixEvidenceTarget)
|
|
449
|
+
.filter(function (target) { return Object.values(target).some(function (entry) { return cleanText(entry, 500); }); });
|
|
450
|
+
if (!targets.length && fallback && Object.values(fallback).some(function (entry) { return cleanText(entry, 500); })) {
|
|
451
|
+
targets.push(fallback);
|
|
452
|
+
}
|
|
453
|
+
var seen = new Set();
|
|
454
|
+
return targets.filter(function (target) {
|
|
455
|
+
var key = "".concat(cleanText(target.host, 240).toLowerCase(), "::").concat(cleanText(target.path || target.processName || target.configKey || target.seedKey || target.cacheKey, 500));
|
|
456
|
+
if (seen.has(key)) {
|
|
457
|
+
return false;
|
|
458
|
+
}
|
|
459
|
+
seen.add(key);
|
|
460
|
+
return true;
|
|
461
|
+
}).slice(0, 20);
|
|
462
|
+
}
|
|
463
|
+
function normalizeHotfixRemoteChecksumProof(value) {
|
|
464
|
+
var source = cleanObject(value);
|
|
465
|
+
return {
|
|
466
|
+
host: cleanText(source.host || source.hostname || source.domain, 240),
|
|
467
|
+
path: cleanText(source.path || source.remotePath || source.remote_path, 500),
|
|
468
|
+
checksumBefore: cleanText(source.checksumBefore || source.checksum_before || source.remoteChecksumBefore || source.remote_checksum_before, 160),
|
|
469
|
+
checksumAfter: cleanText(source.checksumAfter || source.checksum_after || source.remoteChecksumAfter || source.remote_checksum_after, 160),
|
|
470
|
+
checksum: cleanText(source.checksum || source.remoteChecksum || source.remote_checksum, 160),
|
|
471
|
+
status: cleanText(source.status, 160)
|
|
472
|
+
};
|
|
473
|
+
}
|
|
474
|
+
function normalizeHotfixRemoteChecksumProofs(value) {
|
|
475
|
+
return (Array.isArray(value) ? value : [])
|
|
476
|
+
.map(normalizeHotfixRemoteChecksumProof)
|
|
477
|
+
.filter(function (entry) { return entry.host || entry.path || entry.checksumAfter || entry.checksum || entry.status; })
|
|
478
|
+
.slice(0, 40);
|
|
479
|
+
}
|
|
480
|
+
function normalizeHotfixHostStatusProof(value) {
|
|
481
|
+
var _a, _b;
|
|
482
|
+
var source = cleanObject(value);
|
|
483
|
+
var checkCount = Number((_a = source.checkCount) !== null && _a !== void 0 ? _a : source.check_count);
|
|
484
|
+
var failedCount = Number((_b = source.failedCount) !== null && _b !== void 0 ? _b : source.failed_count);
|
|
485
|
+
return {
|
|
486
|
+
host: cleanText(source.host || source.hostname || source.domain, 240),
|
|
487
|
+
status: cleanText(source.status || source.result, 160),
|
|
488
|
+
evidence: cleanText(source.evidence || source.message || source.summary, 1000),
|
|
489
|
+
checkCount: Number.isFinite(checkCount) ? Math.max(0, Math.floor(checkCount)) : undefined,
|
|
490
|
+
failedCount: Number.isFinite(failedCount) ? Math.max(0, Math.floor(failedCount)) : undefined
|
|
491
|
+
};
|
|
492
|
+
}
|
|
493
|
+
function normalizeHotfixHostStatusProofs(value) {
|
|
494
|
+
return (Array.isArray(value) ? value : [])
|
|
495
|
+
.map(normalizeHotfixHostStatusProof)
|
|
496
|
+
.filter(function (entry) { return entry.host || entry.status || entry.evidence; })
|
|
497
|
+
.slice(0, 40);
|
|
498
|
+
}
|
|
499
|
+
function normalizeResolveIOAIManagerHotfixEvidence(value, policy) {
|
|
500
|
+
var _a;
|
|
501
|
+
var source = cleanObject(value);
|
|
502
|
+
if (!Object.keys(source).length) {
|
|
503
|
+
return undefined;
|
|
504
|
+
}
|
|
505
|
+
var channel = normalizeHotfixChannel(source.channel || source.hotfixChannel || source.hotfix_channel || ((_a = policy === null || policy === void 0 ? void 0 : policy.hotfixPlan) === null || _a === void 0 ? void 0 : _a.recommendedChannel));
|
|
506
|
+
if (!channel) {
|
|
507
|
+
return undefined;
|
|
508
|
+
}
|
|
509
|
+
var target = normalizeHotfixEvidenceTarget(source.target || source);
|
|
510
|
+
var targets = normalizeHotfixEvidenceTargets(source.targets || source.hotfixTargets || source.hotfix_targets, target);
|
|
511
|
+
return {
|
|
512
|
+
channel: channel,
|
|
513
|
+
status: normalizeHotfixStatus(source.status),
|
|
514
|
+
target: target,
|
|
515
|
+
targets: targets,
|
|
516
|
+
compiledArtifactPath: cleanText(source.compiledArtifactPath || source.compiled_artifact_path || target.artifactPath, 500),
|
|
517
|
+
builtDistPath: cleanText(source.builtDistPath || source.built_dist_path || target.artifactPath, 500),
|
|
518
|
+
remoteChecksumBefore: cleanText(source.remoteChecksumBefore || source.remote_checksum_before || source.checksumBefore || source.checksum_before, 160),
|
|
519
|
+
remoteChecksumAfter: cleanText(source.remoteChecksumAfter || source.remote_checksum_after || source.checksumAfter || source.checksum_after, 160),
|
|
520
|
+
remoteChecksum: cleanText(source.remoteChecksum || source.remote_checksum || source.checksum, 160),
|
|
521
|
+
remoteChecksums: normalizeHotfixRemoteChecksumProofs(source.remoteChecksums || source.remote_checksums || source.checksums || source.hostChecksums || source.host_checksums),
|
|
522
|
+
restartEvidence: cleanText(source.restartEvidence || source.restart_evidence, 1000),
|
|
523
|
+
restartResults: normalizeHotfixHostStatusProofs(source.restartResults || source.restart_results || source.restarts || source.serviceRestartResults || source.service_restart_results),
|
|
524
|
+
healthCheckStatus: cleanText(source.healthCheckStatus || source.health_check_status || source.health, 160),
|
|
525
|
+
healthChecks: normalizeHotfixHostStatusProofs(source.healthChecks || source.health_checks || source.hostHealthChecks || source.host_health_checks),
|
|
526
|
+
selfTestStatus: cleanText(source.selfTestStatus || source.self_test_status || source.selfTest || source.self_test, 160),
|
|
527
|
+
selfTests: normalizeHotfixHostStatusProofs(source.selfTests || source.self_tests || source.runnerManagerSelfTests || source.runner_manager_self_tests),
|
|
528
|
+
releaseGateStatus: cleanText(source.releaseGateStatus || source.release_gate_status || source.releaseGate || source.release_gate, 160),
|
|
529
|
+
s3UploadResult: cleanText(source.s3UploadResult || source.s3_upload_result || source.uploadResult || source.upload_result, 1000),
|
|
530
|
+
cloudfrontInvalidationId: cleanText(source.cloudfrontInvalidationId || source.cloudfront_invalidation_id || source.invalidationId || source.invalidation_id, 240),
|
|
531
|
+
publicProof: cleanText(source.publicProof || source.public_proof || source.publicUrl || source.public_url, 1000),
|
|
532
|
+
configChangeEvidence: cleanText(source.configChangeEvidence || source.config_change_evidence, 1000),
|
|
533
|
+
seedDataEvidence: cleanText(source.seedDataEvidence || source.seed_data_evidence, 1000),
|
|
534
|
+
cacheInvalidationEvidence: cleanText(source.cacheInvalidationEvidence || source.cache_invalidation_evidence, 1000),
|
|
535
|
+
serviceRestartEvidence: cleanText(source.serviceRestartEvidence || source.service_restart_evidence, 1000),
|
|
536
|
+
releaseArtifactFingerprint: cleanText(source.releaseArtifactFingerprint || source.release_artifact_fingerprint || source.artifactFingerprint || source.artifact_fingerprint, 240),
|
|
537
|
+
lastReleaseArtifactFingerprint: cleanText(source.lastReleaseArtifactFingerprint || source.last_release_artifact_fingerprint || source.lastArtifactFingerprint || source.last_artifact_fingerprint, 240),
|
|
538
|
+
sourceCommitSha: cleanText(source.sourceCommitSha || source.source_commit_sha || source.gitCommitSha || source.git_commit_sha || source.commitSha || source.commit_sha, 120),
|
|
539
|
+
githubCommitUrl: cleanText(source.githubCommitUrl || source.github_commit_url || source.gitCommitUrl || source.git_commit_url || source.commitUrl || source.commit_url, 500),
|
|
540
|
+
gitCommitStatus: cleanText(source.gitCommitStatus || source.git_commit_status || source.githubCommitStatus || source.github_commit_status, 160),
|
|
541
|
+
gitPushStatus: cleanText(source.gitPushStatus || source.git_push_status || source.githubPushStatus || source.github_push_status || source.githubCommitReachableStatus || source.github_commit_reachable_status, 160),
|
|
542
|
+
committedAt: source.committedAt || source.committed_at,
|
|
543
|
+
forceDeployReason: cleanText(source.forceDeployReason || source.force_deploy_reason, 1000),
|
|
544
|
+
hotfixCannotResolveReason: cleanText(source.hotfixCannotResolveReason || source.hotfix_cannot_resolve_reason, 1000),
|
|
545
|
+
fullDeployRequested: source.fullDeployRequested === true || source.full_deploy_requested === true,
|
|
546
|
+
recordedAt: source.recordedAt || source.recorded_at
|
|
547
|
+
};
|
|
548
|
+
}
|
|
549
|
+
function matchingHotfixPlanStep(policy, channel) {
|
|
550
|
+
var _a;
|
|
551
|
+
return (((_a = policy === null || policy === void 0 ? void 0 : policy.hotfixPlan) === null || _a === void 0 ? void 0 : _a.steps) || []).find(function (step) { return step.channel === channel; });
|
|
552
|
+
}
|
|
553
|
+
function pushMissing(blockers, condition, message) {
|
|
554
|
+
if (!condition) {
|
|
555
|
+
blockers.push(message);
|
|
556
|
+
}
|
|
557
|
+
}
|
|
558
|
+
function hotfixRequiresGithubCommit(channel) {
|
|
559
|
+
return /^(backend_js|static_ui|config|seed_data|release_artifact|new_artifact_deploy|artifact_build)$/.test(channel);
|
|
560
|
+
}
|
|
561
|
+
function extractGithubCommitSha(value) {
|
|
562
|
+
var _a;
|
|
563
|
+
var match = cleanText(value, 500).match(/^https:\/\/github\.com\/[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+\/commit\/([a-f0-9]{40})(?:$|[?#/])/i);
|
|
564
|
+
return ((_a = match === null || match === void 0 ? void 0 : match[1]) === null || _a === void 0 ? void 0 : _a.toLowerCase()) || '';
|
|
565
|
+
}
|
|
566
|
+
function isFullGitCommitSha(value) {
|
|
567
|
+
return /^[a-f0-9]{40}$/i.test(cleanText(value, 120));
|
|
568
|
+
}
|
|
569
|
+
function isStrongRemoteChecksum(value) {
|
|
570
|
+
return /^[a-f0-9]{12,128}$/i.test(cleanText(value, 160));
|
|
571
|
+
}
|
|
572
|
+
function hotfixTargetLabel(target, fallbackIndex) {
|
|
573
|
+
return cleanText([target.host, target.path].filter(Boolean).join(':'), 800) || "target[".concat(fallbackIndex, "]");
|
|
574
|
+
}
|
|
575
|
+
function hotfixTargetsForBackendEvidence(evidence) {
|
|
576
|
+
var targets = normalizeHotfixEvidenceTargets(evidence.targets, evidence.target);
|
|
577
|
+
return targets.length ? targets : [evidence.target].filter(function (target) { return !!target; });
|
|
578
|
+
}
|
|
579
|
+
function targetMatchesHostPath(sourceHost, sourcePath, target) {
|
|
580
|
+
var host = cleanText(sourceHost, 240).toLowerCase();
|
|
581
|
+
var path = cleanText(sourcePath, 500);
|
|
582
|
+
var targetHost = cleanText(target.host, 240).toLowerCase();
|
|
583
|
+
var targetPath = cleanText(target.path, 500);
|
|
584
|
+
if (targetHost && host && targetHost !== host) {
|
|
585
|
+
return false;
|
|
586
|
+
}
|
|
587
|
+
if (targetPath && path && targetPath !== path) {
|
|
588
|
+
return false;
|
|
589
|
+
}
|
|
590
|
+
return (!!targetHost && !!host) || (!!targetPath && !!path);
|
|
591
|
+
}
|
|
592
|
+
function checksumProofForBackendTarget(evidence, target, allowLegacyGlobal) {
|
|
593
|
+
var proof = (evidence.remoteChecksums || []).find(function (entry) { return targetMatchesHostPath(entry.host, entry.path, target); });
|
|
594
|
+
if (proof) {
|
|
595
|
+
return proof;
|
|
596
|
+
}
|
|
597
|
+
if (allowLegacyGlobal && (evidence.remoteChecksumAfter || evidence.remoteChecksum)) {
|
|
598
|
+
return {
|
|
599
|
+
host: target.host,
|
|
600
|
+
path: target.path,
|
|
601
|
+
checksumBefore: evidence.remoteChecksumBefore,
|
|
602
|
+
checksumAfter: evidence.remoteChecksumAfter,
|
|
603
|
+
checksum: evidence.remoteChecksum,
|
|
604
|
+
status: evidence.status
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
return undefined;
|
|
608
|
+
}
|
|
609
|
+
function hostStatusProofForBackendTarget(records, target, allowLegacyGlobalStatus) {
|
|
610
|
+
var proof = (records || []).find(function (entry) { return targetMatchesHostPath(entry.host, undefined, target); });
|
|
611
|
+
if (proof) {
|
|
612
|
+
return proof;
|
|
613
|
+
}
|
|
614
|
+
if (allowLegacyGlobalStatus) {
|
|
615
|
+
return {
|
|
616
|
+
host: target.host,
|
|
617
|
+
status: cleanText(allowLegacyGlobalStatus, 160)
|
|
618
|
+
};
|
|
619
|
+
}
|
|
620
|
+
return undefined;
|
|
621
|
+
}
|
|
622
|
+
function backendHotfixTargetTouchesRunnerControlPlane(target) {
|
|
623
|
+
var path = cleanText((target === null || target === void 0 ? void 0 : target.path) || (target === null || target === void 0 ? void 0 : target.artifactPath), 500).replace(/\\/g, '/').toLowerCase();
|
|
624
|
+
return /(^|\/)(managers\/ai-dashboard|methods\/support-ticket-automation|http\/runner-manager-selftest|http\/support|node_modules\/@resolveio\/server-lib\/(?:server-app|util\/(?:support-runner-v5|ai-runner-manager-policy|ai-run-evidence|ai-runner-qa-tools)))/i.test(path);
|
|
625
|
+
}
|
|
626
|
+
function backendHotfixRestartProofIncludesSupportManagers(evidence) {
|
|
627
|
+
var text = __spreadArray([
|
|
628
|
+
evidence.restartEvidence,
|
|
629
|
+
evidence.serviceRestartEvidence
|
|
630
|
+
], __read((evidence.restartResults || []).map(function (entry) { return "".concat(entry.status || '', " ").concat(entry.evidence || ''); })), false).join('\n');
|
|
631
|
+
return /\b(resolveio_support_ticket_codex_manager|support[_ -]?(?:ticket[_ -]?)?(?:codex[_ -]?)?manager|support[_ -]?manager)\b/i.test(text);
|
|
632
|
+
}
|
|
633
|
+
function validateBackendHotfixTargetCoverage(evidence, blockers) {
|
|
634
|
+
var targets = hotfixTargetsForBackendEvidence(evidence);
|
|
635
|
+
var structuredMultiTarget = targets.length > 1;
|
|
636
|
+
if (structuredMultiTarget && !(evidence.remoteChecksums || []).length) {
|
|
637
|
+
blockers.push('Backend JS hotfix with multiple targets requires remoteChecksums[] with a strong checksumAfter per host/path.');
|
|
638
|
+
}
|
|
639
|
+
if (structuredMultiTarget && !(evidence.restartResults || []).length) {
|
|
640
|
+
blockers.push('Backend JS hotfix with multiple targets requires restartResults[] with passed status per host.');
|
|
641
|
+
}
|
|
642
|
+
if (structuredMultiTarget && !(evidence.healthChecks || []).length) {
|
|
643
|
+
blockers.push('Backend JS hotfix with multiple targets requires healthChecks[] with passed status per host.');
|
|
644
|
+
}
|
|
645
|
+
if (structuredMultiTarget && !(evidence.selfTests || []).length) {
|
|
646
|
+
blockers.push('Backend JS hotfix with multiple targets requires selfTests[] with passed status per host.');
|
|
647
|
+
}
|
|
648
|
+
if (targets.some(backendHotfixTargetTouchesRunnerControlPlane) && !backendHotfixRestartProofIncludesSupportManagers(evidence)) {
|
|
649
|
+
blockers.push('Runner/control-plane backend hotfix requires restart evidence for resolveio_support_ticket_codex_manager on affected backend hosts; restarting nodejs alone can leave stale manager code running.');
|
|
650
|
+
}
|
|
651
|
+
targets.forEach(function (target, index) {
|
|
652
|
+
var label = hotfixTargetLabel(target, index);
|
|
653
|
+
pushMissing(blockers, !!target.host, "Backend JS hotfix ".concat(label, " requires target host."));
|
|
654
|
+
pushMissing(blockers, !!target.path, "Backend JS hotfix ".concat(label, " requires target path."));
|
|
655
|
+
var checksumProof = checksumProofForBackendTarget(evidence, target, !structuredMultiTarget);
|
|
656
|
+
var checksumAfter = (checksumProof === null || checksumProof === void 0 ? void 0 : checksumProof.checksumAfter) || (checksumProof === null || checksumProof === void 0 ? void 0 : checksumProof.checksum) || '';
|
|
657
|
+
pushMissing(blockers, !!checksumAfter, "Backend JS hotfix ".concat(label, " requires remote checksum after replacement."));
|
|
658
|
+
if (checksumAfter && !isStrongRemoteChecksum(checksumAfter)) {
|
|
659
|
+
blockers.push("Backend JS hotfix ".concat(label, " remote checksum after replacement must be a strong hex checksum, not a label or placeholder."));
|
|
660
|
+
}
|
|
661
|
+
if ((checksumProof === null || checksumProof === void 0 ? void 0 : checksumProof.checksumBefore) && checksumAfter && checksumProof.checksumBefore === checksumAfter) {
|
|
662
|
+
blockers.push("Backend JS hotfix ".concat(label, " checksum did not change; record force/no-op evidence or do not claim a hotfix."));
|
|
663
|
+
}
|
|
664
|
+
var restartProof = hostStatusProofForBackendTarget(evidence.restartResults, target, structuredMultiTarget ? '' : (evidence.restartEvidence || evidence.serviceRestartEvidence ? 'passed' : ''));
|
|
665
|
+
pushMissing(blockers, !!restartProof && hotfixStatusPassed(restartProof.status || restartProof.evidence), "Backend JS hotfix ".concat(label, " requires restart evidence or passed restartResults status."));
|
|
666
|
+
var healthProof = hostStatusProofForBackendTarget(evidence.healthChecks, target, structuredMultiTarget ? '' : evidence.healthCheckStatus);
|
|
667
|
+
pushMissing(blockers, !!healthProof && hotfixStatusPassed(healthProof.status), "Backend JS hotfix ".concat(label, " requires passed healthCheckStatus or healthChecks status."));
|
|
668
|
+
var selfTestProof = hostStatusProofForBackendTarget(evidence.selfTests, target, structuredMultiTarget ? '' : evidence.selfTestStatus);
|
|
669
|
+
pushMissing(blockers, !!selfTestProof && hotfixStatusPassed(selfTestProof.status), "Backend JS hotfix ".concat(label, " requires passed selfTestStatus or selfTests status."));
|
|
670
|
+
if (selfTestProof && Number.isFinite(Number(selfTestProof.failedCount)) && Number(selfTestProof.failedCount) > 0) {
|
|
671
|
+
blockers.push("Backend JS hotfix ".concat(label, " selfTests failedCount must be 0."));
|
|
672
|
+
}
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
function githubCommitProofBlockers(value, channel) {
|
|
676
|
+
var blockers = [];
|
|
677
|
+
var sourceCommitSha = cleanText(value.sourceCommitSha, 120);
|
|
678
|
+
var githubCommitUrl = cleanText(value.githubCommitUrl, 500);
|
|
679
|
+
var gitCommitStatus = cleanText(value.gitCommitStatus, 160);
|
|
680
|
+
var gitPushStatus = cleanText(value.gitPushStatus, 160);
|
|
681
|
+
var urlCommitSha = extractGithubCommitSha(githubCommitUrl);
|
|
682
|
+
if (!sourceCommitSha || !githubCommitUrl) {
|
|
683
|
+
blockers.push("".concat(channel, " hotfix requires sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus so live hotfixes are backed by a committed and pushed GitHub change before continuation."));
|
|
684
|
+
return blockers;
|
|
685
|
+
}
|
|
686
|
+
if (!isFullGitCommitSha(sourceCommitSha)) {
|
|
687
|
+
blockers.push("".concat(channel, " hotfix sourceCommitSha must be a full 40-character git SHA."));
|
|
688
|
+
}
|
|
689
|
+
if (!urlCommitSha) {
|
|
690
|
+
blockers.push("".concat(channel, " hotfix githubCommitUrl must be a GitHub commit URL ending in a full 40-character git SHA."));
|
|
691
|
+
}
|
|
692
|
+
else if (isFullGitCommitSha(sourceCommitSha) && urlCommitSha !== sourceCommitSha.toLowerCase()) {
|
|
693
|
+
blockers.push("".concat(channel, " hotfix githubCommitUrl commit SHA must match sourceCommitSha."));
|
|
694
|
+
}
|
|
695
|
+
if (!gitCommitStatus) {
|
|
696
|
+
blockers.push("".concat(channel, " hotfix requires passed gitCommitStatus so the manager records that the hotfix diff was committed before continuation."));
|
|
697
|
+
}
|
|
698
|
+
else if (!hotfixStatusPassed(gitCommitStatus)) {
|
|
699
|
+
blockers.push("".concat(channel, " hotfix gitCommitStatus must be passed before continuation."));
|
|
700
|
+
}
|
|
701
|
+
if (!gitPushStatus) {
|
|
702
|
+
blockers.push("".concat(channel, " hotfix requires passed gitPushStatus so the manager knows the hotfix commit is present on GitHub before continuation."));
|
|
703
|
+
}
|
|
704
|
+
else if (!hotfixStatusPassed(gitPushStatus)) {
|
|
705
|
+
blockers.push("".concat(channel, " hotfix gitPushStatus must be passed before continuation."));
|
|
706
|
+
}
|
|
707
|
+
return blockers;
|
|
708
|
+
}
|
|
709
|
+
function evaluateResolveIOAIManagerHotfixGitProof(value, channelHint) {
|
|
710
|
+
if (channelHint === void 0) { channelHint = ''; }
|
|
711
|
+
var normalized = normalizeResolveIOAIManagerHotfixEvidence(value);
|
|
712
|
+
var source = (normalized || cleanObject(value));
|
|
713
|
+
var channel = (channelHint || (normalized === null || normalized === void 0 ? void 0 : normalized.channel) || source.channel || '');
|
|
714
|
+
var required = hotfixRequiresGithubCommit(channel);
|
|
715
|
+
var sourceCommitSha = cleanText(source.sourceCommitSha || source.source_commit_sha || source.gitCommitSha || source.git_commit_sha || source.commitSha || source.commit_sha, 120);
|
|
716
|
+
var githubCommitUrl = cleanText(source.githubCommitUrl || source.github_commit_url || source.gitCommitUrl || source.git_commit_url || source.commitUrl || source.commit_url, 500);
|
|
717
|
+
var githubCommitSha = extractGithubCommitSha(githubCommitUrl);
|
|
718
|
+
var gitCommitStatus = cleanText(source.gitCommitStatus || source.git_commit_status || source.githubCommitStatus || source.github_commit_status, 160);
|
|
719
|
+
var gitPushStatus = cleanText(source.gitPushStatus || source.git_push_status || source.githubPushStatus || source.github_push_status || source.githubCommitReachableStatus || source.github_commit_reachable_status, 160);
|
|
720
|
+
var blockers = required
|
|
721
|
+
? githubCommitProofBlockers({
|
|
722
|
+
channel: channel,
|
|
723
|
+
target: (normalized === null || normalized === void 0 ? void 0 : normalized.target) || {},
|
|
724
|
+
sourceCommitSha: sourceCommitSha,
|
|
725
|
+
githubCommitUrl: githubCommitUrl,
|
|
726
|
+
gitCommitStatus: gitCommitStatus,
|
|
727
|
+
gitPushStatus: gitPushStatus
|
|
728
|
+
}, channel)
|
|
729
|
+
: [];
|
|
730
|
+
var status = !required
|
|
731
|
+
? 'not_required'
|
|
732
|
+
: (!sourceCommitSha || !githubCommitUrl || !gitCommitStatus || !gitPushStatus)
|
|
733
|
+
? 'missing'
|
|
734
|
+
: blockers.length
|
|
735
|
+
? 'invalid'
|
|
736
|
+
: 'passed';
|
|
737
|
+
var passed = !required || status === 'passed';
|
|
738
|
+
return {
|
|
739
|
+
required: required,
|
|
740
|
+
status: status,
|
|
741
|
+
passed: passed,
|
|
742
|
+
managerMustCommitBeforeHotfix: required && !passed,
|
|
743
|
+
channel: channel,
|
|
744
|
+
sourceCommitSha: sourceCommitSha,
|
|
745
|
+
githubCommitUrl: githubCommitUrl,
|
|
746
|
+
githubCommitSha: githubCommitSha,
|
|
747
|
+
gitCommitStatus: gitCommitStatus,
|
|
748
|
+
gitPushStatus: gitPushStatus,
|
|
749
|
+
blockers: blockers,
|
|
750
|
+
nextCommands: required && !passed
|
|
751
|
+
? ['commit_and_push_hotfix_to_github', 'verify_github_commit_url_and_push_status', 'record_hotfix_evidence']
|
|
752
|
+
: [],
|
|
753
|
+
requiredEvidence: required
|
|
754
|
+
? ['full 40-character sourceCommitSha', 'matching GitHub commit URL', 'passed gitCommitStatus', 'passed gitPushStatus']
|
|
755
|
+
: []
|
|
756
|
+
};
|
|
757
|
+
}
|
|
758
|
+
function validateResolveIOAIManagerHotfixEvidence(value, options) {
|
|
759
|
+
var _a, _b, _c, _d;
|
|
760
|
+
if (options === void 0) { options = {}; }
|
|
761
|
+
var normalized = normalizeResolveIOAIManagerHotfixEvidence(value, options.policy);
|
|
762
|
+
var policy = options.policy;
|
|
763
|
+
if (!normalized) {
|
|
764
|
+
return {
|
|
765
|
+
valid: false,
|
|
766
|
+
status: 'missing',
|
|
767
|
+
channel: '',
|
|
768
|
+
blockers: ['Hotfix evidence is missing or channel is unsupported.'],
|
|
769
|
+
warnings: [],
|
|
770
|
+
fullDeployAllowed: false,
|
|
771
|
+
fullDeployBlocked: true,
|
|
772
|
+
hotfixSatisfied: false,
|
|
773
|
+
requiredEvidence: ((_b = (_a = policy === null || policy === void 0 ? void 0 : policy.hotfixPlan) === null || _a === void 0 ? void 0 : _a.steps) === null || _b === void 0 ? void 0 : _b.flatMap(function (step) { return step.requiredEvidence; })) || [],
|
|
774
|
+
successEvidence: ((_d = (_c = policy === null || policy === void 0 ? void 0 : policy.hotfixPlan) === null || _c === void 0 ? void 0 : _c.steps) === null || _d === void 0 ? void 0 : _d.flatMap(function (step) { return step.successEvidence; })) || [],
|
|
775
|
+
githubCommitGuard: evaluateResolveIOAIManagerHotfixGitProof(value),
|
|
776
|
+
policy: policy,
|
|
777
|
+
nextAction: 'record_hotfix_evidence'
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
var blockers = [];
|
|
781
|
+
var warnings = [];
|
|
782
|
+
var target = normalized.target || {};
|
|
783
|
+
var channel = normalized.channel;
|
|
784
|
+
var step = matchingHotfixPlanStep(policy, channel);
|
|
785
|
+
var requiredEvidence = (step === null || step === void 0 ? void 0 : step.requiredEvidence) || [];
|
|
786
|
+
var successEvidence = (step === null || step === void 0 ? void 0 : step.successEvidence) || [];
|
|
787
|
+
var policyAllowsFullDeploy = (policy === null || policy === void 0 ? void 0 : policy.fullDeployAllowed) === true;
|
|
788
|
+
var policyBlocksDuplicate = (policy === null || policy === void 0 ? void 0 : policy.duplicateDeployBlocked) === true || (policy === null || policy === void 0 ? void 0 : policy.duplicatePublishBlocked) === true;
|
|
789
|
+
var githubCommitGuard = evaluateResolveIOAIManagerHotfixGitProof(normalized, channel);
|
|
790
|
+
if (normalized.fullDeployRequested && !policyAllowsFullDeploy && channel !== 'force_deploy_review' && channel !== 'new_artifact_deploy') {
|
|
791
|
+
blockers.push('Full deploy requested but hotfix-first policy does not allow a full deploy for this release state.');
|
|
792
|
+
}
|
|
793
|
+
if (normalized.fullDeployRequested && policyBlocksDuplicate && !normalized.forceDeployReason && channel !== 'force_deploy_review') {
|
|
794
|
+
blockers.push('Duplicate deploy/publish fingerprint requires force deploy/publish evidence before any full deploy.');
|
|
795
|
+
}
|
|
796
|
+
if (githubCommitGuard.required) {
|
|
797
|
+
blockers.push.apply(blockers, __spreadArray([], __read(githubCommitGuard.blockers), false));
|
|
798
|
+
}
|
|
799
|
+
if (channel === 'backend_js') {
|
|
800
|
+
pushMissing(blockers, !!normalized.compiledArtifactPath, 'Backend JS hotfix requires compiledArtifactPath.');
|
|
801
|
+
validateBackendHotfixTargetCoverage(normalized, blockers);
|
|
802
|
+
}
|
|
803
|
+
else if (channel === 'static_ui') {
|
|
804
|
+
pushMissing(blockers, !!normalized.builtDistPath, 'Static UI hotfix requires builtDistPath.');
|
|
805
|
+
pushMissing(blockers, !!target.bucket, 'Static UI hotfix requires target.bucket.');
|
|
806
|
+
pushMissing(blockers, !!target.distributionId, 'Static UI hotfix requires target.distributionId.');
|
|
807
|
+
pushMissing(blockers, !!normalized.s3UploadResult, 'Static UI hotfix requires s3UploadResult.');
|
|
808
|
+
pushMissing(blockers, !!normalized.cloudfrontInvalidationId, 'Static UI hotfix requires cloudfrontInvalidationId.');
|
|
809
|
+
pushMissing(blockers, !!normalized.publicProof, 'Static UI hotfix requires publicProof.');
|
|
810
|
+
}
|
|
811
|
+
else if (channel === 'config') {
|
|
812
|
+
pushMissing(blockers, !!target.configKey, 'Config hotfix requires target.configKey.');
|
|
813
|
+
pushMissing(blockers, !!normalized.configChangeEvidence, 'Config hotfix requires configChangeEvidence.');
|
|
814
|
+
pushMissing(blockers, hotfixStatusPassed(normalized.releaseGateStatus), 'Config hotfix requires passed releaseGateStatus.');
|
|
815
|
+
}
|
|
816
|
+
else if (channel === 'seed_data') {
|
|
817
|
+
pushMissing(blockers, !!target.seedKey, 'Seed-data hotfix requires target.seedKey.');
|
|
818
|
+
pushMissing(blockers, !!normalized.seedDataEvidence, 'Seed-data hotfix requires seedDataEvidence.');
|
|
819
|
+
pushMissing(blockers, hotfixStatusPassed(normalized.releaseGateStatus), 'Seed-data hotfix requires passed releaseGateStatus.');
|
|
820
|
+
}
|
|
821
|
+
else if (channel === 'cache_invalidation') {
|
|
822
|
+
pushMissing(blockers, !!target.cacheKey, 'Cache invalidation hotfix requires target.cacheKey.');
|
|
823
|
+
pushMissing(blockers, !!normalized.cacheInvalidationEvidence, 'Cache invalidation hotfix requires cacheInvalidationEvidence.');
|
|
824
|
+
pushMissing(blockers, hotfixStatusPassed(normalized.releaseGateStatus) || hotfixStatusPassed(normalized.healthCheckStatus), 'Cache invalidation hotfix requires passed releaseGateStatus or healthCheckStatus.');
|
|
825
|
+
}
|
|
826
|
+
else if (channel === 'service_restart') {
|
|
827
|
+
pushMissing(blockers, !!target.processName, 'Service restart hotfix requires target.processName.');
|
|
828
|
+
pushMissing(blockers, !!(normalized.serviceRestartEvidence || normalized.restartEvidence), 'Service restart hotfix requires restart evidence.');
|
|
829
|
+
pushMissing(blockers, hotfixStatusPassed(normalized.healthCheckStatus), 'Service restart hotfix requires passed healthCheckStatus.');
|
|
830
|
+
pushMissing(blockers, hotfixStatusPassed(normalized.selfTestStatus), 'Service restart hotfix requires passed selfTestStatus.');
|
|
831
|
+
}
|
|
832
|
+
else if (channel === 'release_artifact') {
|
|
833
|
+
pushMissing(blockers, !!normalized.releaseArtifactFingerprint, 'Release artifact hotfix requires releaseArtifactFingerprint.');
|
|
834
|
+
pushMissing(blockers, hotfixStatusPassed(normalized.releaseGateStatus), 'Release artifact hotfix requires passed releaseGateStatus.');
|
|
835
|
+
}
|
|
836
|
+
else if (channel === 'force_deploy_review') {
|
|
837
|
+
pushMissing(blockers, !!normalized.forceDeployReason, 'Force deploy review requires forceDeployReason.');
|
|
838
|
+
pushMissing(blockers, !!normalized.hotfixCannotResolveReason, 'Force deploy review requires hotfixCannotResolveReason.');
|
|
839
|
+
}
|
|
840
|
+
else if (channel === 'new_artifact_deploy') {
|
|
841
|
+
pushMissing(blockers, !!normalized.releaseArtifactFingerprint, 'New artifact deploy requires releaseArtifactFingerprint.');
|
|
842
|
+
pushMissing(blockers, !!normalized.lastReleaseArtifactFingerprint, 'New artifact deploy requires lastReleaseArtifactFingerprint.');
|
|
843
|
+
if (normalized.releaseArtifactFingerprint && normalized.lastReleaseArtifactFingerprint && normalized.releaseArtifactFingerprint === normalized.lastReleaseArtifactFingerprint) {
|
|
844
|
+
blockers.push('New artifact deploy requires a fingerprint different from the last deployed artifact.');
|
|
845
|
+
}
|
|
846
|
+
pushMissing(blockers, hotfixStatusPassed(normalized.releaseGateStatus), 'New artifact deploy requires passed releaseGateStatus.');
|
|
847
|
+
}
|
|
848
|
+
else if (channel === 'artifact_build') {
|
|
849
|
+
pushMissing(blockers, !!normalized.releaseArtifactFingerprint, 'Artifact build requires releaseArtifactFingerprint.');
|
|
850
|
+
if (normalized.fullDeployRequested) {
|
|
851
|
+
blockers.push('Artifact build evidence cannot request a full deploy in the same step.');
|
|
852
|
+
}
|
|
853
|
+
}
|
|
854
|
+
if (!step && policy) {
|
|
855
|
+
warnings.push("Hotfix channel ".concat(channel, " is not the recommended channel in the current release policy."));
|
|
856
|
+
}
|
|
857
|
+
var forceDeployReviewValid = channel === 'force_deploy_review' && blockers.length === 0;
|
|
858
|
+
var newArtifactDeployValid = channel === 'new_artifact_deploy' && blockers.length === 0;
|
|
859
|
+
var fullDeployAllowed = forceDeployReviewValid || newArtifactDeployValid || (policyAllowsFullDeploy && blockers.length === 0 && normalized.fullDeployRequested === true);
|
|
860
|
+
var hotfixSatisfied = blockers.length === 0 && !fullDeployAllowed;
|
|
861
|
+
var status = blockers.length
|
|
862
|
+
? (normalizeHotfixStatus(normalized.status) === 'blocked' ? 'blocked' : 'incomplete')
|
|
863
|
+
: 'passed';
|
|
864
|
+
var fullDeployBlocked = !fullDeployAllowed && (normalized.fullDeployRequested === true || (policy === null || policy === void 0 ? void 0 : policy.fullDeployAllowed) !== true);
|
|
865
|
+
var nextAction = blockers.some(function (blocker) { return /force deploy/i.test(blocker); })
|
|
866
|
+
? 'request_force_deploy_reason'
|
|
867
|
+
: fullDeployAllowed
|
|
868
|
+
? 'allow_one_full_deploy'
|
|
869
|
+
: hotfixSatisfied
|
|
870
|
+
? 'rerun_release_gate'
|
|
871
|
+
: blockers.length
|
|
872
|
+
? 'record_hotfix_evidence'
|
|
873
|
+
: 'park_manual';
|
|
874
|
+
normalized.status = status;
|
|
875
|
+
return {
|
|
876
|
+
valid: blockers.length === 0,
|
|
877
|
+
status: status,
|
|
878
|
+
channel: channel,
|
|
879
|
+
blockers: blockers,
|
|
880
|
+
warnings: warnings,
|
|
881
|
+
fullDeployAllowed: fullDeployAllowed,
|
|
882
|
+
fullDeployBlocked: fullDeployBlocked,
|
|
883
|
+
hotfixSatisfied: hotfixSatisfied,
|
|
884
|
+
requiredEvidence: requiredEvidence,
|
|
885
|
+
successEvidence: successEvidence,
|
|
886
|
+
normalized: normalized,
|
|
887
|
+
githubCommitGuard: githubCommitGuard,
|
|
888
|
+
policy: policy,
|
|
889
|
+
nextAction: nextAction
|
|
890
|
+
};
|
|
891
|
+
}
|
|
892
|
+
function mergeHotfixEvidenceRecordInput(input) {
|
|
893
|
+
var e_3, _a;
|
|
894
|
+
var merged = __assign({}, cleanObject(input.evidence));
|
|
895
|
+
var directFields = [
|
|
896
|
+
'channel',
|
|
897
|
+
'status',
|
|
898
|
+
'target',
|
|
899
|
+
'targets',
|
|
900
|
+
'compiledArtifactPath',
|
|
901
|
+
'builtDistPath',
|
|
902
|
+
'remoteChecksumBefore',
|
|
903
|
+
'remoteChecksumAfter',
|
|
904
|
+
'remoteChecksum',
|
|
905
|
+
'remoteChecksums',
|
|
906
|
+
'restartEvidence',
|
|
907
|
+
'restartResults',
|
|
908
|
+
'healthCheckStatus',
|
|
909
|
+
'healthChecks',
|
|
910
|
+
'selfTestStatus',
|
|
911
|
+
'selfTests',
|
|
912
|
+
'releaseGateStatus',
|
|
913
|
+
's3UploadResult',
|
|
914
|
+
'cloudfrontInvalidationId',
|
|
915
|
+
'publicProof',
|
|
916
|
+
'configChangeEvidence',
|
|
917
|
+
'seedDataEvidence',
|
|
918
|
+
'cacheInvalidationEvidence',
|
|
919
|
+
'serviceRestartEvidence',
|
|
920
|
+
'releaseArtifactFingerprint',
|
|
921
|
+
'lastReleaseArtifactFingerprint',
|
|
922
|
+
'sourceCommitSha',
|
|
923
|
+
'githubCommitUrl',
|
|
924
|
+
'gitCommitStatus',
|
|
925
|
+
'gitPushStatus',
|
|
926
|
+
'committedAt',
|
|
927
|
+
'forceDeployReason',
|
|
928
|
+
'hotfixCannotResolveReason',
|
|
929
|
+
'fullDeployRequested',
|
|
930
|
+
'recordedAt'
|
|
931
|
+
];
|
|
932
|
+
try {
|
|
933
|
+
for (var directFields_1 = __values(directFields), directFields_1_1 = directFields_1.next(); !directFields_1_1.done; directFields_1_1 = directFields_1.next()) {
|
|
934
|
+
var field = directFields_1_1.value;
|
|
935
|
+
var value = input[field];
|
|
936
|
+
if (value !== undefined && value !== null && value !== '') {
|
|
937
|
+
merged[field] = value;
|
|
938
|
+
}
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
catch (e_3_1) { e_3 = { error: e_3_1 }; }
|
|
942
|
+
finally {
|
|
943
|
+
try {
|
|
944
|
+
if (directFields_1_1 && !directFields_1_1.done && (_a = directFields_1.return)) _a.call(directFields_1);
|
|
945
|
+
}
|
|
946
|
+
finally { if (e_3) throw e_3.error; }
|
|
947
|
+
}
|
|
948
|
+
return merged;
|
|
949
|
+
}
|
|
950
|
+
function resolveHotfixEvidenceRequiredFields(channel) {
|
|
951
|
+
var fields = ['channel'];
|
|
952
|
+
if (hotfixRequiresGithubCommit(channel)) {
|
|
953
|
+
fields.push('sourceCommitSha', 'githubCommitUrl', 'gitCommitStatus', 'gitPushStatus');
|
|
954
|
+
}
|
|
955
|
+
if (channel === 'backend_js') {
|
|
956
|
+
fields.push('compiledArtifactPath', 'target.host', 'target.path', 'remoteChecksumAfter', 'restartEvidence', 'healthCheckStatus', 'selfTestStatus');
|
|
957
|
+
}
|
|
958
|
+
else if (channel === 'static_ui') {
|
|
959
|
+
fields.push('builtDistPath', 'target.bucket', 'target.distributionId', 's3UploadResult', 'cloudfrontInvalidationId', 'publicProof');
|
|
960
|
+
}
|
|
961
|
+
else if (channel === 'config') {
|
|
962
|
+
fields.push('target.configKey', 'configChangeEvidence', 'releaseGateStatus');
|
|
963
|
+
}
|
|
964
|
+
else if (channel === 'seed_data') {
|
|
965
|
+
fields.push('target.seedKey', 'seedDataEvidence', 'releaseGateStatus');
|
|
966
|
+
}
|
|
967
|
+
else if (channel === 'cache_invalidation') {
|
|
968
|
+
fields.push('target.cacheKey', 'cacheInvalidationEvidence', 'releaseGateStatus_or_healthCheckStatus');
|
|
969
|
+
}
|
|
970
|
+
else if (channel === 'service_restart') {
|
|
971
|
+
fields.push('target.processName', 'serviceRestartEvidence', 'healthCheckStatus', 'selfTestStatus');
|
|
972
|
+
}
|
|
973
|
+
else if (channel === 'release_artifact') {
|
|
974
|
+
fields.push('releaseArtifactFingerprint', 'releaseGateStatus');
|
|
975
|
+
}
|
|
976
|
+
else if (channel === 'new_artifact_deploy') {
|
|
977
|
+
fields.push('releaseArtifactFingerprint', 'lastReleaseArtifactFingerprint', 'releaseGateStatus');
|
|
978
|
+
}
|
|
979
|
+
else if (channel === 'artifact_build') {
|
|
980
|
+
fields.push('releaseArtifactFingerprint');
|
|
981
|
+
}
|
|
982
|
+
else if (channel === 'force_deploy_review') {
|
|
983
|
+
fields.push('forceDeployReason', 'hotfixCannotResolveReason');
|
|
984
|
+
}
|
|
985
|
+
return Array.from(new Set(fields));
|
|
986
|
+
}
|
|
987
|
+
function hotfixEvidenceFieldPresent(evidence, field) {
|
|
988
|
+
if (!evidence) {
|
|
989
|
+
return false;
|
|
990
|
+
}
|
|
991
|
+
var target = evidence.target || {};
|
|
992
|
+
switch (field) {
|
|
993
|
+
case 'channel':
|
|
994
|
+
return !!evidence.channel;
|
|
995
|
+
case 'sourceCommitSha':
|
|
996
|
+
return isFullGitCommitSha(evidence.sourceCommitSha || '');
|
|
997
|
+
case 'githubCommitUrl':
|
|
998
|
+
return !!extractGithubCommitSha(evidence.githubCommitUrl || '');
|
|
999
|
+
case 'gitCommitStatus':
|
|
1000
|
+
return hotfixStatusPassed(evidence.gitCommitStatus);
|
|
1001
|
+
case 'gitPushStatus':
|
|
1002
|
+
return hotfixStatusPassed(evidence.gitPushStatus);
|
|
1003
|
+
case 'compiledArtifactPath':
|
|
1004
|
+
return !!cleanText(evidence.compiledArtifactPath, 500);
|
|
1005
|
+
case 'builtDistPath':
|
|
1006
|
+
return !!cleanText(evidence.builtDistPath, 500);
|
|
1007
|
+
case 'remoteChecksumAfter':
|
|
1008
|
+
return !!cleanText(evidence.remoteChecksumAfter || evidence.remoteChecksum, 160);
|
|
1009
|
+
case 'restartEvidence':
|
|
1010
|
+
return !!cleanText(evidence.restartEvidence || evidence.serviceRestartEvidence, 1000);
|
|
1011
|
+
case 'serviceRestartEvidence':
|
|
1012
|
+
return !!cleanText(evidence.serviceRestartEvidence || evidence.restartEvidence, 1000);
|
|
1013
|
+
case 'healthCheckStatus':
|
|
1014
|
+
return hotfixStatusPassed(evidence.healthCheckStatus);
|
|
1015
|
+
case 'selfTestStatus':
|
|
1016
|
+
return hotfixStatusPassed(evidence.selfTestStatus);
|
|
1017
|
+
case 'releaseGateStatus':
|
|
1018
|
+
return hotfixStatusPassed(evidence.releaseGateStatus);
|
|
1019
|
+
case 'releaseGateStatus_or_healthCheckStatus':
|
|
1020
|
+
return hotfixStatusPassed(evidence.releaseGateStatus) || hotfixStatusPassed(evidence.healthCheckStatus);
|
|
1021
|
+
case 's3UploadResult':
|
|
1022
|
+
return !!cleanText(evidence.s3UploadResult, 1000);
|
|
1023
|
+
case 'cloudfrontInvalidationId':
|
|
1024
|
+
return !!cleanText(evidence.cloudfrontInvalidationId, 240);
|
|
1025
|
+
case 'publicProof':
|
|
1026
|
+
return !!cleanText(evidence.publicProof, 1000);
|
|
1027
|
+
case 'configChangeEvidence':
|
|
1028
|
+
return !!cleanText(evidence.configChangeEvidence, 1000);
|
|
1029
|
+
case 'seedDataEvidence':
|
|
1030
|
+
return !!cleanText(evidence.seedDataEvidence, 1000);
|
|
1031
|
+
case 'cacheInvalidationEvidence':
|
|
1032
|
+
return !!cleanText(evidence.cacheInvalidationEvidence, 1000);
|
|
1033
|
+
case 'releaseArtifactFingerprint':
|
|
1034
|
+
return !!cleanText(evidence.releaseArtifactFingerprint, 240);
|
|
1035
|
+
case 'lastReleaseArtifactFingerprint':
|
|
1036
|
+
return !!cleanText(evidence.lastReleaseArtifactFingerprint, 240);
|
|
1037
|
+
case 'forceDeployReason':
|
|
1038
|
+
return !!cleanText(evidence.forceDeployReason, 1000);
|
|
1039
|
+
case 'hotfixCannotResolveReason':
|
|
1040
|
+
return !!cleanText(evidence.hotfixCannotResolveReason, 1000);
|
|
1041
|
+
case 'target.host':
|
|
1042
|
+
return !!cleanText(target.host, 200);
|
|
1043
|
+
case 'target.path':
|
|
1044
|
+
return !!cleanText(target.path, 500);
|
|
1045
|
+
case 'target.bucket':
|
|
1046
|
+
return !!cleanText(target.bucket, 200);
|
|
1047
|
+
case 'target.distributionId':
|
|
1048
|
+
return !!cleanText(target.distributionId, 200);
|
|
1049
|
+
case 'target.configKey':
|
|
1050
|
+
return !!cleanText(target.configKey, 200);
|
|
1051
|
+
case 'target.seedKey':
|
|
1052
|
+
return !!cleanText(target.seedKey, 200);
|
|
1053
|
+
case 'target.cacheKey':
|
|
1054
|
+
return !!cleanText(target.cacheKey, 200);
|
|
1055
|
+
case 'target.processName':
|
|
1056
|
+
return !!cleanText(target.processName, 200);
|
|
1057
|
+
default:
|
|
1058
|
+
return false;
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
function buildResolveIOAIManagerHotfixEvidenceRecord(input) {
|
|
1062
|
+
var _a, _b;
|
|
1063
|
+
if (input === void 0) { input = {}; }
|
|
1064
|
+
var merged = mergeHotfixEvidenceRecordInput(input);
|
|
1065
|
+
var normalized = normalizeResolveIOAIManagerHotfixEvidence(merged, input.policy);
|
|
1066
|
+
var validation = validateResolveIOAIManagerHotfixEvidence(merged, { policy: input.policy });
|
|
1067
|
+
var channel = validation.channel || (normalized === null || normalized === void 0 ? void 0 : normalized.channel) || ((_b = (_a = input.policy) === null || _a === void 0 ? void 0 : _a.hotfixPlan) === null || _b === void 0 ? void 0 : _b.recommendedChannel) || '';
|
|
1068
|
+
var requiredFields = resolveHotfixEvidenceRequiredFields(channel);
|
|
1069
|
+
var missingFields = requiredFields.filter(function (field) { return !hotfixEvidenceFieldPresent(normalized, field); });
|
|
1070
|
+
var recordedAt = cleanDateString(input.now || (normalized === null || normalized === void 0 ? void 0 : normalized.recordedAt) || new Date());
|
|
1071
|
+
var githubCommitGuard = validation.githubCommitGuard || evaluateResolveIOAIManagerHotfixGitProof(normalized || merged, channel);
|
|
1072
|
+
var commitFirstProtocol = githubCommitGuard.required ? 'commit_first_hotfix' : 'not_required';
|
|
1073
|
+
var commitFirstProtocolSatisfied = githubCommitGuard.required ? githubCommitGuard.passed === true : true;
|
|
1074
|
+
var liveHotfixBlockedUntilCommit = githubCommitGuard.required === true && commitFirstProtocolSatisfied !== true;
|
|
1075
|
+
var liveHotfixAllowed = validation.valid === true && validation.hotfixSatisfied === true && commitFirstProtocolSatisfied === true;
|
|
1076
|
+
var readyForContinuation = validation.valid === true && validation.hotfixSatisfied === true && hotfixStatusPassed(normalized === null || normalized === void 0 ? void 0 : normalized.releaseGateStatus);
|
|
1077
|
+
return {
|
|
1078
|
+
recordId: cleanText(input.recordId, 160) || "hotfix-".concat(fingerprintResolveIOAIManagerBlocker("".concat(channel, ":").concat(githubCommitGuard.sourceCommitSha, ":").concat(recordedAt))),
|
|
1079
|
+
recordedAt: recordedAt,
|
|
1080
|
+
recordedBy: cleanText(input.recordedBy || 'manager', 160),
|
|
1081
|
+
source: cleanText(input.source || 'unknown', 80),
|
|
1082
|
+
reason: cleanText(input.reason, 1000),
|
|
1083
|
+
channel: channel,
|
|
1084
|
+
status: validation.status,
|
|
1085
|
+
nextAction: validation.nextAction,
|
|
1086
|
+
valid: validation.valid,
|
|
1087
|
+
hotfixSatisfied: validation.hotfixSatisfied,
|
|
1088
|
+
fullDeployAllowed: validation.fullDeployAllowed,
|
|
1089
|
+
fullDeployBlocked: validation.fullDeployBlocked,
|
|
1090
|
+
requiredFields: requiredFields,
|
|
1091
|
+
missingFields: missingFields,
|
|
1092
|
+
evidence: normalized,
|
|
1093
|
+
validation: validation,
|
|
1094
|
+
sourceCommitSha: githubCommitGuard.sourceCommitSha,
|
|
1095
|
+
githubCommitUrl: githubCommitGuard.githubCommitUrl,
|
|
1096
|
+
gitCommitStatus: githubCommitGuard.gitCommitStatus,
|
|
1097
|
+
gitPushStatus: githubCommitGuard.gitPushStatus,
|
|
1098
|
+
githubCommitRequired: githubCommitGuard.required,
|
|
1099
|
+
githubCommitProofPassed: githubCommitGuard.passed,
|
|
1100
|
+
commitProofStatus: githubCommitGuard.status,
|
|
1101
|
+
commitFirstProtocol: commitFirstProtocol,
|
|
1102
|
+
commit_first_protocol: commitFirstProtocol,
|
|
1103
|
+
commitFirstProtocolSatisfied: commitFirstProtocolSatisfied,
|
|
1104
|
+
commit_first_protocol_satisfied: commitFirstProtocolSatisfied,
|
|
1105
|
+
liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit,
|
|
1106
|
+
live_hotfix_blocked_until_commit: liveHotfixBlockedUntilCommit,
|
|
1107
|
+
liveHotfixAllowed: liveHotfixAllowed,
|
|
1108
|
+
live_hotfix_allowed: liveHotfixAllowed,
|
|
1109
|
+
managerMustCommitBeforeHotfix: githubCommitGuard.managerMustCommitBeforeHotfix,
|
|
1110
|
+
githubCommitGuard: githubCommitGuard,
|
|
1111
|
+
readyForReleaseGate: validation.valid === true && validation.nextAction === 'rerun_release_gate',
|
|
1112
|
+
readyForContinuation: readyForContinuation,
|
|
1113
|
+
managerContinuationAllowed: readyForContinuation,
|
|
1114
|
+
manager_continuation_allowed: readyForContinuation
|
|
1115
|
+
};
|
|
1116
|
+
}
|
|
1117
|
+
function pickFirstHotfixText(sources, keys, max, seen) {
|
|
1118
|
+
var e_4, _a, e_5, _b, e_6, _c;
|
|
1119
|
+
if (max === void 0) { max = 500; }
|
|
1120
|
+
if (seen === void 0) { seen = new WeakSet(); }
|
|
1121
|
+
try {
|
|
1122
|
+
for (var sources_1 = __values(sources), sources_1_1 = sources_1.next(); !sources_1_1.done; sources_1_1 = sources_1.next()) {
|
|
1123
|
+
var source = sources_1_1.value;
|
|
1124
|
+
var record = cleanObject(source);
|
|
1125
|
+
if (!Object.keys(record).length || seen.has(record)) {
|
|
1126
|
+
continue;
|
|
1127
|
+
}
|
|
1128
|
+
seen.add(record);
|
|
1129
|
+
try {
|
|
1130
|
+
for (var keys_1 = (e_5 = void 0, __values(keys)), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) {
|
|
1131
|
+
var key = keys_1_1.value;
|
|
1132
|
+
var value = cleanText(record[key], max);
|
|
1133
|
+
if (value) {
|
|
1134
|
+
return value;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
}
|
|
1138
|
+
catch (e_5_1) { e_5 = { error: e_5_1 }; }
|
|
1139
|
+
finally {
|
|
1140
|
+
try {
|
|
1141
|
+
if (keys_1_1 && !keys_1_1.done && (_b = keys_1.return)) _b.call(keys_1);
|
|
1142
|
+
}
|
|
1143
|
+
finally { if (e_5) throw e_5.error; }
|
|
1144
|
+
}
|
|
1145
|
+
try {
|
|
1146
|
+
for (var _d = (e_6 = void 0, __values(['evidence', 'hotfixEvidence', 'hotfix_evidence', 'hotfixCommitProof', 'hotfix_commit_proof', 'hotfixCommitGuard', 'hotfix_commit_guard', 'githubCommitGuard', 'github_commit_guard'])), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1147
|
+
var nestedKey = _e.value;
|
|
1148
|
+
var nestedValue = pickFirstHotfixText([record[nestedKey]], keys, max, seen);
|
|
1149
|
+
if (nestedValue) {
|
|
1150
|
+
return nestedValue;
|
|
1151
|
+
}
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
catch (e_6_1) { e_6 = { error: e_6_1 }; }
|
|
1155
|
+
finally {
|
|
1156
|
+
try {
|
|
1157
|
+
if (_e && !_e.done && (_c = _d.return)) _c.call(_d);
|
|
1158
|
+
}
|
|
1159
|
+
finally { if (e_6) throw e_6.error; }
|
|
1160
|
+
}
|
|
1161
|
+
}
|
|
1162
|
+
}
|
|
1163
|
+
catch (e_4_1) { e_4 = { error: e_4_1 }; }
|
|
1164
|
+
finally {
|
|
1165
|
+
try {
|
|
1166
|
+
if (sources_1_1 && !sources_1_1.done && (_a = sources_1.return)) _a.call(sources_1);
|
|
1167
|
+
}
|
|
1168
|
+
finally { if (e_4) throw e_4.error; }
|
|
1169
|
+
}
|
|
1170
|
+
return '';
|
|
1171
|
+
}
|
|
1172
|
+
function hotfixDurabilityExtraRequest(contract) {
|
|
1173
|
+
if (!contract.required) {
|
|
1174
|
+
return '';
|
|
1175
|
+
}
|
|
1176
|
+
return [
|
|
1177
|
+
'Manager hotfix durability contract:',
|
|
1178
|
+
"- Contract id: ".concat(contract.contractId),
|
|
1179
|
+
"- Live backend hotfix blocked until commit proof: ".concat(contract.liveHotfixBlockedUntilCommit ? 'yes' : 'no'),
|
|
1180
|
+
"- GitHub commit proof passed: ".concat(contract.commitProofPassed ? 'yes' : 'no'),
|
|
1181
|
+
contract.missingCommitProofFields.length ? "- Missing commit proof fields: ".concat(contract.missingCommitProofFields.join(', ')) : '',
|
|
1182
|
+
contract.phaseOrder.length ? "- Required phase order: ".concat(contract.phaseOrder.join(' -> ')) : '',
|
|
1183
|
+
contract.requiredFields.length ? "- Required evidence fields: ".concat(contract.requiredFields.join(', ')) : '',
|
|
1184
|
+
contract.successCriteria.length ? "- Success criteria: ".concat(contract.successCriteria.join(' | ')) : '',
|
|
1185
|
+
contract.forbiddenActions.length ? "- Forbidden actions: ".concat(contract.forbiddenActions.join(' | ')) : '',
|
|
1186
|
+
'- Prepare the hotfix patch and GitHub commit proof before any live backend apply/restart.',
|
|
1187
|
+
'- After commit proof exists, apply the backend hotfix only through the existing hotfix path, record restart/checksum evidence, run the runner-manager self-test, and rerun the smallest release gate.'
|
|
1188
|
+
].filter(Boolean).join('\n').slice(0, 3600);
|
|
1189
|
+
}
|
|
1190
|
+
function buildResolveIOAIManagerHotfixDurabilityContract(input) {
|
|
1191
|
+
var _a, _b, _c, _d, _e;
|
|
1192
|
+
if (input === void 0) { input = {}; }
|
|
1193
|
+
var existing = cleanObject(input.existing);
|
|
1194
|
+
var evidence = Object.keys(cleanObject(input.evidence)).length ? input.evidence : existing.evidence || existing.hotfixEvidence || existing.hotfix_evidence || existing;
|
|
1195
|
+
var validation = validateResolveIOAIManagerHotfixEvidence(evidence, { policy: input.policy });
|
|
1196
|
+
var continuation = input.continuation || undefined;
|
|
1197
|
+
var githubCommitGuard = validation.githubCommitGuard || evaluateResolveIOAIManagerHotfixGitProof(evidence, validation.channel);
|
|
1198
|
+
var sources = [evidence, existing, continuation, continuation === null || continuation === void 0 ? void 0 : continuation.githubCommitGuard, continuation === null || continuation === void 0 ? void 0 : continuation.github_commit_guard, githubCommitGuard];
|
|
1199
|
+
var action = cleanText(input.action || existing.action || existing.dispatchAction || existing.dispatch_action || 'run_release_repair', 160);
|
|
1200
|
+
var actionRequiresHotfix = /release_repair|hotfix|apply.*backend|deploy|publish/i.test(action);
|
|
1201
|
+
var required = existing.required === true
|
|
1202
|
+
|| actionRequiresHotfix
|
|
1203
|
+
|| githubCommitGuard.required === true
|
|
1204
|
+
|| ((_a = validation.githubCommitGuard) === null || _a === void 0 ? void 0 : _a.required) === true
|
|
1205
|
+
|| ((_b = continuation === null || continuation === void 0 ? void 0 : continuation.githubCommitGuard) === null || _b === void 0 ? void 0 : _b.required) === true
|
|
1206
|
+
|| ((_c = continuation === null || continuation === void 0 ? void 0 : continuation.github_commit_guard) === null || _c === void 0 ? void 0 : _c.required) === true
|
|
1207
|
+
|| ((_d = input.policy) === null || _d === void 0 ? void 0 : _d.hotfixPreferred) === true;
|
|
1208
|
+
var sourceCommitSha = githubCommitGuard.sourceCommitSha || pickFirstHotfixText(sources, ['sourceCommitSha', 'source_commit_sha', 'commitSha', 'commit_sha'], 120);
|
|
1209
|
+
var githubCommitUrl = githubCommitGuard.githubCommitUrl || pickFirstHotfixText(sources, ['githubCommitUrl', 'github_commit_url', 'commitUrl', 'commit_url'], 500);
|
|
1210
|
+
var gitCommitStatus = githubCommitGuard.gitCommitStatus || pickFirstHotfixText(sources, ['gitCommitStatus', 'git_commit_status', 'commitStatus', 'commit_status'], 160);
|
|
1211
|
+
var gitPushStatus = githubCommitGuard.gitPushStatus || pickFirstHotfixText(sources, ['gitPushStatus', 'git_push_status', 'pushStatus', 'push_status'], 160);
|
|
1212
|
+
var commitPassed = hotfixStatusPassed(gitCommitStatus);
|
|
1213
|
+
var pushPassed = hotfixStatusPassed(gitPushStatus);
|
|
1214
|
+
var sourceShaPassed = isFullGitCommitSha(sourceCommitSha);
|
|
1215
|
+
var githubUrlSha = extractGithubCommitSha(githubCommitUrl);
|
|
1216
|
+
var githubUrlPassed = !!githubUrlSha && (!sourceShaPassed || githubUrlSha === sourceCommitSha.toLowerCase());
|
|
1217
|
+
var existingMissingCommitFields = cleanList(existing.missingCommitProofFields || existing.missing_commit_proof_fields, 20, 160);
|
|
1218
|
+
var commitFirstProtocolRequired = githubCommitGuard.required === true
|
|
1219
|
+
|| existing.durabilityProtocol === 'commit_first_hotfix'
|
|
1220
|
+
|| existing.durability_protocol === 'commit_first_hotfix'
|
|
1221
|
+
|| existing.commitFirstProtocolRequired === true
|
|
1222
|
+
|| existing.commit_first_protocol_required === true
|
|
1223
|
+
|| existingMissingCommitFields.some(function (field) { return /sourceCommitSha|githubCommitUrl|gitCommitStatus|gitPushStatus/i.test(field); });
|
|
1224
|
+
var durabilityProtocol = commitFirstProtocolRequired ? 'commit_first_hotfix' : 'not_required';
|
|
1225
|
+
var missingCommitProofFields = [
|
|
1226
|
+
sourceShaPassed ? '' : 'sourceCommitSha',
|
|
1227
|
+
githubUrlPassed ? '' : 'githubCommitUrl',
|
|
1228
|
+
commitPassed ? '' : 'gitCommitStatus=passed',
|
|
1229
|
+
pushPassed ? '' : 'gitPushStatus=passed'
|
|
1230
|
+
].filter(Boolean);
|
|
1231
|
+
var commitProofPassed = required ? missingCommitProofFields.length === 0 : githubCommitGuard.passed === true;
|
|
1232
|
+
var commitFirstProtocolSatisfied = commitFirstProtocolRequired ? commitProofPassed === true : true;
|
|
1233
|
+
var liveHotfixBlockedUntilCommit = required && commitProofPassed !== true;
|
|
1234
|
+
var releaseGatePassed = input.releaseGatePassed === true
|
|
1235
|
+
|| hotfixStatusPassed((_e = validation.normalized) === null || _e === void 0 ? void 0 : _e.releaseGateStatus)
|
|
1236
|
+
|| (continuation === null || continuation === void 0 ? void 0 : continuation.canContinueRun) === true;
|
|
1237
|
+
var canPrepareHotfixPatch = required && (existing.canPrepareHotfixPatch === true || existing.can_prepare_hotfix_patch === true || actionRequiresHotfix || (continuation === null || continuation === void 0 ? void 0 : continuation.action) === 'record_hotfix_evidence');
|
|
1238
|
+
var canHotfixBackend = required && commitProofPassed === true && canPrepareHotfixPatch === true;
|
|
1239
|
+
var liveHotfixAllowed = required && commitFirstProtocolSatisfied === true && canPrepareHotfixPatch === true;
|
|
1240
|
+
var managerContinuationAllowed = required
|
|
1241
|
+
? commitFirstProtocolSatisfied === true && validation.valid === true && releaseGatePassed === true
|
|
1242
|
+
: true;
|
|
1243
|
+
var status = 'not_required';
|
|
1244
|
+
if (required && liveHotfixBlockedUntilCommit) {
|
|
1245
|
+
status = 'waiting_for_commit_proof';
|
|
1246
|
+
}
|
|
1247
|
+
else if (required && validation.valid && releaseGatePassed) {
|
|
1248
|
+
status = 'ready_for_continuation';
|
|
1249
|
+
}
|
|
1250
|
+
else if (required && validation.valid) {
|
|
1251
|
+
status = 'ready_for_release_gate';
|
|
1252
|
+
}
|
|
1253
|
+
else if (required) {
|
|
1254
|
+
status = 'ready_for_live_hotfix';
|
|
1255
|
+
}
|
|
1256
|
+
var phaseOrder = Array.from(new Set(cleanList(existing.phaseOrder || existing.phase_order, 12, 200).concat([
|
|
1257
|
+
'prepare_hotfix_patch_without_live_apply',
|
|
1258
|
+
'commit_and_push_hotfix_to_github',
|
|
1259
|
+
'record_hotfix_evidence',
|
|
1260
|
+
'apply_backend_hotfix_only_after_commit_proof',
|
|
1261
|
+
'run_runner_manager_self_test',
|
|
1262
|
+
'rerun_smallest_release_gate'
|
|
1263
|
+
]))).slice(0, 12);
|
|
1264
|
+
var requiredFields = Array.from(new Set(cleanList(existing.requiredFields || existing.required_fields, 20, 200).concat([
|
|
1265
|
+
'sourceCommitSha',
|
|
1266
|
+
'githubCommitUrl',
|
|
1267
|
+
'gitCommitStatus=passed',
|
|
1268
|
+
'gitPushStatus=passed',
|
|
1269
|
+
'hotfixPatchDiff',
|
|
1270
|
+
'restartOrChecksumEvidence',
|
|
1271
|
+
'releaseGateResult'
|
|
1272
|
+
]))).slice(0, 20);
|
|
1273
|
+
var requiredEvidence = Array.from(new Set(cleanList(existing.requiredEvidence || existing.required_evidence, 24, 300).concat(requiredFields, validation.requiredEvidence || []))).slice(0, 24);
|
|
1274
|
+
var successCriteria = Array.from(new Set(cleanList(existing.successCriteria || existing.success_criteria, 14, 300).concat([
|
|
1275
|
+
'Hotfix patch exists without live apply side effects.',
|
|
1276
|
+
'GitHub commit and push proof are recorded before live hotfix.',
|
|
1277
|
+
'Backend restart/checksum evidence and runner-manager self-test pass.',
|
|
1278
|
+
'Only the smallest relevant release gate is rerun after hotfix evidence.'
|
|
1279
|
+
]))).slice(0, 14);
|
|
1280
|
+
var forbiddenActions = Array.from(new Set(cleanList(existing.forbiddenActions || existing.forbidden_actions, 14, 500).concat([
|
|
1281
|
+
'Do not apply or restart a live backend before sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus are recorded.',
|
|
1282
|
+
'Do not run a full server deploy as a substitute for a targeted backend hotfix.',
|
|
1283
|
+
'Do not continue the ticket from route-only or release-status-only evidence.'
|
|
1284
|
+
]))).slice(0, 14);
|
|
1285
|
+
var now = cleanDateString(input.now || new Date());
|
|
1286
|
+
var createdAt = cleanDateString(existing.createdAt || existing.created_at || now);
|
|
1287
|
+
var reason = cleanText(input.reason || existing.reason || (continuation === null || continuation === void 0 ? void 0 : continuation.reason) || validation.blockers.join('; '), 1000);
|
|
1288
|
+
var contractId = cleanText(existing.contractId || existing.contract_id, 160)
|
|
1289
|
+
|| "hotfix-durability-".concat(fingerprintResolveIOAIManagerBlocker([
|
|
1290
|
+
action,
|
|
1291
|
+
reason,
|
|
1292
|
+
phaseOrder.join('|'),
|
|
1293
|
+
createdAt.slice(0, 16)
|
|
1294
|
+
].join('\n')).slice(0, 16));
|
|
1295
|
+
var nextSafeAction = !required
|
|
1296
|
+
? 'continue'
|
|
1297
|
+
: liveHotfixBlockedUntilCommit
|
|
1298
|
+
? 'commit_and_push_hotfix_to_github'
|
|
1299
|
+
: validation.valid
|
|
1300
|
+
? (releaseGatePassed ? 'continue_current_runner' : 'rerun_smallest_release_gate')
|
|
1301
|
+
: 'apply_backend_hotfix_only_after_commit_proof';
|
|
1302
|
+
var hotfixCommitGuard = {
|
|
1303
|
+
required: required,
|
|
1304
|
+
blocks_live_hotfix: liveHotfixBlockedUntilCommit,
|
|
1305
|
+
passed: commitProofPassed,
|
|
1306
|
+
status: commitProofPassed ? 'passed' : 'missing',
|
|
1307
|
+
sourceCommitSha: sourceCommitSha,
|
|
1308
|
+
githubCommitUrl: githubCommitUrl,
|
|
1309
|
+
gitCommitStatus: gitCommitStatus,
|
|
1310
|
+
gitPushStatus: gitPushStatus,
|
|
1311
|
+
missingFields: missingCommitProofFields,
|
|
1312
|
+
required_fields: ['sourceCommitSha', 'githubCommitUrl', 'gitCommitStatus=passed', 'gitPushStatus=passed'],
|
|
1313
|
+
next_action: liveHotfixBlockedUntilCommit ? 'commit_and_push_hotfix_to_github' : 'record_hotfix_evidence'
|
|
1314
|
+
};
|
|
1315
|
+
var contract = {
|
|
1316
|
+
contractId: contractId,
|
|
1317
|
+
contract_id: contractId,
|
|
1318
|
+
createdAt: createdAt,
|
|
1319
|
+
created_at: createdAt,
|
|
1320
|
+
updatedAt: now,
|
|
1321
|
+
updated_at: now,
|
|
1322
|
+
source: cleanText(input.source || existing.source || 'ai_manager_hotfix_durability', 160),
|
|
1323
|
+
required: required,
|
|
1324
|
+
action: action,
|
|
1325
|
+
status: status,
|
|
1326
|
+
reason: reason,
|
|
1327
|
+
canPrepareHotfixPatch: canPrepareHotfixPatch,
|
|
1328
|
+
can_prepare_hotfix_patch: canPrepareHotfixPatch,
|
|
1329
|
+
canHotfixBackend: canHotfixBackend,
|
|
1330
|
+
can_hotfix_backend: canHotfixBackend,
|
|
1331
|
+
liveHotfixBlockedUntilCommit: liveHotfixBlockedUntilCommit,
|
|
1332
|
+
live_hotfix_blocked_until_commit: liveHotfixBlockedUntilCommit,
|
|
1333
|
+
durabilityProtocol: durabilityProtocol,
|
|
1334
|
+
durability_protocol: durabilityProtocol,
|
|
1335
|
+
commitFirstProtocolRequired: commitFirstProtocolRequired,
|
|
1336
|
+
commit_first_protocol_required: commitFirstProtocolRequired,
|
|
1337
|
+
commitFirstProtocolSatisfied: commitFirstProtocolSatisfied,
|
|
1338
|
+
commit_first_protocol_satisfied: commitFirstProtocolSatisfied,
|
|
1339
|
+
liveHotfixAllowed: liveHotfixAllowed,
|
|
1340
|
+
live_hotfix_allowed: liveHotfixAllowed,
|
|
1341
|
+
managerContinuationAllowed: managerContinuationAllowed,
|
|
1342
|
+
manager_continuation_allowed: managerContinuationAllowed,
|
|
1343
|
+
commitProofPassed: commitProofPassed,
|
|
1344
|
+
commit_proof_passed: commitProofPassed,
|
|
1345
|
+
commitProofStatus: commitProofPassed ? 'passed' : 'missing',
|
|
1346
|
+
commit_proof_status: commitProofPassed ? 'passed' : 'missing',
|
|
1347
|
+
sourceCommitSha: sourceCommitSha,
|
|
1348
|
+
source_commit_sha: sourceCommitSha,
|
|
1349
|
+
githubCommitUrl: githubCommitUrl,
|
|
1350
|
+
github_commit_url: githubCommitUrl,
|
|
1351
|
+
gitCommitStatus: gitCommitStatus,
|
|
1352
|
+
git_commit_status: gitCommitStatus,
|
|
1353
|
+
gitPushStatus: gitPushStatus,
|
|
1354
|
+
git_push_status: gitPushStatus,
|
|
1355
|
+
missingCommitProofFields: missingCommitProofFields,
|
|
1356
|
+
missing_commit_proof_fields: missingCommitProofFields,
|
|
1357
|
+
nextSafeAction: nextSafeAction,
|
|
1358
|
+
next_safe_action: nextSafeAction,
|
|
1359
|
+
phaseOrder: phaseOrder,
|
|
1360
|
+
phase_order: phaseOrder,
|
|
1361
|
+
requiredFields: requiredFields,
|
|
1362
|
+
required_fields: requiredFields,
|
|
1363
|
+
requiredEvidence: requiredEvidence,
|
|
1364
|
+
required_evidence: requiredEvidence,
|
|
1365
|
+
successCriteria: successCriteria,
|
|
1366
|
+
success_criteria: successCriteria,
|
|
1367
|
+
forbiddenActions: forbiddenActions,
|
|
1368
|
+
forbidden_actions: forbiddenActions,
|
|
1369
|
+
hotfixCommitGuard: hotfixCommitGuard,
|
|
1370
|
+
hotfix_commit_guard: hotfixCommitGuard,
|
|
1371
|
+
githubCommitGuard: __assign(__assign({}, githubCommitGuard), { required: required, passed: commitProofPassed, status: commitProofPassed ? 'passed' : (required ? 'missing' : githubCommitGuard.status), managerMustCommitBeforeHotfix: liveHotfixBlockedUntilCommit, sourceCommitSha: sourceCommitSha, githubCommitUrl: githubCommitUrl, gitCommitStatus: gitCommitStatus, gitPushStatus: gitPushStatus }),
|
|
1372
|
+
github_commit_guard: __assign(__assign({}, githubCommitGuard), { required: required, passed: commitProofPassed, status: commitProofPassed ? 'passed' : (required ? 'missing' : githubCommitGuard.status), managerMustCommitBeforeHotfix: liveHotfixBlockedUntilCommit, sourceCommitSha: sourceCommitSha, githubCommitUrl: githubCommitUrl, gitCommitStatus: gitCommitStatus, gitPushStatus: gitPushStatus }),
|
|
1373
|
+
validation: validation,
|
|
1374
|
+
continuation: continuation,
|
|
1375
|
+
extraRequest: '',
|
|
1376
|
+
extra_request: ''
|
|
1377
|
+
};
|
|
1378
|
+
contract.extraRequest = hotfixDurabilityExtraRequest(contract);
|
|
1379
|
+
contract.extra_request = contract.extraRequest;
|
|
1380
|
+
return contract;
|
|
1381
|
+
}
|
|
1382
|
+
function decideResolveIOAIManagerHotfixContinuation(input) {
|
|
1383
|
+
var e_7, _a;
|
|
1384
|
+
var _b, _c;
|
|
1385
|
+
if (input === void 0) { input = {}; }
|
|
1386
|
+
var validation = validateResolveIOAIManagerHotfixEvidence(input.evidence, { policy: input.policy });
|
|
1387
|
+
var failureClass = cleanText(input.failureClass, 120) || 'release';
|
|
1388
|
+
var blockerText = cleanText(input.blocker || validation.blockers.join('; ') || ((_b = validation.normalized) === null || _b === void 0 ? void 0 : _b.hotfixCannotResolveReason), 1000);
|
|
1389
|
+
var blockerFingerprint = fingerprintResolveIOAIManagerBlocker(blockerText || "".concat(validation.channel, ":").concat(validation.status, ":").concat(validation.nextAction));
|
|
1390
|
+
var baseBlockers = __spreadArray([], __read(validation.blockers), false);
|
|
1391
|
+
var githubCommitGuard = validation.githubCommitGuard || evaluateResolveIOAIManagerHotfixGitProof(input.evidence, validation.channel);
|
|
1392
|
+
var needsGithubCommitProof = githubCommitGuard.managerMustCommitBeforeHotfix
|
|
1393
|
+
|| validation.blockers.some(function (blocker) { return /sourceCommitSha|githubCommitUrl|gitPushStatus|gitCommitStatus|GitHub commit|pushed/i.test(blocker); });
|
|
1394
|
+
var repeatedFailure = input.repeatedFailure === true;
|
|
1395
|
+
var releaseGatePassed = input.releaseGatePassed === true
|
|
1396
|
+
|| hotfixStatusPassed((_c = validation.normalized) === null || _c === void 0 ? void 0 : _c.releaseGateStatus);
|
|
1397
|
+
var action = validation.nextAction;
|
|
1398
|
+
var canContinueRun = false;
|
|
1399
|
+
var canRunFullDeploy = validation.fullDeployAllowed;
|
|
1400
|
+
var shouldRerunReleaseGate = false;
|
|
1401
|
+
var shouldPark = false;
|
|
1402
|
+
var reason = '';
|
|
1403
|
+
var nextCommands = [];
|
|
1404
|
+
if (githubCommitGuard.managerMustCommitBeforeHotfix) {
|
|
1405
|
+
action = 'record_hotfix_evidence';
|
|
1406
|
+
reason = githubCommitGuard.blockers.length
|
|
1407
|
+
? "Manager hotfix cannot continue until the hotfix is committed and pushed: ".concat(githubCommitGuard.blockers.join('; '))
|
|
1408
|
+
: 'Manager hotfix cannot continue until sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus prove the hotfix is committed and pushed to GitHub.';
|
|
1409
|
+
nextCommands.push.apply(nextCommands, __spreadArray(__spreadArray([], __read(githubCommitGuard.nextCommands), false), ['rerun_hotfix_evidence_validator'], false));
|
|
1410
|
+
try {
|
|
1411
|
+
for (var _d = __values(githubCommitGuard.blockers), _e = _d.next(); !_e.done; _e = _d.next()) {
|
|
1412
|
+
var blocker = _e.value;
|
|
1413
|
+
if (!baseBlockers.includes(blocker)) {
|
|
1414
|
+
baseBlockers.push(blocker);
|
|
1415
|
+
}
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1418
|
+
catch (e_7_1) { e_7 = { error: e_7_1 }; }
|
|
1419
|
+
finally {
|
|
1420
|
+
try {
|
|
1421
|
+
if (_e && !_e.done && (_a = _d.return)) _a.call(_d);
|
|
1422
|
+
}
|
|
1423
|
+
finally { if (e_7) throw e_7.error; }
|
|
1424
|
+
}
|
|
1425
|
+
}
|
|
1426
|
+
else if (!validation.valid || validation.status === 'missing' || validation.status === 'incomplete') {
|
|
1427
|
+
action = validation.nextAction === 'request_force_deploy_reason'
|
|
1428
|
+
? 'request_force_deploy_reason'
|
|
1429
|
+
: 'record_hotfix_evidence';
|
|
1430
|
+
reason = validation.blockers.length
|
|
1431
|
+
? "Hotfix evidence is not complete: ".concat(validation.blockers.join('; '))
|
|
1432
|
+
: 'Hotfix evidence is missing; record the hotfix target, checksum, restart, health, and self-test proof before continuing.';
|
|
1433
|
+
if (needsGithubCommitProof) {
|
|
1434
|
+
nextCommands.push('commit_and_push_hotfix_to_github', 'verify_github_commit_url_and_push_status');
|
|
1435
|
+
}
|
|
1436
|
+
nextCommands.push('record_hotfix_evidence', 'rerun_hotfix_evidence_validator');
|
|
1437
|
+
}
|
|
1438
|
+
else if (validation.fullDeployAllowed) {
|
|
1439
|
+
action = 'allow_one_full_deploy';
|
|
1440
|
+
canRunFullDeploy = true;
|
|
1441
|
+
reason = 'Hotfix evidence proves the duplicate release cannot be resolved by a hotfix, or a new artifact was verified, so exactly one full deploy can proceed.';
|
|
1442
|
+
nextCommands.push('run_release_gate_once', 'execute_one_full_deploy_with_force_evidence', 'record_deploy_result');
|
|
1443
|
+
}
|
|
1444
|
+
else if (repeatedFailure) {
|
|
1445
|
+
action = 'park_manual';
|
|
1446
|
+
shouldPark = true;
|
|
1447
|
+
reason = 'The same release failure repeated after valid hotfix evidence; park for manual review instead of looping or redeploying blindly.';
|
|
1448
|
+
nextCommands.push('park_manual_with_hotfix_evidence', 'attach_release_gate_logs');
|
|
1449
|
+
}
|
|
1450
|
+
else if (validation.hotfixSatisfied && releaseGatePassed) {
|
|
1451
|
+
action = 'continue_runner';
|
|
1452
|
+
canContinueRun = true;
|
|
1453
|
+
reason = 'Hotfix evidence and the release gate both passed; continue the current runner without a full deploy.';
|
|
1454
|
+
nextCommands.push('continue_current_runner', 'record_hotfix_continuation');
|
|
1455
|
+
}
|
|
1456
|
+
else if (validation.hotfixSatisfied) {
|
|
1457
|
+
action = 'rerun_release_gate';
|
|
1458
|
+
shouldRerunReleaseGate = true;
|
|
1459
|
+
reason = 'Hotfix evidence passed; rerun the smallest release gate before continuing the runner.';
|
|
1460
|
+
nextCommands.push('rerun_release_gate_once', 'record_release_gate_status');
|
|
1461
|
+
}
|
|
1462
|
+
else {
|
|
1463
|
+
action = 'park_manual';
|
|
1464
|
+
shouldPark = true;
|
|
1465
|
+
reason = 'Hotfix evidence reached an unsupported state; park instead of starting another broad deploy or model loop.';
|
|
1466
|
+
baseBlockers.push('Unsupported hotfix continuation state.');
|
|
1467
|
+
nextCommands.push('park_manual_with_hotfix_evidence');
|
|
1468
|
+
}
|
|
1469
|
+
return {
|
|
1470
|
+
action: action,
|
|
1471
|
+
canContinueRun: canContinueRun,
|
|
1472
|
+
canRunFullDeploy: canRunFullDeploy,
|
|
1473
|
+
shouldRerunReleaseGate: shouldRerunReleaseGate,
|
|
1474
|
+
shouldPark: shouldPark,
|
|
1475
|
+
reason: reason,
|
|
1476
|
+
blockers: baseBlockers,
|
|
1477
|
+
warnings: validation.warnings,
|
|
1478
|
+
requiredEvidence: validation.requiredEvidence,
|
|
1479
|
+
successEvidence: validation.successEvidence,
|
|
1480
|
+
nextCommands: Array.from(new Set(nextCommands)),
|
|
1481
|
+
failureClass: failureClass,
|
|
1482
|
+
blockerFingerprint: blockerFingerprint,
|
|
1483
|
+
githubCommitGuard: githubCommitGuard,
|
|
1484
|
+
validation: validation,
|
|
1485
|
+
recordedAt: isoNow(input.now)
|
|
1486
|
+
};
|
|
1487
|
+
}
|
|
1488
|
+
function decideResolveIOAIManagerHotfixCommitGuard(input) {
|
|
1489
|
+
if (input === void 0) { input = {}; }
|
|
1490
|
+
var normalized = normalizeResolveIOAIManagerHotfixEvidence(input.evidence, input.policy);
|
|
1491
|
+
var validation = validateResolveIOAIManagerHotfixEvidence(input.evidence, { policy: input.policy });
|
|
1492
|
+
var githubCommitGuard = validation.githubCommitGuard || evaluateResolveIOAIManagerHotfixGitProof(input.evidence, validation.channel);
|
|
1493
|
+
var active = !!normalized || githubCommitGuard.required === true;
|
|
1494
|
+
var hotfixCommitBlockers = validation.blockers.filter(function (blocker) { return /sourceCommitSha|githubCommitUrl|gitPushStatus|gitCommitStatus|GitHub commit|pushed/i.test(blocker); });
|
|
1495
|
+
var blockers = Array.from(new Set(__spreadArray(__spreadArray([], __read((githubCommitGuard.blockers || [])), false), __read(hotfixCommitBlockers), false)));
|
|
1496
|
+
var blocked = active && (githubCommitGuard.managerMustCommitBeforeHotfix === true
|
|
1497
|
+
|| (githubCommitGuard.required === true && githubCommitGuard.passed !== true)
|
|
1498
|
+
|| hotfixCommitBlockers.length > 0);
|
|
1499
|
+
var nextCommands = blocked
|
|
1500
|
+
? Array.from(new Set(__spreadArray(__spreadArray([], __read((githubCommitGuard.nextCommands || [])), false), [
|
|
1501
|
+
'commit_and_push_hotfix_to_github',
|
|
1502
|
+
'verify_github_commit_url_and_push_status',
|
|
1503
|
+
'record_hotfix_evidence'
|
|
1504
|
+
], false)))
|
|
1505
|
+
: [];
|
|
1506
|
+
return {
|
|
1507
|
+
active: active,
|
|
1508
|
+
blocked: blocked,
|
|
1509
|
+
reason: blocked
|
|
1510
|
+
? (blockers.length
|
|
1511
|
+
? "Hotfix continuation is blocked until GitHub commit proof is recorded: ".concat(blockers.join('; '))
|
|
1512
|
+
: 'Hotfix continuation is blocked until sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus prove the hotfix is committed and pushed to GitHub.')
|
|
1513
|
+
: (active ? 'Hotfix GitHub commit proof is recorded.' : 'No hotfix commit guard is active.'),
|
|
1514
|
+
nextAction: blocked ? 'record_hotfix_evidence' : 'continue',
|
|
1515
|
+
channel: validation.channel || githubCommitGuard.channel || '',
|
|
1516
|
+
blockers: blockers,
|
|
1517
|
+
nextCommands: nextCommands,
|
|
1518
|
+
requiredEvidence: githubCommitGuard.requiredEvidence,
|
|
1519
|
+
githubCommitGuard: githubCommitGuard,
|
|
1520
|
+
validation: validation
|
|
1521
|
+
};
|
|
1522
|
+
}
|
|
1523
|
+
function releaseStatusIsBlocked(value) {
|
|
1524
|
+
return /fail|error|blocked|missing|empty|not ready|not_ready|denied|invalid|timeout|stale/i.test(value);
|
|
1525
|
+
}
|
|
1526
|
+
function releaseStatusIsTerminalDeploy(value) {
|
|
1527
|
+
return /requested|queued|in.?progress|completed|complete|success|succeeded|pass|passed|published|deployed|failed|error|blocked/i.test(value);
|
|
1528
|
+
}
|
|
1529
|
+
function buildReleaseAllowedActions(action) {
|
|
1530
|
+
if (action === 'wait_for_active_deploy') {
|
|
1531
|
+
return ['wait_for_current_deploy_result', 'collect_current_deploy_log', 'refresh_release_snapshot'];
|
|
1532
|
+
}
|
|
1533
|
+
if (action === 'block_duplicate_deploy') {
|
|
1534
|
+
return ['collect_existing_deploy_evidence', 'hotfix_release_artifact', 'request_force_deploy_with_reason'];
|
|
1535
|
+
}
|
|
1536
|
+
if (action === 'block_duplicate_publish') {
|
|
1537
|
+
return ['collect_existing_publish_evidence', 'hotfix_release_artifact', 'request_force_publish_with_reason'];
|
|
1538
|
+
}
|
|
1539
|
+
if (action === 'review_force_deploy') {
|
|
1540
|
+
return ['verify_force_deploy_reason', 'rerun_failed_release_gate_once', 'record_force_deploy_evidence'];
|
|
1541
|
+
}
|
|
1542
|
+
if (action === 'deploy_new_artifact_after_release_gate') {
|
|
1543
|
+
return ['verify_new_artifact_fingerprint', 'run_release_gate_once', 'record_publish_deploy_evidence'];
|
|
1544
|
+
}
|
|
1545
|
+
if (action === 'build_artifact_first') {
|
|
1546
|
+
return ['build_missing_release_artifact', 'record_artifact_fingerprint', 'run_release_gate_once'];
|
|
1547
|
+
}
|
|
1548
|
+
return ['hotfix_live_runner_or_release_artifact', 'rerun_failed_release_gate_only', 'record_release_evidence'];
|
|
1549
|
+
}
|
|
1550
|
+
function hotfixStep(id, label, channel, options) {
|
|
1551
|
+
if (options === void 0) { options = {}; }
|
|
1552
|
+
return {
|
|
1553
|
+
id: id,
|
|
1554
|
+
label: label,
|
|
1555
|
+
channel: channel,
|
|
1556
|
+
safeToAutoRun: options.safeToAutoRun === true,
|
|
1557
|
+
requiresFullDeploy: options.requiresFullDeploy === true,
|
|
1558
|
+
requiredEvidence: options.requiredEvidence || [],
|
|
1559
|
+
successEvidence: options.successEvidence || [],
|
|
1560
|
+
blockedBy: options.blockedBy || []
|
|
1561
|
+
};
|
|
1562
|
+
}
|
|
1563
|
+
function buildHotfixFirstReleasePlan(input) {
|
|
1564
|
+
var surface = cleanText(input.surface || 'runner', 80)
|
|
1565
|
+
.toLowerCase()
|
|
1566
|
+
.replace(/[^a-z0-9]+/g, '_')
|
|
1567
|
+
.replace(/^_+|_+$/g, '') || 'runner';
|
|
1568
|
+
var commonAcceptance = [
|
|
1569
|
+
'failed release gate is rerun once and passes',
|
|
1570
|
+
'artifact fingerprint or hotfix evidence is recorded',
|
|
1571
|
+
'operator console shows no active duplicate deploy blocker'
|
|
1572
|
+
];
|
|
1573
|
+
if (input.action === 'wait_for_active_deploy') {
|
|
1574
|
+
return {
|
|
1575
|
+
planId: "".concat(surface, ":wait_for_active_deploy"),
|
|
1576
|
+
label: 'Wait For Active Deploy',
|
|
1577
|
+
recommendedChannel: 'release_artifact',
|
|
1578
|
+
reason: input.reason,
|
|
1579
|
+
fullDeployAvoided: true,
|
|
1580
|
+
steps: [
|
|
1581
|
+
hotfixStep('collect_active_deploy_log', 'Collect active deploy log', 'release_artifact', {
|
|
1582
|
+
safeToAutoRun: true,
|
|
1583
|
+
requiredEvidence: ['active deploy id or release operation id'],
|
|
1584
|
+
successEvidence: ['terminal deploy status and release log captured']
|
|
1585
|
+
})
|
|
1586
|
+
],
|
|
1587
|
+
acceptanceEvidence: commonAcceptance,
|
|
1588
|
+
escalationTriggers: ['active deploy exceeds timeout', 'active deploy fails without a release log']
|
|
1589
|
+
};
|
|
1590
|
+
}
|
|
1591
|
+
if (input.action === 'deploy_new_artifact_after_release_gate') {
|
|
1592
|
+
return {
|
|
1593
|
+
planId: "".concat(surface, ":deploy_new_artifact_after_release_gate"),
|
|
1594
|
+
label: 'Deploy New Artifact After Release Gate',
|
|
1595
|
+
recommendedChannel: 'new_artifact_deploy',
|
|
1596
|
+
reason: input.reason,
|
|
1597
|
+
fullDeployAvoided: false,
|
|
1598
|
+
steps: [
|
|
1599
|
+
hotfixStep('verify_new_artifact_fingerprint', 'Verify new artifact fingerprint', 'new_artifact_deploy', {
|
|
1600
|
+
safeToAutoRun: true,
|
|
1601
|
+
requiresFullDeploy: true,
|
|
1602
|
+
requiredEvidence: ['current artifact fingerprint differs from last deployed fingerprint'],
|
|
1603
|
+
successEvidence: ['release gate permits one full deploy']
|
|
1604
|
+
})
|
|
1605
|
+
],
|
|
1606
|
+
acceptanceEvidence: [
|
|
1607
|
+
'new artifact fingerprint recorded',
|
|
1608
|
+
'release gate passed before full deploy',
|
|
1609
|
+
'deploy/publish result recorded'
|
|
1610
|
+
],
|
|
1611
|
+
escalationTriggers: ['artifact fingerprint matches last deploy', 'release gate fails']
|
|
1612
|
+
};
|
|
1613
|
+
}
|
|
1614
|
+
if (input.action === 'build_artifact_first') {
|
|
1615
|
+
return {
|
|
1616
|
+
planId: "".concat(surface, ":build_artifact_first"),
|
|
1617
|
+
label: 'Build Artifact First',
|
|
1618
|
+
recommendedChannel: 'artifact_build',
|
|
1619
|
+
reason: input.reason,
|
|
1620
|
+
fullDeployAvoided: true,
|
|
1621
|
+
steps: [
|
|
1622
|
+
hotfixStep('build_once_record_fingerprint', 'Build once and record fingerprint', 'artifact_build', {
|
|
1623
|
+
safeToAutoRun: false,
|
|
1624
|
+
requiredEvidence: ['missing artifact fingerprint', 'release gate reason for building'],
|
|
1625
|
+
successEvidence: ['artifact fingerprint recorded before any deploy']
|
|
1626
|
+
})
|
|
1627
|
+
],
|
|
1628
|
+
acceptanceEvidence: ['artifact fingerprint exists', 'no deploy queued before release gate'],
|
|
1629
|
+
escalationTriggers: ['build repeats without a new fingerprint', 'build failure lacks compile log']
|
|
1630
|
+
};
|
|
1631
|
+
}
|
|
1632
|
+
if (input.action === 'review_force_deploy') {
|
|
1633
|
+
return {
|
|
1634
|
+
planId: "".concat(surface, ":review_force_deploy"),
|
|
1635
|
+
label: 'Review Force Deploy',
|
|
1636
|
+
recommendedChannel: 'force_deploy_review',
|
|
1637
|
+
reason: input.reason,
|
|
1638
|
+
fullDeployAvoided: false,
|
|
1639
|
+
steps: [
|
|
1640
|
+
hotfixStep('verify_force_deploy_reason', 'Verify force deploy reason', 'force_deploy_review', {
|
|
1641
|
+
requiredEvidence: ['explicit force_deploy reason', 'why hotfix cannot resolve the release blocker'],
|
|
1642
|
+
successEvidence: ['one allowed deploy attempt is recorded with reason']
|
|
1643
|
+
})
|
|
1644
|
+
],
|
|
1645
|
+
acceptanceEvidence: ['force deploy evidence recorded', 'duplicate fingerprint exception is auditable'],
|
|
1646
|
+
escalationTriggers: ['force deploy reason is empty', 'same force deploy fails twice']
|
|
1647
|
+
};
|
|
1648
|
+
}
|
|
1649
|
+
return {
|
|
1650
|
+
planId: "".concat(surface, ":").concat(input.action),
|
|
1651
|
+
label: input.action === 'block_duplicate_deploy'
|
|
1652
|
+
? 'Hotfix Or Force Deploy'
|
|
1653
|
+
: input.action === 'block_duplicate_publish'
|
|
1654
|
+
? 'Hotfix Or Force Publish'
|
|
1655
|
+
: 'Hotfix Release Artifact',
|
|
1656
|
+
recommendedChannel: input.action === 'block_duplicate_publish'
|
|
1657
|
+
? 'release_artifact'
|
|
1658
|
+
: input.releaseBlocked ? 'release_artifact' : 'static_ui',
|
|
1659
|
+
reason: input.reason,
|
|
1660
|
+
fullDeployAvoided: true,
|
|
1661
|
+
steps: [
|
|
1662
|
+
hotfixStep('static_ui_hotfix', 'Static UI hotfix', 'static_ui', {
|
|
1663
|
+
safeToAutoRun: true,
|
|
1664
|
+
requiredEvidence: ['sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus', 'built dist path', 'target S3 bucket and CloudFront distribution', 'changed frontend bundle or asset list'],
|
|
1665
|
+
successEvidence: ['GitHub commit and push proof', 'S3 upload result', 'CloudFront invalidation id', 'public bundle contains expected hotfix marker']
|
|
1666
|
+
}),
|
|
1667
|
+
hotfixStep('backend_js_hotfix', 'Backend JS hotfix', 'backend_js', {
|
|
1668
|
+
requiredEvidence: ['sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus', 'compiled JS artifact path', 'target backend host', 'diff limited to runner/operator code'],
|
|
1669
|
+
successEvidence: ['GitHub commit and push proof', 'remote file checksum', 'service restart or process reload evidence', 'self-test passes']
|
|
1670
|
+
}),
|
|
1671
|
+
hotfixStep('config_seed_cache_restart', 'Config, seed, cache, or restart repair', 'config', {
|
|
1672
|
+
safeToAutoRun: true,
|
|
1673
|
+
requiredEvidence: ['sourceCommitSha, githubCommitUrl, passed gitCommitStatus, and passed gitPushStatus', 'exact config/seed/cache key or process name', 'why no product artifact changed'],
|
|
1674
|
+
successEvidence: ['GitHub commit and push proof', 'release gate rerun result', 'operator console release snapshot refreshed']
|
|
1675
|
+
})
|
|
1676
|
+
],
|
|
1677
|
+
acceptanceEvidence: commonAcceptance,
|
|
1678
|
+
escalationTriggers: [
|
|
1679
|
+
'hotfix changes customer-facing product code outside the release artifact',
|
|
1680
|
+
'same release gate fails twice after hotfix evidence',
|
|
1681
|
+
'same publish fingerprint is retried without force_publish evidence',
|
|
1682
|
+
'force deploy is requested without a reason'
|
|
1683
|
+
]
|
|
1684
|
+
};
|
|
1685
|
+
}
|
|
1686
|
+
function buildResolveIOAIManagerHotfixFirstReleasePolicy(input) {
|
|
1687
|
+
if (input === void 0) { input = {}; }
|
|
1688
|
+
var surface = cleanText(input.surface || 'runner', 120);
|
|
1689
|
+
var deployStatus = cleanText(input.deployStatus, 160);
|
|
1690
|
+
var publishStatus = cleanText(input.publishStatus, 160);
|
|
1691
|
+
var sampleDataStatus = cleanText(input.sampleDataStatus, 160);
|
|
1692
|
+
var deployFingerprint = cleanText(input.deployFingerprint, 240);
|
|
1693
|
+
var lastDeployFingerprint = cleanText(input.lastDeployFingerprint, 240);
|
|
1694
|
+
var publishFingerprint = cleanText(input.publishFingerprint, 240);
|
|
1695
|
+
var lastPublishFingerprint = cleanText(input.lastPublishFingerprint, 240);
|
|
1696
|
+
var fingerprintMatchesLast = !!deployFingerprint && !!lastDeployFingerprint && deployFingerprint === lastDeployFingerprint;
|
|
1697
|
+
var publishFingerprintMatchesLast = !!publishFingerprint && !!lastPublishFingerprint && publishFingerprint === lastPublishFingerprint;
|
|
1698
|
+
var releaseBlocked = [deployStatus, publishStatus, sampleDataStatus].some(releaseStatusIsBlocked);
|
|
1699
|
+
var duplicateDeployBlocked = fingerprintMatchesLast
|
|
1700
|
+
&& input.forceDeploy !== true
|
|
1701
|
+
&& releaseStatusIsTerminalDeploy([deployStatus, publishStatus].filter(Boolean).join(' '));
|
|
1702
|
+
var duplicatePublishBlocked = publishFingerprintMatchesLast
|
|
1703
|
+
&& input.forcePublish !== true
|
|
1704
|
+
&& releaseStatusIsBlocked(publishStatus)
|
|
1705
|
+
&& releaseStatusIsTerminalDeploy(publishStatus);
|
|
1706
|
+
var recommendedAction = 'hotfix_release_artifact';
|
|
1707
|
+
var label = 'Hotfix Release Artifact';
|
|
1708
|
+
var reason = 'Repair the live runner/operator code, release config, domain, seed-data, or release artifact and rerun only the failed release gate.';
|
|
1709
|
+
var fullDeployAllowed = false;
|
|
1710
|
+
if (input.activeDeploy === true) {
|
|
1711
|
+
recommendedAction = 'wait_for_active_deploy';
|
|
1712
|
+
label = 'Wait For Active Deploy';
|
|
1713
|
+
reason = 'A deploy is already queued or running; collect that result before spending another deploy cycle.';
|
|
1714
|
+
}
|
|
1715
|
+
else if (duplicateDeployBlocked) {
|
|
1716
|
+
recommendedAction = 'block_duplicate_deploy';
|
|
1717
|
+
label = 'Block Duplicate Deploy';
|
|
1718
|
+
reason = 'The same artifact fingerprint already has release status; hotfix or provide explicit force_deploy evidence before rerunning it.';
|
|
1719
|
+
}
|
|
1720
|
+
else if (duplicatePublishBlocked) {
|
|
1721
|
+
recommendedAction = 'block_duplicate_publish';
|
|
1722
|
+
label = 'Block Duplicate Publish';
|
|
1723
|
+
reason = 'The same publish fingerprint already has release status; hotfix the release artifact or provide explicit force_publish evidence before rerunning publish.';
|
|
1724
|
+
}
|
|
1725
|
+
else if ((fingerprintMatchesLast && input.forceDeploy === true) || (publishFingerprintMatchesLast && input.forcePublish === true)) {
|
|
1726
|
+
recommendedAction = 'review_force_deploy';
|
|
1727
|
+
label = 'Review Force Deploy';
|
|
1728
|
+
reason = input.forcePublish === true
|
|
1729
|
+
? 'force_publish was explicitly requested for a repeated publish artifact; require a reason and rerun only the failed release gate.'
|
|
1730
|
+
: 'force_deploy was explicitly requested for a repeated artifact; require a reason and rerun only the failed release gate.';
|
|
1731
|
+
fullDeployAllowed = true;
|
|
1732
|
+
}
|
|
1733
|
+
else if (input.hasNewArtifact === false && !releaseBlocked) {
|
|
1734
|
+
recommendedAction = 'build_artifact_first';
|
|
1735
|
+
label = 'Build Artifact First';
|
|
1736
|
+
reason = 'No release artifact fingerprint is available yet; build once, record the fingerprint, and avoid repeated deploys.';
|
|
1737
|
+
}
|
|
1738
|
+
else if (input.hasNewArtifact === true && !releaseBlocked) {
|
|
1739
|
+
recommendedAction = 'deploy_new_artifact_after_release_gate';
|
|
1740
|
+
label = 'Deploy New Artifact After Release Gate';
|
|
1741
|
+
reason = 'A new artifact can be deployed after the release gate proves the artifact is new and ready.';
|
|
1742
|
+
fullDeployAllowed = true;
|
|
1743
|
+
}
|
|
1744
|
+
var allowedActions = buildReleaseAllowedActions(recommendedAction);
|
|
1745
|
+
var hotfixPlan = buildHotfixFirstReleasePlan({
|
|
1746
|
+
action: recommendedAction,
|
|
1747
|
+
surface: surface,
|
|
1748
|
+
reason: reason,
|
|
1749
|
+
releaseBlocked: releaseBlocked
|
|
1750
|
+
});
|
|
1751
|
+
return {
|
|
1752
|
+
policy: 'hotfix_first',
|
|
1753
|
+
surface: surface,
|
|
1754
|
+
recommendedAction: recommendedAction,
|
|
1755
|
+
label: label,
|
|
1756
|
+
reason: reason,
|
|
1757
|
+
hotfixPreferred: recommendedAction !== 'deploy_new_artifact_after_release_gate' && recommendedAction !== 'review_force_deploy',
|
|
1758
|
+
fullDeployAllowed: fullDeployAllowed,
|
|
1759
|
+
duplicateDeployBlocked: duplicateDeployBlocked,
|
|
1760
|
+
duplicatePublishBlocked: duplicatePublishBlocked,
|
|
1761
|
+
forceDeployRequiredToRepeat: true,
|
|
1762
|
+
forcePublishRequiredToRepeat: true,
|
|
1763
|
+
statuses: {
|
|
1764
|
+
deploy: deployStatus,
|
|
1765
|
+
publish: publishStatus,
|
|
1766
|
+
sampleData: sampleDataStatus
|
|
1767
|
+
},
|
|
1768
|
+
fingerprints: {
|
|
1769
|
+
current: deployFingerprint,
|
|
1770
|
+
last: lastDeployFingerprint,
|
|
1771
|
+
matchesLast: fingerprintMatchesLast,
|
|
1772
|
+
publishCurrent: publishFingerprint,
|
|
1773
|
+
publishLast: lastPublishFingerprint,
|
|
1774
|
+
publishMatchesLast: publishFingerprintMatchesLast
|
|
1775
|
+
},
|
|
1776
|
+
hotfixPlan: hotfixPlan,
|
|
1777
|
+
allowedActions: allowedActions,
|
|
1778
|
+
forbiddenActions: [
|
|
1779
|
+
'rerun full builder loop for a release-only blocker',
|
|
1780
|
+
'queue duplicate deploy without force_deploy evidence',
|
|
1781
|
+
'queue duplicate publish without force_publish evidence',
|
|
1782
|
+
'publish/deploy again before reading the failed release log',
|
|
1783
|
+
'change core workflow after business proof passed unless release evidence proves it is required'
|
|
1784
|
+
],
|
|
1785
|
+
requiredEvidence: [
|
|
1786
|
+
'failed release gate log or active deploy result',
|
|
1787
|
+
'deploy artifact fingerprint comparison',
|
|
1788
|
+
'publish artifact fingerprint comparison when publish is the failed gate',
|
|
1789
|
+
'hotfix/config/seed/domain change evidence when no new product artifact is needed',
|
|
1790
|
+
'force_deploy or force_publish reason when repeating the same fingerprint'
|
|
1791
|
+
]
|
|
1792
|
+
};
|
|
1793
|
+
}
|
|
1794
|
+
function isResolveIOAIManagerSafeAutoDispatch(input) {
|
|
1795
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
1796
|
+
var normalizedInput = typeof input === 'string'
|
|
1797
|
+
? { dispatchAction: input }
|
|
1798
|
+
: (input || {});
|
|
1799
|
+
var dispatchAction = cleanText(normalizedInput.dispatchAction || ((_a = normalizedInput.directive) === null || _a === void 0 ? void 0 : _a.dispatchAction), 120);
|
|
1800
|
+
var directiveAllowed = (_b = normalizedInput.directive) === null || _b === void 0 ? void 0 : _b.allowed;
|
|
1801
|
+
var actionAutoRunnable = (_c = normalizedInput.action) === null || _c === void 0 ? void 0 : _c.autoRunnable;
|
|
1802
|
+
var productRepairAllowed = ((_d = normalizedInput.directive) === null || _d === void 0 ? void 0 : _d.canRunProductRepair) === true
|
|
1803
|
+
|| ((_e = normalizedInput.directive) === null || _e === void 0 ? void 0 : _e.productRepairAllowed) === true
|
|
1804
|
+
|| ((_f = normalizedInput.action) === null || _f === void 0 ? void 0 : _f.productRepairAllowed) === true;
|
|
1805
|
+
var expensiveModelAllowed = ((_g = normalizedInput.directive) === null || _g === void 0 ? void 0 : _g.canRunExpensiveModel) === true
|
|
1806
|
+
|| ((_h = normalizedInput.directive) === null || _h === void 0 ? void 0 : _h.expensiveModelAllowed) === true
|
|
1807
|
+
|| ((_j = normalizedInput.action) === null || _j === void 0 ? void 0 : _j.expensiveModelAllowed) === true;
|
|
1808
|
+
if (!dispatchAction || dispatchAction === 'park_manual') {
|
|
1809
|
+
return false;
|
|
1810
|
+
}
|
|
1811
|
+
if (directiveAllowed === false || actionAutoRunnable === false) {
|
|
1812
|
+
return false;
|
|
1813
|
+
}
|
|
1814
|
+
if ([
|
|
1815
|
+
'run_evidence_probe',
|
|
1816
|
+
'run_read_only_diagnosis',
|
|
1817
|
+
'run_infra_repair',
|
|
1818
|
+
'run_compile_repair'
|
|
1819
|
+
].includes(dispatchAction)) {
|
|
1820
|
+
return true;
|
|
1821
|
+
}
|
|
1822
|
+
if (dispatchAction === 'run_release_repair') {
|
|
1823
|
+
return normalizedInput.includeReleaseRepair !== false;
|
|
1824
|
+
}
|
|
1825
|
+
if (dispatchAction === 'run_journey_contract_repair') {
|
|
1826
|
+
return normalizedInput.includeJourneyContractRepair !== false && productRepairAllowed !== true;
|
|
1827
|
+
}
|
|
1828
|
+
if (dispatchAction === 'run_business_assertion_repair') {
|
|
1829
|
+
return normalizedInput.includeBusinessProofRepair === true
|
|
1830
|
+
&& productRepairAllowed !== true
|
|
1831
|
+
&& expensiveModelAllowed !== true;
|
|
1832
|
+
}
|
|
1833
|
+
if (dispatchAction === 'run_targeted_product_repair') {
|
|
1834
|
+
return normalizedInput.includeProductRepair === true
|
|
1835
|
+
&& productRepairAllowed === true
|
|
1836
|
+
&& expensiveModelAllowed !== true;
|
|
1837
|
+
}
|
|
1838
|
+
return dispatchAction === 'advance' || dispatchAction === 'continue_gate';
|
|
1839
|
+
}
|
|
1840
|
+
function isoNow(value) {
|
|
1841
|
+
if (value instanceof Date) {
|
|
1842
|
+
return value.toISOString();
|
|
1843
|
+
}
|
|
1844
|
+
var parsed = value ? new Date(value) : new Date();
|
|
1845
|
+
if (Number.isFinite(parsed.getTime())) {
|
|
1846
|
+
return parsed.toISOString();
|
|
1847
|
+
}
|
|
1848
|
+
return new Date().toISOString();
|
|
1849
|
+
}
|
|
1850
|
+
function stableHash(prefix, value) {
|
|
1851
|
+
var normalized = typeof value === 'string'
|
|
1852
|
+
? cleanText(value, 12000)
|
|
1853
|
+
: JSON.stringify(value || {});
|
|
1854
|
+
var hash = 0;
|
|
1855
|
+
for (var index = 0; index < normalized.length; index += 1) {
|
|
1856
|
+
hash = ((hash << 5) - hash + normalized.charCodeAt(index)) | 0;
|
|
1857
|
+
}
|
|
1858
|
+
return "".concat(prefix, "-").concat(Math.abs(hash).toString(36) || '0');
|
|
1859
|
+
}
|
|
1860
|
+
function normalizeResolveIOAIManagerFailureClass(value) {
|
|
1861
|
+
var normalized = cleanText(value, 80)
|
|
1862
|
+
.toLowerCase()
|
|
1863
|
+
.replace(/[\s-]+/g, '_');
|
|
1864
|
+
if (!normalized) {
|
|
1865
|
+
return 'unknown';
|
|
1866
|
+
}
|
|
1867
|
+
if (/^(qa_infra|infrastructure|harness|puppeteer|chrome|mongo|port|startup)$/.test(normalized)) {
|
|
1868
|
+
return 'infra';
|
|
1869
|
+
}
|
|
1870
|
+
if (/^(build|compile|typescript|tsc|angular_build|ng_build)$/.test(normalized)) {
|
|
1871
|
+
return 'compile';
|
|
1872
|
+
}
|
|
1873
|
+
if (/^(false_pass|route_only|missing_business_proof)$/.test(normalized)) {
|
|
1874
|
+
return 'business';
|
|
1875
|
+
}
|
|
1876
|
+
return normalized.slice(0, 80);
|
|
1877
|
+
}
|
|
1878
|
+
function fingerprintResolveIOAIManagerBlocker(value) {
|
|
1879
|
+
var normalized = cleanText(value, 4000)
|
|
1880
|
+
.toLowerCase()
|
|
1881
|
+
.replace(/[a-f0-9]{16,}/g, '<id>')
|
|
1882
|
+
.replace(/\b\d{2,}\b/g, '<n>')
|
|
1883
|
+
.replace(/\bline\s+<n>\b/g, 'line <n>')
|
|
1884
|
+
.replace(/https?:\/\/\S+/g, '<url>')
|
|
1885
|
+
.replace(/\s+/g, ' ')
|
|
1886
|
+
.trim();
|
|
1887
|
+
return stableHash('mgr-blocker', normalized);
|
|
1888
|
+
}
|
|
1889
|
+
function resolveResolveIOAIManagerBlockerFingerprint(record, fallback) {
|
|
1890
|
+
var blockerText = cleanText((record === null || record === void 0 ? void 0 : record.blocker) || (record === null || record === void 0 ? void 0 : record.summary), 4000);
|
|
1891
|
+
if (blockerText) {
|
|
1892
|
+
return fingerprintResolveIOAIManagerBlocker(blockerText);
|
|
1893
|
+
}
|
|
1894
|
+
var explicit = cleanText(record === null || record === void 0 ? void 0 : record.blockerFingerprint, 120);
|
|
1895
|
+
if (explicit) {
|
|
1896
|
+
return explicit;
|
|
1897
|
+
}
|
|
1898
|
+
return fingerprintResolveIOAIManagerBlocker(fallback || '');
|
|
1899
|
+
}
|
|
1900
|
+
function hashResolveIOAIManagerEvidence(record) {
|
|
1901
|
+
if (!record) {
|
|
1902
|
+
return stableHash('mgr-evidence', '');
|
|
1903
|
+
}
|
|
1904
|
+
var explicit = cleanText(record.evidenceHash, 120);
|
|
1905
|
+
if (explicit) {
|
|
1906
|
+
return explicit;
|
|
1907
|
+
}
|
|
1908
|
+
return stableHash('mgr-evidence', {
|
|
1909
|
+
failureClass: normalizeResolveIOAIManagerFailureClass(record.failureClass),
|
|
1910
|
+
blocker: cleanText(record.blocker || record.summary, 2000),
|
|
1911
|
+
changedFiles: cleanList(record.changedFiles, 80, 500).sort(),
|
|
1912
|
+
artifactPaths: cleanList(record.artifactPaths, 80, 500).sort()
|
|
1913
|
+
});
|
|
1914
|
+
}
|
|
1915
|
+
function buildResolveIOAIManagerRecoveryCheckpoint(input) {
|
|
1916
|
+
var plan = input.plan;
|
|
1917
|
+
var current = input.current || {};
|
|
1918
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, plan.objective);
|
|
1919
|
+
var evidenceHash = hashResolveIOAIManagerEvidence(current);
|
|
1920
|
+
var changedFiles = cleanList(current.changedFiles, 80, 500);
|
|
1921
|
+
var artifactPaths = cleanList(current.artifactPaths, 80, 500);
|
|
1922
|
+
var previous = input.previousCheckpoint;
|
|
1923
|
+
var sameCheckpointBase = previous
|
|
1924
|
+
&& previous.recoveryClass === plan.recoveryClass
|
|
1925
|
+
&& previous.lane === plan.lane
|
|
1926
|
+
&& previous.stepType === plan.stepType
|
|
1927
|
+
&& previous.blockerFingerprint === blockerFingerprint
|
|
1928
|
+
&& previous.evidenceHash === evidenceHash;
|
|
1929
|
+
var attempts = sameCheckpointBase ? Math.max(0, Number(previous.attempts || 0)) + 1 : 1;
|
|
1930
|
+
var status = plan.recoveryClass === 'manual_handoff'
|
|
1931
|
+
? 'manual_handoff'
|
|
1932
|
+
: plan.recoveryClass === 'blocked_until_new_evidence'
|
|
1933
|
+
? 'parked'
|
|
1934
|
+
: plan.recoveryClass === 'advance_after_proof'
|
|
1935
|
+
? 'complete'
|
|
1936
|
+
: 'active';
|
|
1937
|
+
var now = isoNow(input.now);
|
|
1938
|
+
var checkpointId = stableHash('mgr-recovery', {
|
|
1939
|
+
recoveryClass: plan.recoveryClass,
|
|
1940
|
+
lane: plan.lane,
|
|
1941
|
+
stepType: plan.stepType,
|
|
1942
|
+
allowedAction: plan.allowedAction,
|
|
1943
|
+
blockerFingerprint: blockerFingerprint,
|
|
1944
|
+
evidenceHash: evidenceHash
|
|
1945
|
+
});
|
|
1946
|
+
return {
|
|
1947
|
+
checkpointId: checkpointId,
|
|
1948
|
+
recoveryClass: plan.recoveryClass,
|
|
1949
|
+
status: status,
|
|
1950
|
+
lane: plan.lane,
|
|
1951
|
+
stepType: plan.stepType,
|
|
1952
|
+
allowedAction: plan.allowedAction,
|
|
1953
|
+
productRepairAllowed: plan.productRepairAllowed,
|
|
1954
|
+
expensiveModelAllowed: plan.expensiveModelAllowed,
|
|
1955
|
+
attempts: attempts,
|
|
1956
|
+
maxAttemptsBeforePark: plan.maxAttemptsBeforePark,
|
|
1957
|
+
blockerFingerprint: blockerFingerprint,
|
|
1958
|
+
evidenceHash: evidenceHash,
|
|
1959
|
+
changedFiles: changedFiles,
|
|
1960
|
+
artifactPaths: artifactPaths,
|
|
1961
|
+
requiredEvidence: cleanList(plan.requiredEvidence, 40, 500),
|
|
1962
|
+
loopResetEvidence: cleanList(plan.loopResetEvidence, 40, 500),
|
|
1963
|
+
forbiddenActions: cleanList(plan.forbiddenActions, 40, 500),
|
|
1964
|
+
objective: cleanText(plan.objective, 1000),
|
|
1965
|
+
nextActionLabel: cleanText(plan.nextActionLabel, 160),
|
|
1966
|
+
createdAt: sameCheckpointBase && (previous === null || previous === void 0 ? void 0 : previous.createdAt) ? previous.createdAt : now,
|
|
1967
|
+
updatedAt: now
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
function makeRecoveryEvidenceProbeStep(id, kind, label, objective, artifactExpectation, successSignal, options) {
|
|
1971
|
+
if (options === void 0) { options = {}; }
|
|
1972
|
+
return __assign(__assign({ id: id, kind: kind, label: label, objective: cleanText(objective, 1000), required: options.required !== false }, (options.commandHint ? { commandHint: cleanText(options.commandHint, 500) } : {})), { artifactExpectation: cleanText(artifactExpectation, 500), successSignal: cleanText(successSignal, 500) });
|
|
1973
|
+
}
|
|
1974
|
+
function recoveryEvidenceProbeStepsFor(checkpoint) {
|
|
1975
|
+
var base = [
|
|
1976
|
+
makeRecoveryEvidenceProbeStep('snapshot_current_blocker', 'rerun_same_gate', 'Snapshot Current Blocker', 'Capture the current blocker, failure class, evidence hash, changed files, and artifact paths before any new repair.', 'runner-evidence/current-blocker.json', 'Snapshot includes the same checkpointId, blockerFingerprint, and evidenceHashBefore.')
|
|
1977
|
+
];
|
|
1978
|
+
if (checkpoint.recoveryClass === 'diagnosis_only' || checkpoint.recoveryClass === 'diagnosis_revision') {
|
|
1979
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
1980
|
+
makeRecoveryEvidenceProbeStep('collect_read_only_root_cause_evidence', 'read_only_diagnosis', 'Collect Read-Only Root-Cause Evidence', checkpoint.recoveryClass === 'diagnosis_revision'
|
|
1981
|
+
? 'Collect new evidence that proves the current owner_files or failing_path is wrong before broadening scope.'
|
|
1982
|
+
: 'Reproduce or classify the issue and record the exact customer complaint, expected result, observed result, route/module, and account context.', 'runner-evidence/diagnosis-readonly.md', 'Evidence supports one falsifiable accepted hypothesis and at least one rejected alternative.'),
|
|
1983
|
+
makeRecoveryEvidenceProbeStep('validate_diagnosis_gate', 'read_only_diagnosis', 'Validate Diagnosis Gate', 'Validate issue_case, accepted_hypothesis, rejected_alternatives, failing_path, owner_files, and before/action/after proof_plan.', 'runner-evidence/diagnosis-gate.json', 'Diagnosis gate validates before product-code repair is allowed.')
|
|
1984
|
+
], false);
|
|
1985
|
+
}
|
|
1986
|
+
if (checkpoint.recoveryClass === 'infra_repair') {
|
|
1987
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
1988
|
+
makeRecoveryEvidenceProbeStep('run_infra_preflight', 'infra_preflight', 'Run Infra Preflight', 'Check Puppeteer/Chrome, ports, Mongo/settings, cache state, startup commands, and server/client process health.', 'runner-evidence/infra-preflight.log', 'The same infra gate either passes or returns a new infra blocker hash.', { commandHint: 'runner preflight: puppeteer/chrome/mongo/ports/startup' })
|
|
1989
|
+
], false);
|
|
1990
|
+
}
|
|
1991
|
+
if (checkpoint.recoveryClass === 'compile_repair') {
|
|
1992
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
1993
|
+
makeRecoveryEvidenceProbeStep('rerun_compile_gate', 'compile_check', 'Rerun Compile Gate', 'Rerun the same deterministic compile/build command and capture the first actionable error.', 'runner-evidence/compile.log', 'Compile passes or the first failing error changes.', { commandHint: 'same finite build/compile command from the failed gate' })
|
|
1994
|
+
], false);
|
|
1995
|
+
}
|
|
1996
|
+
if (checkpoint.recoveryClass === 'journey_contract_repair') {
|
|
1997
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
1998
|
+
makeRecoveryEvidenceProbeStep('validate_journey_contract', 'journey_validation', 'Validate Journey Contract', 'Validate docs/APP_JOURNEY_CONTRACT.md has first/next/last workflow, route/action/method mapping, seeded data story, completion states, and QA assertions.', 'runner-evidence/journey-contract-validation.json', 'Journey contract validates before build tasks continue.'),
|
|
1999
|
+
makeRecoveryEvidenceProbeStep('verify_hub_workflow_mapping', 'journey_validation', 'Verify Hub Workflow Mapping', 'Confirm the hub CTA and screen sequence implement the journey contract instead of link-only navigation.', 'runner-evidence/hub-workflow-map.json', 'Primary hub action maps to a real route/action/method/calculation and next state.')
|
|
2000
|
+
], false);
|
|
2001
|
+
}
|
|
2002
|
+
if (checkpoint.recoveryClass === 'business_proof_repair' || checkpoint.recoveryClass === 'product_code_repair') {
|
|
2003
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
2004
|
+
makeRecoveryEvidenceProbeStep('rerun_business_assertion', 'business_assertion', 'Rerun Business Assertion', 'Run the exact issue/app promise proof and capture before/action/after DOM/data evidence.', 'runner-evidence/business-assertion.json', 'Business assertion passes, or the observed failure changes with a new artifact path.'),
|
|
2005
|
+
makeRecoveryEvidenceProbeStep('check_diff_scope', 'diff_scope_check', 'Check Diff Scope', 'Compare changed files against the current diagnosis/journey owner scope before another code repair.', 'runner-evidence/diff-scope.json', 'Changed files are in scope, or diagnosis/journey scope is revised with evidence.')
|
|
2006
|
+
], false);
|
|
2007
|
+
}
|
|
2008
|
+
if (checkpoint.recoveryClass === 'release_repair') {
|
|
2009
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
2010
|
+
makeRecoveryEvidenceProbeStep('collect_release_status', 'release_status', 'Collect Release Status', 'Collect publish/deploy/build-instance/domain/CloudFront status and the last actionable deploy error.', 'runner-evidence/release-status.json', 'Release gate passes or returns a new release blocker hash without product-code repair.')
|
|
2011
|
+
], false);
|
|
2012
|
+
}
|
|
2013
|
+
if (checkpoint.recoveryClass === 'manual_handoff') {
|
|
2014
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
2015
|
+
makeRecoveryEvidenceProbeStep('operator_review_checkpoint', 'operator_review', 'Operator Review Checkpoint', 'Expose budget, blocker, evidence hash, and the minimum policy/scope change needed before another expensive loop.', 'runner-evidence/operator-review.json', 'Operator approves a new scope/policy or provides new external evidence.')
|
|
2016
|
+
], false);
|
|
2017
|
+
}
|
|
2018
|
+
return __spreadArray(__spreadArray([], __read(base), false), [
|
|
2019
|
+
makeRecoveryEvidenceProbeStep('rerun_same_deterministic_gate', 'rerun_same_gate', 'Rerun Same Deterministic Gate', 'Rerun the exact failed check and capture new logs/artifacts without changing product code first.', 'runner-evidence/retry-gate.log', 'Gate passes, or evidenceHash/blockerFingerprint/artifactPaths change.')
|
|
2020
|
+
], false);
|
|
2021
|
+
}
|
|
2022
|
+
function buildResolveIOAIManagerRecoveryEvidenceProbe(input) {
|
|
2023
|
+
var checkpoint = input.checkpoint;
|
|
2024
|
+
var now = isoNow(input.now);
|
|
2025
|
+
var steps = recoveryEvidenceProbeStepsFor(checkpoint);
|
|
2026
|
+
var requiredArtifacts = Array.from(new Set(steps
|
|
2027
|
+
.filter(function (step) { return step.required; })
|
|
2028
|
+
.map(function (step) { return step.artifactExpectation; })
|
|
2029
|
+
.filter(Boolean)));
|
|
2030
|
+
return {
|
|
2031
|
+
probeId: stableHash('mgr-probe', {
|
|
2032
|
+
checkpointId: checkpoint.checkpointId,
|
|
2033
|
+
recoveryClass: checkpoint.recoveryClass,
|
|
2034
|
+
evidenceHash: checkpoint.evidenceHash,
|
|
2035
|
+
blockerFingerprint: checkpoint.blockerFingerprint
|
|
2036
|
+
}),
|
|
2037
|
+
checkpointId: checkpoint.checkpointId,
|
|
2038
|
+
recoveryClass: checkpoint.recoveryClass,
|
|
2039
|
+
lane: checkpoint.lane,
|
|
2040
|
+
stepType: checkpoint.stepType,
|
|
2041
|
+
objective: checkpoint.status === 'parked'
|
|
2042
|
+
? 'Collect new evidence before any additional expensive model/code repair.'
|
|
2043
|
+
: cleanText(checkpoint.objective, 1000),
|
|
2044
|
+
evidenceOnly: checkpoint.status === 'parked'
|
|
2045
|
+
|| checkpoint.recoveryClass === 'diagnosis_only'
|
|
2046
|
+
|| checkpoint.recoveryClass === 'diagnosis_revision'
|
|
2047
|
+
|| checkpoint.recoveryClass === 'infra_repair'
|
|
2048
|
+
|| checkpoint.recoveryClass === 'compile_repair'
|
|
2049
|
+
|| checkpoint.recoveryClass === 'release_repair',
|
|
2050
|
+
productRepairAllowed: checkpoint.productRepairAllowed && checkpoint.status !== 'parked',
|
|
2051
|
+
expensiveModelAllowed: checkpoint.expensiveModelAllowed && checkpoint.status !== 'parked',
|
|
2052
|
+
evidenceHashBefore: checkpoint.evidenceHash,
|
|
2053
|
+
blockerFingerprint: checkpoint.blockerFingerprint,
|
|
2054
|
+
steps: steps,
|
|
2055
|
+
requiredArtifacts: requiredArtifacts,
|
|
2056
|
+
acceptanceEvidence: Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(checkpoint.requiredEvidence), false), __read(checkpoint.loopResetEvidence), false), __read(steps.map(function (step) { return step.successSignal; })), false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30),
|
|
2057
|
+
stopConditions: Array.from(new Set(__spreadArray(__spreadArray([], __read(checkpoint.forbiddenActions), false), [
|
|
2058
|
+
'no new evidence hash',
|
|
2059
|
+
'no new artifact path',
|
|
2060
|
+
'product-code repair requested while evidenceOnly is true'
|
|
2061
|
+
], false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30),
|
|
2062
|
+
loopResetEvidence: checkpoint.loopResetEvidence,
|
|
2063
|
+
createdAt: now
|
|
2064
|
+
};
|
|
2065
|
+
}
|
|
2066
|
+
function recoveryAutomationModeFor(checkpoint) {
|
|
2067
|
+
if (checkpoint.status === 'manual_handoff' || checkpoint.recoveryClass === 'manual_handoff') {
|
|
2068
|
+
return 'manual_review';
|
|
2069
|
+
}
|
|
2070
|
+
if (checkpoint.status === 'complete' || checkpoint.recoveryClass === 'advance_after_proof') {
|
|
2071
|
+
return 'advance';
|
|
2072
|
+
}
|
|
2073
|
+
if (checkpoint.status === 'parked' || checkpoint.recoveryClass === 'blocked_until_new_evidence') {
|
|
2074
|
+
return 'collect_evidence';
|
|
2075
|
+
}
|
|
2076
|
+
if (checkpoint.recoveryClass === 'diagnosis_only' || checkpoint.recoveryClass === 'diagnosis_revision') {
|
|
2077
|
+
return 'read_only_diagnosis';
|
|
2078
|
+
}
|
|
2079
|
+
if (checkpoint.recoveryClass === 'infra_repair') {
|
|
2080
|
+
return 'repair_infra';
|
|
2081
|
+
}
|
|
2082
|
+
if (checkpoint.recoveryClass === 'compile_repair') {
|
|
2083
|
+
return 'repair_compile';
|
|
2084
|
+
}
|
|
2085
|
+
if (checkpoint.recoveryClass === 'journey_contract_repair') {
|
|
2086
|
+
return 'repair_journey_contract';
|
|
2087
|
+
}
|
|
2088
|
+
if (checkpoint.recoveryClass === 'business_proof_repair') {
|
|
2089
|
+
return 'repair_business_assertion';
|
|
2090
|
+
}
|
|
2091
|
+
if (checkpoint.recoveryClass === 'release_repair') {
|
|
2092
|
+
return 'repair_release';
|
|
2093
|
+
}
|
|
2094
|
+
if (checkpoint.recoveryClass === 'product_code_repair') {
|
|
2095
|
+
return 'targeted_product_repair';
|
|
2096
|
+
}
|
|
2097
|
+
return 'continue_gate';
|
|
2098
|
+
}
|
|
2099
|
+
function recoveryActionLabelFor(mode, checkpoint) {
|
|
2100
|
+
var explicit = cleanText(checkpoint.nextActionLabel, 120);
|
|
2101
|
+
if (explicit && mode !== 'collect_evidence') {
|
|
2102
|
+
return explicit;
|
|
2103
|
+
}
|
|
2104
|
+
var labels = {
|
|
2105
|
+
advance: 'Advance To Next Gate',
|
|
2106
|
+
collect_evidence: 'Collect New Evidence',
|
|
2107
|
+
read_only_diagnosis: 'Run Diagnosis Evidence Pass',
|
|
2108
|
+
repair_infra: 'Repair Infra Gate',
|
|
2109
|
+
repair_compile: 'Repair Compile Gate',
|
|
2110
|
+
repair_journey_contract: 'Repair Journey Contract',
|
|
2111
|
+
repair_business_assertion: 'Repair Business Proof',
|
|
2112
|
+
repair_release: 'Repair Release Gate',
|
|
2113
|
+
targeted_product_repair: 'Run Targeted Repair',
|
|
2114
|
+
manual_review: 'Manual Review',
|
|
2115
|
+
continue_gate: 'Continue Current Gate'
|
|
2116
|
+
};
|
|
2117
|
+
return labels[mode];
|
|
2118
|
+
}
|
|
2119
|
+
function recoveryActionAutoRunnable(mode, probe) {
|
|
2120
|
+
if (mode === 'manual_review') {
|
|
2121
|
+
return false;
|
|
2122
|
+
}
|
|
2123
|
+
if (mode === 'advance' || mode === 'continue_gate') {
|
|
2124
|
+
return true;
|
|
2125
|
+
}
|
|
2126
|
+
if (mode === 'targeted_product_repair' || mode === 'read_only_diagnosis' || mode === 'repair_journey_contract' || mode === 'repair_business_assertion') {
|
|
2127
|
+
return true;
|
|
2128
|
+
}
|
|
2129
|
+
return probe.steps.some(function (step) { return step.commandHint || step.kind === 'rerun_same_gate' || step.kind === 'release_status' || step.kind === 'diff_scope_check'; });
|
|
2130
|
+
}
|
|
2131
|
+
function recoveryActionCostCeilingUsd(mode) {
|
|
2132
|
+
var _a;
|
|
2133
|
+
var map = {
|
|
2134
|
+
advance: 0,
|
|
2135
|
+
collect_evidence: 0.25,
|
|
2136
|
+
read_only_diagnosis: 1,
|
|
2137
|
+
repair_infra: 0.5,
|
|
2138
|
+
repair_compile: 1.5,
|
|
2139
|
+
repair_journey_contract: 2,
|
|
2140
|
+
repair_business_assertion: 1.5,
|
|
2141
|
+
repair_release: 0.75,
|
|
2142
|
+
targeted_product_repair: 5,
|
|
2143
|
+
manual_review: 0,
|
|
2144
|
+
continue_gate: 0
|
|
2145
|
+
};
|
|
2146
|
+
return (_a = map[mode]) !== null && _a !== void 0 ? _a : 1;
|
|
2147
|
+
}
|
|
2148
|
+
function recoveryActionRequiredStateTransition(mode) {
|
|
2149
|
+
var map = {
|
|
2150
|
+
advance: 'current gate advances without repair after existing proof is accepted',
|
|
2151
|
+
collect_evidence: 'blockerFingerprint or evidenceHash changes with material proof, or run remains parked',
|
|
2152
|
+
read_only_diagnosis: 'diagnosis gate becomes valid or records a blocked-reproduction reason',
|
|
2153
|
+
repair_infra: 'infra preflight changes from failed/blocked to passed, or records a new infra blocker',
|
|
2154
|
+
repair_compile: 'compile/startup status changes from failed to passed, or records a new compile blocker',
|
|
2155
|
+
repair_journey_contract: 'journey contract validates with first/next/last workflow proof',
|
|
2156
|
+
repair_business_assertion: 'business assertion changes from missing/failed to passed with artifact proof',
|
|
2157
|
+
repair_release: 'hotfix/release gate changes from blocked to passed, rerun_release_gate, or parked manual',
|
|
2158
|
+
targeted_product_repair: 'owner-scoped diff is produced and deterministic proof advances to QA',
|
|
2159
|
+
manual_review: 'operator records one explicit decision',
|
|
2160
|
+
continue_gate: 'current gate records accepted proof and advances'
|
|
2161
|
+
};
|
|
2162
|
+
return map[mode] || 'runner records a validated state transition before continuing';
|
|
2163
|
+
}
|
|
2164
|
+
function recoveryActionProofRequiredBeforeContinuation(mode) {
|
|
2165
|
+
return mode !== 'advance' && mode !== 'continue_gate' && mode !== 'manual_review';
|
|
2166
|
+
}
|
|
2167
|
+
function recoveryActionExitCriteria(input) {
|
|
2168
|
+
return Array.from(new Set(__spreadArray(__spreadArray([
|
|
2169
|
+
"exact dispatch action ".concat(input.dispatchAction, " completed or was parked"),
|
|
2170
|
+
input.requiredStateTransition
|
|
2171
|
+
], __read((recoveryActionProofRequiredBeforeContinuation(input.mode) ? ['do not continue runner until required proof artifact is attached'] : [])), false), __read(input.stopWhen), false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30);
|
|
2172
|
+
}
|
|
2173
|
+
function recoveryReleaseHotfixCommands(policy) {
|
|
2174
|
+
if (!policy) {
|
|
2175
|
+
return [];
|
|
2176
|
+
}
|
|
2177
|
+
return Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(policy.allowedActions), false), __read((policy.hotfixPreferred ? [
|
|
2178
|
+
'prepare_hotfix_patch_without_live_apply',
|
|
2179
|
+
'commit_and_push_hotfix_to_github',
|
|
2180
|
+
'record_github_commit_for_hotfix',
|
|
2181
|
+
'apply_live_hotfix_only_after_github_commit_proof'
|
|
2182
|
+
] : [])), false), [
|
|
2183
|
+
'run_failed_release_gate_once',
|
|
2184
|
+
'record_release_evidence'
|
|
2185
|
+
], false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 20);
|
|
2186
|
+
}
|
|
2187
|
+
function recoveryReleaseRequiredEvidence(policy) {
|
|
2188
|
+
var _a;
|
|
2189
|
+
if (!policy) {
|
|
2190
|
+
return [];
|
|
2191
|
+
}
|
|
2192
|
+
var stepEvidence = (((_a = policy.hotfixPlan) === null || _a === void 0 ? void 0 : _a.steps) || []).flatMap(function (step) { return step.requiredEvidence || []; });
|
|
2193
|
+
return Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(policy.requiredEvidence), false), __read(stepEvidence), false), __read((policy.hotfixPreferred ? [
|
|
2194
|
+
'full 40-character sourceCommitSha',
|
|
2195
|
+
'matching githubCommitUrl',
|
|
2196
|
+
'passed gitCommitStatus before any live hotfix is treated as durable',
|
|
2197
|
+
'passed gitPushStatus before any live hotfix is treated as durable'
|
|
2198
|
+
] : [])), false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30);
|
|
2199
|
+
}
|
|
2200
|
+
function recoveryReleaseSuccessEvidence(policy) {
|
|
2201
|
+
var _a, _b;
|
|
2202
|
+
if (!policy) {
|
|
2203
|
+
return [];
|
|
2204
|
+
}
|
|
2205
|
+
var stepEvidence = (((_a = policy.hotfixPlan) === null || _a === void 0 ? void 0 : _a.steps) || []).flatMap(function (step) { return step.successEvidence || []; });
|
|
2206
|
+
return Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read((((_b = policy.hotfixPlan) === null || _b === void 0 ? void 0 : _b.acceptanceEvidence) || [])), false), __read(stepEvidence), false), __read((policy.hotfixPreferred ? ['GitHub commit and push proof validates before continuation'] : [])), false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30);
|
|
2207
|
+
}
|
|
2208
|
+
function buildResolveIOAIManagerRecoveryActionPacket(input) {
|
|
2209
|
+
var checkpoint = input.checkpoint;
|
|
2210
|
+
var probe = input.probe || buildResolveIOAIManagerRecoveryEvidenceProbe({
|
|
2211
|
+
checkpoint: checkpoint,
|
|
2212
|
+
current: input.current,
|
|
2213
|
+
now: input.now
|
|
2214
|
+
});
|
|
2215
|
+
var mode = recoveryAutomationModeFor(checkpoint);
|
|
2216
|
+
var primaryStep = probe.steps.find(function (step) { return step.required && step.id !== 'snapshot_current_blocker'; })
|
|
2217
|
+
|| probe.steps.find(function (step) { return step.required; })
|
|
2218
|
+
|| probe.steps[0];
|
|
2219
|
+
var evidenceOnly = probe.evidenceOnly || mode === 'collect_evidence' || mode === 'repair_infra' || mode === 'repair_compile' || mode === 'repair_release';
|
|
2220
|
+
var requireNewEvidence = mode === 'collect_evidence'
|
|
2221
|
+
|| checkpoint.status === 'parked'
|
|
2222
|
+
|| checkpoint.attempts >= checkpoint.maxAttemptsBeforePark;
|
|
2223
|
+
var stopWhen = Array.from(new Set(__spreadArray(__spreadArray([], __read(probe.stopConditions), false), __read((requireNewEvidence ? ['same blocker fingerprint and same evidence hash after probe'] : [])), false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30);
|
|
2224
|
+
var resetLoopWhen = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(checkpoint.loopResetEvidence), false), __read(probe.loopResetEvidence), false), __read((requireNewEvidence ? [
|
|
2225
|
+
'new material evidence: changed blocker, validated diagnosis/journey, business proof, compile/infra/release proof, or new actionable trace',
|
|
2226
|
+
'weak hash-only evidence does not reset the loop'
|
|
2227
|
+
] : [])), false).map(function (entry) { return cleanText(entry, 500); }).filter(Boolean))).slice(0, 30);
|
|
2228
|
+
var nextCommands = probe.steps
|
|
2229
|
+
.map(function (step) { return cleanText(step.commandHint || "".concat(step.kind, ":").concat(step.id), 500); })
|
|
2230
|
+
.filter(Boolean)
|
|
2231
|
+
.slice(0, 12);
|
|
2232
|
+
var releasePolicy = mode === 'repair_release'
|
|
2233
|
+
? buildResolveIOAIManagerHotfixFirstReleasePolicy({
|
|
2234
|
+
surface: 'manager_recovery',
|
|
2235
|
+
deployStatus: checkpoint.stepType,
|
|
2236
|
+
publishStatus: checkpoint.lane
|
|
2237
|
+
})
|
|
2238
|
+
: undefined;
|
|
2239
|
+
var releaseNextCommands = recoveryReleaseHotfixCommands(releasePolicy);
|
|
2240
|
+
var releaseRequiredEvidence = recoveryReleaseRequiredEvidence(releasePolicy);
|
|
2241
|
+
var releaseSuccessEvidence = recoveryReleaseSuccessEvidence(releasePolicy);
|
|
2242
|
+
var allowedDispatchAction = dispatchActionForMode(mode);
|
|
2243
|
+
var requiredStateTransition = recoveryActionRequiredStateTransition(mode);
|
|
2244
|
+
var proofRequiredBeforeContinuation = recoveryActionProofRequiredBeforeContinuation(mode);
|
|
2245
|
+
var exitCriteria = recoveryActionExitCriteria({
|
|
2246
|
+
mode: mode,
|
|
2247
|
+
dispatchAction: allowedDispatchAction,
|
|
2248
|
+
requiredStateTransition: requiredStateTransition,
|
|
2249
|
+
stopWhen: stopWhen
|
|
2250
|
+
});
|
|
2251
|
+
var now = isoNow(input.now);
|
|
2252
|
+
return __assign(__assign(__assign({ actionId: stableHash('mgr-action', {
|
|
2253
|
+
checkpointId: checkpoint.checkpointId,
|
|
2254
|
+
probeId: probe.probeId,
|
|
2255
|
+
mode: mode,
|
|
2256
|
+
evidenceHash: checkpoint.evidenceHash,
|
|
2257
|
+
blockerFingerprint: checkpoint.blockerFingerprint
|
|
2258
|
+
}), checkpointId: checkpoint.checkpointId, probeId: probe.probeId, recoveryClass: checkpoint.recoveryClass, mode: mode, singleActionOnly: true, allowedDispatchAction: allowedDispatchAction, label: recoveryActionLabelFor(mode, checkpoint), lane: checkpoint.lane, stepType: checkpoint.stepType, primaryStepKind: (primaryStep === null || primaryStep === void 0 ? void 0 : primaryStep.kind) || 'none', objective: mode === 'collect_evidence'
|
|
2259
|
+
? probe.objective
|
|
2260
|
+
: cleanText(checkpoint.objective || probe.objective, 1000), evidenceOnly: evidenceOnly, autoRunnable: recoveryActionAutoRunnable(mode, probe), productRepairAllowed: checkpoint.productRepairAllowed && !evidenceOnly && checkpoint.status !== 'parked', expensiveModelAllowed: checkpoint.expensiveModelAllowed && checkpoint.status !== 'parked', costCeilingUsd: recoveryActionCostCeilingUsd(mode), requiredStateTransition: requiredStateTransition, proofRequiredBeforeContinuation: proofRequiredBeforeContinuation, canResetLoopAfterEvidence: resetLoopWhen.length > 0, maxAttemptsBeforePark: checkpoint.maxAttemptsBeforePark, requiredArtifacts: releasePolicy
|
|
2261
|
+
? Array.from(new Set(__spreadArray(__spreadArray([], __read(probe.requiredArtifacts), false), __read(releaseRequiredEvidence), false))).slice(0, 20)
|
|
2262
|
+
: probe.requiredArtifacts.slice(0, 20), nextCommands: releasePolicy
|
|
2263
|
+
? Array.from(new Set(__spreadArray(__spreadArray([], __read(nextCommands), false), __read(releaseNextCommands), false))).slice(0, 20)
|
|
2264
|
+
: nextCommands, successCriteria: releasePolicy
|
|
2265
|
+
? Array.from(new Set(__spreadArray(__spreadArray([], __read(probe.acceptanceEvidence), false), __read(releaseSuccessEvidence), false))).slice(0, 20)
|
|
2266
|
+
: probe.acceptanceEvidence.slice(0, 20), exitCriteria: exitCriteria, retryPolicy: {
|
|
2267
|
+
allowImmediateRetry: checkpoint.status !== 'parked' && mode !== 'manual_review',
|
|
2268
|
+
requireNewEvidence: requireNewEvidence,
|
|
2269
|
+
resetLoopWhen: resetLoopWhen,
|
|
2270
|
+
stopWhen: stopWhen
|
|
2271
|
+
} }, (releasePolicy ? { releasePolicy: releasePolicy } : {})), (mode === 'collect_evidence' ? { blockedReason: 'Manager parked this loop until the recovery action records new evidence.' } : {})), { createdAt: now });
|
|
2272
|
+
}
|
|
2273
|
+
function dispatchActionForMode(mode) {
|
|
2274
|
+
var map = {
|
|
2275
|
+
advance: 'advance',
|
|
2276
|
+
collect_evidence: 'run_evidence_probe',
|
|
2277
|
+
read_only_diagnosis: 'run_read_only_diagnosis',
|
|
2278
|
+
repair_infra: 'run_infra_repair',
|
|
2279
|
+
repair_compile: 'run_compile_repair',
|
|
2280
|
+
repair_journey_contract: 'run_journey_contract_repair',
|
|
2281
|
+
repair_business_assertion: 'run_business_assertion_repair',
|
|
2282
|
+
repair_release: 'run_release_repair',
|
|
2283
|
+
targeted_product_repair: 'run_targeted_product_repair',
|
|
2284
|
+
manual_review: 'park_manual',
|
|
2285
|
+
continue_gate: 'continue_gate'
|
|
2286
|
+
};
|
|
2287
|
+
return map[mode] || 'park_manual';
|
|
2288
|
+
}
|
|
2289
|
+
function buildRecoveryDispatchRecord(action, dispatchAction, status, reason, current, now) {
|
|
2290
|
+
var evidenceHash = (current === null || current === void 0 ? void 0 : current.evidenceHash) || action.checkpointId || action.actionId;
|
|
2291
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, action.objective);
|
|
2292
|
+
var artifactPaths = cleanList(current === null || current === void 0 ? void 0 : current.artifactPaths, 20, 500);
|
|
2293
|
+
var createdAt = isoNow(now);
|
|
2294
|
+
return __assign(__assign(__assign({ dispatchId: stableHash('mgr-dispatch', {
|
|
2295
|
+
actionId: action.actionId,
|
|
2296
|
+
dispatchAction: dispatchAction,
|
|
2297
|
+
evidenceHash: evidenceHash,
|
|
2298
|
+
blockerFingerprint: blockerFingerprint,
|
|
2299
|
+
status: status
|
|
2300
|
+
}), actionId: action.actionId, checkpointId: action.checkpointId, probeId: action.probeId, mode: action.mode, dispatchAction: dispatchAction, status: status, evidenceHash: evidenceHash, blockerFingerprint: blockerFingerprint, productRepairAllowed: action.productRepairAllowed && dispatchAction === 'run_targeted_product_repair', expensiveModelAllowed: action.expensiveModelAllowed && dispatchAction !== 'run_evidence_probe', reason: reason, artifactPaths: artifactPaths }, (status === 'started' ? { startedAt: createdAt } : {})), (status === 'completed' ? { completedAt: createdAt } : {})), { createdAt: createdAt });
|
|
2301
|
+
}
|
|
2302
|
+
function decideResolveIOAIManagerRecoveryActionDispatch(input) {
|
|
2303
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
2304
|
+
var action = input.action;
|
|
2305
|
+
var history = Array.isArray(input.history) ? input.history.filter(Boolean).slice(-50) : [];
|
|
2306
|
+
var current = input.current || {};
|
|
2307
|
+
if (!action) {
|
|
2308
|
+
return {
|
|
2309
|
+
dispatchAction: 'park_manual',
|
|
2310
|
+
allowed: false,
|
|
2311
|
+
reason: 'recovery_dispatch_missing_action',
|
|
2312
|
+
status: 'parked',
|
|
2313
|
+
canRunProductRepair: false,
|
|
2314
|
+
canRunExpensiveModel: false,
|
|
2315
|
+
shouldRecordDispatch: false,
|
|
2316
|
+
requiresNewEvidence: true,
|
|
2317
|
+
newEvidence: false
|
|
2318
|
+
};
|
|
2319
|
+
}
|
|
2320
|
+
var dispatchAction = dispatchActionForMode(action.mode);
|
|
2321
|
+
var allowedDispatchAction = action.allowedDispatchAction || dispatchAction;
|
|
2322
|
+
var evidenceHash = current.evidenceHash || action.checkpointId || action.actionId;
|
|
2323
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current, action.objective);
|
|
2324
|
+
var sameActionHistory = history.filter(function (entry) { return entry.actionId === action.actionId; });
|
|
2325
|
+
var sameEvidenceHistory = sameActionHistory.filter(function (entry) { return entry.evidenceHash === evidenceHash
|
|
2326
|
+
&& entry.blockerFingerprint === blockerFingerprint; });
|
|
2327
|
+
var activeDispatch = sameEvidenceHistory.find(function (entry) { return entry.status === 'queued' || entry.status === 'started'; });
|
|
2328
|
+
var completedDispatch = sameEvidenceHistory.find(function (entry) { return entry.status === 'completed' || entry.status === 'failed'; });
|
|
2329
|
+
var newEvidence = sameActionHistory.length > 0 && sameEvidenceHistory.length === 0;
|
|
2330
|
+
var requiresNewEvidence = action.retryPolicy.requireNewEvidence === true;
|
|
2331
|
+
var sameEvidenceAlreadyAttempted = !!completedDispatch && requiresNewEvidence && !newEvidence;
|
|
2332
|
+
var manualOnly = action.mode === 'manual_review' || !action.autoRunnable;
|
|
2333
|
+
var productDispatch = dispatchAction === 'run_targeted_product_repair';
|
|
2334
|
+
var expensiveDispatch = !['run_evidence_probe', 'advance', 'continue_gate', 'park_manual'].includes(dispatchAction);
|
|
2335
|
+
var evidenceAssessment = assessResolveIOAIManagerEvidenceChange(undefined, current, action.objective);
|
|
2336
|
+
var autonomyPolicy = input.autonomyPolicy
|
|
2337
|
+
? decideResolveIOAIManagerAutonomyPolicy(__assign(__assign({}, (input.autonomyPolicy || {})), { dispatchAction: dispatchAction, projectedActionCostUsd: (_b = (_a = input.autonomyPolicy) === null || _a === void 0 ? void 0 : _a.projectedActionCostUsd) !== null && _b !== void 0 ? _b : action.costCeilingUsd, newEvidence: (_d = (_c = input.autonomyPolicy) === null || _c === void 0 ? void 0 : _c.newEvidence) !== null && _d !== void 0 ? _d : newEvidence, materialEvidence: (_f = (_e = input.autonomyPolicy) === null || _e === void 0 ? void 0 : _e.materialEvidence) !== null && _f !== void 0 ? _f : evidenceAssessment.material, evidenceStrength: (_h = (_g = input.autonomyPolicy) === null || _g === void 0 ? void 0 : _g.evidenceStrength) !== null && _h !== void 0 ? _h : evidenceAssessment.strength, evidenceSignals: (_k = (_j = input.autonomyPolicy) === null || _j === void 0 ? void 0 : _j.evidenceSignals) !== null && _k !== void 0 ? _k : evidenceAssessment.signals, sameEvidenceAlreadyAttempted: (_m = (_l = input.autonomyPolicy) === null || _l === void 0 ? void 0 : _l.sameEvidenceAlreadyAttempted) !== null && _m !== void 0 ? _m : sameEvidenceAlreadyAttempted, operatorApproved: input.operatorApproved }))
|
|
2338
|
+
: undefined;
|
|
2339
|
+
var autonomyBlocksDispatch = !!autonomyPolicy && (autonomyPolicy.mode === 'monitor_only'
|
|
2340
|
+
|| (autonomyPolicy.requiresHumanApproval === true && input.operatorApproved !== true)
|
|
2341
|
+
|| (autonomyPolicy.canAutoDispatch !== true && input.operatorApproved !== true)
|
|
2342
|
+
|| (autonomyPolicy.blocked === true && autonomyPolicy.canManualDispatch !== true));
|
|
2343
|
+
if (autonomyBlocksDispatch) {
|
|
2344
|
+
var record_1 = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', "recovery_dispatch_blocked_by_autonomy_policy:".concat((autonomyPolicy === null || autonomyPolicy === void 0 ? void 0 : autonomyPolicy.reason) || 'unknown'), current, input.now);
|
|
2345
|
+
return {
|
|
2346
|
+
dispatchAction: 'park_manual',
|
|
2347
|
+
allowed: false,
|
|
2348
|
+
reason: record_1.reason,
|
|
2349
|
+
status: 'parked',
|
|
2350
|
+
canRunProductRepair: false,
|
|
2351
|
+
canRunExpensiveModel: false,
|
|
2352
|
+
shouldRecordDispatch: true,
|
|
2353
|
+
requiresNewEvidence: requiresNewEvidence,
|
|
2354
|
+
newEvidence: newEvidence,
|
|
2355
|
+
autonomyPolicy: autonomyPolicy,
|
|
2356
|
+
dispatchRecord: record_1
|
|
2357
|
+
};
|
|
2358
|
+
}
|
|
2359
|
+
if (action.singleActionOnly === true && allowedDispatchAction !== dispatchAction) {
|
|
2360
|
+
var record_2 = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', 'recovery_dispatch_action_not_in_packet_contract', current, input.now);
|
|
2361
|
+
return {
|
|
2362
|
+
dispatchAction: 'park_manual',
|
|
2363
|
+
allowed: false,
|
|
2364
|
+
reason: record_2.reason,
|
|
2365
|
+
status: 'parked',
|
|
2366
|
+
canRunProductRepair: false,
|
|
2367
|
+
canRunExpensiveModel: false,
|
|
2368
|
+
shouldRecordDispatch: true,
|
|
2369
|
+
requiresNewEvidence: true,
|
|
2370
|
+
newEvidence: newEvidence,
|
|
2371
|
+
autonomyPolicy: autonomyPolicy,
|
|
2372
|
+
dispatchRecord: record_2
|
|
2373
|
+
};
|
|
2374
|
+
}
|
|
2375
|
+
if (manualOnly && input.operatorApproved !== true) {
|
|
2376
|
+
var record_3 = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', 'recovery_dispatch_requires_manual_review', current, input.now);
|
|
2377
|
+
return {
|
|
2378
|
+
dispatchAction: 'park_manual',
|
|
2379
|
+
allowed: false,
|
|
2380
|
+
reason: record_3.reason,
|
|
2381
|
+
status: 'parked',
|
|
2382
|
+
canRunProductRepair: false,
|
|
2383
|
+
canRunExpensiveModel: false,
|
|
2384
|
+
shouldRecordDispatch: true,
|
|
2385
|
+
requiresNewEvidence: requiresNewEvidence,
|
|
2386
|
+
newEvidence: newEvidence,
|
|
2387
|
+
autonomyPolicy: autonomyPolicy,
|
|
2388
|
+
dispatchRecord: record_3
|
|
2389
|
+
};
|
|
2390
|
+
}
|
|
2391
|
+
if (productDispatch && action.productRepairAllowed !== true) {
|
|
2392
|
+
var record_4 = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', 'recovery_dispatch_product_repair_not_allowed', current, input.now);
|
|
2393
|
+
return {
|
|
2394
|
+
dispatchAction: 'park_manual',
|
|
2395
|
+
allowed: false,
|
|
2396
|
+
reason: record_4.reason,
|
|
2397
|
+
status: 'parked',
|
|
2398
|
+
canRunProductRepair: false,
|
|
2399
|
+
canRunExpensiveModel: false,
|
|
2400
|
+
shouldRecordDispatch: true,
|
|
2401
|
+
requiresNewEvidence: true,
|
|
2402
|
+
newEvidence: newEvidence,
|
|
2403
|
+
autonomyPolicy: autonomyPolicy,
|
|
2404
|
+
dispatchRecord: record_4
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
if (activeDispatch) {
|
|
2408
|
+
return {
|
|
2409
|
+
dispatchAction: 'park_manual',
|
|
2410
|
+
allowed: false,
|
|
2411
|
+
reason: 'recovery_dispatch_already_running_for_same_evidence',
|
|
2412
|
+
status: 'parked',
|
|
2413
|
+
canRunProductRepair: false,
|
|
2414
|
+
canRunExpensiveModel: false,
|
|
2415
|
+
shouldRecordDispatch: false,
|
|
2416
|
+
requiresNewEvidence: true,
|
|
2417
|
+
newEvidence: false,
|
|
2418
|
+
autonomyPolicy: autonomyPolicy
|
|
2419
|
+
};
|
|
2420
|
+
}
|
|
2421
|
+
if (sameEvidenceAlreadyAttempted) {
|
|
2422
|
+
var record_5 = buildRecoveryDispatchRecord(action, 'park_manual', 'parked', 'recovery_dispatch_same_evidence_already_attempted', current, input.now);
|
|
2423
|
+
return {
|
|
2424
|
+
dispatchAction: 'park_manual',
|
|
2425
|
+
allowed: false,
|
|
2426
|
+
reason: record_5.reason,
|
|
2427
|
+
status: 'parked',
|
|
2428
|
+
canRunProductRepair: false,
|
|
2429
|
+
canRunExpensiveModel: false,
|
|
2430
|
+
shouldRecordDispatch: true,
|
|
2431
|
+
requiresNewEvidence: true,
|
|
2432
|
+
newEvidence: false,
|
|
2433
|
+
autonomyPolicy: autonomyPolicy,
|
|
2434
|
+
dispatchRecord: record_5
|
|
2435
|
+
};
|
|
2436
|
+
}
|
|
2437
|
+
var status = dispatchAction === 'advance' || dispatchAction === 'continue_gate'
|
|
2438
|
+
? 'completed'
|
|
2439
|
+
: 'started';
|
|
2440
|
+
var record = buildRecoveryDispatchRecord(action, dispatchAction, status, 'recovery_dispatch_allowed', current, input.now);
|
|
2441
|
+
return {
|
|
2442
|
+
dispatchAction: dispatchAction,
|
|
2443
|
+
allowed: true,
|
|
2444
|
+
reason: 'recovery_dispatch_allowed',
|
|
2445
|
+
status: status,
|
|
2446
|
+
canRunProductRepair: productDispatch && action.productRepairAllowed === true,
|
|
2447
|
+
canRunExpensiveModel: expensiveDispatch && action.expensiveModelAllowed === true,
|
|
2448
|
+
shouldRecordDispatch: true,
|
|
2449
|
+
requiresNewEvidence: requiresNewEvidence,
|
|
2450
|
+
newEvidence: newEvidence,
|
|
2451
|
+
autonomyPolicy: autonomyPolicy,
|
|
2452
|
+
dispatchRecord: record
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
function appendResolveIOAIManagerRecoveryActionDispatch(history, record, limit) {
|
|
2456
|
+
if (limit === void 0) { limit = 50; }
|
|
2457
|
+
var existing = Array.isArray(history) ? history.filter(Boolean) : [];
|
|
2458
|
+
if (!record) {
|
|
2459
|
+
return existing.slice(-limit);
|
|
2460
|
+
}
|
|
2461
|
+
var deduped = existing.filter(function (entry) { return entry.dispatchId !== record.dispatchId; });
|
|
2462
|
+
return __spreadArray(__spreadArray([], __read(deduped), false), [record], false).slice(-limit);
|
|
2463
|
+
}
|
|
2464
|
+
function recoveryExecutionPhaseForDispatch(dispatchAction) {
|
|
2465
|
+
var map = {
|
|
2466
|
+
run_evidence_probe: 'evidence',
|
|
2467
|
+
run_read_only_diagnosis: 'diagnosis',
|
|
2468
|
+
run_infra_repair: 'infra',
|
|
2469
|
+
run_compile_repair: 'compile',
|
|
2470
|
+
run_journey_contract_repair: 'journey',
|
|
2471
|
+
run_business_assertion_repair: 'business_proof',
|
|
2472
|
+
run_release_repair: 'release',
|
|
2473
|
+
run_targeted_product_repair: 'product_repair',
|
|
2474
|
+
advance: 'advance',
|
|
2475
|
+
continue_gate: 'advance',
|
|
2476
|
+
park_manual: 'manual'
|
|
2477
|
+
};
|
|
2478
|
+
return map[dispatchAction] || 'manual';
|
|
2479
|
+
}
|
|
2480
|
+
function recoveryDirectiveReason(action, decision, current) {
|
|
2481
|
+
var blocker = cleanText((current === null || current === void 0 ? void 0 : current.blocker) || (current === null || current === void 0 ? void 0 : current.summary) || '', 260);
|
|
2482
|
+
var label = cleanText(action === null || action === void 0 ? void 0 : action.label, 120) || decision.dispatchAction;
|
|
2483
|
+
var objective = cleanText(action === null || action === void 0 ? void 0 : action.objective, 260);
|
|
2484
|
+
return [
|
|
2485
|
+
"MANAGER_RECOVERY:".concat(decision.dispatchAction),
|
|
2486
|
+
"label=".concat(label),
|
|
2487
|
+
decision.reason ? "reason=".concat(decision.reason) : '',
|
|
2488
|
+
blocker ? "blocker=".concat(blocker) : '',
|
|
2489
|
+
objective ? "objective=".concat(objective) : ''
|
|
2490
|
+
].filter(Boolean).join(' | ');
|
|
2491
|
+
}
|
|
2492
|
+
function buildResolveIOAIManagerRecoveryExecutionDirective(input) {
|
|
2493
|
+
var _a, _b, _c, _d, _e;
|
|
2494
|
+
var action = input.action;
|
|
2495
|
+
var dispatchDecision = input.dispatchDecision || decideResolveIOAIManagerRecoveryActionDispatch({
|
|
2496
|
+
action: action,
|
|
2497
|
+
current: input.current,
|
|
2498
|
+
autonomyPolicy: input.autonomyPolicy,
|
|
2499
|
+
now: input.now
|
|
2500
|
+
});
|
|
2501
|
+
var dispatchAction = dispatchDecision.dispatchAction;
|
|
2502
|
+
var now = isoNow(input.now);
|
|
2503
|
+
var phase = recoveryExecutionPhaseForDispatch(dispatchAction);
|
|
2504
|
+
var lane = cleanText((action === null || action === void 0 ? void 0 : action.lane) || ((_a = input.current) === null || _a === void 0 ? void 0 : _a.lane) || '', 120);
|
|
2505
|
+
var stepType = cleanText((action === null || action === void 0 ? void 0 : action.stepType) || ((_b = input.current) === null || _b === void 0 ? void 0 : _b.stepType) || '', 120);
|
|
2506
|
+
var rerunReason = recoveryDirectiveReason(action, dispatchDecision, input.current);
|
|
2507
|
+
var surface = cleanText(input.surface || 'runner', 120);
|
|
2508
|
+
return __assign(__assign(__assign(__assign(__assign({ directiveId: stableHash('mgr-directive', {
|
|
2509
|
+
surface: surface,
|
|
2510
|
+
actionId: (action === null || action === void 0 ? void 0 : action.actionId) || '',
|
|
2511
|
+
dispatchAction: dispatchAction,
|
|
2512
|
+
reason: dispatchDecision.reason,
|
|
2513
|
+
evidenceHash: ((_c = dispatchDecision.dispatchRecord) === null || _c === void 0 ? void 0 : _c.evidenceHash) || ((_d = input.current) === null || _d === void 0 ? void 0 : _d.evidenceHash) || ''
|
|
2514
|
+
}), surface: surface, dispatchAction: dispatchAction, phase: phase, allowed: dispatchDecision.allowed, status: dispatchDecision.status, reason: dispatchDecision.reason, singleActionOnly: (action === null || action === void 0 ? void 0 : action.singleActionOnly) !== false, allowedDispatchAction: (action === null || action === void 0 ? void 0 : action.allowedDispatchAction) || dispatchAction, lane: lane, stepType: stepType, nextActionLabel: cleanText(action === null || action === void 0 ? void 0 : action.label, 160) || dispatchAction, rerunReason: rerunReason, evidenceOnly: (action === null || action === void 0 ? void 0 : action.evidenceOnly) !== false || dispatchAction === 'run_evidence_probe', autoRunnable: (action === null || action === void 0 ? void 0 : action.autoRunnable) === true, productRepairAllowed: (action === null || action === void 0 ? void 0 : action.productRepairAllowed) === true, expensiveModelAllowed: (action === null || action === void 0 ? void 0 : action.expensiveModelAllowed) === true, costCeilingUsd: Math.max(0, Number((action === null || action === void 0 ? void 0 : action.costCeilingUsd) || 0) || 0), requiredStateTransition: cleanText(action === null || action === void 0 ? void 0 : action.requiredStateTransition, 500), proofRequiredBeforeContinuation: (action === null || action === void 0 ? void 0 : action.proofRequiredBeforeContinuation) === true, canRunProductRepair: dispatchDecision.canRunProductRepair, canRunExpensiveModel: dispatchDecision.canRunExpensiveModel, canResetLoopAfterEvidence: (action === null || action === void 0 ? void 0 : action.canResetLoopAfterEvidence) === true, requiresNewEvidence: dispatchDecision.requiresNewEvidence, newEvidence: dispatchDecision.newEvidence }, (dispatchDecision.autonomyPolicy ? { autonomyPolicy: dispatchDecision.autonomyPolicy } : {})), { maxAttemptsBeforePark: Math.max(1, Number((action === null || action === void 0 ? void 0 : action.maxAttemptsBeforePark) || 1) || 1), requiredArtifacts: cleanList(action === null || action === void 0 ? void 0 : action.requiredArtifacts, 20, 500), nextCommands: cleanList(action === null || action === void 0 ? void 0 : action.nextCommands, 20, 500), successCriteria: cleanList(action === null || action === void 0 ? void 0 : action.successCriteria, 20, 500), exitCriteria: cleanList(action === null || action === void 0 ? void 0 : action.exitCriteria, 30, 500), forbiddenActions: (action === null || action === void 0 ? void 0 : action.productRepairAllowed) === true
|
|
2515
|
+
? []
|
|
2516
|
+
: Array.from(new Set(__spreadArray([
|
|
2517
|
+
'Do not run product-code repair from this directive unless canRunProductRepair is true.'
|
|
2518
|
+
], __read((((_e = action === null || action === void 0 ? void 0 : action.releasePolicy) === null || _e === void 0 ? void 0 : _e.forbiddenActions) || [])), false))).slice(0, 20) }), (dispatchDecision.dispatchRecord ? { dispatchRecord: dispatchDecision.dispatchRecord } : {})), ((action === null || action === void 0 ? void 0 : action.releasePolicy) ? { releasePolicy: action.releasePolicy } : {})), { createdAt: now });
|
|
2519
|
+
}
|
|
2520
|
+
function failureRecordFromDirectiveStart(directive, previous) {
|
|
2521
|
+
if (previous) {
|
|
2522
|
+
return previous;
|
|
2523
|
+
}
|
|
2524
|
+
var dispatchRecord = directive === null || directive === void 0 ? void 0 : directive.dispatchRecord;
|
|
2525
|
+
return {
|
|
2526
|
+
lane: directive === null || directive === void 0 ? void 0 : directive.lane,
|
|
2527
|
+
stepType: directive === null || directive === void 0 ? void 0 : directive.stepType,
|
|
2528
|
+
failureClass: '',
|
|
2529
|
+
blockerFingerprint: dispatchRecord === null || dispatchRecord === void 0 ? void 0 : dispatchRecord.blockerFingerprint,
|
|
2530
|
+
evidenceHash: dispatchRecord === null || dispatchRecord === void 0 ? void 0 : dispatchRecord.evidenceHash,
|
|
2531
|
+
artifactPaths: (dispatchRecord === null || dispatchRecord === void 0 ? void 0 : dispatchRecord.artifactPaths) || [],
|
|
2532
|
+
recordedAt: (dispatchRecord === null || dispatchRecord === void 0 ? void 0 : dispatchRecord.createdAt) || (directive === null || directive === void 0 ? void 0 : directive.createdAt)
|
|
2533
|
+
};
|
|
2534
|
+
}
|
|
2535
|
+
function recoveryExecutionProofStatus(input) {
|
|
2536
|
+
var directive = input.directive;
|
|
2537
|
+
if (!directive || directive.allowed !== true || directive.dispatchAction === 'park_manual') {
|
|
2538
|
+
return 'manual_handoff';
|
|
2539
|
+
}
|
|
2540
|
+
if (!input.hasCurrent) {
|
|
2541
|
+
return 'waiting_for_execution';
|
|
2542
|
+
}
|
|
2543
|
+
if (directive.requiresNewEvidence === true && input.assessment.changed !== true) {
|
|
2544
|
+
return 'blocked_same_evidence';
|
|
2545
|
+
}
|
|
2546
|
+
if (directive.proofRequiredBeforeContinuation === true && input.assessment.material !== true) {
|
|
2547
|
+
return 'waiting_for_new_evidence';
|
|
2548
|
+
}
|
|
2549
|
+
return 'proof_ready';
|
|
2550
|
+
}
|
|
2551
|
+
function buildResolveIOAIManagerRecoveryExecutionProofContract(input) {
|
|
2552
|
+
if (input === void 0) { input = {}; }
|
|
2553
|
+
var directive = input.directive;
|
|
2554
|
+
var previous = failureRecordFromDirectiveStart(directive, input.previous);
|
|
2555
|
+
var current = input.current || {};
|
|
2556
|
+
var hasCurrent = !!input.current;
|
|
2557
|
+
var assessment = hasCurrent
|
|
2558
|
+
? assessResolveIOAIManagerEvidenceChange(previous, current, directive === null || directive === void 0 ? void 0 : directive.requiredStateTransition)
|
|
2559
|
+
: {
|
|
2560
|
+
changed: false,
|
|
2561
|
+
material: false,
|
|
2562
|
+
strength: 'none',
|
|
2563
|
+
signals: [],
|
|
2564
|
+
evidenceHash: hashResolveIOAIManagerEvidence(previous),
|
|
2565
|
+
blockerFingerprint: resolveResolveIOAIManagerBlockerFingerprint(previous, directive === null || directive === void 0 ? void 0 : directive.requiredStateTransition)
|
|
2566
|
+
};
|
|
2567
|
+
var status = recoveryExecutionProofStatus({ directive: directive, hasCurrent: hasCurrent, assessment: assessment });
|
|
2568
|
+
var canContinueRun = status === 'proof_ready';
|
|
2569
|
+
var requiredEvidence = Array.from(new Set(__spreadArray(__spreadArray(__spreadArray([], __read(cleanList(input.requiredEvidence, 30, 500)), false), __read(cleanList(directive === null || directive === void 0 ? void 0 : directive.requiredArtifacts, 30, 500)), false), __read(cleanList(directive === null || directive === void 0 ? void 0 : directive.successCriteria, 30, 500)), false).filter(Boolean)));
|
|
2570
|
+
var missingEvidence = (directive === null || directive === void 0 ? void 0 : directive.proofRequiredBeforeContinuation) === true && status !== 'proof_ready'
|
|
2571
|
+
? (requiredEvidence.length ? requiredEvidence : ['new material evidence or passed proof artifact'])
|
|
2572
|
+
: [];
|
|
2573
|
+
var artifactPaths = cleanList(current.artifactPaths || previous.artifactPaths, 80, 500);
|
|
2574
|
+
var changedFiles = cleanList(current.changedFiles, 80, 500);
|
|
2575
|
+
var startingFailureClass = normalizeResolveIOAIManagerFailureClass(previous.failureClass);
|
|
2576
|
+
var latestFailureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass || previous.failureClass);
|
|
2577
|
+
var startingBlockerFingerprint = cleanText(previous.blockerFingerprint, 160)
|
|
2578
|
+
|| resolveResolveIOAIManagerBlockerFingerprint(previous, directive === null || directive === void 0 ? void 0 : directive.requiredStateTransition);
|
|
2579
|
+
var startingEvidenceHash = cleanText(previous.evidenceHash, 160)
|
|
2580
|
+
|| hashResolveIOAIManagerEvidence(previous);
|
|
2581
|
+
var blockers = [
|
|
2582
|
+
status === 'manual_handoff' ? ((directive === null || directive === void 0 ? void 0 : directive.reason) || 'recovery_execution_requires_manual_handoff') : '',
|
|
2583
|
+
status === 'waiting_for_execution' ? 'recovery_execution_waiting_for_current_evidence' : '',
|
|
2584
|
+
status === 'blocked_same_evidence' ? 'recovery_execution_same_evidence_after_dispatch' : '',
|
|
2585
|
+
status === 'waiting_for_new_evidence' ? 'recovery_execution_missing_material_evidence' : ''
|
|
2586
|
+
].filter(Boolean);
|
|
2587
|
+
var createdAt = isoNow(input.now);
|
|
2588
|
+
return {
|
|
2589
|
+
contractId: stableHash('mgr-execution-proof', {
|
|
2590
|
+
directiveId: (directive === null || directive === void 0 ? void 0 : directive.directiveId) || '',
|
|
2591
|
+
dispatchAction: (directive === null || directive === void 0 ? void 0 : directive.dispatchAction) || 'park_manual',
|
|
2592
|
+
status: status,
|
|
2593
|
+
startingEvidenceHash: startingEvidenceHash,
|
|
2594
|
+
latestEvidenceHash: assessment.evidenceHash,
|
|
2595
|
+
createdAt: createdAt.slice(0, 16)
|
|
2596
|
+
}),
|
|
2597
|
+
directiveId: cleanText(directive === null || directive === void 0 ? void 0 : directive.directiveId, 180),
|
|
2598
|
+
surface: cleanText(directive === null || directive === void 0 ? void 0 : directive.surface, 120) || 'runner',
|
|
2599
|
+
dispatchAction: (directive === null || directive === void 0 ? void 0 : directive.dispatchAction) || 'park_manual',
|
|
2600
|
+
phase: (directive === null || directive === void 0 ? void 0 : directive.phase) || 'manual',
|
|
2601
|
+
status: status,
|
|
2602
|
+
canContinueRun: canContinueRun,
|
|
2603
|
+
canRunProductRepair: canContinueRun && (directive === null || directive === void 0 ? void 0 : directive.canRunProductRepair) === true,
|
|
2604
|
+
canRunExpensiveModel: canContinueRun && (directive === null || directive === void 0 ? void 0 : directive.canRunExpensiveModel) === true,
|
|
2605
|
+
canResetLoopBudget: canContinueRun && assessment.material === true,
|
|
2606
|
+
proofRequiredBeforeContinuation: (directive === null || directive === void 0 ? void 0 : directive.proofRequiredBeforeContinuation) === true,
|
|
2607
|
+
requiresNewEvidence: (directive === null || directive === void 0 ? void 0 : directive.requiresNewEvidence) === true,
|
|
2608
|
+
newEvidence: assessment.changed,
|
|
2609
|
+
materialEvidence: assessment.material,
|
|
2610
|
+
evidenceStrength: assessment.strength,
|
|
2611
|
+
evidenceSignals: assessment.signals,
|
|
2612
|
+
startingFailureClass: startingFailureClass,
|
|
2613
|
+
startingBlockerFingerprint: startingBlockerFingerprint,
|
|
2614
|
+
startingEvidenceHash: startingEvidenceHash,
|
|
2615
|
+
latestFailureClass: latestFailureClass,
|
|
2616
|
+
latestBlockerFingerprint: assessment.blockerFingerprint,
|
|
2617
|
+
latestEvidenceHash: assessment.evidenceHash,
|
|
2618
|
+
requiredEvidence: requiredEvidence,
|
|
2619
|
+
missingEvidence: missingEvidence,
|
|
2620
|
+
artifactPaths: artifactPaths,
|
|
2621
|
+
changedFiles: changedFiles,
|
|
2622
|
+
blockers: blockers,
|
|
2623
|
+
nextAllowedAction: canContinueRun ? ((directive === null || directive === void 0 ? void 0 : directive.nextCommands[0]) || 'continue_gate') : 'collect_required_recovery_proof',
|
|
2624
|
+
forbiddenActions: Array.from(new Set(__spreadArray([
|
|
2625
|
+
'Do not continue product-code repair until recovery execution proof is proof_ready.'
|
|
2626
|
+
], __read(cleanList(directive === null || directive === void 0 ? void 0 : directive.forbiddenActions, 30, 500)), false))),
|
|
2627
|
+
createdAt: createdAt
|
|
2628
|
+
};
|
|
2629
|
+
}
|
|
2630
|
+
function validateResolveIOAIManagerRecoveryExecutionProofContract(value) {
|
|
2631
|
+
var source = value || {};
|
|
2632
|
+
var validStatuses = [
|
|
2633
|
+
'proof_ready',
|
|
2634
|
+
'waiting_for_execution',
|
|
2635
|
+
'waiting_for_new_evidence',
|
|
2636
|
+
'blocked_same_evidence',
|
|
2637
|
+
'manual_handoff'
|
|
2638
|
+
];
|
|
2639
|
+
var status = cleanText(source.status, 120);
|
|
2640
|
+
var normalized = {
|
|
2641
|
+
contractId: cleanText(source.contractId || source.contract_id, 180),
|
|
2642
|
+
directiveId: cleanText(source.directiveId || source.directive_id, 180),
|
|
2643
|
+
surface: cleanText(source.surface, 120),
|
|
2644
|
+
dispatchAction: cleanText(source.dispatchAction || source.dispatch_action, 120),
|
|
2645
|
+
phase: cleanText(source.phase, 120),
|
|
2646
|
+
status: validStatuses.includes(status) ? status : 'manual_handoff',
|
|
2647
|
+
canContinueRun: source.canContinueRun === true || source.can_continue_run === true,
|
|
2648
|
+
canRunProductRepair: source.canRunProductRepair === true || source.can_run_product_repair === true,
|
|
2649
|
+
canRunExpensiveModel: source.canRunExpensiveModel === true || source.can_run_expensive_model === true,
|
|
2650
|
+
canResetLoopBudget: source.canResetLoopBudget === true || source.can_reset_loop_budget === true,
|
|
2651
|
+
proofRequiredBeforeContinuation: source.proofRequiredBeforeContinuation === true || source.proof_required_before_continuation === true,
|
|
2652
|
+
requiresNewEvidence: source.requiresNewEvidence === true || source.requires_new_evidence === true,
|
|
2653
|
+
newEvidence: source.newEvidence === true || source.new_evidence === true,
|
|
2654
|
+
materialEvidence: source.materialEvidence === true || source.material_evidence === true,
|
|
2655
|
+
evidenceStrength: cleanText(source.evidenceStrength || source.evidence_strength, 120),
|
|
2656
|
+
evidenceSignals: cleanList(source.evidenceSignals || source.evidence_signals, 30, 200),
|
|
2657
|
+
startingFailureClass: cleanText(source.startingFailureClass || source.starting_failure_class, 120),
|
|
2658
|
+
startingBlockerFingerprint: cleanText(source.startingBlockerFingerprint || source.starting_blocker_fingerprint, 180),
|
|
2659
|
+
startingEvidenceHash: cleanText(source.startingEvidenceHash || source.starting_evidence_hash, 180),
|
|
2660
|
+
latestFailureClass: cleanText(source.latestFailureClass || source.latest_failure_class, 120),
|
|
2661
|
+
latestBlockerFingerprint: cleanText(source.latestBlockerFingerprint || source.latest_blocker_fingerprint, 180),
|
|
2662
|
+
latestEvidenceHash: cleanText(source.latestEvidenceHash || source.latest_evidence_hash, 180),
|
|
2663
|
+
requiredEvidence: cleanList(source.requiredEvidence || source.required_evidence, 30, 500),
|
|
2664
|
+
missingEvidence: cleanList(source.missingEvidence || source.missing_evidence, 30, 500),
|
|
2665
|
+
artifactPaths: cleanList(source.artifactPaths || source.artifact_paths, 80, 500),
|
|
2666
|
+
changedFiles: cleanList(source.changedFiles || source.changed_files, 80, 500),
|
|
2667
|
+
blockers: cleanList(source.blockers, 30, 500),
|
|
2668
|
+
nextAllowedAction: cleanText(source.nextAllowedAction || source.next_allowed_action, 180),
|
|
2669
|
+
forbiddenActions: cleanList(source.forbiddenActions || source.forbidden_actions, 30, 500),
|
|
2670
|
+
createdAt: cleanText(source.createdAt || source.created_at, 120)
|
|
2671
|
+
};
|
|
2672
|
+
var blockers = [
|
|
2673
|
+
normalized.contractId ? '' : 'Recovery execution proof is missing contractId.',
|
|
2674
|
+
normalized.directiveId || normalized.status === 'manual_handoff' ? '' : 'Recovery execution proof is missing directiveId.',
|
|
2675
|
+
normalized.dispatchAction ? '' : 'Recovery execution proof is missing dispatchAction.',
|
|
2676
|
+
validStatuses.includes(status) ? '' : 'Recovery execution proof has an invalid status.',
|
|
2677
|
+
normalized.canContinueRun && normalized.status !== 'proof_ready' ? 'Recovery execution cannot continue unless status=proof_ready.' : '',
|
|
2678
|
+
normalized.status === 'proof_ready' && normalized.proofRequiredBeforeContinuation && !normalized.materialEvidence ? 'Proof-ready recovery requires materialEvidence=true when proof is required.' : '',
|
|
2679
|
+
normalized.status === 'proof_ready' && normalized.requiresNewEvidence && !normalized.newEvidence ? 'Proof-ready recovery requires newEvidence=true when new evidence is required.' : '',
|
|
2680
|
+
normalized.canRunProductRepair && !normalized.canContinueRun ? 'Product repair cannot run before recovery proof can continue.' : '',
|
|
2681
|
+
normalized.canRunExpensiveModel && !normalized.canContinueRun ? 'Expensive model cannot run before recovery proof can continue.' : '',
|
|
2682
|
+
normalized.status !== 'proof_ready' && normalized.missingEvidence.length === 0 && normalized.proofRequiredBeforeContinuation ? 'Blocked recovery proof must list missingEvidence.' : '',
|
|
2683
|
+
normalized.forbiddenActions.length ? '' : 'Recovery execution proof must include forbiddenActions.'
|
|
2684
|
+
].filter(Boolean);
|
|
2685
|
+
return {
|
|
2686
|
+
valid: blockers.length === 0,
|
|
2687
|
+
status: blockers.length ? 'blocked' : normalized.status,
|
|
2688
|
+
blockers: blockers,
|
|
2689
|
+
normalized: normalized
|
|
2690
|
+
};
|
|
2691
|
+
}
|
|
2692
|
+
function newListEntries(current, previous) {
|
|
2693
|
+
var existing = new Set(previous.map(function (entry) { return cleanText(entry, 500); }).filter(Boolean));
|
|
2694
|
+
return current
|
|
2695
|
+
.map(function (entry) { return cleanText(entry, 500); })
|
|
2696
|
+
.filter(function (entry) { return entry && !existing.has(entry); });
|
|
2697
|
+
}
|
|
2698
|
+
function recordLane(value) {
|
|
2699
|
+
return cleanText(value === null || value === void 0 ? void 0 : value.lane, 80);
|
|
2700
|
+
}
|
|
2701
|
+
function recordStepType(value) {
|
|
2702
|
+
return cleanText(value === null || value === void 0 ? void 0 : value.stepType, 80);
|
|
2703
|
+
}
|
|
2704
|
+
function recordFailureClass(value) {
|
|
2705
|
+
var valueText = cleanText(value === null || value === void 0 ? void 0 : value.failureClass, 80);
|
|
2706
|
+
return valueText ? normalizeResolveIOAIManagerFailureClass(valueText) : '';
|
|
2707
|
+
}
|
|
2708
|
+
function materialEvidenceText(record, paths) {
|
|
2709
|
+
if (paths === void 0) { paths = []; }
|
|
2710
|
+
return __spreadArray([
|
|
2711
|
+
cleanText(record === null || record === void 0 ? void 0 : record.blocker, 1200),
|
|
2712
|
+
cleanText(record === null || record === void 0 ? void 0 : record.summary, 1200)
|
|
2713
|
+
], __read(paths.map(function (path) { return cleanText(path, 500); })), false).filter(Boolean).join(' ').toLowerCase();
|
|
2714
|
+
}
|
|
2715
|
+
function hasMaterialEvidenceLanguage(text) {
|
|
2716
|
+
return /(business|assertion|proof|before|after|dom|trace|stack|network|mongo|query|diff|scope|diagnosis|journey|contract|workflow|compile|build|preflight|infra|chrome|puppeteer|release|publish|deploy|sample|seed|route|auth|hydration|performance|slow|owner|root.?cause|repro|pdf|export|upload|import|filter|invoice|saved|calculated|comparison|report)/i.test(text);
|
|
2717
|
+
}
|
|
2718
|
+
function assessResolveIOAIManagerEvidenceChange(previous, current, fallbackObjective) {
|
|
2719
|
+
var currentRecord = current || {};
|
|
2720
|
+
var previousRecord = previous;
|
|
2721
|
+
var previousEvidenceHash = previousRecord ? cleanText(previousRecord.evidenceHash, 160) || hashResolveIOAIManagerEvidence(previousRecord) : '';
|
|
2722
|
+
var currentEvidenceHash = hashResolveIOAIManagerEvidence(currentRecord);
|
|
2723
|
+
var previousBlockerFingerprint = previousRecord
|
|
2724
|
+
? cleanText(previousRecord.blockerFingerprint, 160) || resolveResolveIOAIManagerBlockerFingerprint(previousRecord, fallbackObjective)
|
|
2725
|
+
: '';
|
|
2726
|
+
var currentBlockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(currentRecord, fallbackObjective);
|
|
2727
|
+
var previousChangedFiles = cleanList(previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.changedFiles, 80, 500);
|
|
2728
|
+
var currentChangedFiles = cleanList(currentRecord.changedFiles, 80, 500);
|
|
2729
|
+
var previousArtifactPaths = cleanList(previousRecord === null || previousRecord === void 0 ? void 0 : previousRecord.artifactPaths, 80, 500);
|
|
2730
|
+
var currentArtifactPaths = cleanList(currentRecord.artifactPaths, 80, 500);
|
|
2731
|
+
var addedChangedFiles = newListEntries(currentChangedFiles, previousChangedFiles);
|
|
2732
|
+
var addedArtifactPaths = newListEntries(currentArtifactPaths, previousArtifactPaths);
|
|
2733
|
+
var signals = [];
|
|
2734
|
+
if (previousEvidenceHash && currentEvidenceHash !== previousEvidenceHash) {
|
|
2735
|
+
signals.push('evidence_hash_changed');
|
|
2736
|
+
}
|
|
2737
|
+
if (previousBlockerFingerprint && currentBlockerFingerprint !== previousBlockerFingerprint) {
|
|
2738
|
+
signals.push('blocker_fingerprint_changed');
|
|
2739
|
+
}
|
|
2740
|
+
if (recordLane(previousRecord) && recordLane(previousRecord) !== recordLane(currentRecord)) {
|
|
2741
|
+
signals.push('lane_changed');
|
|
2742
|
+
}
|
|
2743
|
+
if (recordStepType(previousRecord) && recordStepType(previousRecord) !== recordStepType(currentRecord)) {
|
|
2744
|
+
signals.push('step_type_changed');
|
|
2745
|
+
}
|
|
2746
|
+
if (recordFailureClass(previousRecord) && recordFailureClass(previousRecord) !== recordFailureClass(currentRecord)) {
|
|
2747
|
+
signals.push('failure_class_changed');
|
|
2748
|
+
}
|
|
2749
|
+
if (addedChangedFiles.length) {
|
|
2750
|
+
signals.push('changed_files_added');
|
|
2751
|
+
}
|
|
2752
|
+
if (addedArtifactPaths.length) {
|
|
2753
|
+
signals.push('artifact_paths_added');
|
|
2754
|
+
}
|
|
2755
|
+
if (isPassingOutcome(currentRecord)) {
|
|
2756
|
+
signals.push('passing_outcome');
|
|
2757
|
+
}
|
|
2758
|
+
var changed = signals.length > 0;
|
|
2759
|
+
var evidenceText = materialEvidenceText(currentRecord, addedArtifactPaths);
|
|
2760
|
+
var pathOrSummaryHasMaterialSignal = hasMaterialEvidenceLanguage(evidenceText);
|
|
2761
|
+
var proof = signals.includes('passing_outcome');
|
|
2762
|
+
var structuralChange = signals.some(function (signal) { return /blocker_fingerprint_changed|lane_changed|step_type_changed|failure_class_changed/.test(signal); });
|
|
2763
|
+
var materialArtifact = addedArtifactPaths.length > 0 && pathOrSummaryHasMaterialSignal;
|
|
2764
|
+
var materialChangedFiles = addedChangedFiles.length > 0
|
|
2765
|
+
&& /diagnosis|owner|scope|diff|root.?cause|failing path|stack|trace|business|proof|compile|release|deploy|workflow|journey/i.test(evidenceText);
|
|
2766
|
+
var material = proof || structuralChange || materialArtifact || materialChangedFiles;
|
|
2767
|
+
var strength = proof
|
|
2768
|
+
? 'proof'
|
|
2769
|
+
: material
|
|
2770
|
+
? 'material'
|
|
2771
|
+
: changed
|
|
2772
|
+
? 'weak'
|
|
2773
|
+
: 'none';
|
|
2774
|
+
return {
|
|
2775
|
+
changed: changed,
|
|
2776
|
+
material: material,
|
|
2777
|
+
strength: strength,
|
|
2778
|
+
signals: signals,
|
|
2779
|
+
evidenceHash: currentEvidenceHash,
|
|
2780
|
+
blockerFingerprint: currentBlockerFingerprint
|
|
2781
|
+
};
|
|
2782
|
+
}
|
|
2783
|
+
function proposedActionIsProductRepair(value) {
|
|
2784
|
+
var normalized = cleanText(value, 120);
|
|
2785
|
+
return /product|code|repair|build|business|journey|workflow/i.test(normalized)
|
|
2786
|
+
&& !/infra|compile|diagnosis|manual|evidence|release|publish/i.test(normalized);
|
|
2787
|
+
}
|
|
2788
|
+
function decideResolveIOAIManagerRecoveryGate(input) {
|
|
2789
|
+
var checkpoint = input.checkpoint;
|
|
2790
|
+
var hasCurrent = !!input.current;
|
|
2791
|
+
var current = input.current || {};
|
|
2792
|
+
var assessment = hasCurrent
|
|
2793
|
+
? assessResolveIOAIManagerEvidenceChange(checkpoint, current, checkpoint.objective)
|
|
2794
|
+
: {
|
|
2795
|
+
changed: false,
|
|
2796
|
+
material: false,
|
|
2797
|
+
strength: 'none',
|
|
2798
|
+
signals: [],
|
|
2799
|
+
evidenceHash: checkpoint.evidenceHash,
|
|
2800
|
+
blockerFingerprint: checkpoint.blockerFingerprint
|
|
2801
|
+
};
|
|
2802
|
+
var blockerFingerprint = assessment.blockerFingerprint;
|
|
2803
|
+
var evidenceHash = assessment.evidenceHash;
|
|
2804
|
+
var changedFiles = hasCurrent ? cleanList(current.changedFiles, 80, 500) : checkpoint.changedFiles;
|
|
2805
|
+
var artifactPaths = hasCurrent ? cleanList(current.artifactPaths, 80, 500) : checkpoint.artifactPaths;
|
|
2806
|
+
var evidenceChanged = assessment.changed;
|
|
2807
|
+
var proposedAction = cleanText(input.proposedAction || checkpoint.allowedAction, 120);
|
|
2808
|
+
var productRepairRequested = proposedActionIsProductRepair(proposedAction);
|
|
2809
|
+
var missingEvidence = checkpoint.requiredEvidence.filter(function (required) {
|
|
2810
|
+
var normalized = cleanText(required, 120).toLowerCase();
|
|
2811
|
+
if (!normalized) {
|
|
2812
|
+
return false;
|
|
2813
|
+
}
|
|
2814
|
+
if (/artifact|log|proof|gate|evidence/.test(normalized)) {
|
|
2815
|
+
return !artifactPaths.length && !current.evidenceHash;
|
|
2816
|
+
}
|
|
2817
|
+
if (/diff|changed files|owner|scope|file/.test(normalized)) {
|
|
2818
|
+
return !changedFiles.length;
|
|
2819
|
+
}
|
|
2820
|
+
return false;
|
|
2821
|
+
});
|
|
2822
|
+
var makeDecision = function (action, reason, overrides) {
|
|
2823
|
+
if (overrides === void 0) { overrides = {}; }
|
|
2824
|
+
return (__assign({ action: action, reason: reason, canRunProductRepair: checkpoint.productRepairAllowed, canRunExpensiveModel: checkpoint.expensiveModelAllowed, shouldResetLoopBudget: false, shouldIncrementAttempt: action === 'allow', newEvidence: evidenceChanged, materialEvidence: assessment.material, evidenceStrength: assessment.strength, evidenceSignals: assessment.signals, blockerFingerprint: blockerFingerprint, evidenceHash: evidenceHash, missingEvidence: missingEvidence, checkpoint: __assign(__assign({}, checkpoint), { updatedAt: isoNow(input.now) }) }, overrides));
|
|
2825
|
+
};
|
|
2826
|
+
if (checkpoint.status === 'complete') {
|
|
2827
|
+
return makeDecision('complete', 'recovery_gate_checkpoint_already_complete', {
|
|
2828
|
+
canRunProductRepair: false,
|
|
2829
|
+
canRunExpensiveModel: false,
|
|
2830
|
+
shouldIncrementAttempt: false
|
|
2831
|
+
});
|
|
2832
|
+
}
|
|
2833
|
+
if (checkpoint.status === 'manual_handoff' && input.operatorApproved !== true) {
|
|
2834
|
+
return makeDecision('manual_handoff', 'recovery_gate_manual_handoff_requires_operator_approval', {
|
|
2835
|
+
canRunProductRepair: false,
|
|
2836
|
+
canRunExpensiveModel: false,
|
|
2837
|
+
shouldIncrementAttempt: false
|
|
2838
|
+
});
|
|
2839
|
+
}
|
|
2840
|
+
if (productRepairRequested && !checkpoint.productRepairAllowed) {
|
|
2841
|
+
return makeDecision('reject_action', 'recovery_gate_product_repair_not_allowed_for_checkpoint', {
|
|
2842
|
+
canRunProductRepair: false,
|
|
2843
|
+
canRunExpensiveModel: false,
|
|
2844
|
+
shouldIncrementAttempt: false
|
|
2845
|
+
});
|
|
2846
|
+
}
|
|
2847
|
+
if (checkpoint.status === 'parked' && !evidenceChanged) {
|
|
2848
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_parked_until_new_evidence', {
|
|
2849
|
+
canRunProductRepair: false,
|
|
2850
|
+
canRunExpensiveModel: false,
|
|
2851
|
+
shouldIncrementAttempt: false
|
|
2852
|
+
});
|
|
2853
|
+
}
|
|
2854
|
+
if (checkpoint.status === 'parked' && evidenceChanged && !assessment.material) {
|
|
2855
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_weak_evidence_requires_material_signal', {
|
|
2856
|
+
canRunProductRepair: false,
|
|
2857
|
+
canRunExpensiveModel: false,
|
|
2858
|
+
shouldIncrementAttempt: false
|
|
2859
|
+
});
|
|
2860
|
+
}
|
|
2861
|
+
if (checkpoint.attempts >= checkpoint.maxAttemptsBeforePark && !evidenceChanged) {
|
|
2862
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_attempt_limit_requires_new_evidence', {
|
|
2863
|
+
canRunProductRepair: false,
|
|
2864
|
+
canRunExpensiveModel: false,
|
|
2865
|
+
shouldIncrementAttempt: false
|
|
2866
|
+
});
|
|
2867
|
+
}
|
|
2868
|
+
if (checkpoint.attempts >= checkpoint.maxAttemptsBeforePark && evidenceChanged && !assessment.material) {
|
|
2869
|
+
return makeDecision('collect_new_evidence', 'recovery_gate_attempt_limit_requires_material_evidence', {
|
|
2870
|
+
canRunProductRepair: false,
|
|
2871
|
+
canRunExpensiveModel: false,
|
|
2872
|
+
shouldIncrementAttempt: false
|
|
2873
|
+
});
|
|
2874
|
+
}
|
|
2875
|
+
if (evidenceChanged) {
|
|
2876
|
+
var currentFailureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);
|
|
2877
|
+
var currentCanRunProductRepair = checkpoint.productRepairAllowed
|
|
2878
|
+
|| !/^(infra|compile|diagnosis|release)$/i.test(currentFailureClass);
|
|
2879
|
+
return makeDecision('allow', 'recovery_gate_new_material_evidence_unblocks_retry', {
|
|
2880
|
+
canRunProductRepair: currentCanRunProductRepair,
|
|
2881
|
+
canRunExpensiveModel: checkpoint.expensiveModelAllowed || currentCanRunProductRepair,
|
|
2882
|
+
shouldResetLoopBudget: true
|
|
2883
|
+
});
|
|
2884
|
+
}
|
|
2885
|
+
return makeDecision('allow', 'recovery_gate_action_allowed');
|
|
2886
|
+
}
|
|
2887
|
+
function failureKey(record) {
|
|
2888
|
+
if (!record) {
|
|
2889
|
+
return '';
|
|
2890
|
+
}
|
|
2891
|
+
var failureClass = normalizeResolveIOAIManagerFailureClass(record.failureClass);
|
|
2892
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(record);
|
|
2893
|
+
return "".concat(cleanText(record.lane, 80), ":").concat(cleanText(record.stepType, 80), ":").concat(failureClass, ":").concat(blockerFingerprint);
|
|
2894
|
+
}
|
|
2895
|
+
function failureEvidenceKey(record) {
|
|
2896
|
+
return "".concat(failureKey(record), ":").concat(hashResolveIOAIManagerEvidence(record));
|
|
2897
|
+
}
|
|
2898
|
+
function isPassingOutcome(record) {
|
|
2899
|
+
return /^(pass|accepted|ready_to_publish|published|ready_for_merge|complete|completed)$/i.test(cleanText(record === null || record === void 0 ? void 0 : record.outcome, 80));
|
|
2900
|
+
}
|
|
2901
|
+
function isManualOutcome(record) {
|
|
2902
|
+
return /^(manual_handoff|park_manual|stopped)$/i.test(cleanText(record === null || record === void 0 ? void 0 : record.outcome, 80));
|
|
2903
|
+
}
|
|
2904
|
+
function buildResolveIOAIManagerRecoveryPlan(input) {
|
|
2905
|
+
if (input === void 0) { input = {}; }
|
|
2906
|
+
var action = cleanText(input.action, 80) || 'continue';
|
|
2907
|
+
var reason = cleanText(input.reason, 240);
|
|
2908
|
+
var failureClass = normalizeResolveIOAIManagerFailureClass(input.failureClass);
|
|
2909
|
+
var lane = cleanText(input.lane, 80) || 'supervisor';
|
|
2910
|
+
var stepType = cleanText(input.stepType, 80) || 'unknown';
|
|
2911
|
+
var blocker = cleanText(input.blocker, 700);
|
|
2912
|
+
var changedFiles = cleanList(input.changedFiles, 12, 240);
|
|
2913
|
+
var artifactPaths = cleanList(input.artifactPaths, 12, 240);
|
|
2914
|
+
var maxAttemptsBeforePark = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);
|
|
2915
|
+
var commonNotes = [
|
|
2916
|
+
reason ? "policy_reason=".concat(reason) : '',
|
|
2917
|
+
blocker ? "blocker=".concat(blocker) : '',
|
|
2918
|
+
changedFiles.length ? "changed_files=".concat(changedFiles.join(', ')) : '',
|
|
2919
|
+
artifactPaths.length ? "artifacts=".concat(artifactPaths.join(', ')) : ''
|
|
2920
|
+
].filter(Boolean);
|
|
2921
|
+
var base = {
|
|
2922
|
+
lane: lane,
|
|
2923
|
+
stepType: stepType,
|
|
2924
|
+
maxAttemptsBeforePark: maxAttemptsBeforePark,
|
|
2925
|
+
notes: commonNotes
|
|
2926
|
+
};
|
|
2927
|
+
var makePlan = function (recoveryClass, nextActionLabel, objective, allowedAction, productRepairAllowed, expensiveModelAllowed, finiteSteps, requiredEvidence, loopResetEvidence, forbiddenActions) { return (__assign(__assign({}, base), { recoveryClass: recoveryClass, nextActionLabel: nextActionLabel, objective: objective, allowedAction: allowedAction, productRepairAllowed: productRepairAllowed, expensiveModelAllowed: expensiveModelAllowed, finiteSteps: finiteSteps, requiredEvidence: requiredEvidence, loopResetEvidence: loopResetEvidence, forbiddenActions: forbiddenActions })); };
|
|
2928
|
+
if (action === 'reset_loop_budget') {
|
|
2929
|
+
return makePlan('advance_after_proof', 'Advance After Proof', 'Checkpoint the passing evidence and move to the next required gate.', 'advance_to_next_gate', false, false, [
|
|
2930
|
+
'Record the passing artifact, changed files, and gate result.',
|
|
2931
|
+
'Reset the loop counter because a real gate passed.',
|
|
2932
|
+
'Select the next unmet deterministic gate instead of repeating the previous repair.'
|
|
2933
|
+
], ['passing gate record', 'artifact or log proving the passed check'], ['new passing gate result', 'new business proof artifact'], ['rerun the same repair after a pass', 'mark accepted without the required downstream gate']);
|
|
2934
|
+
}
|
|
2935
|
+
if (action === 'manual_handoff') {
|
|
2936
|
+
return makePlan('manual_handoff', 'Manual Review', 'Stop autonomous repair and expose the blocker, evidence, and last safe state.', 'manual_review_only', false, false, [
|
|
2937
|
+
'Freeze further product-code edits.',
|
|
2938
|
+
'Show the blocker fingerprint, evidence hash, and prior attempts.',
|
|
2939
|
+
'Require a human edit to classification, scope, or retry policy before another model/code loop.'
|
|
2940
|
+
], ['blocker fingerprint', 'evidence hash', 'attempt history'], ['manual policy change', 'new external evidence'], ['start another automatic model repair', 'hide the failed evidence']);
|
|
2941
|
+
}
|
|
2942
|
+
if (action === 'budget_stop') {
|
|
2943
|
+
return makePlan('manual_handoff', 'Budget Stop Review', 'Stop autonomous model/code loops until a cheaper scoped next action is selected.', 'budget_review_only', false, false, [
|
|
2944
|
+
'Freeze further model repair loops.',
|
|
2945
|
+
'Show the prompt/token/runtime budget that tripped the guard.',
|
|
2946
|
+
'Select a cheaper deterministic gate, infra repair, diagnosis revision, or manual scope edit before resuming.'
|
|
2947
|
+
], ['budget guard reason', 'latest prompt estimate', 'last blocker/evidence hash'], ['manual scope reduction', 'new deterministic evidence', 'approved budget policy change'], ['start another broad model prompt', 'reset budget without new evidence', 'hide cost context']);
|
|
2948
|
+
}
|
|
2949
|
+
if (failureClass === 'diagnosis' || stepType === 'diagnosis_gate') {
|
|
2950
|
+
return makePlan('diagnosis_only', 'Run Diagnosis Gate', 'Produce a falsifiable root-cause diagnosis before any repair.', 'read_only_diagnosis', false, true, [
|
|
2951
|
+
'Reproduce or explicitly classify the customer issue.',
|
|
2952
|
+
'Accept one falsifiable hypothesis and record rejected alternatives.',
|
|
2953
|
+
'Identify the frontend/backend/shared failing path.',
|
|
2954
|
+
'Select a small owner_files set.',
|
|
2955
|
+
'Define exact before/action/after business proof.'
|
|
2956
|
+
], ['issue_case', 'accepted_hypothesis', 'rejected_alternatives', 'failing_path', 'owner_files', 'proof_plan'], ['new reproduction artifact', 'new query/log/code evidence', 'validated diagnosis gate'], ['edit product code', 'run broad repo repair', 'accept route-load evidence as success']);
|
|
2957
|
+
}
|
|
2958
|
+
if (failureClass === 'owner_scope' || failureClass === 'out_of_scope' || /out.?of.?scope|owner_files/i.test(reason)) {
|
|
2959
|
+
return makePlan('diagnosis_revision', 'Revise Diagnosis Scope', 'Revise owner_files only when new evidence proves the current scope is wrong.', 'diagnosis_revision_only', false, true, [
|
|
2960
|
+
'Compare changed files against the diagnosis owner_files.',
|
|
2961
|
+
'Collect evidence proving why the new file is in the failing path.',
|
|
2962
|
+
'Update accepted_hypothesis, failing_path, owner_files, and proof_plan together.',
|
|
2963
|
+
'Resume repair only after the revised gate validates.'
|
|
2964
|
+
], ['out-of-scope file list', 'new failing-path evidence', 'revalidated diagnosis gate'], ['revised owner_files with evidence', 'new business proof requirement'], ['keep broad edits without diagnosis', 'add convenience refactors', 'continue repair outside owner_files']);
|
|
2965
|
+
}
|
|
2966
|
+
if (action === 'retry_infra') {
|
|
2967
|
+
var isCompile = failureClass === 'compile';
|
|
2968
|
+
return makePlan(isCompile ? 'compile_repair' : 'infra_repair', isCompile ? 'Repair Compile Gate' : 'Repair Infra Gate', isCompile
|
|
2969
|
+
? 'Fix the deterministic compile/build blocker before spending another product repair loop.'
|
|
2970
|
+
: 'Fix the deterministic harness/browser/server/Mongo blocker before product repair.', isCompile ? 'compile_repair_only' : 'infra_repair_only', false, false, isCompile
|
|
2971
|
+
? [
|
|
2972
|
+
'Read the exact compile/build log and identify the first actionable error.',
|
|
2973
|
+
'Fix missing dependency, stale artifact, command, cache, or type wiring required by the compile gate.',
|
|
2974
|
+
'Rerun the same finite compile command.',
|
|
2975
|
+
'Return the compile log artifact and status.'
|
|
2976
|
+
]
|
|
2977
|
+
: [
|
|
2978
|
+
'Run preflight for Puppeteer, Chrome executable, ports, Mongo/settings, and startup command.',
|
|
2979
|
+
'Repair only the failing harness/environment item.',
|
|
2980
|
+
'Rerun the same infra check.',
|
|
2981
|
+
'Return the infra log and pass/fail status.'
|
|
2982
|
+
], isCompile
|
|
2983
|
+
? ['compile command', 'compile log artifact', 'first failing error fixed or still failing']
|
|
2984
|
+
: ['preflight command', 'infra log artifact', 'specific repaired environment item'], ['same check now passes', 'new infra/compile blocker hash'], ['run product-code model repair', 'count this as product failure', 'accept route/business success without the compile/infra gate']);
|
|
2985
|
+
}
|
|
2986
|
+
if (action === 'park_repeated_failure' || action === 'park_ping_pong') {
|
|
2987
|
+
return makePlan('blocked_until_new_evidence', action === 'park_ping_pong' ? 'Park Ping-Pong Loop' : 'Park Repeated Failure', 'Stop the current loop until new evidence changes the diagnosis, route, or repair target.', 'collect_new_evidence_only', false, false, [
|
|
2988
|
+
'Do not rerun the same prompt or same repair.',
|
|
2989
|
+
'Show the repeated blocker and evidence hash.',
|
|
2990
|
+
'Collect a new artifact: failing DOM state, stack trace, network response, Mongo delta, compile log, or revised diagnosis.',
|
|
2991
|
+
'Reset the loop only after material evidence changes the blocker, proof, diagnosis, journey, or actionable trace.'
|
|
2992
|
+
], ['same failure count', 'blocker fingerprint', 'evidence hash'], ['changed blocker fingerprint', 'changed evidence hash', 'new artifact path', 'business/compile/infra/release proof artifact', 'revised diagnosis or journey contract', 'new actionable trace or data delta'], ['alternate between two failed patches', 'increase loop budget without evidence', 'hide the park reason']);
|
|
2993
|
+
}
|
|
2994
|
+
if (failureClass === 'journey') {
|
|
2995
|
+
return makePlan('journey_contract_repair', 'Repair Journey Contract', 'Fix the first/next/last workflow contract before app code work continues.', 'journey_contract_repair', false, true, [
|
|
2996
|
+
'Open docs/APP_JOURNEY_CONTRACT.md.',
|
|
2997
|
+
'Define first_screen, north_star_workflow, screen_sequence, data_story, completion_states, and qa_assertions.',
|
|
2998
|
+
'Give every north_star_workflow step a stable id and map each screen_sequence row with workflow_step_id or exact route/CTA.',
|
|
2999
|
+
'Map every qa_assertions row to workflow_step_id or covers_workflow_step_ids so QA can walk first/next/last deterministically.',
|
|
3000
|
+
'Ensure each CTA maps to an action, route, method, calculation, or state transition.',
|
|
3001
|
+
'Validate that sample data can drive the promised workflow.'
|
|
3002
|
+
], ['validated journey_contract JSON', 'CTA-to-action mapping', 'screen-to-workflow mapping', 'workflow QA assertions mapped to step ids'], ['journey validation passes', 'new workflow QA rows generated'], ['build empty routes', 'add link-only dashboard actions', 'defer workflow design to wow pass']);
|
|
3003
|
+
}
|
|
3004
|
+
if (failureClass === 'release') {
|
|
3005
|
+
return makePlan('release_repair', 'Repair Release Gate', 'Repair deploy/publish/sample-data release evidence with a hotfix-first path before any repeated full deploy.', 'release_repair_only', false, false, [
|
|
3006
|
+
'Read the deploy/publish/sample-data log.',
|
|
3007
|
+
'Identify whether the blocker is domain, asset, seed data, route, permission, or CDN.',
|
|
3008
|
+
'Prefer backend hotfix, release config, domain, cache, or seed-data repair when the product artifact already has business proof.',
|
|
3009
|
+
'Rerun only the failed release gate.'
|
|
3010
|
+
], ['deploy or publish log', 'sample-data status', 'failed release gate rerun'], ['release gate passes', 'new release blocker hash'], ['change core workflow after business QA passed', 'mark accepted from scorecard only', 'rerun full builder loop', 'repeat deploy of same artifact without force_deploy evidence']);
|
|
3011
|
+
}
|
|
3012
|
+
if (failureClass === 'business' || failureClass === 'qa_evidence' || failureClass === 'route') {
|
|
3013
|
+
return makePlan('business_proof_repair', 'Repair Business Proof', 'Fix the exact failing workflow assertion and prove before/action/after behavior.', 'business_repair', true, true, [
|
|
3014
|
+
'Open the failing QA row or proof_plan.',
|
|
3015
|
+
'Trace the UI action to method/publication/query/calculation.',
|
|
3016
|
+
'Patch the smallest owner or workflow files.',
|
|
3017
|
+
'Rerun only the failed business assertion.',
|
|
3018
|
+
'Record DOM/data/Mongo/artifact proof.'
|
|
3019
|
+
], ['failing assertion', 'action trace', 'business proof artifact'], ['business assertion passes', 'new failed assertion with new evidence'], ['treat route load as success', 'rerun unrelated QA rows first', 'accept scorecard-only evidence']);
|
|
3020
|
+
}
|
|
3021
|
+
if (input.productRepairFailure !== false || failureClass === 'product_code') {
|
|
3022
|
+
return makePlan('product_code_repair', 'Run Targeted Product Repair', 'Repair the current product-code blocker with the smallest scoped edit and immediate proof.', 'targeted_product_repair', true, true, [
|
|
3023
|
+
'Inspect the current blocker, artifacts, changed files, and owner/workflow scope.',
|
|
3024
|
+
'Form one small repair hypothesis.',
|
|
3025
|
+
'Patch only files justified by the active diagnosis or journey contract.',
|
|
3026
|
+
'Rerun the smallest failed gate.',
|
|
3027
|
+
'Record new evidence before any additional loop.'
|
|
3028
|
+
], ['owner/workflow scope', 'repair diff', 'failed gate rerun artifact'], ['new evidence hash', 'same gate passes'], ['broad repo search-and-edit', 'rerun the same prompt without inspecting artifacts', 'change unrelated UI polish']);
|
|
3029
|
+
}
|
|
3030
|
+
return makePlan('continue', 'Continue Current Gate', 'Continue the current lane because no blocking loop or infra condition was detected.', 'continue', false, false, [
|
|
3031
|
+
'Use the active lane memory.',
|
|
3032
|
+
'Run the next finite gate.',
|
|
3033
|
+
'Record artifacts and evidence hash.'
|
|
3034
|
+
], ['active lane memory', 'finite gate artifact'], ['new gate result', 'new artifact path'], ['spawn duplicate runners', 'advance without evidence']);
|
|
3035
|
+
}
|
|
3036
|
+
function collectOpenTail(records) {
|
|
3037
|
+
var tail = [];
|
|
3038
|
+
for (var index = records.length - 1; index >= 0; index -= 1) {
|
|
3039
|
+
var record = records[index];
|
|
3040
|
+
if (isPassingOutcome(record)) {
|
|
3041
|
+
break;
|
|
3042
|
+
}
|
|
3043
|
+
tail.unshift(record);
|
|
3044
|
+
}
|
|
3045
|
+
return tail;
|
|
3046
|
+
}
|
|
3047
|
+
function countSameFailure(records, current) {
|
|
3048
|
+
var currentKey = failureKey(current);
|
|
3049
|
+
var count = 0;
|
|
3050
|
+
for (var index = records.length - 1; index >= 0; index -= 1) {
|
|
3051
|
+
var record = records[index];
|
|
3052
|
+
if (isPassingOutcome(record)) {
|
|
3053
|
+
break;
|
|
3054
|
+
}
|
|
3055
|
+
if (failureKey(record) !== currentKey) {
|
|
3056
|
+
break;
|
|
3057
|
+
}
|
|
3058
|
+
count += 1;
|
|
3059
|
+
}
|
|
3060
|
+
return count;
|
|
3061
|
+
}
|
|
3062
|
+
function previousRecordForPolicy(history, current, currentWasExplicit) {
|
|
3063
|
+
if (!history.length) {
|
|
3064
|
+
return undefined;
|
|
3065
|
+
}
|
|
3066
|
+
if (!currentWasExplicit) {
|
|
3067
|
+
return history.length > 1 ? history[history.length - 2] : undefined;
|
|
3068
|
+
}
|
|
3069
|
+
var last = history[history.length - 1];
|
|
3070
|
+
if (failureEvidenceKey(last) === failureEvidenceKey(current)) {
|
|
3071
|
+
return history.length > 1 ? history[history.length - 2] : undefined;
|
|
3072
|
+
}
|
|
3073
|
+
return last;
|
|
3074
|
+
}
|
|
3075
|
+
function countPingPong(records, current) {
|
|
3076
|
+
var tail = collectOpenTail(records).filter(function (record) {
|
|
3077
|
+
return cleanText(record.lane, 80) === cleanText(current.lane, 80)
|
|
3078
|
+
&& cleanText(record.stepType, 80) === cleanText(current.stepType, 80);
|
|
3079
|
+
});
|
|
3080
|
+
if (tail.length < 4) {
|
|
3081
|
+
return 0;
|
|
3082
|
+
}
|
|
3083
|
+
var keys = tail.map(failureKey).filter(Boolean);
|
|
3084
|
+
var last = keys.slice(-6);
|
|
3085
|
+
if (last.length < 4) {
|
|
3086
|
+
return 0;
|
|
3087
|
+
}
|
|
3088
|
+
var distinct = Array.from(new Set(last));
|
|
3089
|
+
if (distinct.length !== 2) {
|
|
3090
|
+
return 0;
|
|
3091
|
+
}
|
|
3092
|
+
for (var index = 2; index < last.length; index += 1) {
|
|
3093
|
+
if (last[index] !== last[index - 2]) {
|
|
3094
|
+
return 0;
|
|
3095
|
+
}
|
|
3096
|
+
}
|
|
3097
|
+
return last.length - 1;
|
|
3098
|
+
}
|
|
3099
|
+
function decideResolveIOAIManagerPolicy(input) {
|
|
3100
|
+
var history = Array.isArray(input.history) ? input.history : [];
|
|
3101
|
+
var currentWasExplicit = !!input.current;
|
|
3102
|
+
var current = input.current || history[history.length - 1] || {};
|
|
3103
|
+
var failureClass = normalizeResolveIOAIManagerFailureClass(current.failureClass);
|
|
3104
|
+
var blockerFingerprint = resolveResolveIOAIManagerBlockerFingerprint(current);
|
|
3105
|
+
var evidenceHash = hashResolveIOAIManagerEvidence(current);
|
|
3106
|
+
var previous = previousRecordForPolicy(history, current, currentWasExplicit);
|
|
3107
|
+
var previousSameFailure = previous && failureKey(previous) === failureKey(current);
|
|
3108
|
+
var evidenceAssessment = previousSameFailure
|
|
3109
|
+
? assessResolveIOAIManagerEvidenceChange(previous, current)
|
|
3110
|
+
: {
|
|
3111
|
+
changed: false,
|
|
3112
|
+
material: false,
|
|
3113
|
+
strength: 'none',
|
|
3114
|
+
signals: [],
|
|
3115
|
+
evidenceHash: evidenceHash,
|
|
3116
|
+
blockerFingerprint: blockerFingerprint
|
|
3117
|
+
};
|
|
3118
|
+
var newEvidence = !!previousSameFailure && evidenceAssessment.changed;
|
|
3119
|
+
var sameFailureCount = countSameFailure(history, current);
|
|
3120
|
+
var pingPongCount = countPingPong(history, current);
|
|
3121
|
+
var maxSameFailureRepeats = Math.max(1, Number(input.maxSameFailureRepeats || 3) || 3);
|
|
3122
|
+
var maxPingPongTransitions = Math.max(3, Number(input.maxPingPongTransitions || 3) || 3);
|
|
3123
|
+
var infraClasses = new Set((input.infraFailureClasses || ['infra', 'compile']).map(normalizeResolveIOAIManagerFailureClass));
|
|
3124
|
+
var ignoredClasses = new Set((input.ignoredFailureClasses || []).map(normalizeResolveIOAIManagerFailureClass));
|
|
3125
|
+
var base = {
|
|
3126
|
+
failureClass: failureClass,
|
|
3127
|
+
blockerFingerprint: blockerFingerprint,
|
|
3128
|
+
evidenceHash: evidenceHash,
|
|
3129
|
+
sameFailureCount: sameFailureCount,
|
|
3130
|
+
pingPongCount: pingPongCount,
|
|
3131
|
+
newEvidence: newEvidence,
|
|
3132
|
+
materialEvidence: evidenceAssessment.material,
|
|
3133
|
+
evidenceStrength: evidenceAssessment.strength,
|
|
3134
|
+
evidenceSignals: evidenceAssessment.signals,
|
|
3135
|
+
loopBudgetShouldReset: false,
|
|
3136
|
+
productRepairFailure: !infraClasses.has(failureClass) && !ignoredClasses.has(failureClass)
|
|
3137
|
+
};
|
|
3138
|
+
var withPlan = function (action, reason, overrides) {
|
|
3139
|
+
if (overrides === void 0) { overrides = {}; }
|
|
3140
|
+
var merged = __assign(__assign({}, base), overrides);
|
|
3141
|
+
var recoveryPlan = buildResolveIOAIManagerRecoveryPlan({
|
|
3142
|
+
action: action,
|
|
3143
|
+
reason: reason,
|
|
3144
|
+
failureClass: merged.failureClass,
|
|
3145
|
+
lane: current.lane,
|
|
3146
|
+
stepType: current.stepType,
|
|
3147
|
+
blocker: current.blocker || current.summary,
|
|
3148
|
+
sameFailureCount: merged.sameFailureCount,
|
|
3149
|
+
pingPongCount: merged.pingPongCount,
|
|
3150
|
+
newEvidence: merged.newEvidence,
|
|
3151
|
+
productRepairFailure: merged.productRepairFailure,
|
|
3152
|
+
changedFiles: current.changedFiles,
|
|
3153
|
+
artifactPaths: current.artifactPaths,
|
|
3154
|
+
maxSameFailureRepeats: maxSameFailureRepeats
|
|
3155
|
+
});
|
|
3156
|
+
var recoveryCheckpoint = buildResolveIOAIManagerRecoveryCheckpoint({
|
|
3157
|
+
plan: recoveryPlan,
|
|
3158
|
+
current: current
|
|
3159
|
+
});
|
|
3160
|
+
var recoveryEvidenceProbe = buildResolveIOAIManagerRecoveryEvidenceProbe({
|
|
3161
|
+
checkpoint: recoveryCheckpoint,
|
|
3162
|
+
current: current
|
|
3163
|
+
});
|
|
3164
|
+
return __assign(__assign({}, merged), { action: action, reason: reason, recoveryPlan: recoveryPlan, recoveryCheckpoint: recoveryCheckpoint, recoveryEvidenceProbe: recoveryEvidenceProbe, recoveryAction: buildResolveIOAIManagerRecoveryActionPacket({
|
|
3165
|
+
plan: recoveryPlan,
|
|
3166
|
+
checkpoint: recoveryCheckpoint,
|
|
3167
|
+
probe: recoveryEvidenceProbe,
|
|
3168
|
+
current: current
|
|
3169
|
+
}) });
|
|
3170
|
+
};
|
|
3171
|
+
if (isPassingOutcome(current)) {
|
|
3172
|
+
return withPlan('reset_loop_budget', 'manager_policy_progress_passed', {
|
|
3173
|
+
loopBudgetShouldReset: true,
|
|
3174
|
+
productRepairFailure: false
|
|
3175
|
+
});
|
|
3176
|
+
}
|
|
3177
|
+
if (isManualOutcome(current)) {
|
|
3178
|
+
return withPlan('manual_handoff', 'manager_policy_manual_or_stopped');
|
|
3179
|
+
}
|
|
3180
|
+
if (pingPongCount >= maxPingPongTransitions) {
|
|
3181
|
+
return withPlan('park_ping_pong', 'manager_policy_ping_pong_failure_loop');
|
|
3182
|
+
}
|
|
3183
|
+
if (sameFailureCount >= maxSameFailureRepeats && !evidenceAssessment.material) {
|
|
3184
|
+
return withPlan('park_repeated_failure', newEvidence
|
|
3185
|
+
? 'manager_policy_same_failure_with_weak_evidence'
|
|
3186
|
+
: 'manager_policy_same_failure_without_new_evidence');
|
|
3187
|
+
}
|
|
3188
|
+
if (infraClasses.has(failureClass)) {
|
|
3189
|
+
return withPlan('retry_infra', 'manager_policy_infra_failure_routes_to_infra_repair', {
|
|
3190
|
+
productRepairFailure: false
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
if (newEvidence || !previousSameFailure) {
|
|
3194
|
+
if (newEvidence && !evidenceAssessment.material) {
|
|
3195
|
+
return withPlan('continue', 'manager_policy_weak_evidence_does_not_reset_loop_budget');
|
|
3196
|
+
}
|
|
3197
|
+
return withPlan('continue', newEvidence
|
|
3198
|
+
? 'manager_policy_new_material_evidence_resets_loop_budget'
|
|
3199
|
+
: 'manager_policy_new_failure_or_lane', {
|
|
3200
|
+
loopBudgetShouldReset: true,
|
|
3201
|
+
materialEvidence: newEvidence ? true : base.materialEvidence,
|
|
3202
|
+
evidenceStrength: newEvidence ? evidenceAssessment.strength : base.evidenceStrength
|
|
3203
|
+
});
|
|
3204
|
+
}
|
|
3205
|
+
return withPlan('continue', 'manager_policy_retry_below_repeat_limit');
|
|
3206
|
+
}
|
|
3207
|
+
function buildReplayDirectiveFromPlan(input) {
|
|
3208
|
+
var checkpoint = buildResolveIOAIManagerRecoveryCheckpoint({
|
|
3209
|
+
plan: input.plan,
|
|
3210
|
+
current: input.current,
|
|
3211
|
+
now: input.now
|
|
3212
|
+
});
|
|
3213
|
+
var probe = buildResolveIOAIManagerRecoveryEvidenceProbe({
|
|
3214
|
+
checkpoint: checkpoint,
|
|
3215
|
+
current: input.current,
|
|
3216
|
+
now: input.now
|
|
3217
|
+
});
|
|
3218
|
+
var action = buildResolveIOAIManagerRecoveryActionPacket({
|
|
3219
|
+
plan: input.plan,
|
|
3220
|
+
checkpoint: checkpoint,
|
|
3221
|
+
probe: probe,
|
|
3222
|
+
current: input.current,
|
|
3223
|
+
now: input.now
|
|
3224
|
+
});
|
|
3225
|
+
var dispatch = decideResolveIOAIManagerRecoveryActionDispatch({
|
|
3226
|
+
action: action,
|
|
3227
|
+
current: input.current,
|
|
3228
|
+
now: input.now
|
|
3229
|
+
});
|
|
3230
|
+
return buildResolveIOAIManagerRecoveryExecutionDirective({
|
|
3231
|
+
action: action,
|
|
3232
|
+
dispatchDecision: dispatch,
|
|
3233
|
+
current: input.current,
|
|
3234
|
+
surface: input.surface,
|
|
3235
|
+
now: input.now
|
|
3236
|
+
});
|
|
3237
|
+
}
|
|
3238
|
+
function replayCaseFromDirective(input) {
|
|
3239
|
+
var _a;
|
|
3240
|
+
var directive = input.directive;
|
|
3241
|
+
var safeAutoDispatch = isResolveIOAIManagerSafeAutoDispatch({
|
|
3242
|
+
dispatchAction: directive.dispatchAction,
|
|
3243
|
+
directive: directive,
|
|
3244
|
+
includeJourneyContractRepair: input.expectedSafeAutoDispatch && directive.dispatchAction === 'run_journey_contract_repair',
|
|
3245
|
+
includeReleaseRepair: input.expectedSafeAutoDispatch && directive.dispatchAction === 'run_release_repair',
|
|
3246
|
+
includeProductRepair: false
|
|
3247
|
+
});
|
|
3248
|
+
return __assign(__assign({ caseId: input.caseId, surface: input.surface, pass: input.pass && safeAutoDispatch === input.expectedSafeAutoDispatch, action: input.action, reason: input.reason, recoveryClass: cleanText(((_a = directive.dispatchRecord) === null || _a === void 0 ? void 0 : _a.mode) || directive.phase, 120), dispatchAction: directive.dispatchAction, safeAutoDispatch: safeAutoDispatch, expectedSafeAutoDispatch: input.expectedSafeAutoDispatch, productRepairAllowed: directive.canRunProductRepair === true, loopBudgetShouldReset: input.loopBudgetShouldReset === true, materialEvidence: input.materialEvidence === true, evidenceStrength: input.evidenceStrength || 'none' }, (directive.releasePolicy ? {
|
|
3249
|
+
hotfixFirst: directive.releasePolicy.policy === 'hotfix_first',
|
|
3250
|
+
fullDeployAllowed: directive.releasePolicy.fullDeployAllowed
|
|
3251
|
+
} : {})), { details: __assign({ phase: directive.phase, allowed: directive.allowed, reason: directive.reason, releasePolicy: directive.releasePolicy }, (input.details || {})) });
|
|
3252
|
+
}
|
|
3253
|
+
function buildResolveIOAIManagerRecoveryReplayMatrix(input) {
|
|
3254
|
+
var _a, _b;
|
|
3255
|
+
if (input === void 0) { input = {}; }
|
|
3256
|
+
var surface = cleanText(input.surface || 'runner', 120);
|
|
3257
|
+
var maxSameFailureRepeats = Math.max(1, Number(input.maxSameFailureRepeats || 2) || 2);
|
|
3258
|
+
var includeReleaseRepair = input.includeReleaseRepair !== false;
|
|
3259
|
+
var includeJourneyContractRepair = input.includeJourneyContractRepair !== false;
|
|
3260
|
+
var cases = [];
|
|
3261
|
+
var infraPolicy = decideResolveIOAIManagerPolicy({
|
|
3262
|
+
history: [
|
|
3263
|
+
{ lane: 'qa', stepType: 'workflow_qa', outcome: 'needs_repair', failureClass: 'infra', blocker: 'Chrome executable missing.', evidenceHash: 'chrome-missing' }
|
|
3264
|
+
],
|
|
3265
|
+
current: { lane: 'qa', stepType: 'workflow_qa', outcome: 'needs_repair', failureClass: 'infra', blocker: 'Chrome executable missing.', evidenceHash: 'chrome-missing' },
|
|
3266
|
+
maxSameFailureRepeats: maxSameFailureRepeats
|
|
3267
|
+
});
|
|
3268
|
+
var infraDirective = buildResolveIOAIManagerRecoveryExecutionDirective({
|
|
3269
|
+
action: infraPolicy.recoveryAction,
|
|
3270
|
+
current: { lane: 'qa', stepType: 'workflow_qa', outcome: 'needs_repair', failureClass: 'infra', blocker: 'Chrome executable missing.', evidenceHash: 'chrome-missing' },
|
|
3271
|
+
surface: surface
|
|
3272
|
+
});
|
|
3273
|
+
cases.push(replayCaseFromDirective({
|
|
3274
|
+
caseId: 'infra_routes_to_infra_repair',
|
|
3275
|
+
surface: surface,
|
|
3276
|
+
action: infraPolicy.action,
|
|
3277
|
+
reason: infraPolicy.reason,
|
|
3278
|
+
directive: infraDirective,
|
|
3279
|
+
expectedSafeAutoDispatch: true,
|
|
3280
|
+
pass: infraPolicy.action === 'retry_infra'
|
|
3281
|
+
&& infraPolicy.recoveryPlan.recoveryClass === 'infra_repair'
|
|
3282
|
+
&& infraDirective.dispatchAction === 'run_infra_repair'
|
|
3283
|
+
&& infraDirective.canRunProductRepair === false,
|
|
3284
|
+
details: { recoveryClass: infraPolicy.recoveryPlan.recoveryClass }
|
|
3285
|
+
}));
|
|
3286
|
+
var releasePlan = buildResolveIOAIManagerRecoveryPlan({
|
|
3287
|
+
action: 'continue',
|
|
3288
|
+
reason: 'publish failed after business proof',
|
|
3289
|
+
failureClass: 'release',
|
|
3290
|
+
lane: 'publish',
|
|
3291
|
+
stepType: 'test_deploy',
|
|
3292
|
+
blocker: 'Domain publish failed for the current artifact.'
|
|
3293
|
+
});
|
|
3294
|
+
var releaseCurrent = {
|
|
3295
|
+
lane: 'publish',
|
|
3296
|
+
stepType: 'test_deploy',
|
|
3297
|
+
outcome: 'needs_repair',
|
|
3298
|
+
failureClass: 'release',
|
|
3299
|
+
blocker: 'Domain publish failed for the current artifact.',
|
|
3300
|
+
evidenceHash: 'release-domain-publish-failed',
|
|
3301
|
+
artifactPaths: ['runner-evidence/release-status.json']
|
|
3302
|
+
};
|
|
3303
|
+
var releaseDirective = buildReplayDirectiveFromPlan({
|
|
3304
|
+
surface: surface,
|
|
3305
|
+
plan: releasePlan,
|
|
3306
|
+
current: releaseCurrent
|
|
3307
|
+
});
|
|
3308
|
+
cases.push(replayCaseFromDirective({
|
|
3309
|
+
caseId: 'release_uses_hotfix_first_repair',
|
|
3310
|
+
surface: surface,
|
|
3311
|
+
action: 'continue',
|
|
3312
|
+
reason: 'publish failed after business proof',
|
|
3313
|
+
directive: releaseDirective,
|
|
3314
|
+
expectedSafeAutoDispatch: includeReleaseRepair,
|
|
3315
|
+
pass: releasePlan.recoveryClass === 'release_repair'
|
|
3316
|
+
&& releaseDirective.dispatchAction === 'run_release_repair'
|
|
3317
|
+
&& ((_a = releaseDirective.releasePolicy) === null || _a === void 0 ? void 0 : _a.policy) === 'hotfix_first'
|
|
3318
|
+
&& ((_b = releaseDirective.releasePolicy) === null || _b === void 0 ? void 0 : _b.fullDeployAllowed) === false
|
|
3319
|
+
&& releaseDirective.canRunProductRepair === false,
|
|
3320
|
+
details: { recoveryClass: releasePlan.recoveryClass }
|
|
3321
|
+
}));
|
|
3322
|
+
var journeyPlan = buildResolveIOAIManagerRecoveryPlan({
|
|
3323
|
+
action: 'continue',
|
|
3324
|
+
reason: 'journey contract missing first next last',
|
|
3325
|
+
failureClass: 'journey',
|
|
3326
|
+
lane: 'plan',
|
|
3327
|
+
stepType: 'journey_contract',
|
|
3328
|
+
blocker: 'Journey contract does not map the hub CTA to an action.'
|
|
3329
|
+
});
|
|
3330
|
+
var journeyDirective = buildReplayDirectiveFromPlan({
|
|
3331
|
+
surface: surface,
|
|
3332
|
+
plan: journeyPlan,
|
|
3333
|
+
current: {
|
|
3334
|
+
lane: 'plan',
|
|
3335
|
+
stepType: 'journey_contract',
|
|
3336
|
+
outcome: 'needs_repair',
|
|
3337
|
+
failureClass: 'journey',
|
|
3338
|
+
blocker: 'Journey contract does not map the hub CTA to an action.',
|
|
3339
|
+
evidenceHash: 'journey-contract-invalid'
|
|
3340
|
+
}
|
|
3341
|
+
});
|
|
3342
|
+
cases.push(replayCaseFromDirective({
|
|
3343
|
+
caseId: 'journey_repair_is_safe_only_for_aicoder_surfaces',
|
|
3344
|
+
surface: surface,
|
|
3345
|
+
action: 'continue',
|
|
3346
|
+
reason: 'journey contract missing first next last',
|
|
3347
|
+
directive: journeyDirective,
|
|
3348
|
+
expectedSafeAutoDispatch: includeJourneyContractRepair,
|
|
3349
|
+
pass: journeyPlan.recoveryClass === 'journey_contract_repair'
|
|
3350
|
+
&& journeyDirective.dispatchAction === 'run_journey_contract_repair'
|
|
3351
|
+
&& journeyDirective.canRunProductRepair === false,
|
|
3352
|
+
details: { recoveryClass: journeyPlan.recoveryClass }
|
|
3353
|
+
}));
|
|
3354
|
+
var weakPolicy = decideResolveIOAIManagerPolicy({
|
|
3355
|
+
history: [
|
|
3356
|
+
{ lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'save-before' },
|
|
3357
|
+
{ lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'renamed-hash-only' }
|
|
3358
|
+
],
|
|
3359
|
+
current: { lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'renamed-hash-only' },
|
|
3360
|
+
maxSameFailureRepeats: maxSameFailureRepeats
|
|
3361
|
+
});
|
|
3362
|
+
var weakDirective = buildResolveIOAIManagerRecoveryExecutionDirective({
|
|
3363
|
+
action: weakPolicy.recoveryAction,
|
|
3364
|
+
current: { lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'renamed-hash-only' },
|
|
3365
|
+
surface: surface
|
|
3366
|
+
});
|
|
3367
|
+
cases.push(replayCaseFromDirective({
|
|
3368
|
+
caseId: 'weak_hash_only_evidence_stays_parked',
|
|
3369
|
+
surface: surface,
|
|
3370
|
+
action: weakPolicy.action,
|
|
3371
|
+
reason: weakPolicy.reason,
|
|
3372
|
+
directive: weakDirective,
|
|
3373
|
+
expectedSafeAutoDispatch: true,
|
|
3374
|
+
pass: weakPolicy.action === 'park_repeated_failure'
|
|
3375
|
+
&& weakPolicy.materialEvidence === false
|
|
3376
|
+
&& weakPolicy.loopBudgetShouldReset === false
|
|
3377
|
+
&& weakDirective.dispatchAction === 'run_evidence_probe',
|
|
3378
|
+
loopBudgetShouldReset: weakPolicy.loopBudgetShouldReset,
|
|
3379
|
+
materialEvidence: weakPolicy.materialEvidence,
|
|
3380
|
+
evidenceStrength: weakPolicy.evidenceStrength,
|
|
3381
|
+
details: { evidenceSignals: weakPolicy.evidenceSignals }
|
|
3382
|
+
}));
|
|
3383
|
+
var materialPolicy = decideResolveIOAIManagerPolicy({
|
|
3384
|
+
history: [
|
|
3385
|
+
{ lane: 'repair', stepType: 'repair', outcome: 'needs_repair', failureClass: 'product_code', blocker: 'Save action still throws TypeError.', evidenceHash: 'save-before', artifactPaths: ['qa/save-before.log'] },
|
|
3386
|
+
{
|
|
3387
|
+
lane: 'repair',
|
|
3388
|
+
stepType: 'repair',
|
|
3389
|
+
outcome: 'needs_repair',
|
|
3390
|
+
failureClass: 'product_code',
|
|
3391
|
+
blocker: 'Save action still throws TypeError.',
|
|
3392
|
+
summary: 'New DOM trace proves the click reaches the method with an undefined id.',
|
|
3393
|
+
evidenceHash: 'save-dom-trace',
|
|
3394
|
+
artifactPaths: ['qa/save-before.log', 'qa/save-dom-trace.json']
|
|
3395
|
+
}
|
|
3396
|
+
],
|
|
3397
|
+
current: {
|
|
3398
|
+
lane: 'repair',
|
|
3399
|
+
stepType: 'repair',
|
|
3400
|
+
outcome: 'needs_repair',
|
|
3401
|
+
failureClass: 'product_code',
|
|
3402
|
+
blocker: 'Save action still throws TypeError.',
|
|
3403
|
+
summary: 'New DOM trace proves the click reaches the method with an undefined id.',
|
|
3404
|
+
evidenceHash: 'save-dom-trace',
|
|
3405
|
+
artifactPaths: ['qa/save-before.log', 'qa/save-dom-trace.json']
|
|
3406
|
+
},
|
|
3407
|
+
maxSameFailureRepeats: maxSameFailureRepeats
|
|
3408
|
+
});
|
|
3409
|
+
cases.push({
|
|
3410
|
+
caseId: 'material_evidence_resets_loop_budget',
|
|
3411
|
+
surface: surface,
|
|
3412
|
+
pass: materialPolicy.action === 'continue'
|
|
3413
|
+
&& materialPolicy.materialEvidence === true
|
|
3414
|
+
&& materialPolicy.loopBudgetShouldReset === true,
|
|
3415
|
+
action: materialPolicy.action,
|
|
3416
|
+
reason: materialPolicy.reason,
|
|
3417
|
+
recoveryClass: materialPolicy.recoveryPlan.recoveryClass,
|
|
3418
|
+
dispatchAction: materialPolicy.recoveryAction.mode,
|
|
3419
|
+
safeAutoDispatch: false,
|
|
3420
|
+
expectedSafeAutoDispatch: false,
|
|
3421
|
+
productRepairAllowed: materialPolicy.recoveryAction.productRepairAllowed,
|
|
3422
|
+
loopBudgetShouldReset: materialPolicy.loopBudgetShouldReset,
|
|
3423
|
+
materialEvidence: materialPolicy.materialEvidence,
|
|
3424
|
+
evidenceStrength: materialPolicy.evidenceStrength,
|
|
3425
|
+
details: { evidenceSignals: materialPolicy.evidenceSignals }
|
|
3426
|
+
});
|
|
3427
|
+
var productPlan = buildResolveIOAIManagerRecoveryPlan({
|
|
3428
|
+
action: 'continue',
|
|
3429
|
+
reason: 'business proof still failing',
|
|
3430
|
+
failureClass: 'product_code',
|
|
3431
|
+
lane: 'repair',
|
|
3432
|
+
stepType: 'repair',
|
|
3433
|
+
blocker: 'Save action still throws TypeError.',
|
|
3434
|
+
productRepairFailure: true
|
|
3435
|
+
});
|
|
3436
|
+
var productDirective = buildReplayDirectiveFromPlan({
|
|
3437
|
+
surface: surface,
|
|
3438
|
+
plan: productPlan,
|
|
3439
|
+
current: {
|
|
3440
|
+
lane: 'repair',
|
|
3441
|
+
stepType: 'repair',
|
|
3442
|
+
outcome: 'needs_repair',
|
|
3443
|
+
failureClass: 'product_code',
|
|
3444
|
+
blocker: 'Save action still throws TypeError.',
|
|
3445
|
+
evidenceHash: 'save-product-repair'
|
|
3446
|
+
}
|
|
3447
|
+
});
|
|
3448
|
+
var productSafe = isResolveIOAIManagerSafeAutoDispatch({
|
|
3449
|
+
dispatchAction: productDirective.dispatchAction,
|
|
3450
|
+
directive: productDirective,
|
|
3451
|
+
includeProductRepair: input.includeProductRepair === true
|
|
3452
|
+
});
|
|
3453
|
+
cases.push({
|
|
3454
|
+
caseId: 'product_repair_requires_explicit_operator_policy',
|
|
3455
|
+
surface: surface,
|
|
3456
|
+
pass: productPlan.recoveryClass === 'product_code_repair'
|
|
3457
|
+
&& productDirective.dispatchAction === 'run_targeted_product_repair'
|
|
3458
|
+
&& productSafe === false,
|
|
3459
|
+
action: 'continue',
|
|
3460
|
+
reason: 'business proof still failing',
|
|
3461
|
+
recoveryClass: productPlan.recoveryClass,
|
|
3462
|
+
dispatchAction: productDirective.dispatchAction,
|
|
3463
|
+
safeAutoDispatch: productSafe,
|
|
3464
|
+
expectedSafeAutoDispatch: false,
|
|
3465
|
+
productRepairAllowed: productDirective.canRunProductRepair,
|
|
3466
|
+
loopBudgetShouldReset: false,
|
|
3467
|
+
materialEvidence: false,
|
|
3468
|
+
evidenceStrength: 'none',
|
|
3469
|
+
details: { phase: productDirective.phase, allowed: productDirective.allowed }
|
|
3470
|
+
});
|
|
3471
|
+
var duplicateReleasePolicy = buildResolveIOAIManagerHotfixFirstReleasePolicy({
|
|
3472
|
+
surface: surface,
|
|
3473
|
+
deployFingerprint: "".concat(surface, "-artifact-sha"),
|
|
3474
|
+
lastDeployFingerprint: "".concat(surface, "-artifact-sha"),
|
|
3475
|
+
deployStatus: 'completed',
|
|
3476
|
+
publishStatus: 'published'
|
|
3477
|
+
});
|
|
3478
|
+
cases.push({
|
|
3479
|
+
caseId: 'duplicate_release_fingerprint_blocks_full_deploy',
|
|
3480
|
+
surface: surface,
|
|
3481
|
+
pass: duplicateReleasePolicy.recommendedAction === 'block_duplicate_deploy'
|
|
3482
|
+
&& duplicateReleasePolicy.duplicateDeployBlocked === true
|
|
3483
|
+
&& duplicateReleasePolicy.fullDeployAllowed === false,
|
|
3484
|
+
action: duplicateReleasePolicy.recommendedAction,
|
|
3485
|
+
reason: duplicateReleasePolicy.reason,
|
|
3486
|
+
recoveryClass: 'release_repair',
|
|
3487
|
+
dispatchAction: 'run_release_repair',
|
|
3488
|
+
safeAutoDispatch: includeReleaseRepair,
|
|
3489
|
+
expectedSafeAutoDispatch: includeReleaseRepair,
|
|
3490
|
+
productRepairAllowed: false,
|
|
3491
|
+
loopBudgetShouldReset: false,
|
|
3492
|
+
materialEvidence: false,
|
|
3493
|
+
evidenceStrength: 'none',
|
|
3494
|
+
hotfixFirst: true,
|
|
3495
|
+
fullDeployAllowed: duplicateReleasePolicy.fullDeployAllowed,
|
|
3496
|
+
details: { releasePolicy: duplicateReleasePolicy }
|
|
3497
|
+
});
|
|
3498
|
+
return cases;
|
|
3499
|
+
}
|
|
3500
|
+
|
|
3501
|
+
//# sourceMappingURL=ai-runner-manager-policy.js.map
|