refactor: rip out the legacy TrackedRepository / repositories path #161

Merged
sharang merged 1 commits from refactor/rip-out-legacy-repository into main 2026-07-16 07:25:46 +00:00
Owner

Full legacy rip-out. Onboarded targets are now the sole persisted entity. 47 files, −1.7k LOC.

Removed

  • TrackedRepository model, the repositories collection + accessor, the /api/v1/repositories API, the Repositories dashboard page, the one-shot migrate onboarding CLI, and the UNIFIED_PIPELINE flag + legacy orchestrator::run.

The key safety property

The working unified path already flowed OnboardedTarget → repo_view_from_target → TrackedRepository → run_pipeline. This PR just turns that mapping into an internal, non-persisted RepoView (RepoView::from_target) and deletes the persisted model — so the scan / PR-review pipeline runs the same behaviour it already ran. Only the type's origin changed.

Repointed to onboarded_targets

Webhooks (github/gitea/gitlab), CVE monitor, graph build, chat embeddings, health stats, pentest repo lookup, scheduler. run_scan always runs run_target; run_pr_review resolves from targets.

Cascade parity

delete_target now cascades the full downstream set (findings, sbom, scans, cve, tracker issues, graph, embeddings, DAST targets + pentest sessions/children) — matching the old repository delete. get_ssh_public_key moved to the health handler.

Tests

Legacy repositories-API + migration integration tests removed; tenant-isolation / cascade-delete / stats repointed to /targets. git.rs gains a sanitize_repo_dir unit test.

Verification (local)

fmt clean; agent + mcp clippy clean; dashboard server + web compile; core + agent lib tests (32) pass; integration tests compile.

⚠️ Please review before merge — this rewrites the core scan pipeline's type contract. It's green locally but can't be runtime-tested from CI (no live Mongo scan). I did not auto-merge; merge when you've eyeballed it, and I'll watch the deploy.

Full legacy rip-out. Onboarded targets are now the **sole persisted entity**. **47 files, −1.7k LOC.** ## Removed - `TrackedRepository` model, the `repositories` collection + accessor, the `/api/v1/repositories` API, the Repositories dashboard page, the one-shot `migrate onboarding` CLI, and the `UNIFIED_PIPELINE` flag + legacy `orchestrator::run`. ## The key safety property The working unified path already flowed `OnboardedTarget → repo_view_from_target → TrackedRepository → run_pipeline`. This PR just turns that mapping into an **internal, non-persisted `RepoView`** (`RepoView::from_target`) and deletes the persisted model — so the scan / PR-review pipeline runs the **same behaviour it already ran**. Only the type's origin changed. ## Repointed to `onboarded_targets` Webhooks (github/gitea/gitlab), CVE monitor, graph build, chat embeddings, health stats, pentest repo lookup, scheduler. `run_scan` always runs `run_target`; `run_pr_review` resolves from targets. ## Cascade parity `delete_target` now cascades the **full** downstream set (findings, sbom, scans, cve, tracker issues, graph, embeddings, DAST targets + pentest sessions/children) — matching the old repository delete. `get_ssh_public_key` moved to the health handler. ## Tests Legacy repositories-API + migration integration tests removed; tenant-isolation / cascade-delete / stats repointed to `/targets`. `git.rs` gains a `sanitize_repo_dir` unit test. ## Verification (local) fmt clean; agent + mcp clippy clean; dashboard server + web compile; core + agent lib tests (32) pass; integration tests compile. > ⚠️ **Please review before merge** — this rewrites the core scan pipeline's type contract. It's green locally but can't be runtime-tested from CI (no live Mongo scan). I did **not** auto-merge; merge when you've eyeballed it, and I'll watch the deploy.
sharang added 1 commit 2026-07-13 19:18:02 +00:00
refactor: rip out the legacy TrackedRepository / repositories path
CI / Check (pull_request) Successful in 5m29s
CI / Detect Changes (pull_request) Has been skipped
CI / Deploy Agent (pull_request) Has been skipped
CI / Deploy Dashboard (pull_request) Has been skipped
CI / Deploy Docs (pull_request) Has been skipped
CI / Deploy MCP (pull_request) Has been skipped
dadccb9264
Onboarded targets are now the sole persisted entity. The legacy
`TrackedRepository` model, the `repositories` collection, the `/repositories`
API, the Repositories dashboard page, the one-shot migration, and the
`UNIFIED_PIPELINE` transition flag are all removed. Net −1.7k LOC.

Agent
- New internal `pipeline::repo_view::RepoView` (non-persisted) replaces the
  `TrackedRepository` model; it's projected from an `OnboardedTarget` + its code
  artifact by `RepoView::from_target` (the old `repo_view_from_target`), so the
  scan/PR-review pipeline is byte-for-byte the same behaviour it already ran on
  the unified path — only the type's origin changed.
- `run_scan` always runs the unified `run_target`; the legacy `orchestrator::run`
  and the `unified_pipeline` flag are gone. `run_pr_review` resolves the target
  from `onboarded_targets`.
- Webhooks (github/gitea/gitlab), the CVE monitor, graph build, chat embeddings,
  health stats, and the pentest repo lookup all read `onboarded_targets`.
- `delete_target` now cascades the full downstream set (findings, sbom, scans,
  cve, tracker issues, graph, embeddings, DAST targets + pentest sessions and
  their children) — matching the old repository delete.
- `get_ssh_public_key` moved to the health handler; `repositories()` accessor,
  `repos.rs`, and `migrate/` deleted.

Core
- `TrackedRepository` removed; `ScanTrigger` stays. `unified_pipeline` config
  field removed.

Dashboard
- Repositories page + route deleted; overview / graph / chat / pentest-wizard
  read onboarded targets; `infrastructure/repositories.rs` trimmed to just the
  SSH-key fetch.

Tests
- Legacy repositories-API and migration integration tests removed; tenant
  isolation, cascade-delete, and stats tests repointed to `/targets` /
  `onboarded_targets`. `git.rs` gains a `sanitize_repo_dir` unit test.

Local: fmt clean; agent/mcp clippy clean; dashboard server+web compile; core +
agent lib tests (32) pass; integration tests compile.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
sharang merged commit a981311413 into main 2026-07-16 07:25:46 +00:00
Sign in to join this conversation.
No Reviewers
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: sharang/compliance-scanner-agent#161