Skip to content

update_sql_transformation: batch str_replace silently succeeds when search strings not found #66

Description

@beckavac

Bug description

When calling update_sql_transformation with multiple str_replace operations in a single batch, the tool returns success: true even when none of the search strings were found and no changes were made.

Steps to reproduce

  1. Fetch transformation config SQL from dev branch
  2. Build a batch of 40+ str_replace operations (e.g. removing AS from table aliases)
  3. Call update_sql_transformation with all operations in one payload
  4. Tool returns {"success": true, "version": N} (version unchanged or incremented)
  5. Re-fetch the SQL — no changes were applied

Expected behavior

  • Each failing str_replace operation (search string not found) should be reported individually
  • OR the batch should fail with a list of which operations had no match
  • The version should NOT increment if nothing changed

Actual behavior

  • Tool returns success: true with a new version number
  • No replacements were actually made
  • Only when running single operations does it explicitly report "search string not found"

Workaround used

Had to abandon batch approach entirely. Used direct Keboola Storage API (PUT /v2/storage/branch/{branch_id}/components/.../configs/{config_id}) with a locally-prepared JSON payload to push the full updated configuration.

Impact

AI agents iterating on SQL code cannot trust batch str_replace results. Silent no-ops with a success response make it impossible to detect when transformations failed without re-fetching and diffing the entire config after every batch.

Context

  • kbagent version: 0.9.0
  • Operation: removing 182 AS alias occurrences from Products code (config 746772863, Slevomat project 226)
  • Dev branch: 1285731

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions