hungry-ghost-hive 0.48.0 → 0.49.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/dist/agents/base-agent.d.ts +11 -11
- package/dist/agents/base-agent.d.ts.map +1 -1
- package/dist/agents/base-agent.js +25 -25
- package/dist/agents/base-agent.js.map +1 -1
- package/dist/agents/base-agent.test.js +2 -1
- package/dist/agents/base-agent.test.js.map +1 -1
- package/dist/agents/intermediate.d.ts +2 -0
- package/dist/agents/intermediate.d.ts.map +1 -1
- package/dist/agents/intermediate.js +25 -18
- package/dist/agents/intermediate.js.map +1 -1
- package/dist/agents/junior.d.ts +2 -0
- package/dist/agents/junior.d.ts.map +1 -1
- package/dist/agents/junior.js +25 -18
- package/dist/agents/junior.js.map +1 -1
- package/dist/agents/qa.d.ts +2 -0
- package/dist/agents/qa.d.ts.map +1 -1
- package/dist/agents/qa.js +47 -38
- package/dist/agents/qa.js.map +1 -1
- package/dist/agents/senior.d.ts +2 -0
- package/dist/agents/senior.d.ts.map +1 -1
- package/dist/agents/senior.js +40 -27
- package/dist/agents/senior.js.map +1 -1
- package/dist/agents/tech-lead.d.ts +2 -0
- package/dist/agents/tech-lead.d.ts.map +1 -1
- package/dist/agents/tech-lead.js +37 -31
- package/dist/agents/tech-lead.js.map +1 -1
- package/dist/cli/commands/add-repo.js +2 -2
- package/dist/cli/commands/add-repo.js.map +1 -1
- package/dist/cli/commands/add-repo.test.js +1 -1
- package/dist/cli/commands/add-repo.test.js.map +1 -1
- package/dist/cli/commands/agents.d.ts.map +1 -1
- package/dist/cli/commands/agents.js +12 -10
- package/dist/cli/commands/agents.js.map +1 -1
- package/dist/cli/commands/agents.test.js +7 -7
- package/dist/cli/commands/agents.test.js.map +1 -1
- package/dist/cli/commands/approach.js +2 -2
- package/dist/cli/commands/approach.js.map +1 -1
- package/dist/cli/commands/approvals.js +7 -7
- package/dist/cli/commands/approvals.js.map +1 -1
- package/dist/cli/commands/approvals.test.js +8 -8
- package/dist/cli/commands/approvals.test.js.map +1 -1
- package/dist/cli/commands/assign.js +4 -4
- package/dist/cli/commands/assign.js.map +1 -1
- package/dist/cli/commands/assign.test.js +18 -16
- package/dist/cli/commands/assign.test.js.map +1 -1
- package/dist/cli/commands/cleanup.d.ts.map +1 -1
- package/dist/cli/commands/cleanup.js +8 -8
- package/dist/cli/commands/cleanup.js.map +1 -1
- package/dist/cli/commands/cleanup.test.js +5 -1
- package/dist/cli/commands/cleanup.test.js.map +1 -1
- package/dist/cli/commands/escalations.js +9 -7
- package/dist/cli/commands/escalations.js.map +1 -1
- package/dist/cli/commands/escalations.test.js +2 -2
- package/dist/cli/commands/escalations.test.js.map +1 -1
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +48 -5
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/init.test.js +4 -0
- package/dist/cli/commands/init.test.js.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.d.ts +2 -2
- package/dist/cli/commands/manager/agent-monitoring.d.ts.map +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js +1 -1
- package/dist/cli/commands/manager/agent-monitoring.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.js +3 -3
- package/dist/cli/commands/manager/auditor-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/auditor-lifecycle.test.js +21 -14
- package/dist/cli/commands/manager/auditor-lifecycle.test.js.map +1 -1
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js +28 -23
- package/dist/cli/commands/manager/auto-reject-comment-only-reviews.test.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.d.ts +2 -2
- package/dist/cli/commands/manager/escalation-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.js +11 -10
- package/dist/cli/commands/manager/escalation-handler.js.map +1 -1
- package/dist/cli/commands/manager/escalation-handler.test.js +8 -8
- package/dist/cli/commands/manager/escalation-handler.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.js +7 -7
- package/dist/cli/commands/manager/feature-sign-off.js.map +1 -1
- package/dist/cli/commands/manager/feature-sign-off.test.js +40 -31
- package/dist/cli/commands/manager/feature-sign-off.test.js.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.d.ts.map +1 -1
- package/dist/cli/commands/manager/feature-test-result.js +12 -13
- package/dist/cli/commands/manager/feature-test-result.js.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.d.ts.map +1 -1
- package/dist/cli/commands/manager/handoff-recovery.js +14 -15
- package/dist/cli/commands/manager/handoff-recovery.js.map +1 -1
- package/dist/cli/commands/manager/index.d.ts.map +1 -1
- package/dist/cli/commands/manager/index.js +26 -26
- package/dist/cli/commands/manager/index.js.map +1 -1
- package/dist/cli/commands/manager/index.test.js +3 -3
- package/dist/cli/commands/manager/index.test.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts +2 -2
- package/dist/cli/commands/manager/merged-story-cleanup.d.ts.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.js +6 -7
- package/dist/cli/commands/manager/merged-story-cleanup.js.map +1 -1
- package/dist/cli/commands/manager/merged-story-cleanup.test.js +27 -18
- package/dist/cli/commands/manager/merged-story-cleanup.test.js.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.d.ts.map +1 -1
- package/dist/cli/commands/manager/pr-sync-orchestrator.js +46 -38
- package/dist/cli/commands/manager/pr-sync-orchestrator.js.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.d.ts.map +1 -1
- package/dist/cli/commands/manager/qa-review-handler.js +25 -22
- package/dist/cli/commands/manager/qa-review-handler.js.map +1 -1
- package/dist/cli/commands/manager/spin-down.d.ts.map +1 -1
- package/dist/cli/commands/manager/spin-down.js +23 -19
- package/dist/cli/commands/manager/spin-down.js.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.d.ts +2 -3
- package/dist/cli/commands/manager/stale-escalations.d.ts.map +1 -1
- package/dist/cli/commands/manager/stale-escalations.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-helpers.js +8 -8
- package/dist/cli/commands/manager/stuck-story-helpers.js.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.d.ts +2 -2
- package/dist/cli/commands/manager/stuck-story-processor.d.ts.map +1 -1
- package/dist/cli/commands/manager/stuck-story-processor.js +23 -22
- package/dist/cli/commands/manager/stuck-story-processor.js.map +1 -1
- package/dist/cli/commands/manager/tech-lead-lifecycle.js +6 -6
- package/dist/cli/commands/manager/tech-lead-lifecycle.js.map +1 -1
- package/dist/cli/commands/manager/types.d.ts +2 -3
- package/dist/cli/commands/manager/types.d.ts.map +1 -1
- package/dist/cli/commands/manager/types.js.map +1 -1
- package/dist/cli/commands/msg.test.js +2 -2
- package/dist/cli/commands/msg.test.js.map +1 -1
- package/dist/cli/commands/my-stories.d.ts.map +1 -1
- package/dist/cli/commands/my-stories.js +17 -18
- package/dist/cli/commands/my-stories.js.map +1 -1
- package/dist/cli/commands/my-stories.test.js +2 -2
- package/dist/cli/commands/my-stories.test.js.map +1 -1
- package/dist/cli/commands/nuke.test.js +1 -1
- package/dist/cli/commands/nuke.test.js.map +1 -1
- package/dist/cli/commands/pr.js +32 -32
- package/dist/cli/commands/pr.js.map +1 -1
- package/dist/cli/commands/pr.test.js +10 -6
- package/dist/cli/commands/pr.test.js.map +1 -1
- package/dist/cli/commands/progress.d.ts.map +1 -1
- package/dist/cli/commands/progress.js +4 -5
- package/dist/cli/commands/progress.js.map +1 -1
- package/dist/cli/commands/progress.test.js +1 -1
- package/dist/cli/commands/progress.test.js.map +1 -1
- package/dist/cli/commands/req-headless.test.d.ts +2 -0
- package/dist/cli/commands/req-headless.test.d.ts.map +1 -0
- package/dist/cli/commands/req-headless.test.js +128 -0
- package/dist/cli/commands/req-headless.test.js.map +1 -0
- package/dist/cli/commands/req-spawn.test.js +5 -1
- package/dist/cli/commands/req-spawn.test.js.map +1 -1
- package/dist/cli/commands/req.d.ts.map +1 -1
- package/dist/cli/commands/req.js +13 -14
- package/dist/cli/commands/req.js.map +1 -1
- package/dist/cli/commands/resume.d.ts.map +1 -1
- package/dist/cli/commands/resume.js +7 -8
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/resume.test.js +1 -1
- package/dist/cli/commands/resume.test.js.map +1 -1
- package/dist/cli/commands/status.d.ts.map +1 -1
- package/dist/cli/commands/status.js +42 -40
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/commands/status.test.js +1 -1
- package/dist/cli/commands/status.test.js.map +1 -1
- package/dist/cli/commands/stories.js +9 -9
- package/dist/cli/commands/stories.js.map +1 -1
- package/dist/cli/commands/stories.test.js +2 -2
- package/dist/cli/commands/stories.test.js.map +1 -1
- package/dist/cli/commands/teams.js +11 -11
- package/dist/cli/commands/teams.js.map +1 -1
- package/dist/cli/commands/teams.test.js +2 -2
- package/dist/cli/commands/teams.test.js.map +1 -1
- package/dist/cli/dashboard/index.d.ts +2 -2
- package/dist/cli/dashboard/index.d.ts.map +1 -1
- package/dist/cli/dashboard/index.js +29 -20
- package/dist/cli/dashboard/index.js.map +1 -1
- package/dist/cli/dashboard/index.test.js +34 -32
- package/dist/cli/dashboard/index.test.js.map +1 -1
- package/dist/cli/dashboard/panels/activity.d.ts +3 -3
- package/dist/cli/dashboard/panels/activity.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/activity.js +1 -1
- package/dist/cli/dashboard/panels/activity.js.map +1 -1
- package/dist/cli/dashboard/panels/agents.d.ts +3 -3
- package/dist/cli/dashboard/panels/agents.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/agents.js +2 -2
- package/dist/cli/dashboard/panels/agents.js.map +1 -1
- package/dist/cli/dashboard/panels/escalations.d.ts +3 -3
- package/dist/cli/dashboard/panels/escalations.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/escalations.js +1 -1
- package/dist/cli/dashboard/panels/escalations.js.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.d.ts +3 -3
- package/dist/cli/dashboard/panels/merge-queue.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js +1 -1
- package/dist/cli/dashboard/panels/merge-queue.js.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.d.ts +3 -3
- package/dist/cli/dashboard/panels/pipeline.d.ts.map +1 -1
- package/dist/cli/dashboard/panels/pipeline.js +1 -1
- package/dist/cli/dashboard/panels/pipeline.js.map +1 -1
- package/dist/config/schema.d.ts +85 -82
- package/dist/config/schema.d.ts.map +1 -1
- package/dist/config/schema.js +1 -0
- package/dist/config/schema.js.map +1 -1
- package/dist/connectors/project-management/operations.d.ts +7 -7
- package/dist/connectors/project-management/operations.d.ts.map +1 -1
- package/dist/connectors/project-management/operations.js +2 -3
- package/dist/connectors/project-management/operations.js.map +1 -1
- package/dist/context-files/index.test.js +1 -0
- package/dist/context-files/index.test.js.map +1 -1
- package/dist/db/client.d.ts +6 -0
- package/dist/db/client.d.ts.map +1 -1
- package/dist/db/client.js +7 -0
- package/dist/db/client.js.map +1 -1
- package/dist/db/postgres-provider.d.ts +43 -0
- package/dist/db/postgres-provider.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.d.ts +2 -0
- package/dist/db/postgres-provider.integration.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.integration.test.js +399 -0
- package/dist/db/postgres-provider.integration.test.js.map +1 -0
- package/dist/db/postgres-provider.js +315 -0
- package/dist/db/postgres-provider.js.map +1 -0
- package/dist/db/postgres-provider.test.d.ts +2 -0
- package/dist/db/postgres-provider.test.d.ts.map +1 -0
- package/dist/db/postgres-provider.test.js +72 -0
- package/dist/db/postgres-provider.test.js.map +1 -0
- package/dist/db/provider.d.ts +59 -0
- package/dist/db/provider.d.ts.map +1 -0
- package/dist/db/provider.js +121 -0
- package/dist/db/provider.js.map +1 -0
- package/dist/db/provider.test.d.ts +2 -0
- package/dist/db/provider.test.d.ts.map +1 -0
- package/dist/db/provider.test.js +226 -0
- package/dist/db/provider.test.js.map +1 -0
- package/dist/db/queries/agents.d.ts +13 -13
- package/dist/db/queries/agents.d.ts.map +1 -1
- package/dist/db/queries/agents.js +27 -28
- package/dist/db/queries/agents.js.map +1 -1
- package/dist/db/queries/agents.test.js +113 -111
- package/dist/db/queries/agents.test.js.map +1 -1
- package/dist/db/queries/escalations.d.ts +16 -16
- package/dist/db/queries/escalations.d.ts.map +1 -1
- package/dist/db/queries/escalations.js +34 -35
- package/dist/db/queries/escalations.js.map +1 -1
- package/dist/db/queries/escalations.test.js +133 -131
- package/dist/db/queries/escalations.test.js.map +1 -1
- package/dist/db/queries/heartbeat.d.ts +5 -5
- package/dist/db/queries/heartbeat.d.ts.map +1 -1
- package/dist/db/queries/heartbeat.js +7 -23
- package/dist/db/queries/heartbeat.js.map +1 -1
- package/dist/db/queries/heartbeat.test.js +76 -76
- package/dist/db/queries/heartbeat.test.js.map +1 -1
- package/dist/db/queries/integration-sync.d.ts +7 -7
- package/dist/db/queries/integration-sync.d.ts.map +1 -1
- package/dist/db/queries/integration-sync.js +13 -14
- package/dist/db/queries/integration-sync.js.map +1 -1
- package/dist/db/queries/logs.d.ts +10 -10
- package/dist/db/queries/logs.d.ts.map +1 -1
- package/dist/db/queries/logs.js +44 -42
- package/dist/db/queries/logs.js.map +1 -1
- package/dist/db/queries/logs.test.js +149 -146
- package/dist/db/queries/logs.test.js.map +1 -1
- package/dist/db/queries/messages.d.ts +6 -6
- package/dist/db/queries/messages.d.ts.map +1 -1
- package/dist/db/queries/messages.js +12 -11
- package/dist/db/queries/messages.js.map +1 -1
- package/dist/db/queries/messages.test.js +47 -46
- package/dist/db/queries/messages.test.js.map +1 -1
- package/dist/db/queries/pull-requests.d.ts +18 -18
- package/dist/db/queries/pull-requests.d.ts.map +1 -1
- package/dist/db/queries/pull-requests.js +50 -48
- package/dist/db/queries/pull-requests.js.map +1 -1
- package/dist/db/queries/pull-requests.test.js +195 -198
- package/dist/db/queries/pull-requests.test.js.map +1 -1
- package/dist/db/queries/requirements.d.ts +8 -8
- package/dist/db/queries/requirements.d.ts.map +1 -1
- package/dist/db/queries/requirements.js +17 -18
- package/dist/db/queries/requirements.js.map +1 -1
- package/dist/db/queries/requirements.test.js +83 -81
- package/dist/db/queries/requirements.test.js.map +1 -1
- package/dist/db/queries/stories.d.ts +29 -29
- package/dist/db/queries/stories.d.ts.map +1 -1
- package/dist/db/queries/stories.js +58 -64
- package/dist/db/queries/stories.js.map +1 -1
- package/dist/db/queries/stories.test.js +172 -170
- package/dist/db/queries/stories.test.js.map +1 -1
- package/dist/db/queries/teams.d.ts +6 -6
- package/dist/db/queries/teams.d.ts.map +1 -1
- package/dist/db/queries/teams.js +11 -12
- package/dist/db/queries/teams.js.map +1 -1
- package/dist/db/queries/teams.test.js +36 -34
- package/dist/db/queries/teams.test.js.map +1 -1
- package/dist/integrations/jira/repair.test.js +26 -24
- package/dist/integrations/jira/repair.test.js.map +1 -1
- package/dist/integrations/jira/stories.d.ts +3 -3
- package/dist/integrations/jira/stories.d.ts.map +1 -1
- package/dist/integrations/jira/stories.js +12 -12
- package/dist/integrations/jira/stories.js.map +1 -1
- package/dist/integrations/jira/stories.test.js +10 -8
- package/dist/integrations/jira/stories.test.js.map +1 -1
- package/dist/integrations/jira/sync.d.ts +7 -7
- package/dist/integrations/jira/sync.d.ts.map +1 -1
- package/dist/integrations/jira/sync.js +17 -20
- package/dist/integrations/jira/sync.js.map +1 -1
- package/dist/integrations/jira/sync.test.js +63 -62
- package/dist/integrations/jira/sync.test.js.map +1 -1
- package/dist/integrations/jira/transitions.d.ts +3 -3
- package/dist/integrations/jira/transitions.d.ts.map +1 -1
- package/dist/integrations/jira/transitions.js +3 -3
- package/dist/integrations/jira/transitions.js.map +1 -1
- package/dist/orchestrator/agent-selector.d.ts +3 -3
- package/dist/orchestrator/agent-selector.d.ts.map +1 -1
- package/dist/orchestrator/agent-selector.js +5 -6
- package/dist/orchestrator/agent-selector.js.map +1 -1
- package/dist/orchestrator/dependency-resolver.d.ts +4 -4
- package/dist/orchestrator/dependency-resolver.d.ts.map +1 -1
- package/dist/orchestrator/dependency-resolver.js +6 -6
- package/dist/orchestrator/dependency-resolver.js.map +1 -1
- package/dist/orchestrator/feature-branch.d.ts +3 -3
- package/dist/orchestrator/feature-branch.d.ts.map +1 -1
- package/dist/orchestrator/feature-branch.js +9 -10
- package/dist/orchestrator/feature-branch.js.map +1 -1
- package/dist/orchestrator/feature-branch.test.js +80 -78
- package/dist/orchestrator/feature-branch.test.js.map +1 -1
- package/dist/orchestrator/orphan-recovery.d.ts +2 -2
- package/dist/orchestrator/orphan-recovery.d.ts.map +1 -1
- package/dist/orchestrator/orphan-recovery.js +10 -10
- package/dist/orchestrator/orphan-recovery.js.map +1 -1
- package/dist/orchestrator/scheduler.d.ts +4 -4
- package/dist/orchestrator/scheduler.d.ts.map +1 -1
- package/dist/orchestrator/scheduler.js +90 -76
- package/dist/orchestrator/scheduler.js.map +1 -1
- package/dist/orchestrator/scheduler.test.js +496 -374
- package/dist/orchestrator/scheduler.test.js.map +1 -1
- package/dist/utils/auto-merge.d.ts.map +1 -1
- package/dist/utils/auto-merge.js +74 -56
- package/dist/utils/auto-merge.js.map +1 -1
- package/dist/utils/auto-merge.test.js +101 -66
- package/dist/utils/auto-merge.test.js.map +1 -1
- package/dist/utils/cli-helpers.d.ts +5 -5
- package/dist/utils/cli-helpers.d.ts.map +1 -1
- package/dist/utils/cli-helpers.js +8 -9
- package/dist/utils/cli-helpers.js.map +1 -1
- package/dist/utils/cli-helpers.test.js +28 -30
- package/dist/utils/cli-helpers.test.js.map +1 -1
- package/dist/utils/paths.d.ts +6 -0
- package/dist/utils/paths.d.ts.map +1 -1
- package/dist/utils/paths.js +12 -1
- package/dist/utils/paths.js.map +1 -1
- package/dist/utils/paths.test.js +1 -0
- package/dist/utils/paths.test.js.map +1 -1
- package/dist/utils/pr-sync.d.ts +10 -10
- package/dist/utils/pr-sync.d.ts.map +1 -1
- package/dist/utils/pr-sync.js +20 -21
- package/dist/utils/pr-sync.js.map +1 -1
- package/dist/utils/pr-sync.test.js +52 -50
- package/dist/utils/pr-sync.test.js.map +1 -1
- package/dist/utils/with-hive-context.d.ts.map +1 -1
- package/dist/utils/with-hive-context.js +70 -1
- package/dist/utils/with-hive-context.js.map +1 -1
- package/package.json +3 -1
- package/src/agents/base-agent.test.ts +2 -1
- package/src/agents/base-agent.ts +32 -28
- package/src/agents/intermediate.ts +27 -18
- package/src/agents/junior.ts +27 -18
- package/src/agents/qa.ts +54 -40
- package/src/agents/senior.ts +42 -27
- package/src/agents/tech-lead.ts +42 -32
- package/src/cli/commands/add-repo.test.ts +1 -1
- package/src/cli/commands/add-repo.ts +2 -2
- package/src/cli/commands/agents.test.ts +7 -7
- package/src/cli/commands/agents.ts +12 -10
- package/src/cli/commands/approach.ts +2 -2
- package/src/cli/commands/approvals.test.ts +8 -8
- package/src/cli/commands/approvals.ts +9 -7
- package/src/cli/commands/assign.test.ts +19 -18
- package/src/cli/commands/assign.ts +4 -4
- package/src/cli/commands/cleanup.test.ts +5 -1
- package/src/cli/commands/cleanup.ts +11 -9
- package/src/cli/commands/escalations.test.ts +2 -2
- package/src/cli/commands/escalations.ts +9 -7
- package/src/cli/commands/init.test.ts +5 -0
- package/src/cli/commands/init.ts +53 -5
- package/src/cli/commands/manager/agent-monitoring.ts +3 -3
- package/src/cli/commands/manager/auditor-lifecycle.test.ts +21 -14
- package/src/cli/commands/manager/auditor-lifecycle.ts +3 -3
- package/src/cli/commands/manager/auto-reject-comment-only-reviews.test.ts +28 -23
- package/src/cli/commands/manager/escalation-handler.test.ts +13 -13
- package/src/cli/commands/manager/escalation-handler.ts +19 -12
- package/src/cli/commands/manager/feature-sign-off.test.ts +40 -31
- package/src/cli/commands/manager/feature-sign-off.ts +7 -7
- package/src/cli/commands/manager/feature-test-result.ts +13 -16
- package/src/cli/commands/manager/handoff-recovery.ts +20 -20
- package/src/cli/commands/manager/index.test.ts +4 -4
- package/src/cli/commands/manager/index.ts +58 -59
- package/src/cli/commands/manager/merged-story-cleanup.test.ts +28 -19
- package/src/cli/commands/manager/merged-story-cleanup.ts +11 -14
- package/src/cli/commands/manager/pr-sync-orchestrator.ts +115 -110
- package/src/cli/commands/manager/qa-review-handler.ts +50 -63
- package/src/cli/commands/manager/spin-down.ts +27 -25
- package/src/cli/commands/manager/stale-escalations.ts +2 -3
- package/src/cli/commands/manager/stuck-story-helpers.ts +10 -10
- package/src/cli/commands/manager/stuck-story-processor.ts +56 -62
- package/src/cli/commands/manager/tech-lead-lifecycle.ts +6 -6
- package/src/cli/commands/manager/types.ts +2 -3
- package/src/cli/commands/msg.test.ts +2 -2
- package/src/cli/commands/my-stories.test.ts +4 -2
- package/src/cli/commands/my-stories.ts +22 -27
- package/src/cli/commands/nuke.test.ts +1 -1
- package/src/cli/commands/pr.test.ts +10 -6
- package/src/cli/commands/pr.ts +41 -32
- package/src/cli/commands/progress.test.ts +1 -1
- package/src/cli/commands/progress.ts +11 -6
- package/src/cli/commands/req-headless.test.ts +170 -0
- package/src/cli/commands/req-spawn.test.ts +12 -2
- package/src/cli/commands/req.ts +13 -14
- package/src/cli/commands/resume.test.ts +1 -1
- package/src/cli/commands/resume.ts +7 -8
- package/src/cli/commands/status.test.ts +1 -1
- package/src/cli/commands/status.ts +52 -40
- package/src/cli/commands/stories.test.ts +4 -2
- package/src/cli/commands/stories.ts +11 -11
- package/src/cli/commands/teams.test.ts +2 -2
- package/src/cli/commands/teams.ts +11 -11
- package/src/cli/dashboard/index.test.ts +35 -34
- package/src/cli/dashboard/index.ts +34 -23
- package/src/cli/dashboard/panels/activity.ts +10 -4
- package/src/cli/dashboard/panels/agents.ts +8 -5
- package/src/cli/dashboard/panels/escalations.ts +4 -4
- package/src/cli/dashboard/panels/merge-queue.ts +4 -4
- package/src/cli/dashboard/panels/pipeline.ts +10 -4
- package/src/config/schema.ts +1 -0
- package/src/connectors/project-management/operations.ts +9 -10
- package/src/context-files/index.test.ts +1 -0
- package/src/db/client.ts +17 -0
- package/src/db/pg-migrations/001-full-schema.sql +209 -0
- package/src/db/postgres-provider.integration.test.ts +574 -0
- package/src/db/postgres-provider.test.ts +97 -0
- package/src/db/postgres-provider.ts +364 -0
- package/src/db/provider.test.ts +283 -0
- package/src/db/provider.ts +161 -0
- package/src/db/queries/agents.test.ts +114 -113
- package/src/db/queries/agents.ts +50 -36
- package/src/db/queries/escalations.test.ts +134 -133
- package/src/db/queries/escalations.ts +72 -57
- package/src/db/queries/heartbeat.test.ts +77 -78
- package/src/db/queries/heartbeat.ts +24 -46
- package/src/db/queries/integration-sync.ts +26 -26
- package/src/db/queries/logs.test.ts +151 -148
- package/src/db/queries/logs.ts +78 -53
- package/src/db/queries/messages.test.ts +48 -50
- package/src/db/queries/messages.ts +26 -18
- package/src/db/queries/pull-requests.test.ts +194 -199
- package/src/db/queries/pull-requests.ts +117 -88
- package/src/db/queries/requirements.test.ts +84 -83
- package/src/db/queries/requirements.ts +33 -28
- package/src/db/queries/stories.test.ts +173 -172
- package/src/db/queries/stories.ts +141 -110
- package/src/db/queries/teams.test.ts +37 -36
- package/src/db/queries/teams.ts +22 -14
- package/src/integrations/jira/repair.test.ts +27 -26
- package/src/integrations/jira/stories.test.ts +15 -16
- package/src/integrations/jira/stories.ts +15 -15
- package/src/integrations/jira/sync.test.ts +68 -68
- package/src/integrations/jira/sync.ts +29 -39
- package/src/integrations/jira/transitions.ts +6 -6
- package/src/orchestrator/agent-selector.ts +9 -8
- package/src/orchestrator/dependency-resolver.ts +16 -7
- package/src/orchestrator/feature-branch.test.ts +85 -80
- package/src/orchestrator/feature-branch.ts +13 -14
- package/src/orchestrator/orphan-recovery.ts +14 -13
- package/src/orchestrator/scheduler.test.ts +536 -394
- package/src/orchestrator/scheduler.ts +129 -115
- package/src/utils/auto-merge.test.ts +102 -68
- package/src/utils/auto-merge.ts +161 -168
- package/src/utils/cli-helpers.test.ts +30 -32
- package/src/utils/cli-helpers.ts +15 -11
- package/src/utils/paths.test.ts +1 -0
- package/src/utils/paths.ts +14 -1
- package/src/utils/pr-sync.test.ts +55 -52
- package/src/utils/pr-sync.ts +27 -32
- package/src/utils/with-hive-context.ts +89 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// Licensed under the Hungry Ghost Hive License. See LICENSE.
|
|
2
2
|
import { beforeEach, describe, expect, it } from 'vitest';
|
|
3
|
+
import { SqliteProvider } from '../provider.js';
|
|
3
4
|
import { createPullRequest, deletePullRequest, getAllPullRequests, getApprovedPullRequests, getMergeQueue, getNextInQueue, getPullRequestByGithubNumber, getPullRequestById, getPullRequestByStory, getPullRequestsByStatus, getPullRequestsByTeam, getQueuePosition, isAgentReviewingPR, updatePullRequest, } from './pull-requests.js';
|
|
4
5
|
import { createStory } from './stories.js';
|
|
5
6
|
import { createTeam } from './teams.js';
|
|
@@ -9,14 +10,15 @@ describe('pull-requests queries', () => {
|
|
|
9
10
|
let teamId;
|
|
10
11
|
let storyId;
|
|
11
12
|
beforeEach(async () => {
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
const rawDb = await createTestDatabase();
|
|
14
|
+
db = new SqliteProvider(rawDb);
|
|
15
|
+
const team = await createTeam(db, {
|
|
14
16
|
repoUrl: 'https://github.com/test/repo.git',
|
|
15
17
|
repoPath: '/path/to/repo',
|
|
16
18
|
name: 'Test Team',
|
|
17
19
|
});
|
|
18
20
|
teamId = team.id;
|
|
19
|
-
const story = createStory(db, {
|
|
21
|
+
const story = await createStory(db, {
|
|
20
22
|
title: 'Test Story',
|
|
21
23
|
description: 'Test description',
|
|
22
24
|
teamId,
|
|
@@ -24,8 +26,8 @@ describe('pull-requests queries', () => {
|
|
|
24
26
|
storyId = story.id;
|
|
25
27
|
});
|
|
26
28
|
describe('createPullRequest', () => {
|
|
27
|
-
it('should create a pull request with all fields', () => {
|
|
28
|
-
const pr = createPullRequest(db, {
|
|
29
|
+
it('should create a pull request with all fields', async () => {
|
|
30
|
+
const pr = await createPullRequest(db, {
|
|
29
31
|
storyId,
|
|
30
32
|
teamId,
|
|
31
33
|
branchName: 'feature/test-branch',
|
|
@@ -43,8 +45,8 @@ describe('pull-requests queries', () => {
|
|
|
43
45
|
expect(pr.status).toBe('queued');
|
|
44
46
|
expect(pr.created_at).toBeDefined();
|
|
45
47
|
});
|
|
46
|
-
it('should create PR with only required fields', () => {
|
|
47
|
-
const pr = createPullRequest(db, {
|
|
48
|
+
it('should create PR with only required fields', async () => {
|
|
49
|
+
const pr = await createPullRequest(db, {
|
|
48
50
|
branchName: 'feature/simple-branch',
|
|
49
51
|
});
|
|
50
52
|
expect(pr.branch_name).toBe('feature/simple-branch');
|
|
@@ -53,13 +55,13 @@ describe('pull-requests queries', () => {
|
|
|
53
55
|
expect(pr.github_pr_number).toBeNull();
|
|
54
56
|
expect(pr.status).toBe('queued');
|
|
55
57
|
});
|
|
56
|
-
it('should generate unique IDs', () => {
|
|
57
|
-
const pr1 = createPullRequest(db, { branchName: 'branch-1' });
|
|
58
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2' });
|
|
58
|
+
it('should generate unique IDs', async () => {
|
|
59
|
+
const pr1 = await createPullRequest(db, { branchName: 'branch-1' });
|
|
60
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2' });
|
|
59
61
|
expect(pr1.id).not.toBe(pr2.id);
|
|
60
62
|
});
|
|
61
|
-
it('should extract PR number from github_pr_url when creating PR', () => {
|
|
62
|
-
const pr = createPullRequest(db, {
|
|
63
|
+
it('should extract PR number from github_pr_url when creating PR', async () => {
|
|
64
|
+
const pr = await createPullRequest(db, {
|
|
63
65
|
storyId,
|
|
64
66
|
teamId,
|
|
65
67
|
branchName: 'feature/extract-test',
|
|
@@ -69,16 +71,16 @@ describe('pull-requests queries', () => {
|
|
|
69
71
|
expect(pr.github_pr_number).toBe(456);
|
|
70
72
|
expect(pr.github_pr_url).toBe('https://github.com/test/repo/pull/456');
|
|
71
73
|
});
|
|
72
|
-
it('should prefer explicit githubPrNumber over extracted from URL', () => {
|
|
73
|
-
const pr = createPullRequest(db, {
|
|
74
|
+
it('should prefer explicit githubPrNumber over extracted from URL', async () => {
|
|
75
|
+
const pr = await createPullRequest(db, {
|
|
74
76
|
branchName: 'feature/prefer-explicit',
|
|
75
77
|
githubPrNumber: 789,
|
|
76
78
|
githubPrUrl: 'https://github.com/test/repo/pull/456',
|
|
77
79
|
});
|
|
78
80
|
expect(pr.github_pr_number).toBe(789);
|
|
79
81
|
});
|
|
80
|
-
it('should handle malformed github_pr_url gracefully', () => {
|
|
81
|
-
const pr = createPullRequest(db, {
|
|
82
|
+
it('should handle malformed github_pr_url gracefully', async () => {
|
|
83
|
+
const pr = await createPullRequest(db, {
|
|
82
84
|
branchName: 'feature/malformed-url',
|
|
83
85
|
githubPrUrl: 'https://github.com/test/repo',
|
|
84
86
|
});
|
|
@@ -87,149 +89,149 @@ describe('pull-requests queries', () => {
|
|
|
87
89
|
});
|
|
88
90
|
});
|
|
89
91
|
describe('getPullRequestById', () => {
|
|
90
|
-
it('should retrieve a PR by ID', () => {
|
|
91
|
-
const created = createPullRequest(db, {
|
|
92
|
+
it('should retrieve a PR by ID', async () => {
|
|
93
|
+
const created = await createPullRequest(db, {
|
|
92
94
|
branchName: 'feature/test',
|
|
93
95
|
storyId,
|
|
94
96
|
});
|
|
95
|
-
const retrieved = getPullRequestById(db, created.id);
|
|
97
|
+
const retrieved = await getPullRequestById(db, created.id);
|
|
96
98
|
expect(retrieved).toBeDefined();
|
|
97
99
|
expect(retrieved?.id).toBe(created.id);
|
|
98
100
|
expect(retrieved?.branch_name).toBe('feature/test');
|
|
99
101
|
});
|
|
100
|
-
it('should return undefined for non-existent PR', () => {
|
|
101
|
-
const result = getPullRequestById(db, 'non-existent-id');
|
|
102
|
+
it('should return undefined for non-existent PR', async () => {
|
|
103
|
+
const result = await getPullRequestById(db, 'non-existent-id');
|
|
102
104
|
expect(result).toBeUndefined();
|
|
103
105
|
});
|
|
104
106
|
});
|
|
105
107
|
describe('getPullRequestByStory', () => {
|
|
106
|
-
it('should retrieve a PR by story ID', () => {
|
|
107
|
-
const pr = createPullRequest(db, {
|
|
108
|
+
it('should retrieve a PR by story ID', async () => {
|
|
109
|
+
const pr = await createPullRequest(db, {
|
|
108
110
|
storyId,
|
|
109
111
|
branchName: 'feature/story-branch',
|
|
110
112
|
});
|
|
111
|
-
const retrieved = getPullRequestByStory(db, storyId);
|
|
113
|
+
const retrieved = await getPullRequestByStory(db, storyId);
|
|
112
114
|
expect(retrieved).toBeDefined();
|
|
113
115
|
expect(retrieved?.id).toBe(pr.id);
|
|
114
116
|
expect(retrieved?.story_id).toBe(storyId);
|
|
115
117
|
});
|
|
116
|
-
it('should return undefined when no PR for story', () => {
|
|
117
|
-
const result = getPullRequestByStory(db, 'non-existent-story');
|
|
118
|
+
it('should return undefined when no PR for story', async () => {
|
|
119
|
+
const result = await getPullRequestByStory(db, 'non-existent-story');
|
|
118
120
|
expect(result).toBeUndefined();
|
|
119
121
|
});
|
|
120
122
|
});
|
|
121
123
|
describe('getPullRequestByGithubNumber', () => {
|
|
122
|
-
it('should retrieve a PR by GitHub PR number', () => {
|
|
123
|
-
const pr = createPullRequest(db, {
|
|
124
|
+
it('should retrieve a PR by GitHub PR number', async () => {
|
|
125
|
+
const pr = await createPullRequest(db, {
|
|
124
126
|
branchName: 'feature/test',
|
|
125
127
|
githubPrNumber: 456,
|
|
126
128
|
});
|
|
127
|
-
const retrieved = getPullRequestByGithubNumber(db, 456);
|
|
129
|
+
const retrieved = await getPullRequestByGithubNumber(db, 456);
|
|
128
130
|
expect(retrieved).toBeDefined();
|
|
129
131
|
expect(retrieved?.id).toBe(pr.id);
|
|
130
132
|
expect(retrieved?.github_pr_number).toBe(456);
|
|
131
133
|
});
|
|
132
|
-
it('should return undefined for non-existent PR number', () => {
|
|
133
|
-
const result = getPullRequestByGithubNumber(db, 999);
|
|
134
|
+
it('should return undefined for non-existent PR number', async () => {
|
|
135
|
+
const result = await getPullRequestByGithubNumber(db, 999);
|
|
134
136
|
expect(result).toBeUndefined();
|
|
135
137
|
});
|
|
136
138
|
});
|
|
137
139
|
describe('getMergeQueue', () => {
|
|
138
|
-
it('should return queued and reviewing PRs', () => {
|
|
139
|
-
const pr1 = createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
140
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
141
|
-
updatePullRequest(db, pr2.id, { status: 'reviewing' });
|
|
142
|
-
const pr3 = createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
143
|
-
updatePullRequest(db, pr3.id, { status: 'merged' });
|
|
144
|
-
const queue = getMergeQueue(db);
|
|
140
|
+
it('should return queued and reviewing PRs', async () => {
|
|
141
|
+
const pr1 = await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
142
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
143
|
+
await updatePullRequest(db, pr2.id, { status: 'reviewing' });
|
|
144
|
+
const pr3 = await createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
145
|
+
await updatePullRequest(db, pr3.id, { status: 'merged' });
|
|
146
|
+
const queue = await getMergeQueue(db);
|
|
145
147
|
expect(queue).toHaveLength(2);
|
|
146
148
|
expect(queue.map(p => p.id)).toContain(pr1.id);
|
|
147
149
|
expect(queue.map(p => p.id)).toContain(pr2.id);
|
|
148
150
|
expect(queue.map(p => p.id)).not.toContain(pr3.id);
|
|
149
151
|
});
|
|
150
|
-
it('should filter by team when teamId provided', () => {
|
|
151
|
-
const team2 = createTeam(db, {
|
|
152
|
+
it('should filter by team when teamId provided', async () => {
|
|
153
|
+
const team2 = await createTeam(db, {
|
|
152
154
|
repoUrl: 'https://github.com/test/repo2.git',
|
|
153
155
|
repoPath: '/path/to/repo2',
|
|
154
156
|
name: 'Team 2',
|
|
155
157
|
});
|
|
156
|
-
const pr1 = createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
157
|
-
createPullRequest(db, { branchName: 'branch-2', teamId: team2.id });
|
|
158
|
-
const queue = getMergeQueue(db, teamId);
|
|
158
|
+
const pr1 = await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
159
|
+
await createPullRequest(db, { branchName: 'branch-2', teamId: team2.id });
|
|
160
|
+
const queue = await getMergeQueue(db, teamId);
|
|
159
161
|
expect(queue).toHaveLength(1);
|
|
160
162
|
expect(queue[0].id).toBe(pr1.id);
|
|
161
163
|
});
|
|
162
|
-
it('should order by created_at ASC', () => {
|
|
163
|
-
const pr1 = createPullRequest(db, { branchName: 'first', teamId });
|
|
164
|
-
const pr2 = createPullRequest(db, { branchName: 'second', teamId });
|
|
165
|
-
const queue = getMergeQueue(db);
|
|
164
|
+
it('should order by created_at ASC', async () => {
|
|
165
|
+
const pr1 = await createPullRequest(db, { branchName: 'first', teamId });
|
|
166
|
+
const pr2 = await createPullRequest(db, { branchName: 'second', teamId });
|
|
167
|
+
const queue = await getMergeQueue(db);
|
|
166
168
|
expect(queue[0].id).toBe(pr1.id);
|
|
167
169
|
expect(queue[1].id).toBe(pr2.id);
|
|
168
170
|
});
|
|
169
171
|
});
|
|
170
172
|
describe('getNextInQueue', () => {
|
|
171
|
-
it('should return the oldest queued PR', () => {
|
|
172
|
-
createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
173
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
174
|
-
updatePullRequest(db, pr2.id, { status: 'reviewing' });
|
|
175
|
-
createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
176
|
-
const next = getNextInQueue(db);
|
|
173
|
+
it('should return the oldest queued PR', async () => {
|
|
174
|
+
await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
175
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
176
|
+
await updatePullRequest(db, pr2.id, { status: 'reviewing' });
|
|
177
|
+
await createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
178
|
+
const next = await getNextInQueue(db);
|
|
177
179
|
expect(next).toBeDefined();
|
|
178
180
|
expect(next?.id).not.toBe(pr2.id); // pr2 is reviewing, not queued
|
|
179
181
|
expect(next?.status).toBe('queued');
|
|
180
182
|
});
|
|
181
|
-
it('should filter by team when teamId provided', () => {
|
|
182
|
-
const team2 = createTeam(db, {
|
|
183
|
+
it('should filter by team when teamId provided', async () => {
|
|
184
|
+
const team2 = await createTeam(db, {
|
|
183
185
|
repoUrl: 'https://github.com/test/repo2.git',
|
|
184
186
|
repoPath: '/path/to/repo2',
|
|
185
187
|
name: 'Team 2',
|
|
186
188
|
});
|
|
187
|
-
createPullRequest(db, { branchName: 'branch-1', teamId: team2.id });
|
|
188
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
189
|
-
const next = getNextInQueue(db, teamId);
|
|
189
|
+
await createPullRequest(db, { branchName: 'branch-1', teamId: team2.id });
|
|
190
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
191
|
+
const next = await getNextInQueue(db, teamId);
|
|
190
192
|
expect(next?.id).toBe(pr2.id);
|
|
191
193
|
});
|
|
192
|
-
it('should return undefined when no queued PRs', () => {
|
|
193
|
-
const pr = createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
194
|
-
updatePullRequest(db, pr.id, { status: 'merged' });
|
|
195
|
-
const next = getNextInQueue(db);
|
|
194
|
+
it('should return undefined when no queued PRs', async () => {
|
|
195
|
+
const pr = await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
196
|
+
await updatePullRequest(db, pr.id, { status: 'merged' });
|
|
197
|
+
const next = await getNextInQueue(db);
|
|
196
198
|
expect(next).toBeUndefined();
|
|
197
199
|
});
|
|
198
200
|
});
|
|
199
201
|
describe('getQueuePosition', () => {
|
|
200
|
-
it('should return correct position in queue', () => {
|
|
201
|
-
const pr1 = createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
202
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
203
|
-
const pr3 = createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
204
|
-
expect(getQueuePosition(db, pr1.id)).toBe(1);
|
|
205
|
-
expect(getQueuePosition(db, pr2.id)).toBe(2);
|
|
206
|
-
expect(getQueuePosition(db, pr3.id)).toBe(3);
|
|
207
|
-
});
|
|
208
|
-
it('should return -1 for PR not in queue', () => {
|
|
209
|
-
const pr = createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
210
|
-
updatePullRequest(db, pr.id, { status: 'merged' });
|
|
211
|
-
expect(getQueuePosition(db, pr.id)).toBe(-1);
|
|
212
|
-
});
|
|
213
|
-
it('should return -1 for non-existent PR', () => {
|
|
214
|
-
expect(getQueuePosition(db, 'non-existent-id')).toBe(-1);
|
|
202
|
+
it('should return correct position in queue', async () => {
|
|
203
|
+
const pr1 = await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
204
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
205
|
+
const pr3 = await createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
206
|
+
expect(await getQueuePosition(db, pr1.id)).toBe(1);
|
|
207
|
+
expect(await getQueuePosition(db, pr2.id)).toBe(2);
|
|
208
|
+
expect(await getQueuePosition(db, pr3.id)).toBe(3);
|
|
209
|
+
});
|
|
210
|
+
it('should return -1 for PR not in queue', async () => {
|
|
211
|
+
const pr = await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
212
|
+
await updatePullRequest(db, pr.id, { status: 'merged' });
|
|
213
|
+
expect(await getQueuePosition(db, pr.id)).toBe(-1);
|
|
214
|
+
});
|
|
215
|
+
it('should return -1 for non-existent PR', async () => {
|
|
216
|
+
expect(await getQueuePosition(db, 'non-existent-id')).toBe(-1);
|
|
215
217
|
});
|
|
216
218
|
});
|
|
217
219
|
describe('getPullRequestsByStatus', () => {
|
|
218
|
-
it('should filter PRs by status', () => {
|
|
219
|
-
const pr1 = createPullRequest(db, { branchName: 'branch-1' });
|
|
220
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2' });
|
|
221
|
-
updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
222
|
-
const queued = getPullRequestsByStatus(db, 'queued');
|
|
223
|
-
const approved = getPullRequestsByStatus(db, 'approved');
|
|
220
|
+
it('should filter PRs by status', async () => {
|
|
221
|
+
const pr1 = await createPullRequest(db, { branchName: 'branch-1' });
|
|
222
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2' });
|
|
223
|
+
await updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
224
|
+
const queued = await getPullRequestsByStatus(db, 'queued');
|
|
225
|
+
const approved = await getPullRequestsByStatus(db, 'approved');
|
|
224
226
|
expect(queued).toHaveLength(1);
|
|
225
227
|
expect(queued[0].id).toBe(pr1.id);
|
|
226
228
|
expect(approved).toHaveLength(1);
|
|
227
229
|
expect(approved[0].id).toBe(pr2.id);
|
|
228
230
|
});
|
|
229
|
-
it('should order by created_at DESC', () => {
|
|
230
|
-
const pr1 = createPullRequest(db, { branchName: 'first' });
|
|
231
|
-
const pr2 = createPullRequest(db, { branchName: 'second' });
|
|
232
|
-
const queued = getPullRequestsByStatus(db, 'queued');
|
|
231
|
+
it('should order by created_at DESC', async () => {
|
|
232
|
+
const pr1 = await createPullRequest(db, { branchName: 'first' });
|
|
233
|
+
const pr2 = await createPullRequest(db, { branchName: 'second' });
|
|
234
|
+
const queued = await getPullRequestsByStatus(db, 'queued');
|
|
233
235
|
expect(queued).toHaveLength(2);
|
|
234
236
|
// Verify both PRs are present
|
|
235
237
|
expect(queued.map(p => p.id)).toContain(pr1.id);
|
|
@@ -237,32 +239,32 @@ describe('pull-requests queries', () => {
|
|
|
237
239
|
});
|
|
238
240
|
});
|
|
239
241
|
describe('getApprovedPullRequests', () => {
|
|
240
|
-
it('should return only approved PRs', () => {
|
|
241
|
-
createPullRequest(db, { branchName: 'branch-1' });
|
|
242
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2' });
|
|
243
|
-
updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
244
|
-
const pr3 = createPullRequest(db, { branchName: 'branch-3' });
|
|
245
|
-
updatePullRequest(db, pr3.id, { status: 'approved' });
|
|
246
|
-
const approved = getApprovedPullRequests(db);
|
|
242
|
+
it('should return only approved PRs', async () => {
|
|
243
|
+
await createPullRequest(db, { branchName: 'branch-1' });
|
|
244
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2' });
|
|
245
|
+
await updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
246
|
+
const pr3 = await createPullRequest(db, { branchName: 'branch-3' });
|
|
247
|
+
await updatePullRequest(db, pr3.id, { status: 'approved' });
|
|
248
|
+
const approved = await getApprovedPullRequests(db);
|
|
247
249
|
expect(approved).toHaveLength(2);
|
|
248
250
|
expect(approved.map(p => p.id)).toContain(pr2.id);
|
|
249
251
|
expect(approved.map(p => p.id)).toContain(pr3.id);
|
|
250
252
|
});
|
|
251
|
-
it('should order by created_at ASC', () => {
|
|
252
|
-
const pr1 = createPullRequest(db, { branchName: 'first' });
|
|
253
|
-
updatePullRequest(db, pr1.id, { status: 'approved' });
|
|
254
|
-
const pr2 = createPullRequest(db, { branchName: 'second' });
|
|
255
|
-
updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
256
|
-
const approved = getApprovedPullRequests(db);
|
|
253
|
+
it('should order by created_at ASC', async () => {
|
|
254
|
+
const pr1 = await createPullRequest(db, { branchName: 'first' });
|
|
255
|
+
await updatePullRequest(db, pr1.id, { status: 'approved' });
|
|
256
|
+
const pr2 = await createPullRequest(db, { branchName: 'second' });
|
|
257
|
+
await updatePullRequest(db, pr2.id, { status: 'approved' });
|
|
258
|
+
const approved = await getApprovedPullRequests(db);
|
|
257
259
|
expect(approved[0].id).toBe(pr1.id);
|
|
258
260
|
expect(approved[1].id).toBe(pr2.id);
|
|
259
261
|
});
|
|
260
262
|
});
|
|
261
263
|
describe('getAllPullRequests', () => {
|
|
262
|
-
it('should return all PRs ordered by created_at DESC', () => {
|
|
263
|
-
const pr1 = createPullRequest(db, { branchName: 'first' });
|
|
264
|
-
const pr2 = createPullRequest(db, { branchName: 'second' });
|
|
265
|
-
const prs = getAllPullRequests(db);
|
|
264
|
+
it('should return all PRs ordered by created_at DESC', async () => {
|
|
265
|
+
const pr1 = await createPullRequest(db, { branchName: 'first' });
|
|
266
|
+
const pr2 = await createPullRequest(db, { branchName: 'second' });
|
|
267
|
+
const prs = await getAllPullRequests(db);
|
|
266
268
|
expect(prs).toHaveLength(2);
|
|
267
269
|
// Verify both PRs are present
|
|
268
270
|
expect(prs.map(p => p.id)).toContain(pr1.id);
|
|
@@ -270,61 +272,61 @@ describe('pull-requests queries', () => {
|
|
|
270
272
|
});
|
|
271
273
|
});
|
|
272
274
|
describe('getPullRequestsByTeam', () => {
|
|
273
|
-
it('should filter PRs by team', () => {
|
|
274
|
-
const team2 = createTeam(db, {
|
|
275
|
+
it('should filter PRs by team', async () => {
|
|
276
|
+
const team2 = await createTeam(db, {
|
|
275
277
|
repoUrl: 'https://github.com/test/repo2.git',
|
|
276
278
|
repoPath: '/path/to/repo2',
|
|
277
279
|
name: 'Team 2',
|
|
278
280
|
});
|
|
279
|
-
const pr1 = createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
280
|
-
createPullRequest(db, { branchName: 'branch-2', teamId: team2.id });
|
|
281
|
-
const teamPrs = getPullRequestsByTeam(db, teamId);
|
|
281
|
+
const pr1 = await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
282
|
+
await createPullRequest(db, { branchName: 'branch-2', teamId: team2.id });
|
|
283
|
+
const teamPrs = await getPullRequestsByTeam(db, teamId);
|
|
282
284
|
expect(teamPrs).toHaveLength(1);
|
|
283
285
|
expect(teamPrs[0].id).toBe(pr1.id);
|
|
284
286
|
});
|
|
285
287
|
});
|
|
286
288
|
describe('updatePullRequest', () => {
|
|
287
|
-
it('should update PR status', () => {
|
|
288
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
289
|
-
const updated = updatePullRequest(db, pr.id, { status: 'reviewing' });
|
|
289
|
+
it('should update PR status', async () => {
|
|
290
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
291
|
+
const updated = await updatePullRequest(db, pr.id, { status: 'reviewing' });
|
|
290
292
|
expect(updated?.status).toBe('reviewing');
|
|
291
293
|
});
|
|
292
|
-
it('should set reviewed_at when status changes to reviewing', () => {
|
|
293
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
294
|
-
const updated = updatePullRequest(db, pr.id, { status: 'reviewing' });
|
|
294
|
+
it('should set reviewed_at when status changes to reviewing', async () => {
|
|
295
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
296
|
+
const updated = await updatePullRequest(db, pr.id, { status: 'reviewing' });
|
|
295
297
|
expect(updated?.reviewed_at).toBeDefined();
|
|
296
298
|
});
|
|
297
|
-
it('should set reviewed_at when status changes to approved', () => {
|
|
298
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
299
|
-
const updated = updatePullRequest(db, pr.id, { status: 'approved' });
|
|
299
|
+
it('should set reviewed_at when status changes to approved', async () => {
|
|
300
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
301
|
+
const updated = await updatePullRequest(db, pr.id, { status: 'approved' });
|
|
300
302
|
expect(updated?.reviewed_at).toBeDefined();
|
|
301
303
|
});
|
|
302
|
-
it('should update reviewedBy', () => {
|
|
303
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
304
|
-
const updated = updatePullRequest(db, pr.id, {
|
|
304
|
+
it('should update reviewedBy', async () => {
|
|
305
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
306
|
+
const updated = await updatePullRequest(db, pr.id, {
|
|
305
307
|
reviewedBy: 'qa-agent-123',
|
|
306
308
|
});
|
|
307
309
|
expect(updated?.reviewed_by).toBe('qa-agent-123');
|
|
308
310
|
});
|
|
309
|
-
it('should update reviewNotes', () => {
|
|
310
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
311
|
-
const updated = updatePullRequest(db, pr.id, {
|
|
311
|
+
it('should update reviewNotes', async () => {
|
|
312
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
313
|
+
const updated = await updatePullRequest(db, pr.id, {
|
|
312
314
|
reviewNotes: 'LGTM! Good work.',
|
|
313
315
|
});
|
|
314
316
|
expect(updated?.review_notes).toBe('LGTM! Good work.');
|
|
315
317
|
});
|
|
316
|
-
it('should update GitHub PR details', () => {
|
|
317
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
318
|
-
const updated = updatePullRequest(db, pr.id, {
|
|
318
|
+
it('should update GitHub PR details', async () => {
|
|
319
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
320
|
+
const updated = await updatePullRequest(db, pr.id, {
|
|
319
321
|
githubPrNumber: 789,
|
|
320
322
|
githubPrUrl: 'https://github.com/test/repo/pull/789',
|
|
321
323
|
});
|
|
322
324
|
expect(updated?.github_pr_number).toBe(789);
|
|
323
325
|
expect(updated?.github_pr_url).toBe('https://github.com/test/repo/pull/789');
|
|
324
326
|
});
|
|
325
|
-
it('should update multiple fields at once', () => {
|
|
326
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
327
|
-
const updated = updatePullRequest(db, pr.id, {
|
|
327
|
+
it('should update multiple fields at once', async () => {
|
|
328
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
329
|
+
const updated = await updatePullRequest(db, pr.id, {
|
|
328
330
|
status: 'approved',
|
|
329
331
|
reviewedBy: 'qa-agent',
|
|
330
332
|
reviewNotes: 'Approved',
|
|
@@ -333,114 +335,114 @@ describe('pull-requests queries', () => {
|
|
|
333
335
|
expect(updated?.reviewed_by).toBe('qa-agent');
|
|
334
336
|
expect(updated?.review_notes).toBe('Approved');
|
|
335
337
|
});
|
|
336
|
-
it('should update updated_at timestamp', () => {
|
|
337
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
338
|
-
const updated = updatePullRequest(db, pr.id, { status: 'reviewing' });
|
|
338
|
+
it('should update updated_at timestamp', async () => {
|
|
339
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
340
|
+
const updated = await updatePullRequest(db, pr.id, { status: 'reviewing' });
|
|
339
341
|
// Verify updated_at exists and is a valid timestamp
|
|
340
342
|
expect(updated?.updated_at).toBeDefined();
|
|
341
343
|
expect(typeof updated?.updated_at).toBe('string');
|
|
342
344
|
});
|
|
343
|
-
it('should return PR when no updates provided', () => {
|
|
344
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
345
|
-
const updated = updatePullRequest(db, pr.id, {});
|
|
345
|
+
it('should return PR when no updates provided', async () => {
|
|
346
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
347
|
+
const updated = await updatePullRequest(db, pr.id, {});
|
|
346
348
|
expect(updated?.id).toBe(pr.id);
|
|
347
349
|
});
|
|
348
|
-
it('should return undefined for non-existent PR', () => {
|
|
349
|
-
const updated = updatePullRequest(db, 'non-existent-id', { status: 'reviewing' });
|
|
350
|
+
it('should return undefined for non-existent PR', async () => {
|
|
351
|
+
const updated = await updatePullRequest(db, 'non-existent-id', { status: 'reviewing' });
|
|
350
352
|
expect(updated).toBeUndefined();
|
|
351
353
|
});
|
|
352
354
|
});
|
|
353
355
|
describe('deletePullRequest', () => {
|
|
354
|
-
it('should delete a PR', () => {
|
|
355
|
-
const pr = createPullRequest(db, { branchName: 'to-delete' });
|
|
356
|
-
deletePullRequest(db, pr.id);
|
|
357
|
-
const retrieved = getPullRequestById(db, pr.id);
|
|
356
|
+
it('should delete a PR', async () => {
|
|
357
|
+
const pr = await createPullRequest(db, { branchName: 'to-delete' });
|
|
358
|
+
await deletePullRequest(db, pr.id);
|
|
359
|
+
const retrieved = await getPullRequestById(db, pr.id);
|
|
358
360
|
expect(retrieved).toBeUndefined();
|
|
359
361
|
});
|
|
360
|
-
it('should not throw when deleting non-existent PR', () => {
|
|
361
|
-
expect(
|
|
362
|
+
it('should not throw when deleting non-existent PR', async () => {
|
|
363
|
+
await expect(deletePullRequest(db, 'non-existent-id')).resolves.not.toThrow();
|
|
362
364
|
});
|
|
363
365
|
});
|
|
364
366
|
describe('isAgentReviewingPR', () => {
|
|
365
|
-
it('should return true if agent has a PR in reviewing status', () => {
|
|
366
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
367
|
-
updatePullRequest(db, pr.id, {
|
|
367
|
+
it('should return true if agent has a PR in reviewing status', async () => {
|
|
368
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
369
|
+
await updatePullRequest(db, pr.id, {
|
|
368
370
|
status: 'reviewing',
|
|
369
371
|
reviewedBy: 'qa-agent-1',
|
|
370
372
|
});
|
|
371
|
-
expect(isAgentReviewingPR(db, 'qa-agent-1')).toBe(true);
|
|
373
|
+
expect(await isAgentReviewingPR(db, 'qa-agent-1')).toBe(true);
|
|
372
374
|
});
|
|
373
|
-
it('should return false if agent has no PRs in reviewing status', () => {
|
|
374
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
375
|
-
updatePullRequest(db, pr.id, {
|
|
375
|
+
it('should return false if agent has no PRs in reviewing status', async () => {
|
|
376
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
377
|
+
await updatePullRequest(db, pr.id, {
|
|
376
378
|
status: 'approved',
|
|
377
379
|
reviewedBy: 'qa-agent-1',
|
|
378
380
|
});
|
|
379
|
-
expect(isAgentReviewingPR(db, 'qa-agent-1')).toBe(false);
|
|
381
|
+
expect(await isAgentReviewingPR(db, 'qa-agent-1')).toBe(false);
|
|
380
382
|
});
|
|
381
|
-
it('should return false if agent has never reviewed any PR', () => {
|
|
382
|
-
expect(isAgentReviewingPR(db, 'non-existent-agent')).toBe(false);
|
|
383
|
+
it('should return false if agent has never reviewed any PR', async () => {
|
|
384
|
+
expect(await isAgentReviewingPR(db, 'non-existent-agent')).toBe(false);
|
|
383
385
|
});
|
|
384
|
-
it('should not count PRs reviewed by other agents', () => {
|
|
385
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
386
|
-
updatePullRequest(db, pr.id, {
|
|
386
|
+
it('should not count PRs reviewed by other agents', async () => {
|
|
387
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
388
|
+
await updatePullRequest(db, pr.id, {
|
|
387
389
|
status: 'reviewing',
|
|
388
390
|
reviewedBy: 'qa-agent-1',
|
|
389
391
|
});
|
|
390
|
-
expect(isAgentReviewingPR(db, 'qa-agent-2')).toBe(false);
|
|
392
|
+
expect(await isAgentReviewingPR(db, 'qa-agent-2')).toBe(false);
|
|
391
393
|
});
|
|
392
|
-
it('should return true only if status is exactly reviewing', () => {
|
|
394
|
+
it('should return true only if status is exactly reviewing', async () => {
|
|
393
395
|
const statuses = ['queued', 'approved', 'merged', 'rejected', 'closed'];
|
|
394
396
|
for (const status of statuses) {
|
|
395
|
-
const pr = createPullRequest(db, { branchName: `test-${status}` });
|
|
396
|
-
updatePullRequest(db, pr.id, {
|
|
397
|
+
const pr = await createPullRequest(db, { branchName: `test-${status}` });
|
|
398
|
+
await updatePullRequest(db, pr.id, {
|
|
397
399
|
status,
|
|
398
400
|
reviewedBy: 'qa-agent-test',
|
|
399
401
|
});
|
|
400
402
|
}
|
|
401
|
-
expect(isAgentReviewingPR(db, 'qa-agent-test')).toBe(false);
|
|
403
|
+
expect(await isAgentReviewingPR(db, 'qa-agent-test')).toBe(false);
|
|
402
404
|
});
|
|
403
|
-
it('should handle multiple PRs and return true if any is reviewing', () => {
|
|
404
|
-
const pr1 = createPullRequest(db, { branchName: 'test-1' });
|
|
405
|
-
updatePullRequest(db, pr1.id, {
|
|
405
|
+
it('should handle multiple PRs and return true if any is reviewing', async () => {
|
|
406
|
+
const pr1 = await createPullRequest(db, { branchName: 'test-1' });
|
|
407
|
+
await updatePullRequest(db, pr1.id, {
|
|
406
408
|
status: 'approved',
|
|
407
409
|
reviewedBy: 'qa-agent-1',
|
|
408
410
|
});
|
|
409
|
-
const pr2 = createPullRequest(db, { branchName: 'test-2' });
|
|
410
|
-
updatePullRequest(db, pr2.id, {
|
|
411
|
+
const pr2 = await createPullRequest(db, { branchName: 'test-2' });
|
|
412
|
+
await updatePullRequest(db, pr2.id, {
|
|
411
413
|
status: 'reviewing',
|
|
412
414
|
reviewedBy: 'qa-agent-1',
|
|
413
415
|
});
|
|
414
|
-
expect(isAgentReviewingPR(db, 'qa-agent-1')).toBe(true);
|
|
416
|
+
expect(await isAgentReviewingPR(db, 'qa-agent-1')).toBe(true);
|
|
415
417
|
});
|
|
416
418
|
});
|
|
417
419
|
describe('edge cases', () => {
|
|
418
|
-
it('should handle all PR statuses', () => {
|
|
420
|
+
it('should handle all PR statuses', async () => {
|
|
419
421
|
const statuses = ['queued', 'reviewing', 'approved', 'merged', 'rejected', 'closed'];
|
|
420
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
421
|
-
|
|
422
|
-
const updated = updatePullRequest(db, pr.id, { status });
|
|
422
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
423
|
+
for (const status of statuses) {
|
|
424
|
+
const updated = await updatePullRequest(db, pr.id, { status });
|
|
423
425
|
expect(updated?.status).toBe(status);
|
|
424
|
-
}
|
|
426
|
+
}
|
|
425
427
|
});
|
|
426
|
-
it('should handle very long review notes', () => {
|
|
427
|
-
const pr = createPullRequest(db, { branchName: 'test' });
|
|
428
|
+
it('should handle very long review notes', async () => {
|
|
429
|
+
const pr = await createPullRequest(db, { branchName: 'test' });
|
|
428
430
|
const longNotes = 'A'.repeat(50000);
|
|
429
|
-
const updated = updatePullRequest(db, pr.id, { reviewNotes: longNotes });
|
|
431
|
+
const updated = await updatePullRequest(db, pr.id, { reviewNotes: longNotes });
|
|
430
432
|
expect(updated?.review_notes).toBe(longNotes);
|
|
431
433
|
});
|
|
432
|
-
it('should handle special characters in branch names', () => {
|
|
433
|
-
const pr = createPullRequest(db, {
|
|
434
|
+
it('should handle special characters in branch names', async () => {
|
|
435
|
+
const pr = await createPullRequest(db, {
|
|
434
436
|
branchName: 'feature/STORY-123_fix-bug-with-dashes',
|
|
435
437
|
});
|
|
436
438
|
expect(pr.branch_name).toBe('feature/STORY-123_fix-bug-with-dashes');
|
|
437
439
|
});
|
|
438
|
-
it('should handle null fields', () => {
|
|
439
|
-
const pr = createPullRequest(db, {
|
|
440
|
+
it('should handle null fields', async () => {
|
|
441
|
+
const pr = await createPullRequest(db, {
|
|
440
442
|
branchName: 'test',
|
|
441
443
|
submittedBy: 'agent-1',
|
|
442
444
|
});
|
|
443
|
-
const updated = updatePullRequest(db, pr.id, {
|
|
445
|
+
const updated = await updatePullRequest(db, pr.id, {
|
|
444
446
|
reviewedBy: null,
|
|
445
447
|
reviewNotes: null,
|
|
446
448
|
});
|
|
@@ -450,11 +452,11 @@ describe('pull-requests queries', () => {
|
|
|
450
452
|
});
|
|
451
453
|
describe('getPrioritizedMergeQueue', () => {
|
|
452
454
|
it('should prioritize by age when no story dependencies', async () => {
|
|
453
|
-
const pr1 = createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
454
|
-
const pr2 = createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
455
|
-
const pr3 = createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
455
|
+
const pr1 = await createPullRequest(db, { branchName: 'branch-1', teamId });
|
|
456
|
+
const pr2 = await createPullRequest(db, { branchName: 'branch-2', teamId });
|
|
457
|
+
const pr3 = await createPullRequest(db, { branchName: 'branch-3', teamId });
|
|
456
458
|
const { getPrioritizedMergeQueue } = await import('./pull-requests.js');
|
|
457
|
-
const queue = getPrioritizedMergeQueue(db, teamId);
|
|
459
|
+
const queue = await getPrioritizedMergeQueue(db, teamId);
|
|
458
460
|
// Should be ordered: pr1 (oldest), pr2, pr3 (newest)
|
|
459
461
|
expect(queue[0].id).toBe(pr1.id);
|
|
460
462
|
expect(queue[1].id).toBe(pr2.id);
|
|
@@ -462,45 +464,40 @@ describe('pull-requests queries', () => {
|
|
|
462
464
|
});
|
|
463
465
|
it('should prioritize PRs with satisfied dependencies', async () => {
|
|
464
466
|
// Create two base stories: story1 and story2
|
|
465
|
-
const story1 = createStory(db, {
|
|
467
|
+
const story1 = await createStory(db, {
|
|
466
468
|
title: 'Story 1 - Base',
|
|
467
469
|
description: 'Base story',
|
|
468
470
|
teamId,
|
|
469
471
|
});
|
|
470
|
-
const story2 = createStory(db, {
|
|
472
|
+
const story2 = await createStory(db, {
|
|
471
473
|
title: 'Story 2 - Dependent',
|
|
472
474
|
description: 'Dependent story',
|
|
473
475
|
teamId,
|
|
474
476
|
});
|
|
475
|
-
const story3 = createStory(db, {
|
|
477
|
+
const story3 = await createStory(db, {
|
|
476
478
|
title: 'Story 3 - Independent',
|
|
477
479
|
description: 'Independent story',
|
|
478
480
|
teamId,
|
|
479
481
|
});
|
|
480
482
|
// Add dependency: story2 depends on story1
|
|
481
483
|
const { addStoryDependency } = await import('./stories.js');
|
|
482
|
-
addStoryDependency(db, story2.id, story1.id);
|
|
484
|
+
await addStoryDependency(db, story2.id, story1.id);
|
|
483
485
|
// Create PRs in order: story3 (independent, oldest), story2 (dependent, newer), story1 (base, newest)
|
|
484
|
-
const pr3 = createPullRequest(db, {
|
|
486
|
+
const pr3 = await createPullRequest(db, {
|
|
485
487
|
storyId: story3.id,
|
|
486
488
|
branchName: 'feature/story3-independent',
|
|
487
489
|
teamId,
|
|
488
490
|
});
|
|
489
|
-
const pr2_unsatisfied = createPullRequest(db, {
|
|
491
|
+
const pr2_unsatisfied = await createPullRequest(db, {
|
|
490
492
|
storyId: story2.id,
|
|
491
493
|
branchName: 'feature/story2-unsatisfied',
|
|
492
494
|
teamId,
|
|
493
495
|
});
|
|
494
496
|
// Update story1 to merged status (satisfies story2's dependency)
|
|
495
497
|
const { updateStory } = await import('./stories.js');
|
|
496
|
-
updateStory(db, story1.id, { status: 'merged' });
|
|
498
|
+
await updateStory(db, story1.id, { status: 'merged' });
|
|
497
499
|
const { getPrioritizedMergeQueue } = await import('./pull-requests.js');
|
|
498
|
-
const queue = getPrioritizedMergeQueue(db, teamId);
|
|
499
|
-
// Expected order:
|
|
500
|
-
// 1. pr2_unsatisfied (has unsatisfied dependency) - should be deprioritized
|
|
501
|
-
// 2. pr3 (independent, no dependencies) - by age after unsatisfied ones
|
|
502
|
-
// Actually: dependencies satisfied > no dependencies
|
|
503
|
-
// So: pr2 should be LAST (unsatisfied), pr3 and pr2_before_merge should be by age
|
|
500
|
+
const queue = await getPrioritizedMergeQueue(db, teamId);
|
|
504
501
|
const indexIndependent = queue.findIndex(p => p.id === pr3.id);
|
|
505
502
|
const indexUnsatisfied = queue.findIndex(p => p.id === pr2_unsatisfied.id);
|
|
506
503
|
// Independent PR should come before dependent PR with unsatisfied dependencies
|