claude-code-session-manager 0.97.0 → 0.100.0
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/README.md +3 -3
- package/bin/cli.cjs +16 -4
- package/bin/node-floor.cjs +41 -0
- package/dist/assets/{DataModel-D93FoaOm.js → DataModel-HdR0AxFq.js} +1 -1
- package/dist/assets/{History-CXxxqNP1.js → History-Dr4Jr_5z.js} +2 -2
- package/dist/assets/{Hooks-CzeYFQjq.js → Hooks-NhrvH3JP.js} +3 -3
- package/dist/assets/{Library-D2zPkwOC.js → Library-Dv_EtIMr.js} +1 -1
- package/dist/assets/{MarkdownEditor-DbinP78A.js → MarkdownEditor-DTKDWV_n.js} +1 -1
- package/dist/assets/{McpServers-Bu_sVGLr.js → McpServers-M034G9B3.js} +2 -2
- package/dist/assets/{Memory-BgiI6LZ_.js → Memory-DzF1B4gx.js} +6 -6
- package/dist/assets/{Permissions-C1MMzZRm.js → Permissions-DrgbSGWl.js} +3 -3
- package/dist/assets/{Plugins-Dhu6wAZi.js → Plugins-Bd3ef35w.js} +2 -2
- package/dist/assets/{ProvenanceBadge-C3AcWKMG.js → ProvenanceBadge-DcBHT1Iy.js} +1 -1
- package/dist/assets/{SaveBar-plwYm0iO.js → SaveBar-rimJem-Y.js} +1 -1
- package/dist/assets/Scheduler-DjgFJl2w.js +16 -0
- package/dist/assets/{ScopeSwitcher-DFy0vv_o.js → ScopeSwitcher-CnAzTBrl.js} +1 -1
- package/dist/assets/Settings-Dc1F_sSg.js +3 -0
- package/dist/assets/{SkillReferenceGraph-DsI7hRPB.js → SkillReferenceGraph-B9aZDecM.js} +1 -1
- package/dist/assets/{Skills-3E748UfB.js → Skills-DRXd18gu.js} +2 -2
- package/dist/assets/{SystemPrompt-BqmfUJOd.js → SystemPrompt-ahy5-Fwe.js} +1 -1
- package/dist/assets/{TagLibrary-CPz6fO8Q.js → TagLibrary-C_tToDeL.js} +1 -1
- package/dist/assets/{TiptapBody-D9EoBQ1P.js → TiptapBody-DvdefS6K.js} +1 -1
- package/dist/assets/{Toggle-BHAmZNDn.js → Toggle-6Jl5Njc6.js} +1 -1
- package/dist/assets/{index-CKH5Uxik.css → index-Bta-hwud.css} +1 -1
- package/dist/assets/{index-tn5JIVPj.js → index-vx8O73l8.js} +497 -502
- package/dist/assets/{settingsSchema-Crqy_aNz.js → settingsSchema-D6iRguNV.js} +1 -1
- package/dist/index.html +2 -2
- package/package.json +26 -29
- package/plugins/CLAUDE.md +6 -6
- package/plugins/session-manager-dev/skills/builder/4-manual/SKILL.md +23 -19
- package/plugins/session-manager-dev/skills/builder/SKILL.md +3 -3
- package/plugins/session-manager-dev/skills/develop/SKILL.md +254 -510
- package/plugins/session-manager-dev/skills/develop/standards.md +17 -22
- package/scripts/README.md +3 -11
- package/scripts/audit-ops-hygiene.cjs +3 -3
- package/scripts/hooks/lib/guard-prd-writes-policy.cjs +1 -1
- package/scripts/hooks/lib/guard-self-schedule-policy.cjs +1 -1
- package/scripts/mint-epic.cjs +2 -3
- package/scripts/scheduler-mcp-server.cjs +36 -7
- package/src/main/agentLibrary.cjs +22 -2
- package/src/main/build-info.json +4 -4
- package/src/main/config.cjs +41 -38
- package/src/main/docEdit.cjs +4 -1
- package/src/main/files.cjs +2 -5
- package/src/main/health.cjs +1 -1
- package/src/main/index.cjs +23 -10
- package/src/main/ipcSchemas.cjs +28 -35
- package/src/main/lib/agentPersonaSchema.cjs +13 -2
- package/src/main/lib/atomicFs.cjs +116 -0
- package/src/main/lib/branchSweep.cjs +13 -12
- package/src/main/lib/buildTarget.cjs +3 -3
- package/src/main/lib/claudeCliCaps.cjs +129 -0
- package/src/main/lib/credentials.cjs +2 -4
- package/src/main/lib/crossProjectFeedback.cjs +3 -3
- package/src/main/lib/cwdClassify.cjs +15 -3
- package/src/main/lib/definitionOfDone.cjs +207 -125
- package/src/main/lib/dodDrainHook.cjs +11 -5
- package/src/main/lib/epicMint.cjs +2 -4
- package/src/main/lib/epicStatusMirror.cjs +8 -10
- package/src/main/lib/epicWorktreeProjectConfig.cjs +2 -4
- package/src/main/lib/gateAuthority.cjs +96 -0
- package/src/main/lib/gitExec.cjs +69 -0
- package/src/main/lib/gitWorktree.cjs +656 -92
- package/src/main/lib/instanceLock.cjs +5 -8
- package/src/main/lib/launchFailure.cjs +2 -3
- package/src/main/lib/macroLibrary.cjs +386 -0
- package/src/main/lib/mcpToolCatalog.cjs +26 -17
- package/src/main/lib/needsReviewLedger.cjs +1 -1
- package/src/main/lib/opsErrorLog.cjs +11 -1
- package/src/main/lib/opsOwnership.cjs +0 -5
- package/src/main/lib/pidAlive.cjs +32 -0
- package/src/main/lib/prdCreate.cjs +153 -19
- package/src/main/lib/prdDisposition.cjs +2 -2
- package/src/main/lib/prdGateFiles.cjs +284 -0
- package/src/main/lib/prdLocations.cjs +61 -0
- package/src/main/lib/prdMigration.cjs +2 -3
- package/src/main/lib/prdSizing.cjs +2 -1
- package/src/main/lib/promptSessionSchema.cjs +10 -2
- package/src/main/lib/rcaReport.cjs +4 -6
- package/src/main/lib/reaperHelpers.cjs +8 -1
- package/src/main/lib/reservationExpiry.cjs +6 -1
- package/src/main/lib/reviewNotice.cjs +263 -0
- package/src/main/lib/runClaudeP.cjs +4 -1
- package/src/main/lib/schedulerPaths.cjs +22 -2
- package/src/main/lib/sessionSlots.cjs +2 -4
- package/src/main/lib/shippedPersonaSeeds.cjs +179 -0
- package/src/main/lib/timeoutShim.cjs +123 -0
- package/src/main/lib/timeoutShimScript.cjs +275 -0
- package/src/main/lib/upgradeDrain.cjs +4 -10
- package/src/main/lib/watchdogHelpers.cjs +33 -30
- package/src/main/lib/workTypeLibrary.cjs +7 -1
- package/src/main/promptSessionEvents.cjs +37 -13
- package/src/main/queueOps.cjs +17 -6
- package/src/main/scheduler.cjs +975 -203
- package/src/main/seedAgentPersonas.cjs +278 -23
- package/src/main/supervisor.cjs +4 -1
- package/src/main/templates/PRD_AUTHORING.md +126 -406
- package/src/preload/__tests__/preload-surface.test.cjs +68 -0
- package/src/preload/api.d.ts +41 -94
- package/src/preload/index.cjs +14 -9
- package/src/seed/agents/architect.md +1 -0
- package/src/seed/agents/dev-lead.md +17 -18
- package/src/seed/agents/project-home-builder.md +1 -0
- package/src/seed/agents/validator.md +10 -4
- package/dist/assets/HostBilko-nESrTRIg.js +0 -1
- package/dist/assets/Scheduler-BVYTeh39.js +0 -16
- package/dist/assets/Settings-DIhGgdfs.js +0 -3
- package/src/main/__tests__/activeIndexMerge.test.cjs +0 -235
- package/src/main/__tests__/agentEffortResolve.test.cjs +0 -117
- package/src/main/__tests__/agentLibrary.test.cjs +0 -276
- package/src/main/__tests__/agentModelResolve.test.cjs +0 -311
- package/src/main/__tests__/agentOverlayWrite.test.cjs +0 -95
- package/src/main/__tests__/bilkoHost-deriveSlug.test.cjs +0 -26
- package/src/main/__tests__/bilkoHost-integration.test.cjs +0 -118
- package/src/main/__tests__/bilkoHostCore.test.cjs +0 -72
- package/src/main/__tests__/broadcastCoalescer.test.cjs +0 -122
- package/src/main/__tests__/chat-cancel-terminal.test.cjs +0 -120
- package/src/main/__tests__/chat-dead-channels.test.cjs +0 -63
- package/src/main/__tests__/chat-exit-close-race.test.cjs +0 -146
- package/src/main/__tests__/chat-mcp-consent-notice.test.cjs +0 -139
- package/src/main/__tests__/chat-preamble-anchors.test.cjs +0 -100
- package/src/main/__tests__/chat-queue.test.cjs +0 -97
- package/src/main/__tests__/chat-stop-signal.test.cjs +0 -89
- package/src/main/__tests__/chatRunner-epic-worktree-execcwd.test.cjs +0 -125
- package/src/main/__tests__/chatRunner-session-flag-retry.test.cjs +0 -252
- package/src/main/__tests__/classifyPromptTicket.test.cjs +0 -101
- package/src/main/__tests__/classifyTranscriptLine.test.cjs +0 -201
- package/src/main/__tests__/computeDepHistorySatisfaction.test.cjs +0 -66
- package/src/main/__tests__/config-readText-bounded.test.cjs +0 -84
- package/src/main/__tests__/configWriteBoundaryOwners.test.cjs +0 -59
- package/src/main/__tests__/crossProjectFeedback.test.cjs +0 -334
- package/src/main/__tests__/crossProjectFeedbackRoutes.test.cjs +0 -161
- package/src/main/__tests__/dep-orphan-archive-health.test.cjs +0 -77
- package/src/main/__tests__/develop-skill-failure-modes.test.cjs +0 -70
- package/src/main/__tests__/docEdit.test.cjs +0 -244
- package/src/main/__tests__/dod-batchkey.test.cjs +0 -183
- package/src/main/__tests__/dod-drain-hook.test.cjs +0 -302
- package/src/main/__tests__/dod-report.test.cjs +0 -304
- package/src/main/__tests__/dod-reverify.test.cjs +0 -285
- package/src/main/__tests__/epicContextDigest.test.cjs +0 -174
- package/src/main/__tests__/epicMint.test.cjs +0 -332
- package/src/main/__tests__/epicMintTelemetryTap.test.cjs +0 -64
- package/src/main/__tests__/epicStatusMirror.test.cjs +0 -110
- package/src/main/__tests__/epicValidationHook.test.cjs +0 -291
- package/src/main/__tests__/exchanges.test.cjs +0 -122
- package/src/main/__tests__/exchangesPromptId.test.cjs +0 -61
- package/src/main/__tests__/extractJson.test.cjs +0 -51
- package/src/main/__tests__/files-reject-credentials.test.cjs +0 -40
- package/src/main/__tests__/fixtures/1218-fo-01-move-scripts-lib-into-src-main-lib.log +0 -556
- package/src/main/__tests__/flatPrdTickSweep.test.cjs +0 -110
- package/src/main/__tests__/health-build-freshness.test.cjs +0 -39
- package/src/main/__tests__/health-claude-md-budget.test.cjs +0 -57
- package/src/main/__tests__/health-credentials.test.cjs +0 -81
- package/src/main/__tests__/health-delegation-chain.test.cjs +0 -124
- package/src/main/__tests__/health-per-project-stall.test.cjs +0 -84
- package/src/main/__tests__/health-prd-migration.test.cjs +0 -37
- package/src/main/__tests__/health-queue-dispatch.test.cjs +0 -135
- package/src/main/__tests__/health-starve-escalation.test.cjs +0 -94
- package/src/main/__tests__/health-tick-liveness.test.cjs +0 -179
- package/src/main/__tests__/health-usage-poller.test.cjs +0 -144
- package/src/main/__tests__/health-worktree-cap-blocked.test.cjs +0 -65
- package/src/main/__tests__/heapSnapshot.test.cjs +0 -121
- package/src/main/__tests__/historyAggregatorIntraday.test.cjs +0 -313
- package/src/main/__tests__/historyDashboard.test.cjs +0 -163
- package/src/main/__tests__/historyRollup.test.cjs +0 -333
- package/src/main/__tests__/intradayRefresh.test.cjs +0 -39
- package/src/main/__tests__/ipcSchemas-dependsOn.test.cjs +0 -39
- package/src/main/__tests__/kg-augment.test.cjs +0 -195
- package/src/main/__tests__/loadGateDetailTick.test.cjs +0 -31
- package/src/main/__tests__/machineProfile.test.cjs +0 -152
- package/src/main/__tests__/mcpStatus.test.cjs +0 -61
- package/src/main/__tests__/memoryAggregate.test.cjs +0 -109
- package/src/main/__tests__/memoryStale.test.cjs +0 -88
- package/src/main/__tests__/needsReviewLedger.test.cjs +0 -162
- package/src/main/__tests__/openExternalApp-spawn-error.test.cjs +0 -25
- package/src/main/__tests__/opsErrorLog.test.cjs +0 -109
- package/src/main/__tests__/opsErrorLogTelemetryTap.test.cjs +0 -173
- package/src/main/__tests__/personaMerge.test.cjs +0 -169
- package/src/main/__tests__/planValidator.test.cjs +0 -125
- package/src/main/__tests__/pollLoop-dispatch-on-failure.test.cjs +0 -176
- package/src/main/__tests__/prd-group-allocator.test.cjs +0 -119
- package/src/main/__tests__/prdAdminRouteParity.test.cjs +0 -70
- package/src/main/__tests__/prdAdminRoutes.test.cjs +0 -718
- package/src/main/__tests__/prdAgentType.test.cjs +0 -103
- package/src/main/__tests__/prdAuthoringSeed.test.cjs +0 -39
- package/src/main/__tests__/prdCreate.test.cjs +0 -979
- package/src/main/__tests__/prdCreateDisposition.test.cjs +0 -201
- package/src/main/__tests__/prdCreatePlanId.test.cjs +0 -132
- package/src/main/__tests__/prdFrontmatterAgentType.test.cjs +0 -117
- package/src/main/__tests__/prdFrontmatterDependsOn.test.cjs +0 -136
- package/src/main/__tests__/prdFrontmatterDisposition.test.cjs +0 -125
- package/src/main/__tests__/prdFrontmatterQuietMachine.test.cjs +0 -108
- package/src/main/__tests__/prdLocations.test.cjs +0 -195
- package/src/main/__tests__/prdLocationsArchived.test.cjs +0 -201
- package/src/main/__tests__/prdMigration.test.cjs +0 -349
- package/src/main/__tests__/prdMigrationLegacyAdopt.test.cjs +0 -91
- package/src/main/__tests__/prdParserHighWater.test.cjs +0 -74
- package/src/main/__tests__/prdParserSourcePromptId.test.cjs +0 -65
- package/src/main/__tests__/prdSetDisposition.test.cjs +0 -222
- package/src/main/__tests__/prdSizing.test.cjs +0 -106
- package/src/main/__tests__/prdSourcePromptIdBackfill.test.cjs +0 -118
- package/src/main/__tests__/prdUpdateDependsOn.test.cjs +0 -160
- package/src/main/__tests__/proc-role-env.test.cjs +0 -125
- package/src/main/__tests__/procname-claude-spawn-sites.test.cjs +0 -304
- package/src/main/__tests__/procname-sm-processes.test.cjs +0 -127
- package/src/main/__tests__/projectHomeAdminRoutes.test.cjs +0 -177
- package/src/main/__tests__/projectPages.test.cjs +0 -137
- package/src/main/__tests__/promptSessionEvents.test.cjs +0 -234
- package/src/main/__tests__/promptSessionSchema.test.cjs +0 -101
- package/src/main/__tests__/promptSessionTranscript.test.cjs +0 -0
- package/src/main/__tests__/promptSessionsCreateEpicHandler.test.cjs +0 -159
- package/src/main/__tests__/pty-epic-worktree-spawn-cwd.test.cjs +0 -282
- package/src/main/__tests__/pty-session-open-telemetry.test.cjs +0 -96
- package/src/main/__tests__/pty-write-result.test.cjs +0 -46
- package/src/main/__tests__/queue-health-verdict.test.cjs +0 -170
- package/src/main/__tests__/queue-starvation-dispatch-driver.test.cjs +0 -286
- package/src/main/__tests__/queue-starvation-per-project.test.cjs +0 -147
- package/src/main/__tests__/queueHistory.test.cjs +0 -355
- package/src/main/__tests__/queueOps-interactive-ac-lint.test.cjs +0 -65
- package/src/main/__tests__/queueOpsArchiveDestination.test.cjs +0 -65
- package/src/main/__tests__/queueOpsAutoArchive.test.cjs +0 -154
- package/src/main/__tests__/rateLimitPollerStreak.test.cjs +0 -128
- package/src/main/__tests__/rcaReport.test.cjs +0 -266
- package/src/main/__tests__/reconcileFlatPrdSweep.test.cjs +0 -119
- package/src/main/__tests__/reconcileTiming.test.cjs +0 -135
- package/src/main/__tests__/runLogRetention.test.cjs +0 -489
- package/src/main/__tests__/runVerify-atomic-verdicts.test.cjs +0 -26
- package/src/main/__tests__/runVerify-blocked-by-foreign-wip.test.cjs +0 -58
- package/src/main/__tests__/runVerify-landed-commit-outranks.test.cjs +0 -191
- package/src/main/__tests__/runVerify-policy-denial.test.cjs +0 -89
- package/src/main/__tests__/runVerify-transcript-commit-evidence.test.cjs +0 -225
- package/src/main/__tests__/runVerify.test.cjs +0 -1784
- package/src/main/__tests__/scheduleJobSchema.test.cjs +0 -127
- package/src/main/__tests__/scheduleJobStatusDrift.test.cjs +0 -65
- package/src/main/__tests__/scheduleJobTransitions.test.cjs +0 -277
- package/src/main/__tests__/scheduleJobTransitionsGrep.test.cjs +0 -59
- package/src/main/__tests__/scheduleJobTransitionsTelemetryTap.test.cjs +0 -72
- package/src/main/__tests__/scheduler-admin-routes.test.cjs +0 -199
- package/src/main/__tests__/scheduler-adopted-run-supervision.test.cjs +0 -143
- package/src/main/__tests__/scheduler-already-satisfied-on-main.test.cjs +0 -105
- package/src/main/__tests__/scheduler-archive-completed-prd.test.cjs +0 -102
- package/src/main/__tests__/scheduler-archived-twin-guard.test.cjs +0 -155
- package/src/main/__tests__/scheduler-autofix-outcome.test.cjs +0 -188
- package/src/main/__tests__/scheduler-autofix-select.test.cjs +0 -439
- package/src/main/__tests__/scheduler-autopromote.test.cjs +0 -51
- package/src/main/__tests__/scheduler-bash-timeout-env.test.cjs +0 -101
- package/src/main/__tests__/scheduler-blocked-by-foreign-wip.test.cjs +0 -107
- package/src/main/__tests__/scheduler-boot-orphans.test.cjs +0 -153
- package/src/main/__tests__/scheduler-broadcast-reconcile.test.cjs +0 -121
- package/src/main/__tests__/scheduler-clear-queue-history.test.cjs +0 -134
- package/src/main/__tests__/scheduler-commit-guard-noop.test.cjs +0 -244
- package/src/main/__tests__/scheduler-committed-in-window.test.cjs +0 -182
- package/src/main/__tests__/scheduler-cross-project-batch.test.cjs +0 -43
- package/src/main/__tests__/scheduler-default-eligible-heal.test.cjs +0 -168
- package/src/main/__tests__/scheduler-dispatch-loop.test.cjs +0 -58
- package/src/main/__tests__/scheduler-effective-concurrency.test.cjs +0 -81
- package/src/main/__tests__/scheduler-epic-digest.test.cjs +0 -227
- package/src/main/__tests__/scheduler-failed-autoreset.test.cjs +0 -121
- package/src/main/__tests__/scheduler-finalize-dispatch-guards.test.cjs +0 -229
- package/src/main/__tests__/scheduler-find-prd-dir.test.cjs +0 -75
- package/src/main/__tests__/scheduler-fix-plan-path.test.cjs +0 -119
- package/src/main/__tests__/scheduler-force-tick-outcome.test.cjs +0 -46
- package/src/main/__tests__/scheduler-foreign-wip-manifest.test.cjs +0 -78
- package/src/main/__tests__/scheduler-gate-shadow.test.cjs +0 -119
- package/src/main/__tests__/scheduler-guard-verdict-autoresolve.test.cjs +0 -390
- package/src/main/__tests__/scheduler-heal-refusal.test.cjs +0 -61
- package/src/main/__tests__/scheduler-heartbeat-payload.test.cjs +0 -80
- package/src/main/__tests__/scheduler-inplace-salvage.test.cjs +0 -323
- package/src/main/__tests__/scheduler-integration-failure-stamp.test.cjs +0 -41
- package/src/main/__tests__/scheduler-investigation-clean-skip.test.cjs +0 -63
- package/src/main/__tests__/scheduler-investigation-prompt.test.cjs +0 -123
- package/src/main/__tests__/scheduler-job-budget.test.cjs +0 -172
- package/src/main/__tests__/scheduler-job-overrun.test.cjs +0 -175
- package/src/main/__tests__/scheduler-launch-failure.test.cjs +0 -199
- package/src/main/__tests__/scheduler-leftover-fields.test.cjs +0 -52
- package/src/main/__tests__/scheduler-leftover-quarantine.test.cjs +0 -199
- package/src/main/__tests__/scheduler-looks-done.test.cjs +0 -537
- package/src/main/__tests__/scheduler-manual-pause.test.cjs +0 -118
- package/src/main/__tests__/scheduler-mechanical-recovery.test.cjs +0 -245
- package/src/main/__tests__/scheduler-meta-code-sha.test.cjs +0 -46
- package/src/main/__tests__/scheduler-needs-review-autoresolve.test.cjs +0 -197
- package/src/main/__tests__/scheduler-never-stop.test.cjs +0 -157
- package/src/main/__tests__/scheduler-no-dead-end-status.test.cjs +0 -152
- package/src/main/__tests__/scheduler-no-orphan-run-dir.test.cjs +0 -81
- package/src/main/__tests__/scheduler-notify-originating-tab-transcript.test.cjs +0 -87
- package/src/main/__tests__/scheduler-notify-originating-tab.test.cjs +0 -343
- package/src/main/__tests__/scheduler-periodic-reverify-guard.test.cjs +0 -217
- package/src/main/__tests__/scheduler-porcelain-rename.test.cjs +0 -164
- package/src/main/__tests__/scheduler-prd-missing-skip.test.cjs +0 -161
- package/src/main/__tests__/scheduler-prd-persona-spawn.test.cjs +0 -178
- package/src/main/__tests__/scheduler-quarantine-autoresolve.test.cjs +0 -165
- package/src/main/__tests__/scheduler-quiet-machine-lease.test.cjs +0 -257
- package/src/main/__tests__/scheduler-rate-limit-cooldown-freshness.test.cjs +0 -123
- package/src/main/__tests__/scheduler-rate-limit-pause.test.cjs +0 -152
- package/src/main/__tests__/scheduler-rate-limit-spin-guard.test.cjs +0 -156
- package/src/main/__tests__/scheduler-reap-dead-running-jobs.test.cjs +0 -754
- package/src/main/__tests__/scheduler-reaper-helpers-basics.test.cjs +0 -87
- package/src/main/__tests__/scheduler-reconcile-cwd-preserve.test.cjs +0 -100
- package/src/main/__tests__/scheduler-reconcile-history-backfill.test.cjs +0 -105
- package/src/main/__tests__/scheduler-reconcile-invalid-repair.test.cjs +0 -203
- package/src/main/__tests__/scheduler-reconcile-quarantine.test.cjs +0 -247
- package/src/main/__tests__/scheduler-reset-job-fields-guard.test.cjs +0 -77
- package/src/main/__tests__/scheduler-resume-recovery.test.cjs +0 -254
- package/src/main/__tests__/scheduler-shard-quarantine.test.cjs +0 -115
- package/src/main/__tests__/scheduler-shared-tree-guard.test.cjs +0 -380
- package/src/main/__tests__/scheduler-sigterm-commit.test.cjs +0 -43
- package/src/main/__tests__/scheduler-stall-per-project.test.cjs +0 -126
- package/src/main/__tests__/scheduler-starve-escalation.test.cjs +0 -154
- package/src/main/__tests__/scheduler-stranded-autofix-park.test.cjs +0 -252
- package/src/main/__tests__/scheduler-stranded-investigation.test.cjs +0 -185
- package/src/main/__tests__/scheduler-stuck-failed-escalation.test.cjs +0 -136
- package/src/main/__tests__/scheduler-supervisor-record.test.cjs +0 -81
- package/src/main/__tests__/scheduler-tick-cancel-token.test.cjs +0 -54
- package/src/main/__tests__/scheduler-tick-wedge.test.cjs +0 -172
- package/src/main/__tests__/scheduler-transient-failure.test.cjs +0 -141
- package/src/main/__tests__/scheduler-unreadable-queue-guard.test.cjs +0 -62
- package/src/main/__tests__/scheduler-utilization-hold.test.cjs +0 -89
- package/src/main/__tests__/scheduler-verify-prd-path.test.cjs +0 -109
- package/src/main/__tests__/scheduler-worktree-cap-defer.test.cjs +0 -234
- package/src/main/__tests__/scheduler-worktree-exec-cwd.test.cjs +0 -120
- package/src/main/__tests__/scheduler-writeprd-epic-rollback.test.cjs +0 -105
- package/src/main/__tests__/schedulerBatchRootBlocker.test.cjs +0 -117
- package/src/main/__tests__/schedulerStateSidecarRestore.test.cjs +0 -110
- package/src/main/__tests__/seedAgentPersonas.test.cjs +0 -184
- package/src/main/__tests__/seedSchedulerMcp.test.cjs +0 -211
- package/src/main/__tests__/seedStatus.test.cjs +0 -100
- package/src/main/__tests__/seedValidatorPersona.test.cjs +0 -116
- package/src/main/__tests__/stop-signal-anchor.test.cjs +0 -75
- package/src/main/__tests__/telemetryClient.test.cjs +0 -1055
- package/src/main/__tests__/telemetryContract.test.cjs +0 -930
- package/src/main/__tests__/telemetrySettings.test.cjs +0 -210
- package/src/main/__tests__/transcripts-batch-flush.test.cjs +0 -249
- package/src/main/__tests__/transcripts-doFlush-array.test.cjs +0 -124
- package/src/main/__tests__/transcripts-paged-reads.test.cjs +0 -241
- package/src/main/__tests__/transcripts-worktree-epic-path.test.cjs +0 -154
- package/src/main/__tests__/transcriptsUsageFor.test.cjs +0 -206
- package/src/main/__tests__/uniquePrdNumbers.test.cjs +0 -153
- package/src/main/__tests__/usageSingleFlight.test.cjs +0 -169
- package/src/main/__tests__/validationSentinels.test.cjs +0 -84
- package/src/main/__tests__/workTypeLibrary.test.cjs +0 -89
- package/src/main/bilkoHost.cjs +0 -314
- package/src/main/bilkoHostCore.cjs +0 -89
- package/src/main/lib/__tests__/active-sessions.test.cjs +0 -251
- package/src/main/lib/__tests__/activeIndexRebuild.test.cjs +0 -179
- package/src/main/lib/__tests__/agentPersonaSchema.test.cjs +0 -67
- package/src/main/lib/__tests__/auditLog.test.cjs +0 -38
- package/src/main/lib/__tests__/bootSelfHeal.test.cjs +0 -107
- package/src/main/lib/__tests__/branchSweep.test.cjs +0 -164
- package/src/main/lib/__tests__/buildIdentity.test.cjs +0 -121
- package/src/main/lib/__tests__/buildTarget.test.cjs +0 -52
- package/src/main/lib/__tests__/childWithLog.test.cjs +0 -321
- package/src/main/lib/__tests__/coldBootPromptSessionsWrite.test.cjs +0 -87
- package/src/main/lib/__tests__/crashTelemetry.test.cjs +0 -103
- package/src/main/lib/__tests__/credentials-futile-refresh.test.cjs +0 -115
- package/src/main/lib/__tests__/cwdClassify.test.cjs +0 -111
- package/src/main/lib/__tests__/definitionOfDoneSequence.test.cjs +0 -95
- package/src/main/lib/__tests__/delegationReadiness.test.cjs +0 -1175
- package/src/main/lib/__tests__/dispatchLoop.test.cjs +0 -63
- package/src/main/lib/__tests__/effectiveModelInfo.test.cjs +0 -244
- package/src/main/lib/__tests__/ephemeralCwd.test.cjs +0 -91
- package/src/main/lib/__tests__/epicDelegationStats.test.cjs +0 -137
- package/src/main/lib/__tests__/epicSpawnCwd.test.cjs +0 -283
- package/src/main/lib/__tests__/epicSpawnPlan.test.cjs +0 -196
- package/src/main/lib/__tests__/epicTranscriptPath.test.cjs +0 -163
- package/src/main/lib/__tests__/epicWorktreeBoot.test.cjs +0 -136
- package/src/main/lib/__tests__/epicWorktreeMerge.test.cjs +0 -130
- package/src/main/lib/__tests__/epicWorktreeMint.test.cjs +0 -117
- package/src/main/lib/__tests__/epicWorktreeProjectConfig.test.cjs +0 -137
- package/src/main/lib/__tests__/fixChainDepth.test.cjs +0 -40
- package/src/main/lib/__tests__/fixtures/204-mercury-steam-horse.log.txt +0 -13
- package/src/main/lib/__tests__/fixtures/scheduler-machine.json.corrupt-1789147548 +0 -34
- package/src/main/lib/__tests__/gateFixtures.json +0 -20
- package/src/main/lib/__tests__/gitCacheBound.test.cjs +0 -69
- package/src/main/lib/__tests__/gitWorktree.test.cjs +0 -1478
- package/src/main/lib/__tests__/gitWorktreeSalvage.test.cjs +0 -107
- package/src/main/lib/__tests__/gitWorktreeSalvageDelta.test.cjs +0 -153
- package/src/main/lib/__tests__/guardShims.test.cjs +0 -158
- package/src/main/lib/__tests__/importReferences.spec.cjs +0 -56
- package/src/main/lib/__tests__/instanceLock.test.cjs +0 -173
- package/src/main/lib/__tests__/jobSupervisorRecord.test.cjs +0 -78
- package/src/main/lib/__tests__/jobWorktree.test.cjs +0 -199
- package/src/main/lib/__tests__/jobWorktreeBootLive.test.cjs +0 -82
- package/src/main/lib/__tests__/landedSinceRun.test.cjs +0 -133
- package/src/main/lib/__tests__/launchFailure.test.cjs +0 -220
- package/src/main/lib/__tests__/loadGate.test.cjs +0 -303
- package/src/main/lib/__tests__/localAdminHttp.test.cjs +0 -214
- package/src/main/lib/__tests__/loopDelay.test.cjs +0 -68
- package/src/main/lib/__tests__/mcpToolCatalog.test.cjs +0 -107
- package/src/main/lib/__tests__/modelCatalog.test.cjs +0 -202
- package/src/main/lib/__tests__/opsOwnership.test.cjs +0 -113
- package/src/main/lib/__tests__/opsRootAbsoluteCwd.test.cjs +0 -328
- package/src/main/lib/__tests__/opsRootNestedWrite.test.cjs +0 -51
- package/src/main/lib/__tests__/opsRootResolve.test.cjs +0 -149
- package/src/main/lib/__tests__/prdDeclaredPaths.test.cjs +0 -82
- package/src/main/lib/__tests__/prdDisposition.test.cjs +0 -224
- package/src/main/lib/__tests__/procIdentity.test.cjs +0 -119
- package/src/main/lib/__tests__/procName.test.cjs +0 -92
- package/src/main/lib/__tests__/projectBriefCore.test.cjs +0 -216
- package/src/main/lib/__tests__/projectRootResolve.test.cjs +0 -148
- package/src/main/lib/__tests__/queueHealth.test.cjs +0 -58
- package/src/main/lib/__tests__/queueStoreAtomicWrite.test.cjs +0 -88
- package/src/main/lib/__tests__/queueStoreMachineStateRecovery.test.cjs +0 -190
- package/src/main/lib/__tests__/quietMachineLease.test.cjs +0 -39
- package/src/main/lib/__tests__/rateLimitWindow.test.cjs +0 -88
- package/src/main/lib/__tests__/reaperHelpers.test.cjs +0 -577
- package/src/main/lib/__tests__/schedulerBatchDepends.test.cjs +0 -312
- package/src/main/lib/__tests__/schedulerBatchFairness.test.cjs +0 -213
- package/src/main/lib/__tests__/schedulerBatchLaunchHold.test.cjs +0 -125
- package/src/main/lib/__tests__/schedulerBatchProjectCap.test.cjs +0 -127
- package/src/main/lib/__tests__/schedulerBatchQuietMachine.test.cjs +0 -109
- package/src/main/lib/__tests__/schedulerMcpServerHeadlessRefusal.test.cjs +0 -71
- package/src/main/lib/__tests__/schedulerMcpServerHelp.test.cjs +0 -216
- package/src/main/lib/__tests__/schedulerMcpServerProjectHome.test.cjs +0 -183
- package/src/main/lib/__tests__/schedulerPaths.test.cjs +0 -226
- package/src/main/lib/__tests__/schedulerPathsWorktree.test.cjs +0 -133
- package/src/main/lib/__tests__/schedulerRuntimeState.test.cjs +0 -56
- package/src/main/lib/__tests__/sessionSlots.test.cjs +0 -144
- package/src/main/lib/__tests__/telemetryBacklog.test.cjs +0 -626
- package/src/main/lib/__tests__/telemetryBoot.test.cjs +0 -134
- package/src/main/lib/__tests__/telemetryConsent.test.cjs +0 -136
- package/src/main/lib/__tests__/telemetryCounters.test.cjs +0 -57
- package/src/main/lib/__tests__/telemetryCountersMetadataColumn.test.cjs +0 -98
- package/src/main/lib/__tests__/terminalRunOutcome.test.cjs +0 -200
- package/src/main/lib/__tests__/toolUseClassify.test.cjs +0 -53
- package/src/main/lib/__tests__/updateCheck.test.cjs +0 -63
- package/src/main/lib/__tests__/upgradeDrain.test.cjs +0 -130
- package/src/main/lib/__tests__/usageCircuit.test.cjs +0 -354
- package/src/main/lib/__tests__/watchdog-helpers.test.cjs +0 -375
- package/src/main/lib/__tests__/watchdog-relaunch.test.cjs +0 -266
- package/src/main/lib/kgExchangePairing.cjs +0 -75
|
@@ -1,244 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scheduler-commit-guard-noop.test.cjs — commitGuardVerdict must not flag a
|
|
3
|
-
* legitimate no-op job (a truthful SCHEDULER_VERDICT: PASS, no commit, whose
|
|
4
|
-
* own verifier verdict already independently proved the no-op is correct)
|
|
5
|
-
* for dirt a CONCURRENT actor (e.g. an interactive /process-feedback session
|
|
6
|
-
* writing new PRD .md files into the same repo) left in the working tree.
|
|
7
|
-
*
|
|
8
|
-
* Reproduces the confirmed 2026-07-31 incidents: job
|
|
9
|
-
* 655-needs-review-rca-feedback-hook (verdict pass_no_commit_already_shipped)
|
|
10
|
-
* was flagged uncommitted_changes for a file an interactive session wrote,
|
|
11
|
-
* and job 672-fix-feedback-session-manager similarly. Before this fix, the
|
|
12
|
-
* commit-guard had no exemption for a job whose verifier verdict was already
|
|
13
|
-
* a proven no-op (COMPLETED_EQUIVALENT_VERDICTS) — only for jobSelfCommitted
|
|
14
|
-
* or siblingRunning.
|
|
15
|
-
*
|
|
16
|
-
* Also guards the inverse: a REAL leftover-work case (no legitimate no-op
|
|
17
|
-
* verdict, no sibling, no self-commit) must still be flagged — this fix must
|
|
18
|
-
* not weaken the guard for genuine finish-protocol violations.
|
|
19
|
-
*
|
|
20
|
-
* Run: timeout 120 npx vitest run src/main/__tests__/scheduler-commit-guard-noop.test.cjs
|
|
21
|
-
*/
|
|
22
|
-
|
|
23
|
-
'use strict';
|
|
24
|
-
|
|
25
|
-
import { test, expect } from 'vitest';
|
|
26
|
-
const { commitGuardVerdict } = require('../scheduler.cjs');
|
|
27
|
-
const { resolveIsFixPlan } = require('../lib/fixPlanSlug.cjs');
|
|
28
|
-
|
|
29
|
-
test('commitGuardVerdict: legitimate no-op verdict (pass_no_commit_already_shipped) + concurrent dirt → no flag (655 incident)', () => {
|
|
30
|
-
const verifyResult = {
|
|
31
|
-
verdict: 'pass_no_commit_already_shipped',
|
|
32
|
-
reason: 'SCHEDULER_VERDICT: PASS with no commit, but every PRD-named deliverable path is already tracked',
|
|
33
|
-
downgradeTo: null,
|
|
34
|
-
};
|
|
35
|
-
const verdict = commitGuardVerdict({
|
|
36
|
-
newlyDirty: ['session-manager-operations/scheduler/prds/816-vitest-register-runverify-test.md'],
|
|
37
|
-
siblingRunning: false,
|
|
38
|
-
jobSelfCommitted: false,
|
|
39
|
-
legitimateNoOp: true,
|
|
40
|
-
verifyResult,
|
|
41
|
-
});
|
|
42
|
-
expect(verdict).toBeNull();
|
|
43
|
-
});
|
|
44
|
-
|
|
45
|
-
test('commitGuardVerdict: legitimate no-op verdict (pass_no_commit_prior_run_verified) + concurrent dirt across multiple files → no flag (672 incident)', () => {
|
|
46
|
-
const verifyResult = {
|
|
47
|
-
verdict: 'pass_no_commit_prior_run_verified',
|
|
48
|
-
reason: 'SCHEDULER_VERDICT: PASS with no commit, but a prior run of this slug landed a commit already',
|
|
49
|
-
downgradeTo: null,
|
|
50
|
-
};
|
|
51
|
-
const verdict = commitGuardVerdict({
|
|
52
|
-
newlyDirty: [
|
|
53
|
-
'session-manager-operations/feedback/processed/a.md',
|
|
54
|
-
'session-manager-operations/feedback/processed/b.md',
|
|
55
|
-
'session-manager-operations/scheduler/prds/816-vitest-register-runverify-test.md',
|
|
56
|
-
],
|
|
57
|
-
siblingRunning: false,
|
|
58
|
-
jobSelfCommitted: false,
|
|
59
|
-
legitimateNoOp: true,
|
|
60
|
-
verifyResult,
|
|
61
|
-
});
|
|
62
|
-
expect(verdict).toBeNull();
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('commitGuardVerdict: REAL leftover work (no legitimate no-op, no sibling, no self-commit) still flags uncommitted_changes', () => {
|
|
66
|
-
const verdict = commitGuardVerdict({
|
|
67
|
-
newlyDirty: ['src/main/someFeature.cjs'],
|
|
68
|
-
siblingRunning: false,
|
|
69
|
-
jobSelfCommitted: false,
|
|
70
|
-
legitimateNoOp: false,
|
|
71
|
-
verifyResult: null,
|
|
72
|
-
});
|
|
73
|
-
expect(verdict).not.toBeNull();
|
|
74
|
-
expect(verdict.verdict).toBe('uncommitted_changes');
|
|
75
|
-
expect(verdict.downgradeTo).toBe('needs_review');
|
|
76
|
-
expect(verdict.reason).toMatch(/finish protocol incomplete/);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('commitGuardVerdict: PRD 972 shape — exitCode 0, no commit, clean tree, non-exempt original slug → needs_review (must fail against pre-fix main)', () => {
|
|
80
|
-
const verdict = commitGuardVerdict({
|
|
81
|
-
newlyDirty: [],
|
|
82
|
-
siblingRunning: false,
|
|
83
|
-
jobSelfCommitted: false,
|
|
84
|
-
legitimateNoOp: false,
|
|
85
|
-
isFixPlanJob: false,
|
|
86
|
-
verifyResult: null,
|
|
87
|
-
});
|
|
88
|
-
expect(verdict).not.toBeNull();
|
|
89
|
-
expect(verdict.verdict).toBe('silent_no_op');
|
|
90
|
-
expect(verdict.downgradeTo).toBe('needs_review');
|
|
91
|
-
expect(verdict.reason).toMatch(/finish protocol incomplete/);
|
|
92
|
-
});
|
|
93
|
-
|
|
94
|
-
test('commitGuardVerdict: fix-plan job (523-fix-bounded-fix-plan-retry incident) — no commit, clean tree, isFixPlanJob → no flag', () => {
|
|
95
|
-
const verdict = commitGuardVerdict({
|
|
96
|
-
newlyDirty: [],
|
|
97
|
-
siblingRunning: false,
|
|
98
|
-
jobSelfCommitted: false,
|
|
99
|
-
legitimateNoOp: false,
|
|
100
|
-
isFixPlanJob: true,
|
|
101
|
-
verifyResult: { verdict: 'clean', reason: null, downgradeTo: null },
|
|
102
|
-
});
|
|
103
|
-
expect(verdict).toBeNull();
|
|
104
|
-
});
|
|
105
|
-
|
|
106
|
-
test('commitGuardVerdict: a zero-edit run of a human-authored PRD whose slug merely starts with "fix-" still yields silent_no_op (PRD 1131 — not exempted by name alone)', () => {
|
|
107
|
-
// Mirrors PRD 1126: authored via scheduler_create_prd (isFixPlan stamped
|
|
108
|
-
// false at reconcile time), slug happens to read "fix-...". Feeding the
|
|
109
|
-
// job's own persisted isFixPlan through resolveIsFixPlan (the same call
|
|
110
|
-
// spawnJob makes) must NOT exempt this zero-edit run from the guard.
|
|
111
|
-
const job = { slug: '126-fix-plan-death-reopens-parent', isFixPlan: false };
|
|
112
|
-
const verdict = commitGuardVerdict({
|
|
113
|
-
newlyDirty: [],
|
|
114
|
-
siblingRunning: false,
|
|
115
|
-
jobSelfCommitted: false,
|
|
116
|
-
legitimateNoOp: false,
|
|
117
|
-
isFixPlanJob: resolveIsFixPlan(job.slug, job.isFixPlan),
|
|
118
|
-
verifyResult: null,
|
|
119
|
-
});
|
|
120
|
-
expect(verdict).not.toBeNull();
|
|
121
|
-
expect(verdict.verdict).toBe('silent_no_op');
|
|
122
|
-
expect(verdict.downgradeTo).toBe('needs_review');
|
|
123
|
-
});
|
|
124
|
-
|
|
125
|
-
test('commitGuardVerdict: fix-plan job that DID leave real dirt behind is still flagged (isFixPlanJob only exempts the zero-edit case)', () => {
|
|
126
|
-
const verdict = commitGuardVerdict({
|
|
127
|
-
newlyDirty: ['src/main/someFeature.cjs'],
|
|
128
|
-
siblingRunning: false,
|
|
129
|
-
jobSelfCommitted: false,
|
|
130
|
-
legitimateNoOp: false,
|
|
131
|
-
isFixPlanJob: true,
|
|
132
|
-
verifyResult: null,
|
|
133
|
-
});
|
|
134
|
-
expect(verdict).not.toBeNull();
|
|
135
|
-
expect(verdict.verdict).toBe('uncommitted_changes');
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
test('commitGuardVerdict: COMPLETED_EQUIVALENT verdict, no commit, clean tree → no flag (legitimateNoOp covers the zero-edit case too)', () => {
|
|
139
|
-
const verdict = commitGuardVerdict({
|
|
140
|
-
newlyDirty: [],
|
|
141
|
-
siblingRunning: false,
|
|
142
|
-
jobSelfCommitted: false,
|
|
143
|
-
legitimateNoOp: true,
|
|
144
|
-
isFixPlanJob: false,
|
|
145
|
-
verifyResult: {
|
|
146
|
-
verdict: 'pass_no_commit_already_shipped',
|
|
147
|
-
reason: 'SCHEDULER_VERDICT: PASS with no commit, but every PRD-named deliverable path is already tracked',
|
|
148
|
-
downgradeTo: null,
|
|
149
|
-
},
|
|
150
|
-
});
|
|
151
|
-
expect(verdict).toBeNull();
|
|
152
|
-
});
|
|
153
|
-
|
|
154
|
-
test('commitGuardVerdict: sibling running + zero-edit → no flag (concurrent job makes working-tree evidence unreliable in both directions)', () => {
|
|
155
|
-
const verdict = commitGuardVerdict({
|
|
156
|
-
newlyDirty: [],
|
|
157
|
-
siblingRunning: true,
|
|
158
|
-
jobSelfCommitted: false,
|
|
159
|
-
legitimateNoOp: false,
|
|
160
|
-
isFixPlanJob: false,
|
|
161
|
-
verifyResult: null,
|
|
162
|
-
});
|
|
163
|
-
expect(verdict).toBeNull();
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
test('commitGuardVerdict: sibling running skip still works (regression check)', () => {
|
|
167
|
-
const verdict = commitGuardVerdict({
|
|
168
|
-
newlyDirty: ['some/file.md'],
|
|
169
|
-
siblingRunning: true,
|
|
170
|
-
jobSelfCommitted: false,
|
|
171
|
-
legitimateNoOp: false,
|
|
172
|
-
verifyResult: null,
|
|
173
|
-
});
|
|
174
|
-
expect(verdict).toBeNull();
|
|
175
|
-
});
|
|
176
|
-
|
|
177
|
-
test('commitGuardVerdict: self-commit skip still works (regression check)', () => {
|
|
178
|
-
const verdict = commitGuardVerdict({
|
|
179
|
-
newlyDirty: ['some/file.md'],
|
|
180
|
-
siblingRunning: false,
|
|
181
|
-
jobSelfCommitted: true,
|
|
182
|
-
legitimateNoOp: false,
|
|
183
|
-
verifyResult: null,
|
|
184
|
-
});
|
|
185
|
-
expect(verdict).toBeNull();
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
test('commitGuardVerdict: ranInWorktree=true defeats siblingRunning — clean tree, no self-commit → silent_no_op (PRD 109 shape)', () => {
|
|
189
|
-
const verdict = commitGuardVerdict({
|
|
190
|
-
newlyDirty: [],
|
|
191
|
-
siblingRunning: true,
|
|
192
|
-
ranInWorktree: true,
|
|
193
|
-
jobSelfCommitted: false,
|
|
194
|
-
legitimateNoOp: false,
|
|
195
|
-
isFixPlanJob: false,
|
|
196
|
-
verifyResult: null,
|
|
197
|
-
});
|
|
198
|
-
expect(verdict).not.toBeNull();
|
|
199
|
-
expect(verdict.verdict).toBe('silent_no_op');
|
|
200
|
-
expect(verdict.downgradeTo).toBe('needs_review');
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
test('commitGuardVerdict: identical inputs with ranInWorktree=false → no flag (legacy shared-tree behaviour unchanged)', () => {
|
|
204
|
-
const verdict = commitGuardVerdict({
|
|
205
|
-
newlyDirty: [],
|
|
206
|
-
siblingRunning: true,
|
|
207
|
-
ranInWorktree: false,
|
|
208
|
-
jobSelfCommitted: false,
|
|
209
|
-
legitimateNoOp: false,
|
|
210
|
-
isFixPlanJob: false,
|
|
211
|
-
verifyResult: null,
|
|
212
|
-
});
|
|
213
|
-
expect(verdict).toBeNull();
|
|
214
|
-
});
|
|
215
|
-
|
|
216
|
-
test('commitGuardVerdict: ranInWorktree=true + siblingRunning=true but jobSelfCommitted=true → no flag (self-commit carve-out still applies)', () => {
|
|
217
|
-
const verdict = commitGuardVerdict({
|
|
218
|
-
newlyDirty: [],
|
|
219
|
-
siblingRunning: true,
|
|
220
|
-
ranInWorktree: true,
|
|
221
|
-
jobSelfCommitted: true,
|
|
222
|
-
legitimateNoOp: false,
|
|
223
|
-
isFixPlanJob: false,
|
|
224
|
-
verifyResult: null,
|
|
225
|
-
});
|
|
226
|
-
expect(verdict).toBeNull();
|
|
227
|
-
});
|
|
228
|
-
|
|
229
|
-
test('commitGuardVerdict: carries forward a non-clean prior verdict as an annotation', () => {
|
|
230
|
-
const verifyResult = {
|
|
231
|
-
verdict: 'transcript_errors',
|
|
232
|
-
reason: 'grep hit an Error string',
|
|
233
|
-
downgradeTo: 'needs_review',
|
|
234
|
-
};
|
|
235
|
-
const verdict = commitGuardVerdict({
|
|
236
|
-
newlyDirty: ['some/file.md'],
|
|
237
|
-
siblingRunning: false,
|
|
238
|
-
jobSelfCommitted: false,
|
|
239
|
-
legitimateNoOp: false,
|
|
240
|
-
verifyResult,
|
|
241
|
-
});
|
|
242
|
-
expect(verdict).not.toBeNull();
|
|
243
|
-
expect(verdict.annotations).toEqual([{ verdict: 'transcript_errors', reason: 'grep hit an Error string' }]);
|
|
244
|
-
});
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scheduler-committed-in-window.test.cjs — unit tests for committedInWindow
|
|
3
|
-
* and computeCommittedDuringRun's bounded retry.
|
|
4
|
-
*
|
|
5
|
-
* Run: timeout 300 npx vitest run src/main/__tests__/scheduler-committed-in-window.test.cjs
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
'use strict';
|
|
9
|
-
|
|
10
|
-
import { test, expect, vi } from 'vitest';
|
|
11
|
-
const fs = require('node:fs');
|
|
12
|
-
const os = require('node:os');
|
|
13
|
-
const path = require('node:path');
|
|
14
|
-
const { execFileSync } = require('node:child_process');
|
|
15
|
-
const scheduler = require('../scheduler.cjs');
|
|
16
|
-
const { committedInWindow, computeCommittedDuringRun } = scheduler;
|
|
17
|
-
|
|
18
|
-
function git(cwd, args) {
|
|
19
|
-
return execFileSync('git', args, { cwd, encoding: 'utf8' }).trim();
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
function makeRepo() {
|
|
23
|
-
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'sm-committed-in-window-'));
|
|
24
|
-
git(dir, ['init', '-q']);
|
|
25
|
-
git(dir, ['config', 'user.email', 'test@example.com']);
|
|
26
|
-
git(dir, ['config', 'user.name', 'Test']);
|
|
27
|
-
fs.writeFileSync(path.join(dir, 'base.txt'), 'base\n');
|
|
28
|
-
git(dir, ['add', '.']);
|
|
29
|
-
git(dir, ['commit', '-q', '-m', 'base']);
|
|
30
|
-
return dir;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
test('committedInWindow returns true for a commit landed on a non-checked-out branch', async () => {
|
|
34
|
-
const dir = makeRepo();
|
|
35
|
-
try {
|
|
36
|
-
git(dir, ['checkout', '-q', '-b', 'work']);
|
|
37
|
-
|
|
38
|
-
const startedAt = new Date().toISOString();
|
|
39
|
-
fs.writeFileSync(path.join(dir, 'feature.txt'), 'feature\n');
|
|
40
|
-
git(dir, ['add', '.']);
|
|
41
|
-
git(dir, ['commit', '-q', '-m', 'feature commit']);
|
|
42
|
-
const finishedAt = new Date(Date.now() + 1000).toISOString();
|
|
43
|
-
|
|
44
|
-
// Simulate the run leaving a different branch checked out at exit.
|
|
45
|
-
git(dir, ['checkout', '-q', '-b', 'other-branch-at-exit']);
|
|
46
|
-
|
|
47
|
-
const result = await committedInWindow(dir, startedAt, finishedAt);
|
|
48
|
-
expect(result).toBe(true);
|
|
49
|
-
} finally {
|
|
50
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
51
|
-
}
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
test('committedInWindow returns false when the window covers no commit', async () => {
|
|
55
|
-
const dir = makeRepo();
|
|
56
|
-
try {
|
|
57
|
-
const farFutureStart = new Date(Date.now() + 365 * 24 * 60 * 60 * 1000).toISOString();
|
|
58
|
-
const farFutureEnd = new Date(Date.now() + 366 * 24 * 60 * 60 * 1000).toISOString();
|
|
59
|
-
|
|
60
|
-
const result = await committedInWindow(dir, farFutureStart, farFutureEnd);
|
|
61
|
-
expect(result).toBe(false);
|
|
62
|
-
} finally {
|
|
63
|
-
fs.rmSync(dir, { recursive: true, force: true });
|
|
64
|
-
}
|
|
65
|
-
});
|
|
66
|
-
|
|
67
|
-
// Reproduces the sigma PRD 713 incident: a commit made+pushed from an
|
|
68
|
-
// isolated worktree checkout that shares the run's remote but not job.cwd's
|
|
69
|
-
// local refs — e.g. `git worktree add /tmp/foo` followed by `git worktree
|
|
70
|
-
// remove` clears the worktree's local branch, leaving the commit reachable
|
|
71
|
-
// in job.cwd only via a remote-tracking ref that hasn't been fetched yet.
|
|
72
|
-
// Modeled here as a second, independent clone of the shared remote (rather
|
|
73
|
-
// than a literal `git worktree add`, which shares job.cwd's .git store and
|
|
74
|
-
// so opportunistically updates job.cwd's remote-tracking ref on push,
|
|
75
|
-
// masking the staleness this test needs to exercise) — the observable
|
|
76
|
-
// symptom is identical: job.cwd's remote-tracking ref is stale until fetched.
|
|
77
|
-
test('committedInWindow sees a commit pushed from an isolated checkout, only reachable via a stale remote-tracking ref', async () => {
|
|
78
|
-
const bareDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sm-committed-in-window-bare-'));
|
|
79
|
-
const cwd = fs.mkdtempSync(path.join(os.tmpdir(), 'sm-committed-in-window-cwd-'));
|
|
80
|
-
const worktreeDir = fs.mkdtempSync(path.join(os.tmpdir(), 'sm-committed-in-window-wt-'));
|
|
81
|
-
try {
|
|
82
|
-
git(bareDir, ['init', '-q', '--bare']);
|
|
83
|
-
|
|
84
|
-
const seedDir = makeRepo();
|
|
85
|
-
try {
|
|
86
|
-
git(seedDir, ['push', bareDir, 'HEAD:refs/heads/main']);
|
|
87
|
-
// Without an explicit default branch, the bare repo's symbolic HEAD can
|
|
88
|
-
// point at a nonexistent ref (e.g. 'master'), which makes the clone
|
|
89
|
-
// below check out no local branch at all — set it explicitly.
|
|
90
|
-
git(bareDir, ['symbolic-ref', 'HEAD', 'refs/heads/main']);
|
|
91
|
-
} finally {
|
|
92
|
-
fs.rmSync(seedDir, { recursive: true, force: true });
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
git(cwd, ['clone', '-q', bareDir, '.']);
|
|
96
|
-
git(cwd, ['config', 'user.email', 'test@example.com']);
|
|
97
|
-
git(cwd, ['config', 'user.name', 'Test']);
|
|
98
|
-
|
|
99
|
-
const startedAt = new Date().toISOString();
|
|
100
|
-
|
|
101
|
-
// Simulate the PRD's own isolated-checkout workflow: a separate clone of
|
|
102
|
-
// the same shared remote, a commit there, a push back to that remote —
|
|
103
|
-
// job.cwd never touches this checkout and never fetches after the push.
|
|
104
|
-
git(worktreeDir, ['clone', '-q', bareDir, '.']);
|
|
105
|
-
git(worktreeDir, ['config', 'user.email', 'test@example.com']);
|
|
106
|
-
git(worktreeDir, ['config', 'user.name', 'Test']);
|
|
107
|
-
git(worktreeDir, ['checkout', '-q', '-b', 'temp-merge-branch']);
|
|
108
|
-
fs.writeFileSync(path.join(worktreeDir, 'feature.txt'), 'feature\n');
|
|
109
|
-
git(worktreeDir, ['add', '.']);
|
|
110
|
-
git(worktreeDir, ['commit', '-q', '-m', 'feature commit from isolated worktree']);
|
|
111
|
-
git(worktreeDir, ['push', 'origin', 'temp-merge-branch']);
|
|
112
|
-
|
|
113
|
-
const finishedAt = new Date(Date.now() + 1000).toISOString();
|
|
114
|
-
|
|
115
|
-
// Precondition: without a fetch, job.cwd genuinely cannot see the commit —
|
|
116
|
-
// this is what made committedInWindow's old bare `git log --all` blind to it.
|
|
117
|
-
expect(() => git(cwd, ['log', '--all', '--format=%H', '--grep=feature commit from isolated worktree']))
|
|
118
|
-
.not.toThrow();
|
|
119
|
-
const beforeFetch = git(cwd, ['log', '--all', '--format=%H', '--grep=feature commit from isolated worktree']);
|
|
120
|
-
expect(beforeFetch).toBe('');
|
|
121
|
-
|
|
122
|
-
const result = await committedInWindow(cwd, startedAt, finishedAt);
|
|
123
|
-
expect(result).toBe(true);
|
|
124
|
-
} finally {
|
|
125
|
-
fs.rmSync(bareDir, { recursive: true, force: true });
|
|
126
|
-
fs.rmSync(cwd, { recursive: true, force: true });
|
|
127
|
-
fs.rmSync(worktreeDir, { recursive: true, force: true });
|
|
128
|
-
}
|
|
129
|
-
});
|
|
130
|
-
|
|
131
|
-
// Reproduces the pass-no-commit-worktree / RCA 770-pr269 incidents: the live
|
|
132
|
-
// commit-guard's committedInWindow() call can race against ref/object
|
|
133
|
-
// visibility at the exact moment of process exit and return false even
|
|
134
|
-
// though the commit is real. computeCommittedDuringRun() should retry once
|
|
135
|
-
// after a bounded delay before giving up.
|
|
136
|
-
test('computeCommittedDuringRun retries committedInWindow once and returns true when the retry succeeds', async () => {
|
|
137
|
-
vi.useFakeTimers();
|
|
138
|
-
try {
|
|
139
|
-
const spy = vi.spyOn(scheduler, 'committedInWindow')
|
|
140
|
-
.mockResolvedValueOnce(false)
|
|
141
|
-
.mockResolvedValueOnce(true);
|
|
142
|
-
|
|
143
|
-
const resultPromise = computeCommittedDuringRun('/tmp/fake', 'abc', 'abc', 'start', 'until');
|
|
144
|
-
await vi.runAllTimersAsync();
|
|
145
|
-
const result = await resultPromise;
|
|
146
|
-
|
|
147
|
-
expect(result).toBe(true);
|
|
148
|
-
expect(spy).toHaveBeenCalledTimes(2);
|
|
149
|
-
} finally {
|
|
150
|
-
vi.useRealTimers();
|
|
151
|
-
vi.restoreAllMocks();
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
test('computeCommittedDuringRun returns false when both committedInWindow calls return false', async () => {
|
|
156
|
-
vi.useFakeTimers();
|
|
157
|
-
try {
|
|
158
|
-
const spy = vi.spyOn(scheduler, 'committedInWindow').mockResolvedValue(false);
|
|
159
|
-
|
|
160
|
-
const resultPromise = computeCommittedDuringRun('/tmp/fake', 'abc', 'abc', 'start', 'until');
|
|
161
|
-
await vi.runAllTimersAsync();
|
|
162
|
-
const result = await resultPromise;
|
|
163
|
-
|
|
164
|
-
expect(result).toBe(false);
|
|
165
|
-
expect(spy).toHaveBeenCalledTimes(2);
|
|
166
|
-
} finally {
|
|
167
|
-
vi.useRealTimers();
|
|
168
|
-
vi.restoreAllMocks();
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
test('computeCommittedDuringRun skips the retry (and the delay) when the HEAD-diff fast path already resolves true', async () => {
|
|
173
|
-
const spy = vi.spyOn(scheduler, 'committedInWindow');
|
|
174
|
-
try {
|
|
175
|
-
const result = await computeCommittedDuringRun('/tmp/fake', 'headBefore', 'headAfter', 'start', 'until');
|
|
176
|
-
|
|
177
|
-
expect(result).toBe(true);
|
|
178
|
-
expect(spy).not.toHaveBeenCalled();
|
|
179
|
-
} finally {
|
|
180
|
-
vi.restoreAllMocks();
|
|
181
|
-
}
|
|
182
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
// Ported from the retired top-level test-root directory (a node:test suite,
|
|
4
|
-
// never runnable by this repo's vitest-only setup — see CLAUDE.md's Commands
|
|
5
|
-
// section). Pins the two basic cross-project pickNextBatch contracts that
|
|
6
|
-
// were asserted there but not literally exercised elsewhere: N independent
|
|
7
|
-
// projects each with a single pending job all fire together when the global
|
|
8
|
-
// slot pool is generous, and a global cap BELOW the total pending count
|
|
9
|
-
// across projects admits exactly that many, not more.
|
|
10
|
-
//
|
|
11
|
-
// Run: timeout 120 npx vitest run src/main/__tests__/scheduler-cross-project-batch.test.cjs
|
|
12
|
-
|
|
13
|
-
const assert = require('node:assert/strict');
|
|
14
|
-
const { pickNextBatch } = require('../lib/schedulerBatch.cjs');
|
|
15
|
-
|
|
16
|
-
function job(slug, status, cwd, parallelGroup) {
|
|
17
|
-
return { slug, status, cwd, parallelGroup, dependsOn: [] };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
test('3 independent projects, 1 pending each, generous cap (6) → all 3 fire', () => {
|
|
21
|
-
const jobs = [
|
|
22
|
-
job('a-job', 'pending', '/a', 5),
|
|
23
|
-
job('b-job', 'pending', '/b', 5),
|
|
24
|
-
job('c-job', 'pending', '/c', 5),
|
|
25
|
-
];
|
|
26
|
-
const { batch, reason } = pickNextBatch(jobs, new Set(), 6);
|
|
27
|
-
assert.equal(batch.length, 3);
|
|
28
|
-
assert.equal(reason, null);
|
|
29
|
-
const slugs = new Set(batch.map((j) => j.slug));
|
|
30
|
-
assert.ok(slugs.has('a-job'));
|
|
31
|
-
assert.ok(slugs.has('b-job'));
|
|
32
|
-
assert.ok(slugs.has('c-job'));
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
test('3 independent projects, 1 pending each, cap 2 (below total pending) → exactly 2 fire', () => {
|
|
36
|
-
const jobs = [
|
|
37
|
-
job('a-job', 'pending', '/a', 5),
|
|
38
|
-
job('b-job', 'pending', '/b', 5),
|
|
39
|
-
job('c-job', 'pending', '/c', 5),
|
|
40
|
-
];
|
|
41
|
-
const { batch } = pickNextBatch(jobs, new Set(), 2);
|
|
42
|
-
assert.equal(batch.length, 2);
|
|
43
|
-
});
|
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* scheduler-default-eligible-heal.test.cjs — the periodic heal ladder is
|
|
3
|
-
* default-ELIGIBLE (2026-09-18, 1229-fo-03 parked shared_tree_reverted and
|
|
4
|
-
* blocked 19 of 20 pending rows because that verdict was on no allow-list).
|
|
5
|
-
*
|
|
6
|
-
* Covers: any needs_review verdict is a candidate unless named in
|
|
7
|
-
* RESCAN_EXCLUDED_VERDICTS; the evidence rung is bounded; a row that cannot
|
|
8
|
-
* heal terminates under the bounded ladder; health names a silent blocker.
|
|
9
|
-
*
|
|
10
|
-
* Run: timeout 120 npx vitest run src/main/__tests__/scheduler-default-eligible-heal.test.cjs
|
|
11
|
-
*/
|
|
12
|
-
|
|
13
|
-
'use strict';
|
|
14
|
-
|
|
15
|
-
const assert = require('node:assert/strict');
|
|
16
|
-
const fs = require('node:fs');
|
|
17
|
-
const os = require('node:os');
|
|
18
|
-
const path = require('node:path');
|
|
19
|
-
|
|
20
|
-
process.env.HOME = fs.mkdtempSync(path.join(os.tmpdir(), 'default-eligible-heal-test-'));
|
|
21
|
-
|
|
22
|
-
// Fixture cwd must be a REAL, writable dir: transitionJob out of needs_review
|
|
23
|
-
// fire-and-forgets a history append under <cwd>/session-manager-operations. A fake
|
|
24
|
-
// path made it fail EACCES AFTER the sync test returned, so its console.error hit
|
|
25
|
-
// vitest mid worker-close ("Closing rpc while onUserConsoleLog was pending").
|
|
26
|
-
const PROJECT_CWD = path.join(process.env.HOME, 'project');
|
|
27
|
-
fs.mkdirSync(PROJECT_CWD, { recursive: true });
|
|
28
|
-
|
|
29
|
-
const {
|
|
30
|
-
isRescanCandidate,
|
|
31
|
-
isTranscriptRescannable,
|
|
32
|
-
isStrandedAutoFixPark,
|
|
33
|
-
isEligibleForNeedsReviewAutoResolve,
|
|
34
|
-
shouldRunPeriodicReverify,
|
|
35
|
-
selectEvidenceScanTargets,
|
|
36
|
-
selectAutoFixTargets,
|
|
37
|
-
selectMechanicalRecoveryTarget,
|
|
38
|
-
selectResumeRecoveryTarget,
|
|
39
|
-
applyNeedsReviewAutoResolve,
|
|
40
|
-
RESCAN_EXCLUDED_VERDICTS,
|
|
41
|
-
RESCANNABLE_VERDICTS,
|
|
42
|
-
EVIDENCE_SCAN_MAX_PER_PASS,
|
|
43
|
-
EVIDENCE_SCAN_MIN_INTERVAL_MS,
|
|
44
|
-
REVERIFY_INTERVAL_MS,
|
|
45
|
-
NEEDS_REVIEW_RESOLVE_CAP,
|
|
46
|
-
} = require('../scheduler.cjs');
|
|
47
|
-
const { evaluateBlockingParkHealth } = require('../health.cjs');
|
|
48
|
-
|
|
49
|
-
const row = (o = {}) => ({ slug: '10-x', status: 'needs_review', runId: 'r1', cwd: PROJECT_CWD, ...o });
|
|
50
|
-
|
|
51
|
-
test('shared_tree_reverted is a rescan candidate without being on any list', () => {
|
|
52
|
-
assert.equal(RESCANNABLE_VERDICTS.has('shared_tree_reverted'), false);
|
|
53
|
-
assert.equal(isRescanCandidate(row({ verifierVerdict: 'shared_tree_reverted' })), true);
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
test('an invented verdict name the code has never seen is a rescan candidate', () => {
|
|
57
|
-
const j = row({ verifierVerdict: 'some_future_guard_verdict' });
|
|
58
|
-
assert.equal(isRescanCandidate(j), true);
|
|
59
|
-
assert.equal(shouldRunPeriodicReverify([j]), true);
|
|
60
|
-
// Not transcript-rescannable: it gets the evidence rung, never a verifyRun heal.
|
|
61
|
-
assert.equal(isTranscriptRescannable(j), false);
|
|
62
|
-
assert.deepEqual(selectEvidenceScanTargets([j]).map((x) => x.slug), ['10-x']);
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
test('a needs_review row with no runId and no verdict is still a candidate', () => {
|
|
66
|
-
assert.equal(isRescanCandidate({ slug: 's', status: 'needs_review' }), true);
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
test('only the named exclusions are refused, each verdict in the set', () => {
|
|
70
|
-
for (const v of RESCAN_EXCLUDED_VERDICTS) assert.equal(isRescanCandidate(row({ verifierVerdict: v })), false, v);
|
|
71
|
-
assert.deepEqual([...RESCAN_EXCLUDED_VERDICTS].sort(), ['budget_exceeded', 'uncommitted_changes', 'worktree_integration_failed']);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('rescannable verdict keeps the transcript rung as a hint', () => {
|
|
75
|
-
assert.equal(isTranscriptRescannable(row({ verifierVerdict: 'transcript_errors' })), true);
|
|
76
|
-
assert.deepEqual(selectEvidenceScanTargets([row({ verifierVerdict: 'transcript_errors' })]), []);
|
|
77
|
-
});
|
|
78
|
-
|
|
79
|
-
test('1229-fo-03 shape: stranded auto-fix park is an auto-resolve door AND an evidence-scan target', () => {
|
|
80
|
-
const j = row({ verifierVerdict: 'shared_tree_reverted', autoFixAttempted: true });
|
|
81
|
-
assert.equal(isStrandedAutoFixPark(j, [j]), true);
|
|
82
|
-
assert.equal(isEligibleForNeedsReviewAutoResolve(j, [j]), true);
|
|
83
|
-
assert.equal(selectEvidenceScanTargets([j]).length, 1, 'looksDone evidence is now computed for it, so the door can fire');
|
|
84
|
-
});
|
|
85
|
-
|
|
86
|
-
test('a live auto-fix history that is not an auto-resolve door gets no evidence scan (PRD 1136)', () => {
|
|
87
|
-
const j = row({ verifierVerdict: 'some_future_guard_verdict', autoFixAttempted: true, autoFixOutcome: 'plan' });
|
|
88
|
-
assert.equal(selectEvidenceScanTargets([j]).length, 0);
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
test('cost bound: per-pass cap, looksDone skip, and per-row re-scan throttle', () => {
|
|
92
|
-
const now = Date.now();
|
|
93
|
-
const many = Array.from({ length: 100 }, (_, i) => row({ slug: `${i}-p`, verifierVerdict: 'v_new' }));
|
|
94
|
-
assert.equal(selectEvidenceScanTargets(many, now).length, EVIDENCE_SCAN_MAX_PER_PASS);
|
|
95
|
-
const done = many.map((j) => ({ ...j, looksDone: { commits: ['a'] } }));
|
|
96
|
-
assert.equal(selectEvidenceScanTargets(done, now).length, 0);
|
|
97
|
-
const fresh = many.map((j) => ({ ...j, evidenceScannedAt: new Date(now - EVIDENCE_SCAN_MIN_INTERVAL_MS + 1000).toISOString() }));
|
|
98
|
-
assert.equal(selectEvidenceScanTargets(fresh, now).length, 0);
|
|
99
|
-
// never-scanned rows go before stale-scanned ones
|
|
100
|
-
const mixed = [
|
|
101
|
-
row({ slug: 'old', verifierVerdict: 'v', evidenceScannedAt: new Date(now - 10 * EVIDENCE_SCAN_MIN_INTERVAL_MS).toISOString() }),
|
|
102
|
-
row({ slug: 'never', verifierVerdict: 'v' }),
|
|
103
|
-
];
|
|
104
|
-
assert.equal(selectEvidenceScanTargets(mixed, now)[0].slug, 'never');
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
test('unhealable row terminates: N passes yield a bounded number of recovery attempts, reason intact', () => {
|
|
108
|
-
let now = Date.now();
|
|
109
|
-
const job = row({ slug: '20-stuck', verifierVerdict: 'some_future_guard_verdict' });
|
|
110
|
-
const jobs = [job];
|
|
111
|
-
let evidenceScans = 0;
|
|
112
|
-
let autoFixDispatches = 0;
|
|
113
|
-
let resumeOrMechanical = 0;
|
|
114
|
-
const PASSES = 500;
|
|
115
|
-
for (let n = 0; n < PASSES; n++) {
|
|
116
|
-
now += REVERIFY_INTERVAL_MS;
|
|
117
|
-
for (const t of selectEvidenceScanTargets(jobs, now)) { evidenceScans++; t.evidenceScannedAt = new Date(now).toISOString(); }
|
|
118
|
-
resumeOrMechanical += jobs.filter((j) => selectMechanicalRecoveryTarget(j) || selectResumeRecoveryTarget(j)).length;
|
|
119
|
-
for (const t of selectAutoFixTargets(jobs, { fixSlugExists: () => false, resolveJobRunId: () => 'r1' })) {
|
|
120
|
-
autoFixDispatches++;
|
|
121
|
-
// what reverifyNeedsReview stamps before spawning
|
|
122
|
-
t.autoFixRetries = t.autoFixAttempted === true ? (t.autoFixRetries ?? 0) + 1 : t.autoFixRetries;
|
|
123
|
-
t.autoFixAttempted = true;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
assert.ok(autoFixDispatches <= 2, `auto-fix dispatched ${autoFixDispatches}x`);
|
|
127
|
-
assert.equal(resumeOrMechanical, 0);
|
|
128
|
-
// one scan per throttle window, not one per pass
|
|
129
|
-
assert.ok(evidenceScans <= Math.ceil(PASSES * REVERIFY_INTERVAL_MS / EVIDENCE_SCAN_MIN_INTERVAL_MS), `evidence scans ${evidenceScans}`);
|
|
130
|
-
assert.ok(evidenceScans < PASSES / 2);
|
|
131
|
-
assert.equal(job.status, 'needs_review');
|
|
132
|
-
assert.equal(job.verifierVerdict, 'some_future_guard_verdict');
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
test('auto-resolve ladder is capped: requeue attempts stop at NEEDS_REVIEW_RESOLVE_CAP then skip', () => {
|
|
136
|
-
const j = row({ slug: '30-cap', verifierVerdict: 'x', autoFixAttempted: true });
|
|
137
|
-
const outcomes = [];
|
|
138
|
-
for (let i = 0; i < NEEDS_REVIEW_RESOLVE_CAP + 3; i++) {
|
|
139
|
-
const o = applyNeedsReviewAutoResolve(j, [j]);
|
|
140
|
-
if (!o) break;
|
|
141
|
-
outcomes.push(o);
|
|
142
|
-
if (o === 'requeued') j.status = 'needs_review';
|
|
143
|
-
if (o === 'skipped') break;
|
|
144
|
-
}
|
|
145
|
-
assert.equal(outcomes.filter((o) => o === 'requeued').length, NEEDS_REVIEW_RESOLVE_CAP);
|
|
146
|
-
assert.equal(outcomes.at(-1), 'skipped');
|
|
147
|
-
});
|
|
148
|
-
|
|
149
|
-
describe('evaluateBlockingParkHealth', () => {
|
|
150
|
-
const now = Date.parse('2026-09-18T20:00:00Z');
|
|
151
|
-
const parkedAgo = (ms) => [{ to: 'needs_review', at: new Date(now - ms).toISOString() }];
|
|
152
|
-
const park = (ms, o = {}) => ({ slug: '5-park', status: 'needs_review', cwd: PROJECT_CWD, verifierVerdict: 'shared_tree_reverted', statusHistory: parkedAgo(ms), ...o });
|
|
153
|
-
const dep = (slug, dependsOn) => ({ slug, status: 'pending', cwd: PROJECT_CWD, dependsOn });
|
|
154
|
-
|
|
155
|
-
test('parked past one interval with pending dependents (transitive) is non-green, naming row + count', () => {
|
|
156
|
-
const r = evaluateBlockingParkHealth([park(REVERIFY_INTERVAL_MS + 1000), dep('6-a', ['5-park']), dep('7-b', ['6-a']), dep('8-c', [])], now);
|
|
157
|
-
assert.equal(r.ok, false);
|
|
158
|
-
assert.equal(r.parks[0].slug, '5-park');
|
|
159
|
-
assert.equal(r.parks[0].dependents, 2);
|
|
160
|
-
assert.match(r.message, /5-park/);
|
|
161
|
-
assert.match(r.message, /blocking 2 pending dependent/);
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
test('young park, or park with no dependents, is healthy', () => {
|
|
165
|
-
assert.equal(evaluateBlockingParkHealth([park(1000), dep('6-a', ['5-park'])], now).ok, true);
|
|
166
|
-
assert.equal(evaluateBlockingParkHealth([park(REVERIFY_INTERVAL_MS * 5), dep('6-a', [])], now).ok, true);
|
|
167
|
-
});
|
|
168
|
-
});
|