Skip to content

test(agentforce): add lint tests for config agent name and variable validation rules - #100

Open
dsorajisto wants to merge 1 commit into
salesforce:mainfrom
dsorajisto:test-agentforce-config-variable-validation
Open

dsorajisto wants to merge 1 commit into
salesforce:mainfrom
dsorajisto:test-agentforce-config-variable-validation

Conversation

@dsorajisto

Copy link
Copy Markdown
Contributor

What

Adds lint tests for five Agentforce diagnostics that weren't checked by any existing test (by code or by message):

  • config-missing-agent-name and config-duplicate-agent-name (config-validation.ts)
  • invalid-variable-name, linked-variable-cannot-be-object and linked-variable-cannot-have-default (variable-validation.ts)

The other codes in these passes (agent-type-not-allowed, mutable-variable-cannot-have-source, linked-variable-missing-source, linked-variable-cannot-be-list) are already tested in dialect/agentforce/src/tests/lint.test.ts. These tests sit alongside them and use the same runSecurityLint helper.

Coverage

  • Config agent name: neither name set, a blank developer_name, both set, and each name alone (no error)
  • Variable names: leading underscore, trailing underscore, consecutive underscores, the __c suffix exception, __ before a __c suffix, and a valid name
  • Linked variables: object type rejected, default value rejected, and a default on a mutable variable allowed

I checked that each "reports error" test fails when the rule it covers is disabled.

Testing

pnpm test in dialect/agentforce: 33 files, 861 tests pass.

@dsorajisto
dsorajisto force-pushed the test-agentforce-config-variable-validation branch from ef28d38 to 5eb6c75 Compare October 21, 2026 01:37

@BichengWang BichengWang 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.

Reviewed 5eb6c75cc71337b0721ea520a6c1670856ae9921 against ace15eb2dc75564fd9e214385ac045c539056770. No blocking findings.

The new cases exercise the registered rules through the real parser and Agentforce schema. The positive controls for a sole developer_name or agent_name, the __c suffix exception, single underscores, and mutable defaults distinguish allowed inputs from the rejected cases. The variable diagnostic target checks also cover the metadata consumers use to identify the declaration.

I independently disabled each of the five covered checks in turn. The missing-name mutation failed both absent/blank-name cases; duplicate-name failed its case; disabling name validation failed all four rejected-name cases; and the linked-object/default mutations each failed their respective case. The allowed-input controls continued to pass. All temporary mutations were restored.

Offline validation with Node 22.20.0 and pnpm 10.34.6: all 33 Agentforce dialect test files passed (861 tests), including a fresh run after the mutation checks; the dialect typecheck, ESLint and Prettier checks for the changed file passed. The normal Turbo build was blocked by the missing tree-sitter CLI, so I built the required TypeScript dependencies and dialect packages directly. These checks used the default JavaScript parser; I did not run the full monorepo CI suite.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants