Skip to content

codegen: file-upload body params reference undefined shell variables #589

Description

@JoshMock

Opened from failing KB functional tests in test/functional/kb/definitions/. Generated functional-test scripts reference file-upload shell variables that are never defined. file/multipart body fields emit a variable (CSV_FILE, ITEMS_FILE, SCRIPT_FILE) that the codegen generator never binds, producing unbound variable on stack and downstream input_error on serverless.

In codegen/functional/, when a body param is file-typed, emit a heredoc that writes fixture content to a temp file, bind the referenced variable, and clean it up in teardown. This requires declaring fixture content in the definition (inline files: block), so parser.ts support is part of the fix. Add a codegen unit test asserting the variable is defined and the file exists before the command runs.

Failing test definitions:

  • security_entity_analytics_api_privmon_bulk_upload_users_c_s_v.yml (stack)
  • security_lists_api_import_list_items.yml (stack)
  • security_endpoint_management_api_endpoint_script_library_create_script.yml (serverless; and dependent script-library ops)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions