Skip to content

W-20926773: global assets validation#370

Merged
WillieRuemmele merged 15 commits intofix-bot-template-generationfrom
er/globalAssetsValidation
Mar 23, 2026
Merged

W-20926773: global assets validation#370
WillieRuemmele merged 15 commits intofix-bot-template-generationfrom
er/globalAssetsValidation

Conversation

@EstebanRomero84
Copy link
Contributor

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@

Copy link
Contributor

@jshackell-sfdc jshackell-sfdc left a comment

Choose a reason for hiding this comment

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

See my small edits, thx.

EstebanRomero84 and others added 3 commits March 20, 2026 16:06
Co-authored-by: Juliet Shackell <63259011+jshackell-sfdc@users.noreply.github.com>
@EstebanRomero84 EstebanRomero84 marked this pull request as ready for review March 23, 2026 13:23
@EstebanRomero84 EstebanRomero84 requested a review from a team as a code owner March 23, 2026 13:23

// replace references in attributeMappings and ruleExpressionAssignments
for (const mapping of plannerBundle.attributeMappings ?? []) {
const attributeMappings = Array.isArray(plannerBundle.attributeMappings)
Copy link
Contributor

Choose a reason for hiding this comment

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

could you use ensureArray? and same with ruleExpressionAssignments below

],
genAiPlugins: [],
},
} as unknown as GenAiPlannerBundleExt;
Copy link
Contributor

Choose a reason for hiding this comment

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

you shouldn't need to cast as unknown just as GenAiPlannerBundleExt

);
});

it('Converts an Agent into an BotTemplate and GenAiPlannerBundle', async () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

will NUTs be coming later once all the changes are ready for main?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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.

@WillieRuemmele
Copy link
Contributor

WillieRuemmele commented Mar 23, 2026

QA notes


✅ : error when using --source-org when it's empty/missing metadata

../../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 --source-org is where the retrieved MD came from

../../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({
Copy link
Contributor

Choose a reason for hiding this comment

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

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?

@WillieRuemmele WillieRuemmele merged commit 1861def into fix-bot-template-generation Mar 23, 2026
15 checks passed
@WillieRuemmele WillieRuemmele deleted the er/globalAssetsValidation branch March 23, 2026 21:07
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.

4 participants