Skip to content

fix(shared): accept system-authored users (role: "system", null email) in UserSchema#2

Open
obiyoda wants to merge 1 commit into
ryanyogan:masterfrom
obiyoda:fix/user-schema-system-author
Open

fix(shared): accept system-authored users (role: "system", null email) in UserSchema#2
obiyoda wants to merge 1 commit into
ryanyogan:masterfrom
obiyoda:fix/user-schema-system-author

Conversation

@obiyoda

@obiyoda obiyoda commented Jun 6, 2026

Copy link
Copy Markdown

Problem

The Fizzy API returns a user with role: "system" and email_address: null for system-authored content — notably the automated "moved to column" comment that gets added whenever a card is triaged/moved.

UserSchema (in packages/shared/src/schemas/common.ts) only permits owner | admin | member and a non-null .email() address. So as soon as a card's comment list contains any system-authored comment, list_comments fails Zod validation on that entry and the entire response throws — the thread becomes unreadable through the MCP server. In practice this hits every card an agent has moved between columns.

Observed error:

invalid_enum_value at creator.role: received "system" (expected owner|admin|member)
invalid_type at creator.email_address: received null (expected string)

Fix

Two-line change to UserSchema:

  • add 'system' to the role enum
  • make email_address nullable
role: z.enum(['owner', 'admin', 'member', 'system']),
email_address: z.string().email().nullable(),

This unblocks reading any comment thread that includes system-authored comments, with no impact on human-authored users.

Summary by CodeRabbit

  • New Features
    • Added 'system' user role option
    • Email address is now optional for user accounts

The Fizzy API returns a 'system' role with a null email_address for
system-authored content (e.g. the automated "moved to column" comment
added when a card is triaged). UserSchema only allowed owner/admin/member
and a non-null email, so any list_comments response containing a system
comment failed Zod validation and the whole call threw — making such
threads unreadable via the MCP server.

Allow role 'system' and a nullable email_address.
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f7a82150-26d8-469d-a06e-8cf717502bd1

📥 Commits

Reviewing files that changed from the base of the PR and between 87d7872 and a2d20ac.

📒 Files selected for processing (1)
  • packages/shared/src/schemas/common.ts

📝 Walkthrough

Walkthrough

The UserSchema in the shared schemas package is updated to expand the user role enumeration with a new 'system' value and modify the email_address field from required to nullable.

Changes

User Schema Updates

Layer / File(s) Summary
User schema role and email updates
packages/shared/src/schemas/common.ts
UserSchema role enum extended to include 'system' alongside existing 'owner', 'admin', and 'member' values. email_address field changed from required string to nullable email string.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A schema dance, so light and neat,
New system roles make users complete,
Email floats free—nullable, true,
Fizzy changes through and through! ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately and specifically describes the main change: adding support for system-authored users with 'system' role and nullable email in UserSchema.
Description check ✅ Passed The description provides comprehensive context including the problem, observed errors, and the fix. However, the Type of change checkbox is not marked and the Checklist section is incomplete.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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 and usage tips.

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.

1 participant