Skip to content

Fix secondaryType validation and add tests for convertFormulaSecondaryTypeToEvaluatorType#1839

Open
paustint wants to merge 1 commit into
mainfrom
bug/create-fields-lowercase-error
Open

Fix secondaryType validation and add tests for convertFormulaSecondaryTypeToEvaluatorType#1839
paustint wants to merge 1 commit into
mainfrom
bug/create-fields-lowercase-error

Conversation

@paustint

Copy link
Copy Markdown
Contributor

Update the validation for secondaryType to ensure it correctly handles various inputs. Add tests to verify the mapping of secondary types to evaluator types, including cases for undefined and unknown types. This resolves a BetterStack error related to secondaryType handling.

Copilot AI review requested due to automatic review settings June 30, 2026 15:28

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR hardens formula secondaryType handling in the Create Fields workflow by preventing runtime errors when secondaryType is missing and by adding targeted unit tests to lock in the expected evaluator-type mapping.

Changes:

  • Make convertFormulaSecondaryTypeToEvaluatorType tolerant of undefined/null secondary types (defaulting to 'string').
  • Add Vitest coverage for secondary-type → evaluator-type mapping, including missing and unknown values.
  • Ensure imported secondaryType values are always normalized via ensureValidSecondaryType during import (even when the column/value is absent).

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
libs/shared/ui-core/src/create-fields/create-fields-utils.tsx Makes secondary-type conversion resilient to missing values to avoid .toLowerCase() crashes.
libs/shared/ui-core/src/create-fields/tests/create-fields-utils.spec.ts Adds unit tests verifying mapping behavior for known, missing, and unknown secondary types.
libs/features/create-object-and-fields/src/CreateFieldsImportExport.tsx Always runs secondary-type normalization during import so downstream code sees a safe default.

Comment thread libs/shared/ui-core/src/create-fields/create-fields-utils.tsx Outdated
@paustint paustint force-pushed the bug/create-fields-lowercase-error branch from 9fc5dd6 to c333ed1 Compare July 1, 2026 15:01
@paustint paustint requested a review from Copilot July 1, 2026 15:01

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread libs/shared/ui-core/src/create-fields/create-fields-utils.tsx
Comment thread libs/features/create-object-and-fields/src/CreateFieldsFormulaEditor.tsx Outdated
@paustint paustint force-pushed the bug/create-fields-lowercase-error branch from c333ed1 to 04fd81c Compare July 1, 2026 22:22
@paustint paustint requested a review from Copilot July 1, 2026 22:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

Comment thread libs/shared/ui-core/src/create-fields/create-fields-utils.tsx Outdated
…SecondaryTypeToEvaluatorType

Refs: Resolves betterstack error b6ef8c57fe46e77538723abcec6d649e1812a7ac8f4686727753c8351e0e4eae
@paustint paustint force-pushed the bug/create-fields-lowercase-error branch from 04fd81c to 9063f52 Compare July 1, 2026 22:42
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