Skip to content

fix(app): service card counts only added evidence tasks (matches detail)#3007

Merged
tofikwest merged 4 commits into
mainfrom
tofik/service-card-evidence-count
Jun 3, 2026
Merged

fix(app): service card counts only added evidence tasks (matches detail)#3007
tofikwest merged 4 commits into
mainfrom
tofik/service-card-evidence-count

Conversation

@tofikwest
Copy link
Copy Markdown
Contributor

@tofikwest tofikwest commented Jun 3, 2026

Problem

The service card in a cloud integration's grid shows an evidence-task count = total mapped templates, while the service detail page (PR #3006) shows only tasks added to the org. So a card can read "2 evidence tasks" while the detail shows "1" — a mismatch that confuses users.

Fix

Thread the org's task templates through ProviderDetailView → ServicesGrid → ServiceCard and count only mapped tasks that have a live task in the org, so the card matches the detail.

  • The count badge hides entirely when none are added (existing taskCount > 0 guard).
  • Falls back to total mapped tasks if no templates are provided (defensive; the grid always passes them).

Tests

ServiceCard.test.tsx (3 tests): added-only count (1 evidence task not 2), fallback to total when addedTemplateIds absent, and the hidden-count case when none are added. All pass.

App typecheck: my files are clean (pre-existing .test/auth-client errors on main are unrelated, not in this diff).

Related

🤖 Generated with Claude Code


Summary by cubic

Fixes the service card evidence-task count to show only tasks added to the org, matching the service detail page. Also fixes the fallback so cards show total mapped tasks when templates aren’t provided.

  • Bug Fixes
    • Counts only mapped tasks with live org tasks via addedTemplateIds; hides the badge when zero.
    • Keeps addedTemplateIds undefined when taskTemplates is omitted so fallback to total works; an explicit empty array means “none added.”
    • Tests cover ServiceCard and ServicesGrid: added-only, fallback when omitted, and hidden badge.

Written for commit e47a500. Summary will update on new commits.

Review in cubic

The service card in a cloud integration's grid showed an evidence-task count =
total mapped templates, while the service detail page now shows only tasks added
to the org. That mismatch (card "2 evidence tasks" vs detail "1") confuses users.

Thread the org's task templates through ProviderDetailView → ServicesGrid →
ServiceCard and count only mapped tasks that have a live task in the org, so the
card matches the detail. The count badge hides entirely when none are added
(taskCount > 0 guard). Falls back to total mapped tasks when no templates are
provided.

Tests for ServiceCard cover added-only count, the fallback, and the hidden-count
case.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 3, 2026

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

Project Deployment Actions Updated (UTC)
app Ready Ready Preview, Comment Jun 3, 2026 2:55am
comp-framework-editor Ready Ready Preview, Comment Jun 3, 2026 2:55am
1 Skipped Deployment
Project Deployment Actions Updated (UTC)
portal Skipped Skipped Jun 3, 2026 2:55am

Request Review

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 4 files

Confidence score: 3/5

  • There is a concrete regression risk in apps/app/src/app/(app)/[orgId]/integrations/[slug]/components/services-grid.tsx: when templates are missing, the empty default for addedTemplateIds blocks the fallback path and shows 0 tasks instead of mapped task totals.
  • Because this affects visible task counts (user-facing behavior) with high confidence, the merge risk is moderate even though severity is not high.
  • Pay close attention to apps/app/src/app/(app)/[orgId]/integrations/[slug]/components/services-grid.tsx - ensure addedTemplateIds stays undefined when templates are not provided so fallback counting still works.

Reply with feedback, questions, or to request a fix.

Fix all with cubic | Re-trigger cubic

Comment thread apps/app/src/app/(app)/[orgId]/integrations/[slug]/components/services-grid.tsx Outdated
tofikwest and others added 2 commits June 2, 2026 22:52
Addresses the cubic review of #3007. The `taskTemplates = []` default made
addedTemplateIds always a Set, so ServiceCard's fallback-to-total branch was
dead code: a caller that omits taskTemplates got an empty Set → count 0 instead
of the total mapped tasks. Drop the default and compute undefined when
taskTemplates isn't provided so the fallback works; an explicit empty array
still means "none added" (count 0), matching the detail page for an org with no
live tasks. Add a ServicesGrid regression test (omitted → total, provided →
added-only).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tofikwest
Copy link
Copy Markdown
Contributor Author

@cubic-dev-ai review it

@cubic-dev-ai
Copy link
Copy Markdown
Contributor

cubic-dev-ai Bot commented Jun 3, 2026

@cubic-dev-ai review it

@tofikwest I have started the AI code review. It will take a few minutes to complete.

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@tofikwest tofikwest merged commit 97488b4 into main Jun 3, 2026
11 checks passed
@tofikwest tofikwest deleted the tofik/service-card-evidence-count branch June 3, 2026 03:02
@claudfuen
Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.68.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants