feat(projects): assign targets to the tenant's projects #427

Merged
sharang merged 1 commits from feat/projects into main 2026-09-29 14:13:02 +00:00
Owner

Why

The platform is adding tenant-level "Projekte": a customer's product or machine, or a topic such as the CRA or the Data Act. Staff and tenants should be able to assign Prüfobjekte to them. The contract was agreed with the portal session, and this goes into v0.4.1. Projects are organisational only; compliance_profile is unchanged.

What

  • Model: OnboardedTarget.project_ids: Vec<String> (serde default, multikey index) and a shared Project {id, name, kind: product|topic, description}.
  • Registry client: list_projects(tenant) → GET /v1/tenants/{id}/projects, cached for 60 s, readable with tenants.read.
  • User API:
    • GET /api/v1/projects;
    • PATCH /api/v1/targets/{id} with project_ids: trimmed, deduplicated, and checked against the registry (an unknown id gives 422);
    • GET /api/v1/targets?project=<id>.
  • Platform API: GET /api/v1/platform/tenants/{id}/targets?project=<id> → {"items":[{id, name, target_type, last_scan_at, open_findings, project_ids}]}.
    • Behind the existing service-token gate, which already allows tenant-registry-svc-{env}.
    • Ids of deleted projects are left out on read.
  • Dashboard:
    • a "Projekte" checkbox list in the target editor, saved only when changed;
    • project chips on the list and the target page;
    • a project filter on the list, shown when the tenant has projects;
    • German and English texts.
  • Staff assign through support access (#425), audited.

Deploy note

Until the registry serves /v1/tenants/{id}/projects, GET /api/v1/projects returns 503. The editor then shows "Die Projekte konnten nicht geladen werden", and the filter and chips stay hidden. Nothing else changes.

Tests

  • core: a registry project deserialises.
  • agent: assignment trim/dedupe; unknown id refused; deleted ids dropped on read; the project filter query.
  • dashboard: reading project_ids; deleted projects not shown.
  • Full suites; clippy with the CI flags on every crate; fmt.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p

## Why The platform is adding tenant-level "Projekte": a customer's product or machine, or a topic such as the CRA or the Data Act. Staff and tenants should be able to assign Prüfobjekte to them. The contract was agreed with the portal session, and this goes into v0.4.1. Projects are organisational only; `compliance_profile` is unchanged. ## What - **Model:** `OnboardedTarget.project_ids: Vec<String>` (serde default, multikey index) and a shared `Project {id, name, kind: product|topic, description}`. - **Registry client:** `list_projects(tenant)` → `GET /v1/tenants/{id}/projects`, cached for 60 s, readable with `tenants.read`. - **User API:** - `GET /api/v1/projects`; - `PATCH /api/v1/targets/{id}` with `project_ids`: trimmed, deduplicated, and checked against the registry (an unknown id gives 422); - `GET /api/v1/targets?project=<id>`. - **Platform API:** `GET /api/v1/platform/tenants/{id}/targets?project=<id>` → `{"items":[{id, name, target_type, last_scan_at, open_findings, project_ids}]}`. - Behind the existing service-token gate, which already allows `tenant-registry-svc-{env}`. - Ids of deleted projects are left out on read. - **Dashboard:** - a "Projekte" checkbox list in the target editor, saved only when changed; - project chips on the list and the target page; - a project filter on the list, shown when the tenant has projects; - German and English texts. - **Staff** assign through support access (#425), audited. ## Deploy note Until the registry serves `/v1/tenants/{id}/projects`, `GET /api/v1/projects` returns 503. The editor then shows "Die Projekte konnten nicht geladen werden", and the filter and chips stay hidden. Nothing else changes. ## Tests - **core:** a registry project deserialises. - **agent:** assignment trim/dedupe; unknown id refused; deleted ids dropped on read; the project filter query. - **dashboard:** reading `project_ids`; deleted projects not shown. - Full suites; clippy with the CI flags on every crate; fmt. 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang added 1 commit 2026-09-29 12:30:54 +00:00
feat(projects): assign targets to the tenant's projects
CI / Check (push) Skipped
CI / Detect Changes (pull_request) Skipped
CI / Deploy Agent (pull_request) Skipped
CI / Deploy Dashboard (pull_request) Skipped
CI / Deploy Docs (pull_request) Skipped
CI / Deploy MCP (pull_request) Skipped
CI / Check (pull_request) Successful in 7m26s
530f400bbe
Projects are the platform registry's: a customer's product or machine, or
a topic such as the CRA or the Data Act. They only group targets and
never change what gets checked.

- Targets carry `project_ids`, set through PATCH /api/v1/targets/{id} and
  checked against the tenant's projects in the registry (cached 60 s);
  an unknown id is refused with 422.
- GET /api/v1/projects lists the tenant's projects for the dashboard;
  GET /api/v1/targets takes ?project=<id> (indexed).
- GET /api/v1/platform/tenants/{id}/targets?project=<id>: read-only list
  (id, name, type, last scan, open findings, project ids) for the portal
  through the registry. Ids of deleted projects are left out on read.
- Dashboard: a "Projekte" checkbox list in the target editor, project
  chips on the list and the target page, and a project filter on the list.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYKjxacrr6K88DruUmP48p
sharang merged commit 202f5ea325 into main 2026-09-29 14:13:02 +00:00
Sign in to join this conversation.