feat: add cross-integration entity references (#1862)
* feat: add cross-integration entity references * fix(web): anchor entity reference menu to composer * fix: keep Kandev tasks under @ mentions * fix: address entity reference review findings * test(e2e): use option role for prompt menu * test(e2e): update passthrough mention roles * fix: preserve queued references and paginate Azure PRs
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
---
|
||||
spec: docs/specs/ui/entity-reference-composer.md
|
||||
decision: docs/decisions/2026-07-21-work-item-reference-search.md
|
||||
created: 2026-07-21
|
||||
status: implemented
|
||||
---
|
||||
|
||||
# Implementation Plan: Entity Reference Composer
|
||||
|
||||
## Overview
|
||||
|
||||
Build a backend-normalized, workspace-scoped provider registry first, then add each external adapter without sharing mutable files. Registry and DTOs stay transport- and provider-neutral so native adapters can later be replaced by a plugin bridge with an explicit contribution and workspace permission. After central wiring and durable message metadata work, add the frontend search/client, `#` atom, composer interaction, sent-message chips, and desktop/mobile E2E.
|
||||
|
||||
## Backend
|
||||
|
||||
### Normalized search contract
|
||||
|
||||
Files:
|
||||
|
||||
- `apps/backend/pkg/api/v1/mentions.go` (new)
|
||||
- `apps/backend/internal/mentions/types.go` (new)
|
||||
- `apps/backend/internal/mentions/service.go` (new)
|
||||
- `apps/backend/internal/mentions/handler.go` (new)
|
||||
- `apps/backend/internal/mentions/service_test.go` (new)
|
||||
- `apps/backend/internal/mentions/handler_test.go` (new)
|
||||
|
||||
Define `MentionProvider.Descriptor()` plus `MentionProvider.Search(ctx, SearchRequest)`, normalized groups/results/statuses, validation, deterministic group order, bounded concurrent all-settled execution, per-provider timeouts, safe errors, and the HTTP handler. Core registry code accepts arbitrary validated source/provider/kind IDs and uses descriptor labels/generic fallbacks; it contains no native-provider type switch. The registry owns provider identity and canonical `ref` construction, while adapters return bounded untrusted candidates with provider-local identity. Each unique `(provider, kind)` may also register a `ReferenceAuthorizer`; search filtering and later submission validation dispatch through that same provider-owned seam. Do not register Kandev tasks in this search contract: existing Kandev task discovery remains owned by `@`, while `#` is external-integration search only.
|
||||
|
||||
### External provider adapters
|
||||
|
||||
Each adapter owns plain-query translation, workspace/config checks, stable identity mapping, exact destination/scope authorization for search and submission, safe failure classification, and focused tests in separate files:
|
||||
|
||||
- Jira: preserve immutable issue ID and generate escaped text/key JQL in `internal/jira/service_mentions.go`.
|
||||
- Linear: use the existing structured `SearchFilter.Query` path.
|
||||
- GitHub: preserve REST/node IDs and generate title-only issue/PR queries through workspace-scoped search.
|
||||
- GitLab: include host + immutable object ID and add a workspace-scoped safe search wrapper.
|
||||
- Azure DevOps: generate escaped WIQL for work items and add project-level active-PR listing/title filtering without repository-by-repository browser fan-out.
|
||||
- Sentry: search every configured workspace instance through bounded organization discovery, include instance ID in scope, and escape free text.
|
||||
|
||||
Provider adapters live in `apps/backend/internal/mentions/provider_<name>.go`; provider-owned safe methods live beside their existing service/client code. No adapter registers routes or edits central backend composition.
|
||||
|
||||
### Message and queue reference metadata
|
||||
|
||||
Files:
|
||||
|
||||
- `apps/backend/internal/orchestrator/message_meta.go`
|
||||
- `apps/backend/internal/task/handlers/message_handlers.go`
|
||||
- `apps/backend/internal/task/handlers/message_handlers_test.go`
|
||||
- `apps/backend/internal/orchestrator/handlers/queue_handlers.go`
|
||||
- `apps/backend/internal/orchestrator/handlers/queue_handlers_test.go`
|
||||
- `apps/backend/internal/orchestrator/messagequeue/service.go`
|
||||
- `apps/backend/internal/orchestrator/messagequeue/repository_sqlite.go`
|
||||
- `apps/backend/internal/orchestrator/messagequeue/repository_sqlite_test.go`
|
||||
- `apps/backend/internal/task/models/message_shell_output.go`
|
||||
- `apps/backend/internal/task/models/message_shell_output_test.go`
|
||||
|
||||
Extract structural normalization/canonicalization into a neutral `internal/entityrefs` leaf, then validate, deduplicate, and persist `entity_references` for direct messages and queue add/update/drain. A conversation resolver derives trusted workspace from the persisted session/task; provider authorization dispatches through the registry and fails closed for unknown providers. Queue update replaces metadata instead of retaining deleted links. Project typed metadata to clients and build one sanitized agent-facing reference system block. Keep legacy `@task` context behavior intact.
|
||||
|
||||
### Composition and route wiring
|
||||
|
||||
Files:
|
||||
|
||||
- `apps/backend/internal/backendapp/types.go`
|
||||
- `apps/backend/internal/backendapp/services.go`
|
||||
- `apps/backend/internal/backendapp/helpers.go`
|
||||
- `apps/backend/internal/backendapp/mentions.go` (new)
|
||||
- `apps/backend/internal/backendapp/mentions_test.go` (new)
|
||||
|
||||
Construct adapters from available services, register them through stable provider descriptors, validate the workspace before fan-out, and mount `GET /api/v1/workspaces/:workspaceId/mentions/search`. Built-ins have deterministic descriptor order; the registry can also accept future dynamic descriptors without native-provider switches. Nil/unconfigured services must degrade to safe statuses. Add an aggregate integration test covering mixed success, disconnect, timeout, caps, and workspace isolation.
|
||||
|
||||
### Future plugin migration seam
|
||||
|
||||
This release does not change plugin manifests, protobufs, SDKs, or runtime. It does establish constraints for that later work:
|
||||
|
||||
- normalized result/reference DTOs are hand-mapped, versioned, additive, and independent of native structs, plugin wire models, and `structpb`, matching ADR 0043's public DTO rule;
|
||||
- provider registration is dynamic and descriptor-driven, so a future plugin bridge registers providers without changing aggregation or React code; registry code injects provider identity and constructs canonical refs from validated plugin-local candidates;
|
||||
- registry-issued source/provider IDs are stable across a native-to-plugin migration (or retain explicit aliases); brand-new plugin providers use reserved namespaced IDs and generic UI fallbacks;
|
||||
- workspace scope is an explicit provider input, leaving the future bridge one place to enforce plugin workspace grants;
|
||||
- provider timeout, cancellation, partial failure, URL validation, and result caps apply equally to native and future plugin-backed providers; and
|
||||
- no task in this plan adds a `mentions.providers` manifest contribution, plugin workspace permission/grant, or `Plugin.SearchMentions` gRPC RPC. Those public wire and permission changes require their own plugin spec/ADR. Search flows Kandev-to-plugin and must not be inferred from plugin categories or reuse the plugin-to-Kandev Host data API/`api_read` capability.
|
||||
|
||||
## Frontend
|
||||
|
||||
### API client and search hook
|
||||
|
||||
Files:
|
||||
|
||||
- `apps/web/lib/types/entity-reference.ts` (new)
|
||||
- `apps/web/lib/api/domains/mentions-api.ts` (new)
|
||||
- `apps/web/lib/api/domains/mentions-api.test.ts` (new)
|
||||
- `apps/web/hooks/use-entity-reference-search.ts` (new)
|
||||
- `apps/web/hooks/use-entity-reference-search.test.ts` (new)
|
||||
|
||||
Add normalized types/client and a 250 ms debounced, abortable/generation-guarded hook. Search only with an active workspace and non-empty query. Preserve grouped partial results and a safe retryable aggregate error state.
|
||||
|
||||
### Composer and mobile interaction
|
||||
|
||||
Files:
|
||||
|
||||
- `apps/web/components/task/chat/entity-reference-types.ts` (new)
|
||||
- `apps/web/components/task/chat/tiptap-entity-reference-extension.tsx` (new)
|
||||
- `apps/web/components/task/chat/tiptap-entity-reference-suggestion.ts` (new)
|
||||
- `apps/web/components/task/chat/entity-reference-menu.tsx` (new)
|
||||
- `apps/web/components/task/chat/tiptap-input.tsx`
|
||||
- `apps/web/components/task/chat/use-tiptap-editor.ts`
|
||||
- `apps/web/components/task/chat/tiptap-helpers.ts`
|
||||
- `apps/web/components/task/chat/popup-menu.tsx`
|
||||
- `apps/web/components/task/chat/chat-input-body.tsx`
|
||||
- `apps/web/components/task/chat/chat-input-container.tsx`
|
||||
- `apps/web/components/task/chat/chat-input-area.tsx`
|
||||
- `apps/web/components/task/passthrough-chat-composer.tsx`
|
||||
|
||||
Add a separate `entityReference` atom/plugin/menu; do not widen `MentionItem` or `ContextMention`. Explicitly enable `#` in task chat and Quick Chat and leave passthrough disabled. Keep Kandev task discovery under `@`, including legacy node parsing, and defensively omit any Kandev-task group returned to the external-only `#` menu. Serialize safe generated Markdown links, preserve draft JSON, carry reference metadata in history/reverse-search entries so only generated links rehydrate, and expose structured references from the editor handle.
|
||||
|
||||
Improve the shared popup's visual-viewport clamping, internal scroll owner, semantic listbox/option roles, pointer outside-dismiss, wrapping/truncation, and `min-h-11` touch rows.
|
||||
|
||||
### Mobile design contract
|
||||
|
||||
- **Desktop outcome / mobile entry:** typing `#` in the existing task/Quick Chat composer opens the same capability at both viewports.
|
||||
- **Nearest exemplar:** shared `PopupMenu` and mobile slash-command composer supply anchored-above-caret selection; `MobilePickerSheet` is only a fallback if visual-viewport containment cannot preserve typing continuity.
|
||||
- **Hierarchy / primary action:** provider and kind headings group a one-dimensional result list; selecting one row is the primary action.
|
||||
- **Presentation:** anchored popover above the composer. This short, frequent typeahead must keep the software keyboard and caret active; a drawer would interrupt the typing loop.
|
||||
- **Geometry:** visual viewport owns bounds, result body owns the only scroll, safe-area/keyboard clearance is explicit, rows are at least 44 px, and document horizontal overflow stays zero.
|
||||
- **Shared logic:** query state, grouping, selection, serialization, and validation are shared; only viewport geometry changes.
|
||||
- **Proof:** `mobile-entity-reference-composer.spec.ts` inserts and sends a reference by touch and asserts containment/no document overflow.
|
||||
|
||||
### Submission, queue, and sent rendering
|
||||
|
||||
Files:
|
||||
|
||||
- `apps/web/components/task/chat/chat-input-container.tsx`
|
||||
- `apps/web/components/task/chat/use-chat-input-container.ts`
|
||||
- `apps/web/components/task/chat/use-chat-input-state.ts`
|
||||
- `apps/web/components/task/chat/chat-input-area.tsx`
|
||||
- `apps/web/hooks/use-message-handler.ts`
|
||||
- `apps/web/hooks/domains/session/use-queue.ts`
|
||||
- `apps/web/lib/api/domains/queue-api.ts`
|
||||
- `apps/web/lib/types/http.ts`
|
||||
- `apps/web/lib/state/slices/session/types.ts`
|
||||
- `apps/web/components/task/chat/messages/entity-reference-chip.tsx` (new)
|
||||
- `apps/web/components/task/chat/messages/chat-message.tsx`
|
||||
- `apps/web/components/task/chat/queued-ghost-message.tsx`
|
||||
|
||||
Replace the growing positional composer callback with a named submit payload, then carry `entity_references` through direct send and queue add/update. Render metadata-matched generated links as chips; unknown/missing metadata remains normal Markdown. Queue edits recompute references from surviving generated links. Preserve passthrough and existing context attachments without enabling `#` there.
|
||||
|
||||
## Tests
|
||||
|
||||
- Aggregator unit tests: deterministic groups, validation/caps, timeout/cancellation, partial errors, and sanitized statuses in `internal/mentions/service_test.go`.
|
||||
- One focused adapter suite per provider for stable identity, workspace scope, escaping, fan-out bounds, cancellation, and error mapping.
|
||||
- Handler/composition integration tests: HTTP request through real service registry with mixed fake adapters.
|
||||
- Message/queue tests: direct persistence, queue update replacement, restart round-trip, drain, deduplication, unsafe metadata, metadata projection, and prompt-block sanitization.
|
||||
- Frontend unit tests: URL construction, debounce/stale suppression, trigger boundaries, keyboard selection, serialization/history rehydration, viewport geometry, named submit payload, queue clearing, sent chip rendering, and legacy `@task` compatibility.
|
||||
|
||||
## E2E Tests
|
||||
|
||||
- `apps/web/e2e/tests/chat/entity-reference-composer.spec.ts`: task chat Arrow/Tab insertion, no auto-send, explicit send/clickable chip, partial provider result, draft restore, Quick Chat parity, and literal passthrough `#`.
|
||||
- `apps/web/e2e/tests/chat/mobile-entity-reference-composer.spec.ts`: touch selection/send, 44 px row, keyboard/visual-viewport containment, internal scrolling, and no document horizontal overflow.
|
||||
|
||||
## Risks
|
||||
|
||||
- External typeahead can exhaust API quotas; debounce, cancellation, provider timeouts, and fan-out caps are mandatory. Any cache introduced by an adapter/client must include workspace and provider-connection scope in its key.
|
||||
- GitHub/GitLab configuration history includes install-wide auth. Adapters must enforce workspace operational scope and validate the workspace before using shared credentials.
|
||||
- Jira, Azure, GitHub/GitLab, and Sentry accept provider query languages today. Only provider-owned safe methods may translate the plain query.
|
||||
- Azure PR and Sentry searches require extra scope discovery. Provider tests must prove bounded work and cancellation rather than silently omitting connected scopes.
|
||||
- Hot frontend files already approach lint limits; new state, menus, atoms, and renderers stay extracted.
|
||||
- Native-only switches or DTOs would make planned integration-to-plugin migration breaking. Conformance tests use an arbitrary fake provider descriptor to prove aggregation and frontend grouping remain generic.
|
||||
|
||||
## Verification
|
||||
|
||||
Targeted commands are recorded in each task file. Final integrated verification runs in this order:
|
||||
|
||||
```bash
|
||||
make fmt
|
||||
make typecheck test lint
|
||||
cd apps/web && pnpm e2e:run tests/chat/entity-reference-composer.spec.ts tests/chat/mobile-entity-reference-composer.spec.ts
|
||||
```
|
||||
|
||||
## Implementation Waves
|
||||
|
||||
Wave 1:
|
||||
|
||||
- [x] [task-01-core-and-task-search](task-01-core-and-task-search.md)
|
||||
|
||||
Wave 2 (parallel after Task 01):
|
||||
|
||||
- [x] [task-02-jira-provider](task-02-jira-provider.md)
|
||||
- [x] [task-03-linear-provider](task-03-linear-provider.md)
|
||||
- [x] [task-04-github-provider](task-04-github-provider.md)
|
||||
- [x] [task-05-gitlab-provider](task-05-gitlab-provider.md)
|
||||
- [x] [task-06-azure-provider](task-06-azure-provider.md)
|
||||
- [x] [task-07-sentry-provider](task-07-sentry-provider.md)
|
||||
- [x] [task-08-message-reference-metadata](task-08-message-reference-metadata.md)
|
||||
|
||||
Wave 3:
|
||||
|
||||
- [x] [task-09-backend-composition](task-09-backend-composition.md)
|
||||
|
||||
Wave 4 (sequential):
|
||||
|
||||
- [x] [task-10-frontend-search-client](task-10-frontend-search-client.md)
|
||||
- [x] [task-11-composer-reference-ui](task-11-composer-reference-ui.md)
|
||||
- [x] [task-12-message-reference-ui](task-12-message-reference-ui.md)
|
||||
|
||||
Wave 5:
|
||||
|
||||
- [x] [task-13-e2e-and-verification](task-13-e2e-and-verification.md)
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: "01-core-and-task-search"
|
||||
title: "Core external mention search"
|
||||
status: completed
|
||||
wave: 1
|
||||
depends_on: []
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 01: Core External Mention Search
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Normalized provider service validates plain queries, runs bounded providers concurrently, and returns deterministic partial groups with safe statuses.
|
||||
- Registry uses provider descriptors, owns provider identity/canonical ref construction, and accepts an arbitrary namespaced fake provider without native-provider switches, proving a future plugin bridge can use the same seam.
|
||||
- Registry binds a unique `(provider, kind)` reference authorizer so search destinations and later submissions use the same provider-owned scope checks.
|
||||
- HTTP handler implements the spec contract without central route registration yet.
|
||||
- Kandev tasks are not registered in this provider registry because existing task discovery remains owned by `@`.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/pkg/api/v1/mentions.go`
|
||||
- `apps/backend/internal/mentions/types.go`
|
||||
- `apps/backend/internal/mentions/service.go`
|
||||
- `apps/backend/internal/mentions/handler.go`
|
||||
- `apps/backend/internal/mentions/service_test.go`
|
||||
- `apps/backend/internal/mentions/handler_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec API/failure/plugin-compatibility sections; ADR provider boundary; ADR 0043 stable DTO rules and RPC direction.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report contract/type choices, ranking/cap/timeout behavior, files changed, exact test result, blockers, risks, and set this task plus plan checkbox to done.
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: "02-jira-provider"
|
||||
title: "Jira mention provider"
|
||||
status: completed
|
||||
wave: 2
|
||||
depends_on: ["01-core-and-task-search"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 02: Jira Mention Provider
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Jira ticket projections preserve immutable upstream issue ID plus key/title/URL/site scope.
|
||||
- Plain text becomes backend-generated, escaped key-or-title JQL; callers cannot inject raw JQL.
|
||||
- Adapter enforces explicit workspace config and maps auth/rate/timeout/upstream failures safely.
|
||||
- Provider authorizer accepts only the configured workspace site origin/scope for search and submission.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/jira/... ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/jira/models.go`
|
||||
- `apps/backend/internal/jira/cloud_client.go`
|
||||
- `apps/backend/internal/jira/cloud_client_test.go`
|
||||
- `apps/backend/internal/jira/service_mentions.go`
|
||||
- `apps/backend/internal/jira/service_mentions_test.go`
|
||||
- `apps/backend/internal/mentions/provider_jira.go`
|
||||
- `apps/backend/internal/mentions/provider_jira_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 01.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec sources/security/failure requirements; `SearchTicketsForWorkspace`; Jira response conversion tests.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report identity and escaping behavior, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: "03-linear-provider"
|
||||
title: "Linear mention provider"
|
||||
status: completed
|
||||
wave: 2
|
||||
depends_on: ["01-core-and-task-search"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 03: Linear Mention Provider
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Linear adapter searches issues with structured `SearchFilter.Query` and explicit workspace scope.
|
||||
- Results retain immutable issue ID, identifier, title, URL, and non-secret workspace/org scope.
|
||||
- Missing config and upstream failures map to normalized statuses with cancellation preserved.
|
||||
- Provider authorizer validates workspace organization scope and canonical Linear destinations.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/linear/... ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/linear/service_mentions.go`
|
||||
- `apps/backend/internal/linear/service_mentions_test.go`
|
||||
- `apps/backend/internal/mentions/provider_linear.go`
|
||||
- `apps/backend/internal/mentions/provider_linear_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 01.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec provider contract; existing `SearchIssuesForWorkspace`, `LinearIssue.ID`, and GraphQL query tests.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report mapping/scope, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
id: "04-github-provider"
|
||||
title: "GitHub mention provider"
|
||||
status: completed
|
||||
wave: 2
|
||||
depends_on: ["01-core-and-task-search"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 04: GitHub Mention Provider
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Issue and PR search projections preserve immutable REST/node identity through PAT and `gh` paths.
|
||||
- Plain text becomes backend-generated title-only GitHub search and respects workspace repository/org scope.
|
||||
- Issue and PR groups remain separate, cached/scoped safely, bounded, cancellable, and safely classified.
|
||||
- Provider authorizers validate the workspace-owned repository/organization scope and canonical GitHub host.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/github/... ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/github/models.go`
|
||||
- `apps/backend/internal/github/client_helpers.go`
|
||||
- `apps/backend/internal/github/pat_client.go`
|
||||
- `apps/backend/internal/github/gh_client.go`
|
||||
- `apps/backend/internal/github/service_mentions.go`
|
||||
- `apps/backend/internal/github/service_mentions_test.go`
|
||||
- `apps/backend/internal/mentions/provider_github.go`
|
||||
- `apps/backend/internal/mentions/provider_github_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 01.
|
||||
|
||||
## Inputs
|
||||
|
||||
ADR identity rule; workspace settings search wrappers; existing search-cache and workspace-scope tests.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report identity propagation/query generation/cache scope, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
id: "05-gitlab-provider"
|
||||
title: "GitLab mention provider"
|
||||
status: completed
|
||||
wave: 2
|
||||
depends_on: ["01-core-and-task-search"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 05: GitLab Mention Provider
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Issue and MR adapters use immutable object ID plus host scope and keep human IID/project details for display.
|
||||
- Safe service methods construct title-search parameters without accepting raw GitLab filters.
|
||||
- Search validates workspace-owned config/scope and never leaks install-wide results across workspaces.
|
||||
- Provider authorizers fail closed unless the result host/project is proven to belong to the active workspace.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/gitlab/... ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/gitlab/service_mentions.go`
|
||||
- `apps/backend/internal/gitlab/service_mentions_test.go`
|
||||
- `apps/backend/internal/gitlab/store.go`
|
||||
- `apps/backend/internal/mentions/provider_gitlab.go`
|
||||
- `apps/backend/internal/mentions/provider_gitlab_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 01.
|
||||
|
||||
## Inputs
|
||||
|
||||
ADR 0030; GitLab `SearchUserIssuesPaged`/`SearchUserMRsPaged`; existing stable `ID`, `IID`, `ProjectID`, and host models.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report workspace enforcement/query safety, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,47 @@
|
||||
---
|
||||
id: "06-azure-provider"
|
||||
title: "Azure DevOps mention provider"
|
||||
status: completed
|
||||
wave: 2
|
||||
depends_on: ["01-core-and-task-search"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 06: Azure DevOps Mention Provider
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Work-item search generates escaped WIQL internally and returns organization-scoped immutable IDs.
|
||||
- PR search adds a project-level active-PR read path, filters titles server-side, and avoids browser or unbounded repository fan-out.
|
||||
- Adapter respects workspace config/default project plus bounded project discovery, cancellation, caps, and safe errors.
|
||||
- Provider authorizers validate organization URL/path and project scope, not only the shared host origin.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/azuredevops/... ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/azuredevops/client.go`
|
||||
- `apps/backend/internal/azuredevops/rest_client.go`
|
||||
- `apps/backend/internal/azuredevops/client_models.go`
|
||||
- `apps/backend/internal/azuredevops/service_mentions.go`
|
||||
- `apps/backend/internal/azuredevops/service_mentions_test.go`
|
||||
- `apps/backend/internal/azuredevops/rest_client_test.go`
|
||||
- `apps/backend/internal/mentions/provider_azure.go`
|
||||
- `apps/backend/internal/mentions/provider_azure_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 01.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec all-source contract; existing workspace credential resolver, WIQL path, project/repository listing, and PR models.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report search/fan-out bounds and identity, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,46 @@
|
||||
---
|
||||
id: "07-sentry-provider"
|
||||
title: "Sentry mention provider"
|
||||
status: completed
|
||||
wave: 2
|
||||
depends_on: ["01-core-and-task-search"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 07: Sentry Mention Provider
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Adapter searches every configured active-workspace Sentry instance through bounded organization discovery.
|
||||
- Stable reference scope includes instance ID; result ID/title/URL never collide across self-hosted instances.
|
||||
- Free text is escaped from Sentry syntax and provider calls preserve cancellation/caps/safe error mapping.
|
||||
- Provider authorizer verifies workspace-owned instance ID and that the destination matches that instance origin.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/sentry/... ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/sentry/client.go`
|
||||
- `apps/backend/internal/sentry/rest_client.go`
|
||||
- `apps/backend/internal/sentry/service_mentions.go`
|
||||
- `apps/backend/internal/sentry/service_mentions_test.go`
|
||||
- `apps/backend/internal/sentry/rest_client_test.go`
|
||||
- `apps/backend/internal/mentions/provider_sentry.go`
|
||||
- `apps/backend/internal/mentions/provider_sentry_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 01.
|
||||
|
||||
## Inputs
|
||||
|
||||
ADR 0030 multiple-instance rules; existing `ListInstances`, instance ownership checks, browse client, and `SentryIssue.ID`.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report instance/org discovery bounds, escaping, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,51 @@
|
||||
---
|
||||
id: "08-message-reference-metadata"
|
||||
title: "Durable message reference metadata"
|
||||
status: completed
|
||||
wave: 2
|
||||
depends_on: ["01-core-and-task-search"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 08: Durable Message Reference Metadata
|
||||
|
||||
## Acceptance
|
||||
|
||||
- A neutral `internal/entityrefs` leaf structurally normalizes/canonicalizes arrays; `message.add` and queue add/update resolve the persisted conversation workspace and dispatch provider authorization through the mention registry before persistence.
|
||||
- Queue persistence and both normal/workflow queue-drain paths preserve normalized reference arrays without reauthorizing previously accepted references.
|
||||
- Queue update replaces references so deleted links cannot leave stale metadata; direct/queued arrays dedupe by canonical `ref`.
|
||||
- Client projection and agent prompt context expose sanitized typed references without breaking legacy task mentions.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/task/handlers/... ./internal/task/models/... ./internal/orchestrator/handlers/... ./internal/orchestrator/messagequeue/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/orchestrator/message_meta.go`
|
||||
- `apps/backend/internal/entityrefs/reference.go`
|
||||
- `apps/backend/internal/entityrefs/reference_test.go`
|
||||
- `apps/backend/internal/task/handlers/message_handlers.go`
|
||||
- `apps/backend/internal/task/handlers/message_handlers_test.go`
|
||||
- `apps/backend/internal/orchestrator/handlers/queue_handlers.go`
|
||||
- `apps/backend/internal/orchestrator/handlers/queue_handlers_test.go`
|
||||
- `apps/backend/internal/orchestrator/messagequeue/service.go`
|
||||
- `apps/backend/internal/orchestrator/messagequeue/repository_sqlite.go`
|
||||
- `apps/backend/internal/orchestrator/messagequeue/repository_sqlite_test.go`
|
||||
- `apps/backend/internal/task/models/message_shell_output.go`
|
||||
- `apps/backend/internal/task/models/message_shell_output_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 01 normalized API type.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec data/API/persistence/failure sections; `UserMessageMeta`, existing message metadata projection, and queue `metadata_json` patterns.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report validation/dedup/update semantics, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,50 @@
|
||||
---
|
||||
id: "09-backend-composition"
|
||||
title: "Backend provider composition"
|
||||
status: completed
|
||||
wave: 3
|
||||
depends_on:
|
||||
- "02-jira-provider"
|
||||
- "03-linear-provider"
|
||||
- "04-github-provider"
|
||||
- "05-gitlab-provider"
|
||||
- "06-azure-provider"
|
||||
- "07-sentry-provider"
|
||||
- "08-message-reference-metadata"
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 09: Backend Provider Composition
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Backend registers built-in adapters through the same descriptor-driven registrar a future plugin bridge can use, without giving adapters control of registry identity, then mounts the workspace search route.
|
||||
- Request workspace is validated before any provider call; nil/disconnected providers degrade safely.
|
||||
- Handler-to-provider integration test proves mixed success/failure, deterministic caps, cancellation, and workspace isolation.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps/backend && go test ./internal/backendapp/... ./internal/mentions/...
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/backend/internal/backendapp/types.go`
|
||||
- `apps/backend/internal/backendapp/services.go`
|
||||
- `apps/backend/internal/backendapp/helpers.go`
|
||||
- `apps/backend/internal/backendapp/mentions.go`
|
||||
- `apps/backend/internal/backendapp/mentions_test.go`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Tasks 02-08.
|
||||
|
||||
## Inputs
|
||||
|
||||
All provider constructors; existing integration service construction/route registration patterns; spec API order/status/plugin-compatibility contract; ADR 0043.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report registry order and workspace validation, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,43 @@
|
||||
---
|
||||
id: "10-frontend-search-client"
|
||||
title: "Frontend reference search client"
|
||||
status: completed
|
||||
wave: 4
|
||||
depends_on: ["09-backend-composition"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 10: Frontend Reference Search Client
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Typed API client encodes workspace/query/limit/current-task exclusion and preserves normalized provider groups/statuses without closed native-provider unions.
|
||||
- Hook debounces non-empty queries, aborts or generation-guards stale work, and resets cleanly on workspace/session changes.
|
||||
- Partial groups remain usable while aggregate failures expose a retryable state without mutating the draft.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps && pnpm --filter @kandev/web test -- lib/api/domains/mentions-api.test.ts hooks/use-entity-reference-search.test.ts
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/web/lib/types/entity-reference.ts`
|
||||
- `apps/web/lib/api/domains/mentions-api.ts`
|
||||
- `apps/web/lib/api/domains/mentions-api.test.ts`
|
||||
- `apps/web/hooks/use-entity-reference-search.ts`
|
||||
- `apps/web/hooks/use-entity-reference-search.test.ts`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 09 endpoint contract.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec API/state/failure sections; command-panel abort/debounce search pattern.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report request lifecycle and types, files changed, exact tests, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
id: "11-composer-reference-ui"
|
||||
title: "Composer entity reference interaction"
|
||||
status: completed
|
||||
wave: 4
|
||||
depends_on: ["10-frontend-search-client"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 11: Composer Entity Reference Interaction
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Valid `#` triggers in task/Quick Chat open descriptor-driven grouped search, including a generic unknown-provider fallback; arrows + Enter/Tab and touch insert a non-sending atom with trailing space.
|
||||
- Passthrough stays literal; Kandev task discovery remains under `@`, while `#` defensively omits any Kandev-task group returned by the search service.
|
||||
- Draft/history and reverse-search entries round-trip generated Markdown plus metadata, without converting ordinary links; popup stays visual-viewport-contained with one scroll owner and 44 px rows.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps && pnpm --filter @kandev/web test -- components/task/chat/tiptap-helpers.test.ts components/task/chat/use-tiptap-editor.test.ts components/task/chat/tiptap-editor-history.test.ts components/task/chat/popup-menu.test.tsx components/task/chat/entity-reference-menu.test.tsx
|
||||
cd apps && pnpm --filter @kandev/web typecheck
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/web/components/task/chat/entity-reference-types.ts`
|
||||
- `apps/web/components/task/chat/tiptap-entity-reference-extension.tsx`
|
||||
- `apps/web/components/task/chat/tiptap-entity-reference-suggestion.ts`
|
||||
- `apps/web/components/task/chat/entity-reference-menu.tsx`
|
||||
- `apps/web/components/task/chat/tiptap-input.tsx`
|
||||
- `apps/web/components/task/chat/use-tiptap-editor.ts`
|
||||
- `apps/web/components/task/chat/tiptap-helpers.ts`
|
||||
- `apps/web/components/task/chat/message-history.ts`
|
||||
- `apps/web/components/task/chat/tiptap-editor-history.ts`
|
||||
- `apps/web/components/task/chat/popup-menu.tsx`
|
||||
- `apps/web/components/task/chat/chat-input-body.tsx`
|
||||
- `apps/web/components/task/chat/chat-input-container.tsx`
|
||||
- `apps/web/components/task/chat/chat-input-area.tsx`
|
||||
- `apps/web/components/task/passthrough-chat-composer.tsx`
|
||||
- `apps/web/components/task/chat/tiptap-helpers.test.ts`
|
||||
- `apps/web/components/task/chat/use-tiptap-editor.test.ts`
|
||||
- `apps/web/components/task/chat/tiptap-editor-history.test.ts`
|
||||
- `apps/web/components/task/chat/popup-menu.test.tsx`
|
||||
- `apps/web/components/task/chat/entity-reference-menu.test.tsx`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 10.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec interaction/state/mobile sections; existing slash suggestion/menu; Mobile UI Language; current legacy mention tests.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report trigger/gating/serialization/mobile geometry, files changed, exact tests/typecheck, rendered mobile check, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,58 @@
|
||||
---
|
||||
id: "12-message-reference-ui"
|
||||
title: "Reference submission and sent rendering"
|
||||
status: completed
|
||||
wave: 4
|
||||
depends_on: ["08-message-reference-metadata", "11-composer-reference-ui"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 12: Reference Submission and Sent Rendering
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Named composer submit payload carries references through direct send and queue add/update without stale metadata.
|
||||
- Sent and queued generated links render as clickable chips only when matched by typed metadata; ordinary Markdown stays unchanged.
|
||||
- Existing files/prompts/plan/task mentions, passthrough submission, attachments, comments, and queue behavior retain parity.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
cd apps && pnpm --filter @kandev/web test -- hooks/use-message-handler.test.ts components/task/chat/use-chat-input-state.test.ts lib/api/domains/queue-api.test.ts components/task/chat/messages/chat-message.test.tsx components/task/chat/queued-ghost-message.test.tsx components/task/passthrough-chat-composer.test.ts
|
||||
cd apps && pnpm --filter @kandev/web typecheck
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/web/components/task/chat/chat-input-container.tsx`
|
||||
- `apps/web/components/task/chat/use-chat-input-container.ts`
|
||||
- `apps/web/components/task/chat/use-chat-input-state.ts`
|
||||
- `apps/web/components/task/chat/chat-input-area.tsx`
|
||||
- `apps/web/hooks/use-message-handler.ts`
|
||||
- `apps/web/hooks/domains/session/use-queue.ts`
|
||||
- `apps/web/lib/api/domains/queue-api.ts`
|
||||
- `apps/web/lib/types/http.ts`
|
||||
- `apps/web/lib/state/slices/session/types.ts`
|
||||
- `apps/web/components/task/chat/messages/entity-reference-chip.tsx`
|
||||
- `apps/web/components/task/chat/messages/chat-message.tsx`
|
||||
- `apps/web/components/task/chat/queued-ghost-message.tsx`
|
||||
- `apps/web/components/task/passthrough-chat-composer.tsx`
|
||||
- `apps/web/hooks/use-message-handler.test.ts`
|
||||
- `apps/web/components/task/chat/use-chat-input-state.test.ts`
|
||||
- `apps/web/lib/api/domains/queue-api.test.ts`
|
||||
- `apps/web/components/task/chat/messages/chat-message.test.tsx`
|
||||
- `apps/web/components/task/chat/queued-ghost-message.test.tsx`
|
||||
- `apps/web/components/task/passthrough-chat-composer.test.ts`
|
||||
|
||||
## Dependencies
|
||||
|
||||
Tasks 08 and 11.
|
||||
|
||||
## Inputs
|
||||
|
||||
Spec persistence/scenarios; backend metadata contract; existing prompt mention rendering and queue metadata shapes.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report payload migration/render matching/queue edit semantics, files changed, exact tests/typecheck, blockers, risks, and mark task/plan done.
|
||||
@@ -0,0 +1,44 @@
|
||||
---
|
||||
id: "13-e2e-and-verification"
|
||||
title: "Entity reference E2E and integrated verification"
|
||||
status: completed
|
||||
wave: 5
|
||||
depends_on: ["12-message-reference-ui"]
|
||||
plan: "plan.md"
|
||||
spec: "../../specs/ui/entity-reference-composer.md"
|
||||
---
|
||||
|
||||
# Task 13: Entity Reference E2E and Integrated Verification
|
||||
|
||||
## Acceptance
|
||||
|
||||
- Desktop E2E proves task chat keyboard insertion/no auto-send/explicit send, clickable persistence, partial provider results, draft restore, Quick Chat parity, and literal passthrough behavior.
|
||||
- Mobile E2E proves touch selection and send, visual-viewport containment, internal scrolling, 44 px rows, and no document horizontal overflow.
|
||||
- Format, typecheck, unit/integration tests, lint, focused E2E, QA, security review, and code review complete with no unresolved required issue.
|
||||
|
||||
## Verification
|
||||
|
||||
```bash
|
||||
make fmt
|
||||
make typecheck test lint
|
||||
cd apps/web && pnpm e2e:run tests/chat/entity-reference-composer.spec.ts tests/chat/mobile-entity-reference-composer.spec.ts
|
||||
```
|
||||
|
||||
## Files likely touched
|
||||
|
||||
- `apps/web/e2e/tests/chat/entity-reference-composer.spec.ts`
|
||||
- `apps/web/e2e/tests/chat/mobile-entity-reference-composer.spec.ts`
|
||||
- `apps/web/e2e/pages/session-page.ts` only for a small reusable helper
|
||||
- provider mock controllers/fixtures only where deterministic mixed-source seeding is missing
|
||||
|
||||
## Dependencies
|
||||
|
||||
Task 12 and all integrated backend work.
|
||||
|
||||
## Inputs
|
||||
|
||||
Every spec scenario; slash composer desktop/mobile precedents; E2E backend rebuild requirements.
|
||||
|
||||
## Output contract
|
||||
|
||||
Report exact commands/results, browser artifacts for failures, desktop/mobile visual findings, QA/security/review findings and fixes, files changed, blockers, residual risks, and mark task/plan done.
|
||||
Reference in New Issue
Block a user