Skip to content

ENG-2878: Refine tag display in QuestionCard to show source or status#7570

Merged
kruulik merged 10 commits intomainfrom
2878-tag-refinements
Mar 5, 2026
Merged

ENG-2878: Refine tag display in QuestionCard to show source or status#7570
kruulik merged 10 commits intomainfrom
2878-tag-refinements

Conversation

@kruulik
Copy link
Contributor

@kruulik kruulik commented Mar 5, 2026

Ticket ENG-2878

Description Of Changes

Updated the card tags so now when an answer is complete it shows Agent (with a sparkle indicator for AI), "Team input", "System derived". When an answer is not complete it show "needs input" or "system derivable"

image

Code Changes

  • clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx - Replace AnswerStatusTags with inline conditional Tag rendering based on answer status

Steps to Confirm

  1. Navigate to a privacy assessment with questions
  2. Verify that complete questions show the source tag (e.g., "Agent" with sparkle for AI answers, "Team input" for user-entered answers)
  3. Verify that incomplete questions show the status tag (e.g., "Needs input", "System derivable")
  4. Confirm AnswerStatusTags still renders correctly in the request input modal

Pre-Merge Checklist

  • Issue requirements met
  • All CI pipelines succeeded
  • CHANGELOG.md updated
    • Updates unreleased work already in Changelog, no new entry necessary
  • UX feedback:
    • All UX related changes have been reviewed by a designer
    • No UX review needed
  • Followup issues:
    • Followup issues created
    • No followup issues
  • Database migrations:
    • No migrations
  • Documentation:
    • No documentation updates required

Summary by CodeRabbit

  • Bug Fixes

    • Privacy assessment tags now show the answer source for completed items and the answer status for incomplete items; status tooltip updated to reference system data.
    • Status tag now renders inline within question headers for a cleaner layout.
  • Style

    • "AI derived" label renamed to "Agent".
    • Completed answers use a consistent sandstone-colored tag with a sparkle indicator for agent-analyzed answers.

@vercel
Copy link
Contributor

vercel bot commented Mar 5, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
fides-plus-nightly Ready Ready Preview, Comment Mar 5, 2026 8:57pm
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
fides-privacy-center Ignored Ignored Mar 5, 2026 8:57pm

Request Review

@coderabbitai
Copy link

coderabbitai bot commented Mar 5, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

QuestionCard tag display updated: COMPLETE answers now show a single source tag (sandstone, sparkle for AI), incomplete answers show status tag; removed ANSWER_SOURCE_TAG_COLORS, renamed AI_ANALYSIS label to "Agent", and added a changelog entry linking PR 7570.

Changes

Cohort / File(s) Summary
Changelog
changelog/2878-tag-refinements.yaml
Add changelog entry documenting the QuestionCard tag-display change and PR association (7570).
AnswerStatusTags
clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx
Render COMPLETE as a single Tag using CUSTOM_TAG_COLOR.SANDSTONE and hasSparkle when answer_source === AnswerSource.AI_ANALYSIS; remove ANSWER_SOURCE_TAG_COLORS usage; adjust PARTIAL tooltip fallback.
QuestionCard
clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx
Remove Space wrapper; render AnswerStatusTags inline within header (layout/import change only).
Constants
clients/admin-ui/src/features/privacy-assessments/constants.ts
Remove exported ANSWER_SOURCE_TAG_COLORS; change ANSWER_SOURCE_LABELS[AnswerSource.AI_ANALYSIS] from "AI derived" to "Agent".

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

Privacy Assessments

Suggested reviewers

  • lucanovera

Poem

🐰 I hopped through code with nimble cheer,
Tags now shimmer when the answer's clear,
"Agent" whispers where AI once spoke,
Statuses linger when replies are broke,
A tiny carrot for changes here 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: refining tag display in QuestionCard to show source when complete or status when incomplete.
Description check ✅ Passed The description covers required sections: ticket reference, detailed changes explanation, code changes list, confirmation steps, and completed pre-merge checklist items.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch 2878-tag-refinements

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

kruulik and others added 2 commits March 4, 2026 19:50
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kruulik kruulik marked this pull request as ready for review March 5, 2026 14:46
@kruulik kruulik requested a review from a team as a code owner March 5, 2026 14:46
@kruulik kruulik requested review from lucanovera and removed request for a team March 5, 2026 14:46
@greptile-apps
Copy link
Contributor

greptile-apps bot commented Mar 5, 2026

Greptile Summary

This PR refines the tag display in QuestionCard so that completed questions show their answer source (e.g., "Agent" with a sparkle for AI, "Team input", "System derived") while incomplete questions continue to show their status ("Needs input", "System derivable"). The constants are also updated to unify source tag colors and rename the AI label to "Agent".

Key points:

  • QuestionCard.tsx: Correctly implements the new conditional tag logic with a proper hasSparkle check (question.answer_source === AnswerSource.AI_ANALYSIS).
  • AnswerStatusTags.tsx: Contains a bug — hasSparkle={!!AnswerSource.AI_ANALYSIS} always evaluates to true (double-negation of the non-empty string "ai_analysis"), causing the sparkle to incorrectly appear on all source tags regardless of type.
  • QuestionCard.tsx: The Tooltip that previously wrapped the "System derivable" tag (surfacing missing_data fields) is not carried over into the new inline rendering; this may be an intentional simplification but is worth confirming.
  • constants.ts: Clean and correct — label rename and color unification look good.

