lint error on complex_data_type field for primitive type#39
Open
nishank-bhatnagar wants to merge 1 commit into
Open
lint error on complex_data_type field for primitive type#39nishank-bhatnagar wants to merge 1 commit into
nishank-bhatnagar wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Refines the
complex-data-typelint pass for Agentforce so it correctly handles primitive types, and adds focused test coverage for the new behavior.Why
complex_data_type_nameis only meaningful forobjectandlist[object]. Previously:object/list[object]declarations lackedcomplex_data_type_name/schema.number,string,id) was declared with acomplex_data_type_name, even though that combination is invalid.objectandlistdoes not need acomplex_data_type_nameto validate — so specifying one on a primitive should be a hard error.How
dialect/agentforce/src/lint/passes/complex-data-type.ts
isObjectType→isComplexType, backed by a named setREQURIED_COMPLEX_DATA_TYPE = { object, list[object] }. Anything outside the set is treated as primitive.checkInputsandcheckOutputsinto a singlecheckDecls(decls, actionName, kind)to remove duplication;kind('input' | 'output') only shapes the diagnostic message and gates the input-onlyschema:escape hatch.complex-data-type-on-primitive(Error severity): emitted when a non-whitelisted type carries acomplex_data_type_name.object-type-missing-schema(Warning) for whitelisted types missing schema info.Notable design decisions:
list[<primitive>]is intentionally classified as primitive (list[object]is the only list variant that supportscomplex_data_type_name).schema:remains an alternative tocomplex_data_type_namefor inputs only; outputs still requirecomplex_data_type_name.dialect/agentforce/src/tests/lint.test.ts
Added a
describe('complex data type rule', …)block with awrap(inputs, outputs)helper that builds a minimalsubagentAfScript fixture, plus these scenarios:number) input +complex_data_type_namecomplex-data-type-on-primitivenumber) input, nocomplex_data_type_namestring) output +complex_data_type_nameit.eachoverboolean,integer,id,date,datetime,time,timestamp,currency,longwithcomplex_data_type_nameobjectinput +complex_data_type_nameobjectinput +schema:list[object]output +complex_data_type_namelist[string]input +complex_data_type_nameobjectoutputTest Plan
pnpm vitest run src/tests/lint.test.ts→ 125 passed, including the pre-existing'warns with actions:'warning case.pnpm typecheckclean (nopnpm lintscript in this package).Checklist
git diff main— 2 files, 223 insertions / 43 deletions; logic isolated tocomplex-data-type.tsand tests)