Skip to content

Conversation

@ggreer
Copy link
Contributor

@ggreer ggreer commented Sep 29, 2025

Description

  • Bug fix
  • New feature

Useful links:


Note

Adds a configurable connector actions framework with execution/validation, updates syncers and provisioning errors, and refreshes key dependencies.

  • Actions:
    • Introduces configurable connector actions with schema/validation, runtime registration, and execution flow (pkg/connector/action.go, integrated in pkg/connector/connector.go).
  • Sync/BSql:
    • Updates to support action runs and related logic (pkg/bsql/*.go).
  • Provisioning:
    • Clearer, more contextual error messages.
  • Examples:
    • Updates in examples/postgres-test.yml.
  • Dependencies:
    • Bumps major libs (e.g., github.com/conductorone/baton-sdk to v0.4.6 incl. pkg/actions), migrates to github.com/shirou/gopsutil/v4, updates testify to v1.11.1, adds github.com/ebitengine/purego, removes go-m1cpu.

Written by Cursor Bugbot for commit 585b60f. This will update automatically on new commits. Configure here.

Summary by CodeRabbit

  • New Features

    • Admins can define and run configurable connector actions with argument schemas, validation, runtime registration, and a dedicated action execution flow; includes a new action-oriented syncer to support action runs.
  • Bug Fixes

    • Provisioning error messages now include clearer context to make failures easier to diagnose.
  • Chores

    • Upgraded several dependencies for stability and compatibility (SDKs, gRPC, system utilities, and testing libraries).

@coderabbitai
Copy link

coderabbitai bot commented Sep 29, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Walkthrough

Adds configurable, query-driven actions with runtime registration and execution; extends config with Action and Argument types and validation; exposes RunProvisioningQueries and NewActionSyncer for action execution; updates callers and dependency versions; adds a TODO for SQL connection validation.

Changes

Cohort / File(s) Summary
Dependencies
go.mod
Updated dependency versions: github.com/conductorone/baton-sdk → v0.4.6, github.com/stretchr/testify → v1.11.1; added google.golang.org/grpc v1.71.1; added indirect github.com/ebitengine/purego v0.8.4; upgraded github.com/shirou/gopsutil to v4 and golang.org/x/sys to v0.35.0; adjusted direct/indirect entries.
Config: Action model
pkg/bsql/config.go
Added Actions map[string]ActionConfig to Config; new ActionConfig and ArgumentConfig types; added Config.HasActions() and ActionConfig.Validate() enforcing presence of Query and argument validation rules.
Connector: Action manager & handler
pkg/connector/action.go
Added Connector.RegisterActionManager(ctx) to build/register actions from config; added ActionTypeMap and convertActionTypes(...); added Connector.handleQueryAction(...) to execute configured query actions, map args, invoke provisioning via an ActionSyncer, and return structured results and annotations with logging and error handling.
Connector: Validation TODO
pkg/connector/connector.go
Added // TODO: Validate SQL connection. comment in Validate; behavior unchanged.
Provisioning API & callers
pkg/bsql/query.go, pkg/bsql/provisioning.go, pkg/bsql/user_syncer.go
Renamed private runProvisioningQueries → exported RunProvisioningQueries; added error context wrapping on prepare/exec failures; updated callers in Grant/Revoke/CreateAccount/Rotate to call exported method.
SQL Syncer: action constructor
pkg/bsql/sql_syncer.go
Added NewActionSyncer(ctx, db, dbEngine, celEnv, fullConfig) (*SQLSyncer, error) to construct an SQLSyncer used for action execution.

Sequence Diagram(s)

sequenceDiagram
  autonumber
  actor User
  participant Connector
  participant Config as "Config (Actions)"
  participant SDK as "CustomActionManager"

  User->>Connector: Initialize connector
  Connector->>Config: Load Actions
  Connector->>Connector: Validate ActionConfig(s)
  alt validation error
    Connector-->>User: Return error
  else
    Connector->>SDK: Register action schemas & handlers
    SDK-->>Connector: Manager ready
    Connector-->>User: Initialization complete
  end
Loading
sequenceDiagram
  autonumber
  actor Caller
  participant SDK as "CustomActionManager"
  participant Connector
  participant Syncer as "SQLSyncer / ActionSyncer"
  participant DB as "SQL Backend"

  Caller->>SDK: Invoke Action(name, args)
  SDK->>Connector: handleQueryAction(name, args)
  Connector->>Syncer: NewActionSyncer(...) / prepare vars
  Connector->>Syncer: RunProvisioningQueries(ctx, queries, vars, useTx)
  Syncer->>DB: Execute queries
  alt success
    DB-->>Syncer: Result(s)
    Syncer-->>Connector: Success
    Connector-->>SDK: Struct payload + annotations
    SDK-->>Caller: Success
  else error
    DB-->>Syncer: Error
    Syncer-->>Connector: Wrapped error
    Connector-->>SDK: Error response
    SDK-->>Caller: Error
  end
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Poem

I twitch my nose at configs bright and new,
Actions queued and arguments in view,
I hop through queries, validate each part,
Run syncs, return payloads with a heart,
Carrots compiled, handlers ready to chew 🥕

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title “Add support for custom actions.” succinctly encapsulates the primary feature introduced by this PR, namely the addition of a configurable actions framework and related connectors, without extraneous detail or vague language. It is clear, specific, and directly tied to the core changes in both the config and connector code, ensuring that teammates scanning the history will immediately understand the main purpose of the update.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ggreer/actions

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ea33a63 and 585b60f.

📒 Files selected for processing (1)
  • pkg/connector/action.go (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • pkg/connector/action.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: Cursor Bugbot

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4df7ccd and 99c3811.

⛔ Files ignored due to path filters (296)
  • examples/postgres-test.yml is excluded by none and included by none
  • go.sum is excluded by !**/*.sum and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/actions/actions.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/sdk/version.go is excluded by !vendor/** and included by none
  • vendor/github.com/conductorone/baton-sdk/pkg/tasks/c1api/hello.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/.gitignore is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/LICENSE is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/README.md is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/abi_amd64.h is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/abi_arm64.h is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlerror.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_android.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_nocgo_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_nocgo_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_playground.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/dlfcn_stubs.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/func.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/go_runtime.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/cgo/dlfcn_cgo_unix.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/cgo/empty.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/cgo/syscall_cgo_unix.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/abi_amd64.h is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/abi_arm64.h is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/asm_amd64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/asm_arm64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/callbacks.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/doc.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_darwin_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_darwin_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_freebsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_freebsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_libinit.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_linux_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_setenv.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/go_util.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/iscgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/libcgo_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/setenv.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/symbols.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/symbols_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_amd64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_arm64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/fakecgo/trampolines_stubs.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/internal/strings/strings.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/is_ios.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/struct_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/struct_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/struct_other.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/sys_amd64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/sys_arm64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/sys_unix_arm64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/syscall.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/syscall_cgo_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/syscall_sysv.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/syscall_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/zcallback_amd64.s is excluded by !vendor/** and included by none
  • vendor/github.com/ebitengine/purego/zcallback_arm64.s is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/cpu/cpu_darwin_nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/host/host_darwin_cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/host/host_darwin_nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/host/host_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/host/smc_darwin.c is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/host/smc_darwin.h is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/internal/common/binary.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/internal/common/common_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/mem/mem_darwin_nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/net/net_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/net/net_linux_111.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/net/net_linux_116.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/process/process_bsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/process/process_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/process/process_darwin_cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/process/process_darwin_nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/process/process_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/process/process_freebsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v3/process/process_plan9.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/LICENSE is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/common/env.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_aix_nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_darwin_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_dragonfly_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_freebsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_netbsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_openbsd_riscv64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_plan9.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_solaris.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/cpu/cpu_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_aix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_aix_ppc64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_bsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_darwin_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_darwin_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_freebsd_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_freebsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_freebsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_freebsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_loong64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_mips.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_mips64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_mips64le.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_mipsle.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_ppc64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_ppc64le.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_riscv64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_linux_s390x.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_netbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_openbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_openbsd_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_openbsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_openbsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_openbsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_openbsd_riscv64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_posix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_solaris.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/host/host_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common_netbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common_openbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common_unix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/common_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/endian.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/readlink_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/sleep.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/internal/common/warnings.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/ex_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/ex_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_aix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_aix_nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_bsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_netbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_openbsd_riscv64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_plan9.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_solaris.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/mem/mem_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_aix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_aix_cgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_aix_nocgo.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_openbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_solaris.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_unix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/net/net_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_bsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_darwin.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_darwin_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_darwin_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_fallback.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_freebsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_freebsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_linux.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_openbsd.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_386.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_amd64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_arm64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_openbsd_riscv64.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_plan9.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_posix.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_solaris.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_windows.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_windows_32bit.go is excluded by !vendor/** and included by none
  • vendor/github.com/shirou/gopsutil/v4/process/process_windows_64bit.go is excluded by !vendor/** and included by none
  • vendor/github.com/shoenig/go-m1cpu/.golangci.yaml is excluded by !vendor/** and included by none
  • vendor/github.com/shoenig/go-m1cpu/LICENSE is excluded by !vendor/** and included by none
  • vendor/github.com/shoenig/go-m1cpu/Makefile is excluded by !vendor/** and included by none
  • vendor/github.com/shoenig/go-m1cpu/README.md is excluded by !vendor/** and included by none
  • vendor/github.com/shoenig/go-m1cpu/cpu.go is excluded by !vendor/** and included by none
  • vendor/github.com/shoenig/go-m1cpu/incompatible.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/assertion_compare.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/assertion_format.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/assertion_forward.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/assertion_order.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/assertions.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/doc.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/http_assertions.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/yaml/yaml_custom.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/yaml/yaml_default.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/assert/yaml/yaml_fail.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/require/doc.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/require/require.go is excluded by !vendor/** and included by none
  • vendor/github.com/stretchr/testify/require/require_forward.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/cpu/cpu.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/cpu/cpu_linux_riscv64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/cpu/cpu_riscv64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/mkerrors.sh is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/syscall_darwin.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_386.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_amd64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_arm.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_arm64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_loong64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_mips.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_mips64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_mips64le.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_mipsle.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_ppc.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_ppc64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_ppc64le.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_riscv64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_s390x.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zerrors_linux_sparc64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_386.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_amd64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_arm.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_arm64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_loong64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_mips.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_mips64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_mips64le.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_mipsle.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_ppc.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_ppc64le.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_riscv64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_s390x.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/zsysnum_linux_sparc64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_386.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_arm.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_loong64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_mips.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go is excluded by !vendor/** and included by none
  • vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go is excluded by !vendor/** and included by none
📒 Files selected for processing (4)
  • go.mod (5 hunks)
  • pkg/bsql/config.go (3 hunks)
  • pkg/connector/action.go (1 hunks)
  • pkg/connector/connector.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/connector/connector.go
  • pkg/connector/action.go
  • pkg/bsql/config.go
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Cursor Bugbot
  • GitHub Check: go-lint
  • GitHub Check: test
  • GitHub Check: go-test (ubuntu-latest)
🔇 Additional comments (1)
go.mod (1)

98-98: Remove gopsutil import path update check
Search shows no github.com/shirou/gopsutil imports in the codebase (it’s marked indirect in go.mod), so no import path updates are needed.

@ggreer ggreer changed the title (WIP) Add support for custom actions. Add support for custom actions. Sep 29, 2025
cursor[bot]

This comment was marked as outdated.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 99c3811 and 5500dfb.

⛔ Files ignored due to path filters (1)
  • examples/postgres-test.yml is excluded by none and included by none
📒 Files selected for processing (5)
  • pkg/bsql/provisioning.go (2 hunks)
  • pkg/bsql/query.go (2 hunks)
  • pkg/bsql/sql_syncer.go (1 hunks)
  • pkg/bsql/user_syncer.go (2 hunks)
  • pkg/connector/action.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/bsql/sql_syncer.go
  • pkg/bsql/user_syncer.go
  • pkg/bsql/query.go
  • pkg/connector/action.go
  • pkg/bsql/provisioning.go
🧬 Code graph analysis (3)
pkg/bsql/sql_syncer.go (3)
pkg/database/database.go (1)
  • DbEngine (20-20)
pkg/bcel/bcel.go (1)
  • Env (17-19)
pkg/bsql/config.go (1)
  • Config (17-32)
pkg/bsql/query.go (1)
pkg/bsql/sql_syncer.go (1)
  • SQLSyncer (20-27)
pkg/connector/action.go (3)
pkg/connector/connector.go (1)
  • Connector (18-23)
pkg/bsql/config.go (1)
  • ActionConfig (412-422)
pkg/bsql/sql_syncer.go (1)
  • NewActionSyncer (62-70)
🔇 Additional comments (1)
pkg/connector/action.go (1)

108-115: Fix closure capture before registering actions.

actionCfg and actionSchema are reused loop variables. Every handler will close over the final iteration’s values, so every registered action ends up executing with the last config/schema. Copy them to per-iteration locals before registering the closure.

Apply this diff:

-		err := actionManager.RegisterAction(ctx, actionKey, actionSchema, func(ctx context.Context, args *structpb.Struct) (*structpb.Struct, annotations.Annotations, error) {
-			return c.handleQueryAction(ctx, actionCfg, actionSchema, args)
+		cfg := actionCfg
+		schema := actionSchema
+
+		err := actionManager.RegisterAction(ctx, actionKey, schema, func(ctx context.Context, args *structpb.Struct) (*structpb.Struct, annotations.Annotations, error) {
+			return c.handleQueryAction(ctx, cfg, schema, args)
 		})

Comment on lines 69 to 100
switch argCfg.Type {
case "string":
stringField := &config_sdk.StringField{}
if defaultValue != nil {
stringField.DefaultValue = defaultValue.(string)
}
arg.Field = &config_sdk.Field_StringField{StringField: stringField}
case "boolean":
boolField := &config_sdk.BoolField{}
if defaultValue != nil {
boolField.DefaultValue = defaultValue.(bool)
}
arg.Field = &config_sdk.Field_BoolField{BoolField: boolField}
case "number":
intField := &config_sdk.IntField{}
if defaultValue != nil {
intField.DefaultValue = defaultValue.(int64)
}
arg.Field = &config_sdk.Field_IntField{IntField: intField}
case "string_list":
stringSliceField := &config_sdk.StringSliceField{}
if defaultValue != nil {
stringSliceField.DefaultValue = defaultValue.([]string)
}
arg.Field = &config_sdk.Field_StringSliceField{StringSliceField: stringSliceField}
case "string_map":
stringMapField := &config_sdk.StringMapField{}
if defaultValue != nil {
stringMapField.DefaultValue = defaultValue.(map[string]*anypb.Any)
}
arg.Field = &config_sdk.Field_StringMapField{StringMapField: stringMapField}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Guard default-value conversions to avoid panics.

Each defaultValue.(…) assertion will panic whenever the config supplies a valid default that doesn’t already have the exact target type (e.g., YAML/JSON numbers decode as int/float64, not int64). Convert via a type switch (and return a validation error on mismatch) before populating the proto fields.

Example fix:

-			case "number":
-				intField := &config_sdk.IntField{}
-				if defaultValue != nil {
-					intField.DefaultValue = defaultValue.(int64)
-				}
-				arg.Field = &config_sdk.Field_IntField{IntField: intField}
+			case "number":
+				intField := &config_sdk.IntField{}
+				switch v := defaultValue.(type) {
+				case nil:
+				case int, int32, int64:
+					intField.DefaultValue = int64(reflect.ValueOf(v).Int())
+				case float32, float64:
+					intField.DefaultValue = int64(reflect.ValueOf(v).Float())
+				default:
+					return nil, fmt.Errorf("invalid numeric default for %s: %T", actionKey, defaultValue)
+				}
+				arg.Field = &config_sdk.Field_IntField{IntField: intField}

Apply the same pattern for the other branches (string, boolean, string_list, string_map) so config-supplied defaults cannot crash the process.

cursor[bot]

This comment was marked as outdated.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
pkg/connector/action.go (3)

3-18: Organize imports per project standards.

Group as: standard library, third‑party, then project imports; alphabetize within each group. Move github.com/conductorone/baton-sql/pkg/bsql to the project group (last). Run goimports to enforce. As per coding guidelines.


20-27: Document exported symbol or make it unexported.

Add a doc comment for ActionTypeMap (exported), or unexport it if not required outside this package. As per coding guidelines.

+// ActionTypeMap maps action_type strings from config to v2.ActionType enums.
 var ActionTypeMap = map[string]v2.ActionType{

59-69: Ensure argument Name is set (fallback to config key) and cascade DisplayName.

If argCfg.Name is empty, schema and request parsing will use an empty field name. Fall back to the map key for stability.

-        for _, argCfg := range actionCfg.Arguments {
+        for k, argCfg := range actionCfg.Arguments {
           arg := &config_sdk.Field{
             Name:        argCfg.Name,
             DisplayName: argCfg.DisplayName,
             Description: argCfg.Description,
             IsRequired:  argCfg.Required,
           }
-          if arg.DisplayName == "" {
-            arg.DisplayName = argCfg.Name
-          }
+          if arg.Name == "" {
+            arg.Name = k
+          }
+          if arg.DisplayName == "" {
+            arg.DisplayName = arg.Name
+          }
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a05e1ef and 7ef128a.

📒 Files selected for processing (1)
  • pkg/connector/action.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/connector/action.go
🧬 Code graph analysis (1)
pkg/connector/action.go (3)
pkg/connector/connector.go (1)
  • Connector (18-23)
pkg/bsql/config.go (1)
  • ActionConfig (412-422)
pkg/bsql/sql_syncer.go (1)
  • NewActionSyncer (62-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (4)
pkg/connector/action.go (4)

118-120: Closure capture fix looks good.

Using per‑iteration locals (cfg, schema) avoids capturing range variables.


111-113: Good validation for required query.

Early return on missing Query is correct.


69-107: Fix unsafe default-value assertions (panic risk) and coerce types.

Type assertions on defaultValue for string/bool/list/map will panic for valid YAML/JSON values (e.g., []any, map[string]any). Guard with type switches and convert.

           switch argCfg.Type {
           case "string":
             stringField := &config_sdk.StringField{}
-            if defaultValue != nil {
-              stringField.DefaultValue = defaultValue.(string)
-            }
+            switch v := defaultValue.(type) {
+            case nil:
+            case string:
+              stringField.DefaultValue = v
+            default:
+              return nil, fmt.Errorf("invalid string default for %s.%s: %T", actionKey, argCfg.Name, defaultValue)
+            }
             arg.Field = &config_sdk.Field_StringField{StringField: stringField}
           case "boolean":
             boolField := &config_sdk.BoolField{}
-            if defaultValue != nil {
-              boolField.DefaultValue = defaultValue.(bool)
-            }
+            switch v := defaultValue.(type) {
+            case nil:
+            case bool:
+              boolField.DefaultValue = v
+            default:
+              return nil, fmt.Errorf("invalid boolean default for %s.%s: %T", actionKey, argCfg.Name, defaultValue)
+            }
             arg.Field = &config_sdk.Field_BoolField{BoolField: boolField}
           case "number":
             intField := &config_sdk.IntField{}
             switch v := defaultValue.(type) {
             case nil:
             case int, int32, int64:
               intField.DefaultValue = reflect.ValueOf(v).Int()
             case float32, float64:
               intField.DefaultValue = int64(reflect.ValueOf(v).Float())
             default:
               return nil, fmt.Errorf("invalid numeric default for %s: %T", actionKey, defaultValue)
             }
             arg.Field = &config_sdk.Field_IntField{IntField: intField}
           case "string_list":
             stringSliceField := &config_sdk.StringSliceField{}
-            if defaultValue != nil {
-              stringSliceField.DefaultValue = defaultValue.([]string)
-            }
+            switch v := defaultValue.(type) {
+            case nil:
+            case []string:
+              stringSliceField.DefaultValue = v
+            case []interface{}:
+              strs := make([]string, 0, len(v))
+              for _, it := range v {
+                strs = append(strs, fmt.Sprint(it))
+              }
+              stringSliceField.DefaultValue = strs
+            default:
+              return nil, fmt.Errorf("invalid string_list default for %s.%s: %T", actionKey, argCfg.Name, defaultValue)
+            }
             arg.Field = &config_sdk.Field_StringSliceField{StringSliceField: stringSliceField}
           case "string_map":
             stringMapField := &config_sdk.StringMapField{}
-            if defaultValue != nil {
-              stringMapField.DefaultValue = defaultValue.(map[string]*anypb.Any)
-            }
+            switch m := defaultValue.(type) {
+            case nil:
+            case map[string]string:
+              out := make(map[string]*anypb.Any, len(m))
+              for k, v := range m {
+                av, _ := anypb.New(structpb.NewStringValue(v))
+                out[k] = av
+              }
+              stringMapField.DefaultValue = out
+            case map[string]interface{}:
+              out := make(map[string]*anypb.Any, len(m))
+              for k, v := range m {
+                sv, ok := v.(string)
+                if !ok {
+                  return nil, fmt.Errorf("invalid string_map default for %s.%s: value for key %q is %T (want string)", actionKey, argCfg.Name, k, v)
+                }
+                av, _ := anypb.New(structpb.NewStringValue(sv))
+                out[k] = av
+              }
+              stringMapField.DefaultValue = out
+            default:
+              return nil, fmt.Errorf("invalid string_map default for %s.%s: %T", actionKey, argCfg.Name, defaultValue)
+            }
             arg.Field = &config_sdk.Field_StringMapField{StringMapField: stringMapField}
           }

Based on learnings.


140-165: Validate incoming args, guard nils, and normalize types (prevent panics).

Current code can deref nil (e.g., GetListValue().Values) and passes []*structpb.Value instead of []string. Also unify numbers to int64.

-  var argMap = make(map[string]any)
-  for k, v := range actionCfg.Arguments {
-    if _, ok := args.Fields[v.Name]; !ok {
+  argMap := make(map[string]any)
+  fields := map[string]*structpb.Value{}
+  if args != nil && args.GetFields() != nil {
+    fields = args.GetFields()
+  }
+  for k, v := range actionCfg.Arguments {
+    name := v.Name
+    if name == "" {
+      name = k
+    }
+    pbArg, ok := fields[name]
+    if !ok || pbArg == nil {
       if v.Required {
-        return nil, nil, fmt.Errorf("argument %s is required", v.Name)
+        return nil, nil, fmt.Errorf("missing required argument %q", name)
       }
       if v.Default != nil {
         argMap[k] = v.Default
       }
       continue
     }
     switch v.Type {
     case "string":
-      argMap[k] = args.Fields[v.Name].GetStringValue()
+      if _, ok := pbArg.Kind.(*structpb.Value_StringValue); !ok {
+        return nil, nil, fmt.Errorf("argument %q must be a string", name)
+      }
+      argMap[k] = pbArg.GetStringValue()
     case "boolean":
-      argMap[k] = args.Fields[v.Name].GetBoolValue()
+      if _, ok := pbArg.Kind.(*structpb.Value_BoolValue); !ok {
+        return nil, nil, fmt.Errorf("argument %q must be a boolean", name)
+      }
+      argMap[k] = pbArg.GetBoolValue()
     case "number":
-      argMap[k] = args.Fields[v.Name].GetNumberValue()
+      if _, ok := pbArg.Kind.(*structpb.Value_NumberValue); !ok {
+        return nil, nil, fmt.Errorf("argument %q must be a number", name)
+      }
+      argMap[k] = int64(pbArg.GetNumberValue())
     case "string_list":
-      argMap[k] = args.Fields[v.Name].GetListValue().Values
+      listVal := pbArg.GetListValue()
+      if listVal == nil {
+        if v.Required {
+          return nil, nil, fmt.Errorf("argument %q must be a list of strings", name)
+        }
+        continue
+      }
+      strs := make([]string, 0, len(listVal.Values))
+      for _, item := range listVal.Values {
+        sv, ok := item.Kind.(*structpb.Value_StringValue)
+        if !ok {
+          return nil, nil, fmt.Errorf("argument %q must be a list of strings", name)
+        }
+        strs = append(strs, sv.StringValue)
+      }
+      argMap[k] = strs
     case "string_map":
-      argMap[k] = args.Fields[v.Name].GetStructValue().AsMap()
+      sv := pbArg.GetStructValue()
+      if sv == nil {
+        if v.Required {
+          return nil, nil, fmt.Errorf("argument %q must be a string map", name)
+        }
+        continue
+      }
+      argMap[k] = sv.AsMap()
     default:
       return nil, nil, fmt.Errorf("unsupported argument type: %s", v.Type)
     }
   }

Based on learnings.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7ef128a and 6082f82.

📒 Files selected for processing (1)
  • pkg/connector/action.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/connector/action.go
🧬 Code graph analysis (1)
pkg/connector/action.go (3)
pkg/connector/connector.go (1)
  • Connector (18-23)
pkg/bsql/config.go (1)
  • ActionConfig (412-422)
pkg/bsql/sql_syncer.go (1)
  • NewActionSyncer (62-70)
🔇 Additional comments (2)
pkg/connector/action.go (2)

148-148: Stop logging full action configuration.

Line 148 still logs actionCfg with zap.Any, which can include SQL text, defaults, and other sensitive data. This was flagged earlier and remains unresolved—please log only safe metadata (e.g., key and high-level type).

-		l.Info("registered action", zap.String("action", actionKey), zap.Any("actionCfg", actionCfg))
+		l.Info("registered action", zap.String("action", actionKey), zap.Strings("action_types", actionCfg.ActionType))

154-157: Redact action handler debug log.

The debug statement still dumps the entire config, schema, and raw args, leaking SQL and user input into logs. This mirrors the previously raised concern; trim it down to safe identifiers before we ship.

-	l.Debug("actionHandler", zap.Any("actionCfg", actionCfg), zap.Any("actionSchema", actionSchema), zap.Any("args", args))
+	l.Debug("actionHandler", zap.String("action", actionCfg.Name), zap.Int("argument_count", len(actionCfg.Arguments)))

Comment on lines 163 to 188
var argMap = make(map[string]any)
for k, v := range actionCfg.Arguments {
if _, ok := args.Fields[v.Name]; !ok {
if v.Required {
return nil, nil, fmt.Errorf("argument %s is required", v.Name)
}
if v.Default != nil {
argMap[k] = v.Default
}
continue
}
switch v.Type {
case "string":
argMap[k] = args.Fields[v.Name].GetStringValue()
case "boolean":
argMap[k] = args.Fields[v.Name].GetBoolValue()
case "number":
argMap[k] = args.Fields[v.Name].GetNumberValue()
case "string_list":
argMap[k] = args.Fields[v.Name].GetListValue().Values
case "string_map":
argMap[k] = args.Fields[v.Name].GetStructValue().AsMap()
default:
return nil, nil, fmt.Errorf("unsupported argument type: %s", v.Type)
}
}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical

Prevent nil-arg panic in action handler.

Line 165 dereferences args without ensuring it’s non-nil. When an action is invoked without a payload, Baton passes nil; calling args.Fields[...] then panics and crashes the worker. Guard the struct before reading fields.

@@
-	var argMap = make(map[string]any)
+	if args == nil {
+		args = &structpb.Struct{Fields: map[string]*structpb.Value{}}
+	}
+
+	var argMap = make(map[string]any)
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
var argMap = make(map[string]any)
for k, v := range actionCfg.Arguments {
if _, ok := args.Fields[v.Name]; !ok {
if v.Required {
return nil, nil, fmt.Errorf("argument %s is required", v.Name)
}
if v.Default != nil {
argMap[k] = v.Default
}
continue
}
switch v.Type {
case "string":
argMap[k] = args.Fields[v.Name].GetStringValue()
case "boolean":
argMap[k] = args.Fields[v.Name].GetBoolValue()
case "number":
argMap[k] = args.Fields[v.Name].GetNumberValue()
case "string_list":
argMap[k] = args.Fields[v.Name].GetListValue().Values
case "string_map":
argMap[k] = args.Fields[v.Name].GetStructValue().AsMap()
default:
return nil, nil, fmt.Errorf("unsupported argument type: %s", v.Type)
}
}
// Guard against nil args to avoid panic when Baton invokes the action without a payload.
if args == nil {
args = &structpb.Struct{Fields: map[string]*structpb.Value{}}
}
var argMap = make(map[string]any)
for k, v := range actionCfg.Arguments {
if _, ok := args.Fields[v.Name]; !ok {
if v.Required {
return nil, nil, fmt.Errorf("argument %s is required", v.Name)
}
if v.Default != nil {
argMap[k] = v.Default
}
continue
}
switch v.Type {
case "string":
argMap[k] = args.Fields[v.Name].GetStringValue()
case "boolean":
argMap[k] = args.Fields[v.Name].GetBoolValue()
case "number":
argMap[k] = args.Fields[v.Name].GetNumberValue()
case "string_list":
argMap[k] = args.Fields[v.Name].GetListValue().Values
case "string_map":
argMap[k] = args.Fields[v.Name].GetStructValue().AsMap()
default:
return nil, nil, fmt.Errorf("unsupported argument type: %s", v.Type)
}
}
🤖 Prompt for AI Agents
In pkg/connector/action.go around lines 163 to 188, the code dereferences args
and args.Fields without guarding for nil, which panics when actions are invoked
with no payload; update the logic to first treat args as optional by checking if
args != nil and args.Fields != nil (or initialize a local empty map variable
when nil) before accessing args.Fields, then use that safe map for lookups and
value extraction so required/default handling still works without causing a
nil-pointer dereference.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6082f82 and ea33a63.

📒 Files selected for processing (1)
  • pkg/connector/action.go (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.go

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.go: Error handling: use fmt.Errorf with contextual messages; check specific errors with errors.Is
Organize imports: standard library first, then third-party, then project imports; alphabetize within each group
Naming: CamelCase for exported identifiers; camelCase for unexported; preserve acronyms like ID, URL, HTTP, API
Limit line length to a maximum of 200 characters
Comments for exported items must be complete sentences ending with periods
Do not use log.Fatal or log.Panic (ruleguard-enforced)

Files:

  • pkg/connector/action.go
🧬 Code graph analysis (1)
pkg/connector/action.go (3)
pkg/connector/connector.go (1)
  • Connector (18-23)
pkg/bsql/config.go (1)
  • ActionConfig (412-422)
pkg/bsql/sql_syncer.go (1)
  • NewActionSyncer (62-70)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Cursor Bugbot
🔇 Additional comments (1)
pkg/connector/action.go (1)

162-187: Handle nil action args before dereferencing.

When Baton invokes an action without a payload, it passes nil for args. Dereferencing args.Fields on Line 165 panics and crashes the connector. Initialize an empty struct/map before the loop so we can safely treat missing payloads as empty input.

-	var argMap = make(map[string]any)
-	for k, v := range actionCfg.Arguments {
-		if _, ok := args.Fields[v.Name]; !ok {
+	if args == nil {
+		args = &structpb.Struct{Fields: map[string]*structpb.Value{}}
+	} else if args.Fields == nil {
+		args.Fields = map[string]*structpb.Value{}
+	}
+
+	var argMap = make(map[string]any)
+	for k, v := range actionCfg.Arguments {
+		if _, ok := args.Fields[v.Name]; !ok {

Comment on lines +121 to +129
stringMapField := &config_sdk.StringMapField{}
switch v := defaultValue.(type) {
case nil:
case map[string]*anypb.Any:
stringMapField.DefaultValue = v
default:
return nil, fmt.Errorf("invalid string map default for %s: %T", actionKey, defaultValue)
}
arg.Field = &config_sdk.Field_StringMapField{StringMapField: stringMapField}
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Accept plain Go maps for string_map defaults.

Config authors naturally supply defaults as map[string]string (or map[string]any) in YAML/JSON. The current type assertion only allows map[string]*anypb.Any, so any real-world default triggers the “invalid string map default” error and blocks action registration. Convert common Go map inputs into the proto-backed map instead of rejecting them.

 		case "string_map":
 			stringMapField := &config_sdk.StringMapField{}
 			switch v := defaultValue.(type) {
 			case nil:
 			case map[string]*anypb.Any:
 				stringMapField.DefaultValue = v
+			case map[string]string:
+				out := make(map[string]*anypb.Any, len(v))
+				for key, value := range v {
+					pbValue := structpb.NewStringValue(value)
+					pbAny, err := anypb.New(pbValue)
+					if err != nil {
+						return nil, fmt.Errorf("invalid string map default for %s: %w", actionKey, err)
+					}
+					out[key] = pbAny
+				}
+				stringMapField.DefaultValue = out
+			case map[string]any:
+				out := make(map[string]*anypb.Any, len(v))
+				for key, value := range v {
+					pbValue, err := structpb.NewValue(value)
+					if err != nil {
+						return nil, fmt.Errorf("invalid string map default for %s: %w", actionKey, err)
+					}
+					pbAny, err := anypb.New(pbValue)
+					if err != nil {
+						return nil, fmt.Errorf("invalid string map default for %s: %w", actionKey, err)
+					}
+					out[key] = pbAny
+				}
+				stringMapField.DefaultValue = out
 			default:
 				return nil, fmt.Errorf("invalid string map default for %s: %T", actionKey, defaultValue)
 			}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
stringMapField := &config_sdk.StringMapField{}
switch v := defaultValue.(type) {
case nil:
case map[string]*anypb.Any:
stringMapField.DefaultValue = v
default:
return nil, fmt.Errorf("invalid string map default for %s: %T", actionKey, defaultValue)
}
arg.Field = &config_sdk.Field_StringMapField{StringMapField: stringMapField}
case "string_map":
stringMapField := &config_sdk.StringMapField{}
switch v := defaultValue.(type) {
case nil:
case map[string]*anypb.Any:
stringMapField.DefaultValue = v
case map[string]string:
out := make(map[string]*anypb.Any, len(v))
for key, value := range v {
pbValue := structpb.NewStringValue(value)
pbAny, err := anypb.New(pbValue)
if err != nil {
return nil, fmt.Errorf("invalid string map default for %s: %w", actionKey, err)
}
out[key] = pbAny
}
stringMapField.DefaultValue = out
case map[string]any:
out := make(map[string]*anypb.Any, len(v))
for key, value := range v {
pbValue, err := structpb.NewValue(value)
if err != nil {
return nil, fmt.Errorf("invalid string map default for %s: %w", actionKey, err)
}
pbAny, err := anypb.New(pbValue)
if err != nil {
return nil, fmt.Errorf("invalid string map default for %s: %w", actionKey, err)
}
out[key] = pbAny
}
stringMapField.DefaultValue = out
default:
return nil, fmt.Errorf("invalid string map default for %s: %T", actionKey, defaultValue)
}
arg.Field = &config_sdk.Field_StringMapField{StringMapField: stringMapField}
🤖 Prompt for AI Agents
In pkg/connector/action.go around lines 121 to 129, the string_map default
handling currently only accepts map[string]*anypb.Any and returns an error for
common Go maps; update the logic to accept map[string]*anypb.Any,
map[string]string and map[string]any (and nil) by converting non-proto maps into
the required map[string]*anypb.Any: create a new config_sdk.StringMapField, if
defaultValue is nil leave DefaultValue nil, if it's map[string]*anypb.Any assign
directly, if it's map[string]string or map[string]any iterate entries, convert
each value to an *anypb.Any (use proto/any helper like anypb.New on proto
messages or marshal non-proto values to protobuf Any via jsonpb/marshal-to-Any
or encoding into a suitable protobuf representation), handle conversion errors
by returning a descriptive fmt.Errorf, then set arg.Field =
&config_sdk.Field_StringMapField{StringMapField: stringMapField}.

Comment on lines 173 to 183
switch v.Type {
case "string":
argMap[k] = args.Fields[v.Name].GetStringValue()
case "boolean":
argMap[k] = args.Fields[v.Name].GetBoolValue()
case "number":
argMap[k] = args.Fields[v.Name].GetNumberValue()
case "string_list":
argMap[k] = args.Fields[v.Name].GetListValue().Values
case "string_map":
argMap[k] = args.Fields[v.Name].GetStructValue().AsMap()
Copy link

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟠 Major

Normalize string_list inputs to Go strings.

GetListValue().Values returns []*structpb.Value, so downstream CEL/SQL templating receives protobuf wrappers instead of the plain []string the config advertises. That breaks every action argument of type string_list. Convert the payload to a slice of Go strings before storing it in argMap.

-		case "string_list":
-			argMap[k] = args.Fields[v.Name].GetListValue().Values
+		case "string_list":
+			listValue := args.Fields[v.Name].GetListValue()
+			if listValue == nil {
+				return nil, nil, fmt.Errorf("argument %s must be a list of strings", v.Name)
+			}
+			values := listValue.GetValues()
+			items := make([]string, len(values))
+			for i, item := range values {
+				items[i] = item.GetStringValue()
+			}
+			argMap[k] = items
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
switch v.Type {
case "string":
argMap[k] = args.Fields[v.Name].GetStringValue()
case "boolean":
argMap[k] = args.Fields[v.Name].GetBoolValue()
case "number":
argMap[k] = args.Fields[v.Name].GetNumberValue()
case "string_list":
argMap[k] = args.Fields[v.Name].GetListValue().Values
case "string_map":
argMap[k] = args.Fields[v.Name].GetStructValue().AsMap()
switch v.Type {
case "string":
argMap[k] = args.Fields[v.Name].GetStringValue()
case "boolean":
argMap[k] = args.Fields[v.Name].GetBoolValue()
case "number":
argMap[k] = args.Fields[v.Name].GetNumberValue()
case "string_list":
listValue := args.Fields[v.Name].GetListValue()
if listValue == nil {
return nil, nil, fmt.Errorf("argument %s must be a list of strings", v.Name)
}
values := listValue.GetValues()
items := make([]string, len(values))
for i, item := range values {
items[i] = item.GetStringValue()
}
argMap[k] = items
case "string_map":
argMap[k] = args.Fields[v.Name].GetStructValue().AsMap()
}
🤖 Prompt for AI Agents
In pkg/connector/action.go around lines 173 to 183, the current case for
"string_list" assigns args.Fields[v.Name].GetListValue().Values (a
[]*structpb.Value) directly into argMap, which leaves protobuf Value wrappers
instead of plain Go strings; iterate the returned Values slice, extract each
element's string with GetStringValue() (or equivalent), collect them into a
[]string, and store that []string in argMap under the same key so downstream
CEL/SQL templating receives a plain []string as advertised.

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.

2 participants