Skip to content

feat: add displaying of evidence subjects, and support for selecting … - #320

Merged
gusfcarvalho merged 2 commits into
mainfrom
feat/bch-1364-subject-template-fields
Oct 5, 2026
Merged

gusfcarvalho merged 2 commits into
mainfrom
feat/bch-1364-subject-template-fields

Conversation

@reecebedding

@reecebedding reecebedding commented Oct 2, 2026 •

Copy link
Copy Markdown
Member

…subject on evidence

Summary by CodeRabbit

  • New Features
    • Evidence can now be assigned subjects when created or updated. When subjects are required, the form prompts for them before submission.
    • Browse evidence by subject, with subject filters available when supported. Evidence listings and detail pages show associated subjects, including linked details and “Unattributed” labels where applicable.
    • Subject templates now support display priorities and component types, which appear in template details and can be edited.

Copilot AI balanced review requested due to automatic review settings October 2, 2026 13:28
@coderabbitai

coderabbitai Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: aad2951e-e375-403b-8296-d45e6034ca0c
📥 Commits

Reviewing files that changed from the base of the PR and between d645bbe and de4df71.

📒 Files selected for processing (32)
  • src/components/EvidenceList.vue
  • src/components/__tests__/EvidenceList.spec.ts
  • src/components/evidence/SubjectFilter.vue
  • src/components/evidence/SubjectPicker.vue
  • src/components/evidence/SubjectsSection.vue
  • src/components/evidence/__tests__/SubjectFilter.spec.ts
  • src/components/evidence/__tests__/SubjectPicker.spec.ts
  • src/components/evidence/__tests__/SubjectsSection.spec.ts
  • src/composables/evidence/__tests__/useEvidenceConfig.spec.ts
  • src/composables/evidence/useEvidenceConfig.ts
  • src/composables/subjects/__tests__/useSubjectSearch.spec.ts
  • src/composables/subjects/useSubjectSearch.ts
  • src/stores/evidence.ts
  • src/types/subject-templates.spec.ts
  • src/types/subject-templates.ts
  • src/types/subjects.ts
  • src/utils/links.spec.ts
  • src/utils/links.ts
  • src/views/__tests__/SubjectTemplateDetailView.spec.ts
  • src/views/__tests__/SubjectTemplatesView.spec.ts
  • src/views/admin/SubjectTemplateDetailView.vue
  • src/views/admin/SubjectTemplatesView.vue
  • src/views/evidence/CreateView.vue
  • src/views/evidence/IndexView.vue
  • src/views/evidence/UpdateView.vue
  • src/views/evidence/ViewView.vue
  • src/views/evidence/__tests__/CreateView.spec.ts
  • src/views/evidence/__tests__/IndexView.spec.ts
  • src/views/evidence/__tests__/UpdateView.spec.ts
  • src/views/evidence/__tests__/ViewView.spec.ts
  • src/views/evidence/partial/EvidenceForm.vue
  • src/views/evidence/partial/__tests__/EvidenceForm.spec.ts
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🔵 Needs a closer look

It is a broad, multi-view feature whose correctness depends on unverifiable API contracts (/api/subjects, /api/evidence/config) and subtle subject-replacement semantics on evidence re-submission, warranting human review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

This PR adds first-class support for evidence subjects (what a piece of evidence is about) across the evidence UI, plus related admin-side configuration for subject templates. Subjects are displayed on the evidence list, the evidence detail page, and can be picked when creating/updating evidence and used as a list filter. A shared useSubjectSearch composable talks to GET /api/subjects, and feature detection gracefully hides all subject UI on older APIs that don't return subjects. The PR also extracts link-sanitization helpers into src/utils/links.ts and adds displayPriority/componentType to subject templates.

Changes:

  • New subject types/helpers (src/types/subjects.ts), useSubjectSearch/useEvidenceConfig composables, and components (SubjectPicker, SubjectFilter, SubjectsSection) wired into evidence Index/View/Create/Update views and EvidenceList.
  • Subject-based list filtering via a ?subject=<uuid> route param, plus optional "manual subject required" validation driven by GET /api/evidence/config.
  • Subject-template admin additions (displayPriority, componentType) with payload normalization, and extraction of normalizeLinkHref/isInternalLink/getSafeExternalHref into a tested utils/links.ts.
File Description
src/​types/​subjects.ts New subject summary type + subjectSource/subjectTemplate/describeSubject helpers (one unused).
src/​types/​subject-templates.ts Adds component-type options, display-priority normalization, and payload fields.
src/​stores/​evidence.ts Adds DeclaredSubject and optional subjectReferences to Evidence.
src/​composables/​subjects/​useSubjectSearch.ts Search/lookup against /api/subjects with 404→unsupported detection.
src/​composables/​evidence/​useEvidenceConfig.ts Reads manualSubjectRequired from /api/evidence/config.
src/​components/​evidence/​SubjectPicker.vue Multi-select subject picker with per-SSP narrowing.
src/​components/​evidence/​SubjectFilter.vue Single-subject list filter autocomplete.
src/​components/​evidence/​SubjectsSection.vue Renders evidence subjects with linked-SSP details and safe links.
src/​components/​EvidenceList.vue New Subjects column with chips, "+N more" popover, and Unattributed state.
src/​views/​evidence/​IndexView.vue Subject route filter sync, capability detection, and search param.
src/​views/​evidence/​ViewView.vue Subjects card beside Current State; imports extracted link helpers.
src/​views/​evidence/​CreateView.vue, UpdateView.vue Pass picked subjects into the evidence submit payload.
src/​views/​evidence/​partial/​EvidenceForm.vue Subject picker + required-subject validation and emit.
src/​views/​admin/​SubjectTemplatesView.vue, SubjectTemplateDetailView.vue Display-priority and component-type form/detail fields.
src/​utils/​links.ts Extracted, now-shared link normalization/sanitization helpers.
src/​**/​__tests__/​*.spec.ts, *.spec.ts Extensive new unit tests for the above.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/types/subjects.ts Outdated
@gusfcarvalho gusfcarvalho added the size-exception PR intentionally exceeds the 1k-line size limit; reasoning in the description label Oct 5, 2026
@gusfcarvalho

Copy link
Copy Markdown
Contributor

added size-exception label as this PR was created before the review standardization.

- SubjectPicker: only fetch the SSP list (and show the SSP dropdown) when the user can
  read SSPs, so evidence submitters without ssp:read don't get a 403 toast.
- useSubjectSearch: ignore search responses that resolve after a newer search, so stale
  results can't replace the current suggestions.
- Add CreateView and UpdateView specs asserting the POST body carries the picked
  subjects as subjects[].subject-uuid, replacing the previous revision's subjects.
- Remove the unused subjectTemplate() helper.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@gusfcarvalho
gusfcarvalho enabled auto-merge (squash) October 5, 2026 16:23
@gusfcarvalho
gusfcarvalho merged commit 7c67cf4 into main Oct 5, 2026
2 of 3 checks passed
@gusfcarvalho
gusfcarvalho deleted the feat/bch-1364-subject-template-fields branch October 5, 2026 16:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size-exception PR intentionally exceeds the 1k-line size limit; reasoning in the description

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants