Skip to content

Conversation

@EstebanRomero84
Copy link
Contributor

What does this PR do?

Update error handling for compilation errors.

What issues does this PR fix or reference?

@W-19995335@

const targetOrg = flags['target-org'];
const conn = targetOrg.getConnection(flags['api-version']);
// Call Agent.compileAgent() API
await sleep(Duration.seconds(2));
Copy link
Contributor

Choose a reason for hiding this comment

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

let's remove this and the sleep

});
});

describe('flag validation', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

these tests should be removed, the --api-version flag validation is already tested in sf-plugins-core

import { throwAgentCompilationError } from '../../../../src/common.js';

describe('Agent Validate Authoring Bundle', () => {
describe('command configuration', () => {
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we need to test that the command has a specific summary, or required project, etc...

}
} catch (error) {
// Handle validation errors
const err = SfError.wrap(error);
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be using the throwAgentCompilationError method?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This catch block is used to handle all error, not only compilation errors returned from the api

@EstebanRomero84 EstebanRomero84 marked this pull request as ready for review October 23, 2025 20:49
@WillieRuemmele
Copy link
Contributor

QA Notes


✅ : no error

 ➜  sf agent validate authoring-bundle         
? API name of the authoring bundle to validate my_AGent

 ────── Validating my_AGent Authoring Bundle ──────

 ✔ Validating Authoring Bundle 1.36s
   ▸ Status: COMPLETED
   ▸ Errors: 0

 Elapsed Time: 1.38s

✅ : error

 ➜  sf agent validate authoring-bundle  
? API name of the authoring bundle to validate my_AGent

 ────── Validating my_AGent Authoring Bundle ──────

 ✘ Validating Authoring Bundle 1.33s
   ▸ Status: ERROR
   ▸ Errors: 1

 Elapsed Time: 1.34s

Compilation of the agent file failed with the following errors:
- SyntaxError: Unexpected 'sysem' [Ln 1, Col 0]

@WillieRuemmele WillieRuemmele merged commit 46560d5 into nga Oct 23, 2025
13 checks passed
@WillieRuemmele WillieRuemmele deleted the er/update-validate-agent branch October 23, 2025 21:40
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.

3 participants