Confidence Score: 3/5

  • Safe to merge after fixing the always-true hasSparkle bug in AnswerStatusTags.tsx.
  • One clear logic bug (!!AnswerSource.AI_ANALYSIS always being true) will cause the sparkle indicator to display incorrectly for non-AI sources in the request input modal context. The fix is a one-line change. The QuestionCard implementation itself is correct.
  • clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx — the hasSparkle prop is set to a constant true instead of comparing against the question's actual source.

Important Files Changed

Filename Overview
clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx Added hasSparkle prop to the AI source tag, but used !!AnswerSource.AI_ANALYSIS which always evaluates to true instead of comparing question.answer_source === AnswerSource.AI_ANALYSIS. This causes the sparkle to render for all answer sources, not just AI.
clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx Correctly replaces AnswerStatusTags with inline conditional tag rendering — shows source tag (with sparkle for AI) when complete, and status tag otherwise. The hasSparkle logic is correct here. The tooltip for the PARTIAL/System-derivable status that existed in AnswerStatusTags is no longer present.
clients/admin-ui/src/features/privacy-assessments/constants.ts Renamed AI source label from "AI derived" to "Agent" and unified all ANSWER_SOURCE_TAG_COLORS to CUSTOM_TAG_COLOR.SANDSTONE. Straightforward and correct.
changelog/2878-tag-refinements.yaml New changelog entry for the tag refinement feature. Correct format and content.

Last reviewed commit: ccd5dfc

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx`:
- Line 24: The sparkle condition is always true because it uses the constant
coercion (!!AnswerSource.AI_ANALYSIS); update the check in AnswerStatusTags to
compare the answer's source to the enum: replace
hasSparkle={!!AnswerSource.AI_ANALYSIS} with a comparison like
hasSparkle={answer.source === AnswerSource.AI_ANALYSIS} (or use the same
variable/name pattern used in QuestionCard.tsx) so the sparkle only shows when
the answer's source equals AnswerSource.AI_ANALYSIS.

In `@clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx`:
- Around line 50-61: QuestionCard currently renders the non-COMPLETE Tag
directly and misses the PARTIAL tooltip logic implemented in AnswerStatusTags;
update the else branch in the QuestionCard render (the Tag using
ANSWER_STATUS_TAG_COLORS and ANSWER_STATUS_LABELS) to detect when
question.answer_status === AnswerStatus.PARTIAL and wrap the Tag with a Tooltip
whose title mirrors AnswerStatusTags (use question.missing_data to build "This
answer can be automatically derived if you populate: ..." when present,
otherwise the fallback message), leaving behavior unchanged for other
non-COMPLETE statuses.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 41cad904-04a9-448b-b012-798e18bb7de2

📥 Commits

Reviewing files that changed from the base of the PR and between f7b17b5 and ccd5dfc.

📒 Files selected for processing (4)
  • changelog/2878-tag-refinements.yaml
  • clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx
  • clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx
  • clients/admin-ui/src/features/privacy-assessments/constants.ts

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx`:
- Line 62: The tooltip string in the QuestionCard component contains a
product-specific term ("Fides data"); open the QuestionCard.tsx component and
replace that literal with neutral wording (e.g., "This answer can be derived
from the system data if the relevant field is populated" or similar) so no
internal system names are referenced; update the JSX string used for the tooltip
in the QuestionCard component to the new generic copy.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: cecc60c0-3787-40fa-acfa-7b2f7cb1120b

📥 Commits

Reviewing files that changed from the base of the PR and between ccd5dfc and 436af2b.

📒 Files selected for processing (2)
  • clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx
  • clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx

Copy link
Contributor

@lucanovera lucanovera left a comment

Choose a reason for hiding this comment

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

Nice UI improvements. The tags are looking better, that sparkle icon brings consistency with other AI features in the product.

Left a couple of comments about the code.

kruulik and others added 2 commits March 5, 2026 15:25
- Update AnswerStatusTags to show source tag only when complete (drop
  redundant "Complete" status tag), reuse from QuestionCard
- Fix "Fides data" -> "system data" in tooltip copy
- Remove ANSWER_SOURCE_TAG_COLORS const (all values were SANDSTONE)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@clients/admin-ui/src/features/privacy-assessments/constants.ts`:
- Around line 28-33: The frontend AnswerSource enum member SLACK mismatches the
backend (backend uses team_input), so rename the frontend enum member SLACK to
TEAM_INPUT (ensure its value is "team_input"), update all references/usages to
AnswerSource.SLACK to AnswerSource.TEAM_INPUT, and change the
ANSWER_SOURCE_LABELS mapping key from [AnswerSource.SLACK] to
[AnswerSource.TEAM_INPUT] (keep the label "Team input"); also search and update
any other code that relied on the old SLACK identifier.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2293ac68-bbd0-45d2-b8bd-2a12029a5cf0

📥 Commits

Reviewing files that changed from the base of the PR and between b359a06 and b68564e.

📒 Files selected for processing (3)
  • clients/admin-ui/src/features/privacy-assessments/AnswerStatusTags.tsx
  • clients/admin-ui/src/features/privacy-assessments/QuestionCard.tsx
  • clients/admin-ui/src/features/privacy-assessments/constants.ts

Frontend had SLACK = "slack" but backend sends team_input = "team_input".
Rename enum member and update ANSWER_SOURCE_LABELS accordingly.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@kruulik kruulik added this pull request to the merge queue Mar 5, 2026
Merged via the queue into main with commit 48ab071 Mar 5, 2026
47 checks passed
@kruulik kruulik deleted the 2878-tag-refinements branch March 5, 2026 21:19
mfbrown pushed a commit that referenced this pull request Mar 12, 2026
…#7570)

Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants