3.4 KiB
3.4 KiB
id, title, status, wave, depends_on, plan, spec
| id | title | status | wave | depends_on | plan | spec | |||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| 11-plugin-workflows-watches | Plugin task, Git, linking, and watch workflows | completed | 3 |
|
plan.md | ../../specs/integrations/requirements/bitbucket-plugin.md |
Task 11: Plugin task, Git, linking, and watch workflows
Intent
Use released host seams to implement Bitbucket plugin actions/RPC handlers for task launching, scoped Git credentials, PR linking/creation, and durable watches.
Owned paths
- Attached
kdlbs/kandev-plugin-bitbucketworktree: action/RPC handlers, task and Git workflow services, link storage, credential resolver, health poll integration, watch persistence/poller/recovery, events, and focused tests.
Dependencies
Tasks 03, 05, 06, 07, and 10.
Acceptance
- Authenticated actions launch tasks from PRs, link/unlink tasks, create PRs from task branches, and resolve Git credentials without secrets crossing host boundaries.
- Plugin
pull_requestsearch and authorization use the live Cloud/DC adapter for both composer search and message submission; they do not bypass host canonicalization. - Watches persist definition/cursor/dedupe/reservation/link/recovery state, use keyed
mutex plus durable
creatingreservation, reconcile crashes, and emitplugin.kandev-plugin-bitbucket.*events. - Reset/delete previews cascade and removes only plugin/watch-owned task trees; manually linked and adopted tasks survive.
- The Cloud/Data Center provider wrapper preserves restart-safe PR paging; a watch-created task is returned by both task-scoped PR and workspace-association queries after restart.
- Creating a PR from a verified task persists its association immediately. A remote create success followed by local association failure returns a bounded partial result rather than a retryable error that could duplicate the remote PR.
- Review status adapters query the PR source/head commit.
- Task-scoped refresh performs bounded, exact source-branch PR discovery from the host-verified repository checkout and persists the result idempotently; discovery errors do not suppress existing associations.
Verification
make test
make vet
make build
Risks
Concurrent polls and crash timing can duplicate tasks. Credential refresh and ownership
checks must fail closed; avoid adding Bitbucket logic to host agentctl PR automation.
Completion
- Live Cloud acceptance proved manual linking through the host-native dialog and durable association recovery after host/plugin restarts.
- A disposable linked task was explicitly unlinked, then task-scoped refresh rediscovered
the open pull request by its exact host-verified
kandev-live-testcheckout branch and persisted the association again (0 -> discovered key -> 1). - The live watch created exactly one owned task and a subsequent run skipped the same pull request. Cloud paging now respects Bitbucket's 50-item maximum.
- Review status reads the source commit: the live
KANDEV-LIVE-ACCEPTANCEmarker resolved targetc1c53106bebf, not the destination commit. - Final plugin checks passed: 37 UI tests,
go test ./...,go test -race ./internal/...,go vet ./..., host build, five-platform package build, and checksum verification.