Skip to content

Conversation

@marcoacierno
Copy link
Member

Closes #4553

Summary

When Plain requests the grant card via cardKeys, always include it in the response even when the user doesn't exist. Previously, if the user was not found, we returned an empty cards array. Now we return an empty grant card to match Plain's expectation that all requested card keys are always present.

Generated with Claude Code

When Plain requests the grant card via cardKeys, always include it in
the response even when the user doesn't exist. Previously, if the user
was not found, we returned an empty cards array. Now we return an empty
grant card ({key: "grant", components: []}) to match Plain's expectation
that all requested card keys are always present in the response.

Closes #4553

Co-authored-by: Marco Acierno <marcoacierno@users.noreply.github.com>
@vercel
Copy link

vercel bot commented Feb 3, 2026

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

Project Deployment Actions Updated (UTC)
pycon Ready Ready Preview Feb 3, 2026 5:29pm

@claude

This comment has been minimized.

Comment on lines 35 to 38
if user:
cards.append(create_grant_card(request, user, conference))
else:
cards.append({"key": "grant", "components": []})
Copy link
Member Author

Choose a reason for hiding this comment

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

@claude this feels like we are leaking the card creation outside. Maybe a better one would be to have create_grant_card check if the user is present, and if not, return the empty card?

This would allow each card in the future to check its own requirements? Review this approach and see if it makes sense

Copy link
Contributor

@claude claude bot Feb 3, 2026

Choose a reason for hiding this comment

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

Claude finished @marcoacierno's task in 48s —— View job


  • Read current code (views.py, plain_cards.py) to understand the structure
  • Evaluate the proposed approach
  • Implement the refactor
  • Push changes

Good call — the approach makes sense. Moved the user existence check into create_grant_card so each card function encapsulates its own requirements. The view now just does cards.append(create_grant_card(request, user, conference)) without needing to know what each card needs.

Changes:

  • plain_cards.py: create_grant_card now checks if user is None before querying for the grant, returning the empty card structure if there's no user.
  • views.py: Simplified to a single cards.append(...) call — no more branching on user existence in the view.

View commit ·

@codecov
Copy link

codecov bot commented Feb 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.16%. Comparing base (10b9c2c) to head (e759b0c).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4555      +/-   ##
==========================================
- Coverage   94.16%   94.16%   -0.01%     
==========================================
  Files         353      353              
  Lines       10348    10346       -2     
  Branches      762      761       -1     
==========================================
- Hits         9744     9742       -2     
  Misses        502      502              
  Partials      102      102              
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Each card function now handles its own requirements internally,
keeping the view layer clean and making it easier to add new cards.

Co-authored-by: Marco Acierno <marcoacierno@users.noreply.github.com>
@marcoacierno marcoacierno merged commit 1439357 into main Feb 4, 2026
7 of 8 checks passed
@marcoacierno marcoacierno deleted the claude/issue-4553-20260203-1721 branch February 4, 2026 03:57
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.

Fix Plain user customer card

1 participant