Repository navigation
test(agentforce): add lint tests for config agent name and variable validation rules - #100
dsorajisto wants to merge 1 commit into
Conversation
ef28d38 to
5eb6c75
Compare
BichengWang
left a comment
There was a problem hiding this comment.
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.
What
Adds lint tests for five Agentforce diagnostics that weren't checked by any existing test (by code or by message):
config-missing-agent-nameandconfig-duplicate-agent-name(config-validation.ts)invalid-variable-name,linked-variable-cannot-be-objectandlinked-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 indialect/agentforce/src/tests/lint.test.ts. These tests sit alongside them and use the samerunSecurityLinthelper.Coverage
developer_name, both set, and each name alone (no error)__csuffix exception,__before a__csuffix, and a valid nameobjecttype rejected, default value rejected, and a default on a mutable variable allowedI checked that each "reports error" test fails when the rule it covers is disabled.
Testing
pnpm testindialect/agentforce: 33 files, 861 tests pass.