21ef60047efcb5993ee255ca3ec5ae0feef836b1
5 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
203557e7ae |
feat(dashboard): attach issue images on GitHub and GitLab import (#2151)
## Problem An imported issue whose bug report *is* a screenshot arrived at the agent as an unfetchable link. Everything needed to show an agent an image already existed — the executor builds a `## Attachments` section pointing at `.fusion/tasks/<id>/attachments/` (`executor.ts:18887`), triage inlines image attachments as base64 vision blocks, and `agent-prompts.ts:171` explicitly permits reading that directory. But the import routes only ever called `createTask()` with the issue body as text and never called `addAttachment()`, so **that directory was always empty for imported issues**. The images can't be fetched later by the agent: GitHub `user-attachments` assets redirect to a signed CDN URL and 404 on private repos without credentials, and GitLab `/uploads/...` needs the instance token. Import time is the only point where those credentials are known to be present. ## Change New `packages/dashboard/src/issue-image-attachments.ts` extracts images from an issue's **body and comments**, downloads them, and stores them via `addAttachment` — which already bridges images into the artifact registry, so they also surface in the UI gallery. Wired into every import surface: - `POST /github/issues/import` - `POST /github/issues/batch-import` - All four GitLab routes, via the shared `importItem` chokepoint Provider differences sit behind an `ImageImportPolicy` rather than one shared host list, because the forges disagree on what matters: | | GitHub | GitLab | |---|---|---| | URL form | absolute | usually relative `/uploads/<sha>/f.png` | | Resolution | n/a | **project**-rooted, not instance-rooted | | Trust boundary | fixed host allowlist | the configured instance origin (self-managed = any host) | | Auth | `Bearer` (gh CLI token) | `PRIVATE-TOKEN` | Notable decisions: - **Extraction runs on the original body, not the translated one.** The translation model can rewrite or drop URLs — the same reason the existing code appends `Source:` *after* translating. - **`resolve()` returning null is the SSRF guard.** It's the single place deciding a URL is ours to fetch, so `` in an issue body is never requested. - **Best-effort.** A failed download or comment fetch never fails an import that already produced the task. - **Batch stays cheap.** The REST `comments` count (free on the payload) skips the comment fetch for issues with none, so a 50-issue batch doesn't pay 50 round trips to discover empty threads. - Capped at 10 images / 5MB each (matching `MAX_ATTACHMENT_SIZE`) / 15s timeout. - `GitLabClient.listNotes` is new and **read-only** — the client's existing "no comment side effects" rule governs writes. ## Verification - **30 new/updated tests pass** (23 helper + route-level wiring on both forges). Route tests drive the real Express routes through to `addAttachment`; the helper tests alone wouldn't prove the wiring. - Typecheck clean (exit 0), lint clean, `check:changesets` passes. - **Pre-existing failures confirmed against the untouched baseline, not caused here:** 5 in `routes-github.test.ts` (`engine-unavailable`, conflict-reclaim) and the `test:gate` `chat.test.ts` mock-completeness failure both reproduce identically on `main` with this branch stashed. One incidental test fix: `routes-gitlab.test.ts` used `mockResolvedValue(jsonResponse(...))`, handing the **same** `Response` instance to every call. A `Response` body is single-use, so the added notes fetch got a consumed body. Switched to `mockImplementation` to build a fresh one per call, matching the neighbouring test. ## Notes for the reviewer Images are attached but the body's markdown links are left as-is — the agent reads the files, and rewriting URLs in operator-visible text seemed worse than leaving them. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * GitHub and GitLab issue (and merge request) imports now convert embedded screenshots in issue descriptions and comments/notes into real task attachments. * Works across single-issue and batch import workflows, including project/group import flows. * **Bug Fixes** * Attachment extraction/import is resilient: per-image failures, comment/notes fetch issues, and problematic/unsafe/oversized links won’t break the overall import. * **Tests** * Added comprehensive coverage for URL extraction, provider policies, attachment downloading/limits, redirects, and route integration for both GitHub and GitLab. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> |
||
|
|
c49a933fb0 |
FN-7428: add GitLab tracking coverage and reconciliation support
Add GitLab tracking persistence, analytics, and reconciliation coverage across core, dashboard, and CLI paths. - Store GitLab tracking and closed-at metadata when importing issues and merge requests from CLI, extension tools, and dashboard routes. - Add GitLab source-issue analytics, Command Center GitLab signal surfaces, CSV export fields, and a closed-at backfill route. - Cover GitLab tracking storage, reconciliation, CLI imports, dashboard import UI, route behavior, and Command Center signals with focused tests. Files changed: .changeset/fn-7428-gitlab-import-tracking.md | 7 + .../__tests__/extension-gitlab-tracking.test.ts | 140 ++++++++++++ .../__tests__/task-command-gitlab-import.test.ts | 18 +- packages/cli/src/commands/task.ts | 1 + packages/cli/src/extension.ts | 2 +- .../src/__tests__/gitlab-issue-analytics.test.ts | 243 +++++++++++++++++++++ .../__tests__/gitlab-source-issue-storage.test.ts | 128 +++++++++++ .../store-gitlab-tracking-reconcile.test.ts | 125 +++++++++++ packages/core/src/gitlab-issue-analytics.ts | 227 +++++++++++++++++++ packages/core/src/index.ts | 8 + packages/core/src/store.ts | 21 +- .../__tests__/GitHubImportModal.test.tsx | 46 ++++ .../components/__tests__/gitlabTracking.test.tsx | 43 ++++ .../components/command-center/CommandCenter.tsx | 5 + .../components/command-center/areas/GitlabArea.tsx | 126 +++++++++++ .../areas/__tests__/areas.gitlab-signals.test.tsx | 83 +++++++ .../gitlab-source-issue-reconciler.test.ts | 187 ++++++++++++++++ .../register-command-center-routes.test.ts | 52 +++++ .../__tests__/register-git-gitlab.backfill.test.ts | 116 ++++++++++ .../dashboard/src/__tests__/routes-gitlab.test.ts | 59 +++-- packages/dashboard/src/command-center-csv.ts | 21 ++ .../src/gitlab-source-issue-reconciler.ts | 104 +++++++++ packages/dashboard/src/gitlab.ts | 16 +- .../src/routes/register-command-center-routes.ts | 25 +++ packages/dashboard/src/routes/register-gitlab.ts | 29 +++ 25 files changed, 1800 insertions(+), 32 deletions(-) Fusion-Task-Id: FN-7428 Fusion-Task-Lineage: 7b0ebb5c-c6e7-42a9-a339-b2dd1d4e263a Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
34be333a2a |
FN-7426: add GitLab lifecycle automation
Add GitLab lifecycle automation for comments and source item state changes. - Add GitLab REST helpers for posting notes and closing or reopening issues and merge requests. - Register GitLab source-comment, tracking-comment, tracking-state, and source-close services with multi-project lifecycle wiring. - Add project settings, documentation, tests, and a changeset for GitLab completion comments and auto-close behavior. Files changed: .changeset/fn-7426-gitlab-lifecycle.md | 7 ++ docs/cli-reference.md | 2 +- docs/dashboard-guide.md | 3 +- docs/settings-reference.md | 5 +- packages/core/src/settings-schema.ts | 3 + packages/core/src/types.ts | 10 +++ .../src/__tests__/gitlab-issue-comment.test.ts | 37 +++++++++ .../__tests__/gitlab-source-issue-close.test.ts | 29 +++++++ .../src/__tests__/gitlab-tracking-comments.test.ts | 31 +++++++ .../src/__tests__/gitlab-tracking-state.test.ts | 42 ++++++++++ packages/dashboard/src/__tests__/gitlab.test.ts | 18 ++++ .../register-git-github.gitlab-lifecycle.test.ts | 54 ++++++++++++ packages/dashboard/src/gitlab-issue-comment.ts | 62 ++++++++++++++ packages/dashboard/src/gitlab-lifecycle.ts | 58 +++++++++++++ .../dashboard/src/gitlab-source-issue-close.ts | 45 ++++++++++ packages/dashboard/src/gitlab-tracking-comments.ts | 77 +++++++++++++++++ packages/dashboard/src/gitlab-tracking-state.ts | 97 ++++++++++++++++++++++ packages/dashboard/src/gitlab.ts | 30 +++++++ .../dashboard/src/routes/register-git-github.ts | 23 +++++ 19 files changed, 630 insertions(+), 3 deletions(-) Fusion-Task-Id: FN-7426 Fusion-Task-Lineage: a46bd11f-96ef-4291-ab41-829007fa057a Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
b8e126eeaf |
FN-7425: add GitLab tracking metadata to tasks
Persist GitLab tracking metadata and surface it across task APIs and dashboard views. - add task-store schema, migration, and update helpers for linked GitLab items and stale state - expose validated GitLab tracking updates through task workflow routes and legacy task payloads - render GitLab badges, detail-panel metadata, open/unlink actions, styling, i18n strings, and docs - cover persistence, route validation, task card badges, and task detail interactions with tests - add a patch changeset for the published Fusion package Files changed: .changeset/fn-7425-gitlab-tracking.md | 7 ++ docs/cli-reference.md | 2 +- docs/dashboard-guide.md | 3 + packages/core/src/__tests__/db-migrate.test.ts | 29 +++++ .../src/__tests__/store-gitlab-tracking.test.ts | 138 +++++++++++++++++++++ packages/core/src/db.ts | 10 +- packages/core/src/gitlab-tracking.ts | 10 ++ packages/core/src/index.ts | 3 +- packages/core/src/store.ts | 135 +++++++++++++++++++- packages/core/src/types.ts | 49 ++++++++ packages/dashboard/app/api/legacy.ts | 3 + packages/dashboard/app/components/GitLabBadge.tsx | 33 +++++ packages/dashboard/app/components/TaskCard.tsx | 7 +- .../dashboard/app/components/TaskCardBadge.tsx | 15 ++- .../dashboard/app/components/TaskDetailModal.css | 47 +++++-- .../dashboard/app/components/TaskDetailModal.tsx | 134 +++++++++++++++++++- .../app/components/__tests__/TaskCard.test.tsx | 49 ++++++++ .../TaskDetailModal.gitlab-tracking.test.tsx | 121 ++++++++++++++++++ .../__tests__/TaskDetailModal.test-helpers.ts | 1 + packages/dashboard/app/styles.css | 9 ++ .../src/__tests__/routes-tasks-ops.test.ts | 136 ++++++++++++++++++++ packages/dashboard/src/gitlab.ts | 24 +++- packages/dashboard/src/routes/register-gitlab.ts | 1 + .../src/routes/register-task-workflow-routes.ts | 106 +++++++++++++++- packages/i18n/locales/en/app.json | 31 +++++ packages/i18n/src/resources.d.ts | 31 +++++ 26 files changed, 1106 insertions(+), 28 deletions(-) Fusion-Task-Id: FN-7425 Fusion-Task-Lineage: 9b5e6005-7284-402e-995c-553be2275eff Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |
||
|
|
865dec235b |
FN-7424: add GitLab task imports
Adds GitLab-backed task import flows across the CLI, extension, API, and dashboard. - Add GitLab client normalization, provenance, duplicate detection, and import routes for project issues, group issues, and merge requests. - Extend the dashboard import modal with a GitLab provider, resource tabs, previews, imported-state detection, and import actions. - Add CLI and extension task import commands plus usage event/gating classifications and operator documentation. - Cover GitLab fetch/import behavior with dashboard, CLI, and gating tests. Files changed: .changeset/fn-7424-gitlab-imports.md | 7 + docs/cli-reference.md | 11 +- docs/gitlab-parity-inventory.md | 10 +- docs/task-management.md | 6 +- packages/cli/skill/fusion/SKILL.md | 2 +- .../cli/skill/fusion/references/extension-tools.md | 60 ++++ .../skill/fusion/references/fusion-capabilities.md | 6 + packages/cli/src/__tests__/extension.test.ts | 6 + .../__tests__/task-command-gitlab-import.test.ts | 97 ++++++ packages/cli/src/bin.ts | 25 +- packages/cli/src/commands/task.ts | 58 ++++ packages/cli/src/extension.ts | 106 +++++++ packages/core/src/__tests__/usage-events.test.ts | 2 + packages/core/src/types.ts | 7 + packages/core/src/usage-events.ts | 3 + packages/dashboard/app/api/legacy.ts | 52 ++++ .../dashboard/app/components/GitHubImportModal.css | 41 +++ .../dashboard/app/components/GitHubImportModal.tsx | 143 ++++++++- .../__tests__/GitHubImportModal.test.tsx | 33 ++ packages/dashboard/src/__tests__/gitlab.test.ts | 56 ++++ .../dashboard/src/__tests__/routes-gitlab.test.ts | 99 ++++++ packages/dashboard/src/gitlab.ts | 334 +++++++++++++++++++++ packages/dashboard/src/index.ts | 15 + packages/dashboard/src/routes.ts | 2 + packages/dashboard/src/routes/register-gitlab.ts | 192 ++++++++++++ .../engine/src/__tests__/agent-action-gate.test.ts | 4 + .../gating-classifications-provisioning.test.ts | 13 +- .../src/__tests__/gating-classifications.test.ts | 6 + packages/engine/src/gating-classifications.ts | 9 + 29 files changed, 1388 insertions(+), 17 deletions(-) Fusion-Task-Id: FN-7424 Fusion-Task-Lineage: 8012425c-21d5-4b20-adb7-07d2e5aa1cef Co-authored-by: Fusion (runfusion.ai) <noreply@runfusion.ai> |