Skip to content

fix(zendesk): warn on custom-field name collisions#312

Merged
christophebrun-forest merged 2 commits into
mainfrom
fix/zendesk-custom-field-name-collision
May 22, 2026
Merged

fix(zendesk): warn on custom-field name collisions#312
christophebrun-forest merged 2 commits into
mainfrom
fix/zendesk-custom-field-name-collision

Conversation

@christophebrun-forest
Copy link
Copy Markdown
Member

@christophebrun-forest christophebrun-forest commented May 22, 2026

Summary

  • Zendesk custom fields whose key collides with a native column or relation (e.g. a user_field named role) used to crash agent setup with Field role already defined in collection (RuntimeError).
  • The conflicting field is now skipped with a warning via ForestAdminDatasourceZendesk.logger, so agent setup keeps going.
  • The filtered list flows back into the datasource search mapping so schema and query translation stay in sync.

Test plan

  • bundle exec rspec in packages/forest_admin_datasource_zendesk — 238 examples, 0 failures.
  • bundle exec rubocop lib/ spec/ — clean.
  • New unit tests in user_spec.rb cover the role collision (warning emitted, native enum schema preserved, native value not overwritten by serializer).

🤖 Generated with Claude Code

Note

Warn and skip custom fields that collide with native field names in Zendesk collections

  • Adds add_custom_fields to BaseCollection that checks each custom field against the existing schema, logs a warning on collision, and skips the conflicting field.
  • Updates Ticket, User, and Organization collections to use add_custom_fields instead of registering custom fields directly in define_schema, so @custom_fields only contains fields actually added.
  • Updates Datasource#build_custom_field_mapping to derive the mapping from the filtered @custom_fields on each collection rather than raw introspection arrays.
  • Behavioral Change: native fields (e.g. role on User) can no longer be silently overwritten by a colliding custom field during serialization.

Macroscope summarized 3810cf0.

christophebrun-forest and others added 2 commits May 22, 2026 11:18
Skip Zendesk custom fields whose key collides with a native column or relation
(e.g. a user_field named "role") and log a warning, so agent setup is not
blocked. The filtered list flows back into the datasource search-mapping to
keep schema and query translation in sync.

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

@PMerlet PMerlet left a comment

Choose a reason for hiding this comment

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

LGTM

@christophebrun-forest christophebrun-forest merged commit b1274e9 into main May 22, 2026
44 checks passed
@christophebrun-forest christophebrun-forest deleted the fix/zendesk-custom-field-name-collision branch May 22, 2026 11:59
forest-bot added a commit that referenced this pull request May 22, 2026
## [1.30.4](v1.30.3...v1.30.4) (2026-05-22)

### Bug Fixes

* **zendesk:** warn on custom-field name collisions ([#312](#312)) ([b1274e9](b1274e9))
@forest-bot
Copy link
Copy Markdown
Member

🎉 This PR is included in version 1.30.4 🎉

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.

3 participants