Skip to content

Conversation

@jdschleicher
Copy link
Owner

@jdschleicher jdschleicher commented May 13, 2025

Motivation and Context

When generating recipes error handling was not granular and provided no specific detail into what Salesforce field in the local project base was causing an issue. This functionality wraps the field processing service in a try/catch and generates a error details page for self-service troubleshooting.

BUGFIX - as part of this work, there was a bug discovered for dependent picklists and global picklist markup. This update provides functionality that provides necessary logic to prevent recipe generation failure at run time.

What does this PR do?

  • introduce try/catch at field processing level to provide error message and generate file capturing error details around what field caused faker generation to fail
  • for faker-js -> adjust "text" type function to trim lorem ipsum generator to 255 characters
  • new IRecipeService interface methods for providing correct syntax for picklist or multipicklist for global value set fields
  • new properties on XMLFieldDetail for capturing info whether field is globalvaluepicklist or standard value set
  • bugfix: prevent issues where picklist have values for inactive fields or dependent picklists that do not have a configuration for a parent picklist value ( done by providing "if size > 0" check)

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Other (please describe):

How Has This Been Tested?

  • Tested on Windows
  • Tested on macOS
  • Tested on Linux
  • Added new unit tests
  • Updated existing tests

Test Details

Built additional mock structures to handle edge scenarios for standardpicklists, global value picklist and dependent picklists with isactive set to false

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

Changelog for branch: feature/fieldProcessorErrorHandling

Generated on: 2025-05-16

Summary

  • Total commits: 23
  • Files added: 1
  • Files modified: 23
  • Files deleted: 0
  • Files renamed: 0

Changes at a glance

Added Files

Added File Commits History
src/treecipe/src/DirectoryProcessingService/tests/mocks/MockObjectsDirectory/objects/Example_Everything__c/fields/GlobalValuePicklist__c.field-meta.xml 1 View Full History

Modified Files

Modified File Commits History
extensionDevelopmentScriptsAndArtifacts/treecipe/GeneratedRecipes/recipe-2025-01-03T15-45-06-fakerjs.yaml 1 View Full History
src/treecipe/src/DirectoryProcessingService/DirectoryProcessor.ts 1 View Full History
src/treecipe/src/DirectoryProcessingService/tests/DirectoryProcessor.test.ts 1 View Full History
src/treecipe/src/DirectoryProcessingService/tests/mocks/MockObjectsDirectory/objects/Example_Everything__c/recordTypes/OneRecType.recordType-meta.xml 1 View Full History
src/treecipe/src/DirectoryProcessingService/tests/mocks/MockObjectsDirectory/objects/Example_Everything__c/recordTypes/TwoRecType.recordType-meta.xml 1 View Full History
src/treecipe/src/ErrorHandlingService/ErrorHandlingService.ts 4 View Full History
src/treecipe/src/FakerRecipeProcessor/FakerJSRecipeProcessor/FakerJSRecipeProcessor.ts 3 View Full History
src/treecipe/src/FakerRecipeProcessor/FakerJSRecipeProcessor/tests/FakerJSRecipeProcessor.test.ts 2 View Full History
src/treecipe/src/FakerRecipeProcessor/SnowfakeryRecipeProcessor/SnowfakeryRecipeProcessor.ts 1 View Full History
src/treecipe/src/FakerRecipeProcessor/SnowfakeryRecipeProcessor/tests/SnowfakeryRecipeProcessor.test.ts 2 View Full History
src/treecipe/src/ObjectInfoWrapper/FieldInfo.ts 1 View Full History
src/treecipe/src/RecipeFakerService.ts/FakerJSRecipeFakerService/FakerJSRecipeFakerService.ts 2 View Full History
src/treecipe/src/RecipeFakerService.ts/FakerJSRecipeFakerService/tests/FakerJSRecipeFakerService.test.ts 1 View Full History
src/treecipe/src/RecipeFakerService.ts/IRecipeFakerService.ts 1 View Full History
src/treecipe/src/RecipeFakerService.ts/SnowfakeryRecipeFakerService/SnowfakeryRecipeFakerService.ts 1 View Full History
src/treecipe/src/RecipeService/RecipeService.ts 4 View Full History
src/treecipe/src/RecipeService/tests/RecipeService.test.ts 2 View Full History
src/treecipe/src/RecordTypeService/tests/RecordTypeService.test.ts 1 View Full History
src/treecipe/src/VSCodeWorkspace/VSCodeWorkspaceService.ts 2 View Full History
src/treecipe/src/XMLProcessingService/XMLFieldDetail.ts 3 View Full History
src/treecipe/src/XMLProcessingService/XmlFileProcessor.ts 6 View Full History
src/treecipe/src/XMLProcessingService/tests/XmlFileProcessor.test.ts 6 View Full History
src/treecipe/src/XMLProcessingService/tests/mocks/XMLMarkupMockService.ts 7 View Full History

@jdschleicher jdschleicher marked this pull request as ready for review May 16, 2025 10:07
@jdschleicher jdschleicher merged commit 4e1f1e3 into main May 16, 2025
2 checks passed
@jdschleicher jdschleicher deleted the feature/fieldProcessorErrorHandling branch July 6, 2025 15:24
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