W-20926773: global assets validation#370
W-20926773: global assets validation#370WillieRuemmele merged 15 commits intofix-bot-template-generationfrom
Conversation
jshackell-sfdc
left a comment
There was a problem hiding this comment.
See my small edits, thx.
Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com>
|
|
||
| // replace references in attributeMappings and ruleExpressionAssignments | ||
| for (const mapping of plannerBundle.attributeMappings ?? []) { | ||
| const attributeMappings = Array.isArray(plannerBundle.attributeMappings) |
There was a problem hiding this comment.
could you use ensureArray? and same with ruleExpressionAssignments below
| ], | ||
| genAiPlugins: [], | ||
| }, | ||
| } as unknown as GenAiPlannerBundleExt; |
There was a problem hiding this comment.
you shouldn't need to cast as unknown just as GenAiPlannerBundleExt
| ); | ||
| }); | ||
|
|
||
| it('Converts an Agent into an BotTemplate and GenAiPlannerBundle', async () => { |
There was a problem hiding this comment.
will NUTs be coming later once all the changes are ready for main?
There was a problem hiding this comment.
Previously, this test compared the command output against a reference file. However, with the new org asset validation, IDs are now generated dynamically, causing the comparison to fail consistently. I attempted to create a test using local assets, but I couldn't find a way to make the IDs match reliably. Because of this, I've shifted the verification of the asset replacement logic to unit tests.
QA notes✅ : error when using ../../oss/plugin-agent/bin/run.js agent generate template --agent-file force-app/main/default/bots/Slack_Employee_Help/Slack_Employee_Help.bot-meta.xml --agent-version 1
Saved BotTemplate to:
- /Users/william.ruemmele/projects/scratches/ABCD/force-app/main/default/botTemplates/Slack_Employee_Help_v1_Template.botTemplate-meta.xml
Saved GenAiPlannerBundle to:
- /Users/william.ruemmele/projects/scratches/ABCD/force-app/main/default/genAiPlannerBundles/Slack_Employee_Help_v1_Template/Slack_Employee_Help_v1_Template.genAiPlannerBundle
➜ abcd git:(main) ✗ hub:(GLOBAL - DevHub) scratch:(test-kgyvuoleixoe@example.com) ➜ ../../oss/plugin-agent/bin/run.js agent generate template --agent-file force-app/main/default/bots/Slack_Employee_Help/Slack_Employee_Help.bot-meta.xml --agent-version 1 --source-org temp
Error (SfError): The following assets (genAiPlugin or genAiFunction) that you're including in the agent template reference an asset that isn't in the source org:
GeneralFAQ_16jKS00000000Au, SlackKnowledge_16jKS00000000Au, AnswerQuestionsWithKnowledge_179KS000000Cb14, CreateSlackCanvas_179KS000000Cb13, ShareSlackCanvas_179KS000000Cb13, UpdateSlackCanvas_179KS000000Cb13, SearchSlack_179KS000000Cb13, AnswerQuestionsWithKnowledge_16jKS00000000Au.✅ : no error when ../../oss/plugin-agent/bin/run.js agent generate template --agent-file force-app/main/default/bots/Slack_Employee_Help/Slack_Employee_Help.bot-meta.xml --agent-version 1 --source-org test-kgyvuoleixoe@example.com
Saved BotTemplate to:
- /Users/william.ruemmele/projects/scratches/ABCD/force-app/main/default/botTemplates/Slack_Employee_Help_v1_Template.botTemplate-meta.xml
Saved GenAiPlannerBundle to:
- /Users/william.ruemmele/projects/scratches/ABCD/force-app/main/default/genAiPlannerBundles/Slack_Employee_Help_v1_Template/Slack_Employee_Help_v1_Template.genAiPlannerBundle |
|
|
||
| public static readonly flags = { | ||
| 'api-version': Flags.orgApiVersion(), | ||
| 'source-org': Flags.requiredOrg({ |
There was a problem hiding this comment.
why use --source-org and not --target-org like other commands? using Flags.requiredOrg creates an additional alias, of -o, see help: -o, --source-org=<value> should this change to be our standard --target-org?
What does this PR do?
Verify that a global assets that is referenced by a local asset in the planner bundle exists in the source org.
What issues does this PR fix or reference?
@W-20926773@