feat(dashboard): search and filter tickets, link each to its finding (#946) #956

Merged
sharang merged 1 commits from feat/946-tickets-search into main 2026-11-10 16:41:39 +00:00
Owner

What changed

The Tickets page was a paged table only. You can now search and filter it, and each ticket links to the place in Prüfwerk where you decide about it.

API: GET /api/v1/issues

New query parameters next to page and limit. The handler stays tenant-scoped through tenant_db exactly as before.

  • q: a title word (a case-insensitive literal substring through literal_regex) or a ticket number. The number match is external_id ~ (^|-)N$ after one leading # is stripped, so 913 and #913 both find ticket 913, and 913 also finds the Jira key PROJ-913. It does not find 1913 or 9130.
  • status: open (open + in_progress) or closed (closed + resolved). This is a typed enum, so an unknown value gets a 400. That is on purpose and matches UpdateStatusRequest; the findings filter, by contrast, takes any string.
  • repo_id: one target's tickets. TrackerIssue stores no target, so the handler first runs findings.distinct("_id", { repo_id, tracker_issue_url: { $ne: null } }) and builds $or: [ finding_id $in <those hex ids>, finding_id ~ ^cve:<repo_id>: ]. The second branch covers the target's CVE tickets, whose finding_id is the key cve:{target}:{package}:{cve}.
  • Search, status and target go into an $and. Search and target are both $ors, and the $and stops one from overwriting the other.
  • The query is built by a pure issues_query() that has unit tests.

Dependency worth knowing: the target filter relies on issue_creation::record() setting the finding's tracker_issue_url before it stores the ticket. That is how only the findings that have a ticket end up in the $in. This PR does not touch issue_creation.rs (#947 is changing its link code), but that field needs to stay set.

Core

  • IssueStatus::ALL and IssueStatus::is_closed().
  • cve_issue_prefix(), which builds the CVE ticket key prefix.
  • TrackerIssue::subject(), which returns Finding(id) for a 24-hex id, Cve { target_id } for a CVE key, and None for an empty or other id.
  • pipeline/cve_issues.rs now uses the core is_closed() and cve_issue_prefix() and no longer has its own copies. Its behaviour is unchanged.

Dashboard

  • Tickets page:
    • A search box plus target and status selects, the same as the findings page.
    • Columns: Tracker (product name), Nr. (#913 or the Jira key), Titel, Status, Erstellt, Öffnen.
    • The Öffnen column has Befund (/findings/{id}) and Im Tracker (the external link, now with rel="noopener noreferrer").
    • CVE tickets link to CVEs des Prüfobjekts, i.e. /sbom?target=<id>, the target's components and their CVEs. The issue text asks for "the target's CVE list", so I chose this over the target page.
    • Tickets with an empty finding_id show only the tracker link.
    • Status badges: open is blue, in progress amber, closed and resolved green.
    • An empty state.
  • infrastructure/issues.rs: IssuesQuery replaces the bare page number. Every parameter is URL-encoded (#913 becomes %23913). Page size is a shared PAGE_SIZE.
  • German and English texts come from a new texts::issues module. Shared words (all targets, all statuses, title, status) come from texts::findings.
  • Small ticket-* CSS classes in main.css.
  • The docs guide (docs/guide/issues.md) and the README API row describe the filters.

How it was tested

  • cargo fmt --all --check: passed
  • RUSTFLAGS="-D warnings" cargo clippy -p compliance-core --all-targets -j8 -- -D warnings: passed
  • RUSTFLAGS="-D warnings" cargo clippy -p compliance-agent --all-targets -j8 -- -D warnings: passed
  • RUSTFLAGS="-D warnings" cargo clippy -p compliance-dashboard --features server --no-default-features --all-targets -j8 -- -D warnings: passed
  • RUSTFLAGS="-D warnings" cargo clippy -p compliance-dashboard --features web --no-default-features --all-targets -j8 -- -D warnings: passed
  • cargo test -p compliance-core --lib models::issue: 4 passed. Doctest cve_issue_prefix: passed.
  • cargo test -p compliance-agent --lib api::handlers: 86 passed. 12 of them are new, covering IssuesFilter/TicketState and issues_query: number with and without #, literal search, lone #, status buckets, target with and without ticketed findings, all three filters together.
  • cargo test -p compliance-agent --lib cve_issues: 8 passed.
  • cargo test -p compliance-dashboard --features server --no-default-features issues: 8 passed (path encoding, link targets, number display, badge colours, status texts).

Not tried by hand in a running dashboard.

Closes #946

🤖 Generated with Claude Code

## What changed The Tickets page was a paged table only. You can now search and filter it, and each ticket links to the place in Prüfwerk where you decide about it. ### API: `GET /api/v1/issues` New query parameters next to `page` and `limit`. The handler stays tenant-scoped through `tenant_db` exactly as before. - `q`: a title word (a case-insensitive literal substring through `literal_regex`) or a ticket number. The number match is `external_id ~ (^|-)N$` after one leading `#` is stripped, so `913` and `#913` both find ticket 913, and `913` also finds the Jira key `PROJ-913`. It does not find 1913 or 9130. - `status`: `open` (open + in_progress) or `closed` (closed + resolved). This is a typed enum, so an unknown value gets a 400. That is on purpose and matches `UpdateStatusRequest`; the findings filter, by contrast, takes any string. - `repo_id`: one target's tickets. `TrackerIssue` stores no target, so the handler first runs `findings.distinct("_id", { repo_id, tracker_issue_url: { $ne: null } })` and builds `$or: [ finding_id $in <those hex ids>, finding_id ~ ^cve:<repo_id>: ]`. The second branch covers the target's CVE tickets, whose `finding_id` is the key `cve:{target}:{package}:{cve}`. - Search, status and target go into an `$and`. Search and target are both `$or`s, and the `$and` stops one from overwriting the other. - The query is built by a pure `issues_query()` that has unit tests. **Dependency worth knowing:** the target filter relies on `issue_creation::record()` setting the finding's `tracker_issue_url` before it stores the ticket. That is how only the findings that have a ticket end up in the `$in`. This PR does not touch `issue_creation.rs` (#947 is changing its link code), but that field needs to stay set. ### Core - `IssueStatus::ALL` and `IssueStatus::is_closed()`. - `cve_issue_prefix()`, which builds the CVE ticket key prefix. - `TrackerIssue::subject()`, which returns `Finding(id)` for a 24-hex id, `Cve { target_id }` for a CVE key, and `None` for an empty or other id. - `pipeline/cve_issues.rs` now uses the core `is_closed()` and `cve_issue_prefix()` and no longer has its own copies. Its behaviour is unchanged. ### Dashboard - Tickets page: - A search box plus target and status selects, the same as the findings page. - Columns: Tracker (product name), Nr. (`#913` or the Jira key), Titel, Status, Erstellt, Öffnen. - The Öffnen column has **Befund** (`/findings/{id}`) and **Im Tracker** (the external link, now with `rel="noopener noreferrer"`). - CVE tickets link to **CVEs des Prüfobjekts**, i.e. `/sbom?target=<id>`, the target's components and their CVEs. The issue text asks for "the target's CVE list", so I chose this over the target page. - Tickets with an empty `finding_id` show only the tracker link. - Status badges: open is blue, in progress amber, closed and resolved green. - An empty state. - `infrastructure/issues.rs`: `IssuesQuery` replaces the bare page number. Every parameter is URL-encoded (`#913` becomes `%23913`). Page size is a shared `PAGE_SIZE`. - German and English texts come from a new `texts::issues` module. Shared words (all targets, all statuses, title, status) come from `texts::findings`. - Small `ticket-*` CSS classes in `main.css`. - The docs guide (`docs/guide/issues.md`) and the README API row describe the filters. ## How it was tested - `cargo fmt --all --check`: passed - `RUSTFLAGS="-D warnings" cargo clippy -p compliance-core --all-targets -j8 -- -D warnings`: passed - `RUSTFLAGS="-D warnings" cargo clippy -p compliance-agent --all-targets -j8 -- -D warnings`: passed - `RUSTFLAGS="-D warnings" cargo clippy -p compliance-dashboard --features server --no-default-features --all-targets -j8 -- -D warnings`: passed - `RUSTFLAGS="-D warnings" cargo clippy -p compliance-dashboard --features web --no-default-features --all-targets -j8 -- -D warnings`: passed - `cargo test -p compliance-core --lib models::issue`: 4 passed. Doctest `cve_issue_prefix`: passed. - `cargo test -p compliance-agent --lib api::handlers`: 86 passed. 12 of them are new, covering `IssuesFilter`/`TicketState` and `issues_query`: number with and without `#`, literal search, lone `#`, status buckets, target with and without ticketed findings, all three filters together. - `cargo test -p compliance-agent --lib cve_issues`: 8 passed. - `cargo test -p compliance-dashboard --features server --no-default-features issues`: 8 passed (path encoding, link targets, number display, badge colours, status texts). Not tried by hand in a running dashboard. Closes #946 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Author
Owner

Rebased onto #960 (Gitea back-sync). In pipeline/cve_issues.rs, #960 added the "closed in the tracker" branches around the is_closed(&issue.status) calls that this PR replaces with IssueStatus::is_closed(). Resolution: #960's logic is kept, using this PR's issue.status.is_closed(). CSS and texts are both kept.

Checked locally: fmt, clippy -D warnings (core, agent, dashboard server and web), agent cve_issues + api::handlers tests (108), core issue tests and dashboard lib tests (164).

Rebased onto #960 (Gitea back-sync). In `pipeline/cve_issues.rs`, #960 added the "closed in the tracker" branches around the `is_closed(&issue.status)` calls that this PR replaces with `IssueStatus::is_closed()`. Resolution: #960's logic is kept, using this PR's `issue.status.is_closed()`. CSS and texts are both kept. Checked locally: fmt, clippy `-D warnings` (core, agent, dashboard server and web), agent `cve_issues` + `api::handlers` tests (108), core issue tests and dashboard lib tests (164).
sharang added 1 commit 2026-11-10 16:22:33 +00:00
feat(dashboard): search and filter tickets, link each to its finding (#946)
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 / Agent integration (pull_request) Successful in 4m24s
CI / Check (pull_request) Successful in 18m34s
a3fe4c94ff
The Tickets page was a paged table only. GET /api/v1/issues now takes
q (title word or ticket number: 913, #913, PROJ-913), status (open
takes in_progress, closed takes resolved) and repo_id, tenant-scoped as
before. A ticket stores no target: the target filter takes the ids of
the target's findings with a ticket plus its CVE tickets
(finding_id cve:{target}:...).

Each row links to its finding, or for a CVE ticket to the target's
components and CVEs (SBOM page), next to the tracker link. Texts are
German and English, the status is a readable badge. The CVE key prefix
and the closed check move to compliance-core so the agent and the
dashboard read them the same way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
sharang force-pushed feat/946-tickets-search from 293adb7369 to a3fe4c94ff 2026-11-10 16:22:33 +00:00 Compare
sharang merged commit 03dd8f8df4 into main 2026-11-10 16:41:39 +00:00
Sign in to join this conversation.