Skip to content

fix: parse configured field arrays through PostgreSQL text - #12

Merged
artiphishle merged 4 commits into
mainfrom
fix/issue-11-bun-json-array-cast
Aug 5, 2026
Merged

fix: parse configured field arrays through PostgreSQL text#12
artiphishle merged 4 commits into
mainfrom
fix/issue-11-bun-json-array-cast

Conversation

@artiphishle

Copy link
Copy Markdown
Contributor

Closes #11.

Summary

  • cast serialized configured-field parameters through PostgreSQL text before parsing them as jsonb
  • apply the correction to both create and replace paths
  • keep passing deterministic JSON strings instead of JavaScript arrays
  • add regression assertions for the Bun-safe SQL casts
  • include a patch changeset

Root cause

Bun SQL encodes the bound JavaScript string as a JSON string scalar when it is cast directly with $n::jsonb. jsonb_array_elements_text then fails with cannot extract elements from a scalar.

Using $n::text::jsonb makes PostgreSQL parse the serialized JSON array text explicitly.

Validation

A rollback-only Bun/PostgreSQL probe isolated the failure to the metadata insert after vault.create_secret succeeded. The changed SQL matches the successful form from that probe.

@artiphishle artiphishle self-assigned this Aug 5, 2026
@artiphishle
artiphishle merged commit 4b56474 into main Aug 5, 2026
1 check passed
@artiphishle
artiphishle deleted the fix/issue-11-bun-json-array-cast branch August 5, 2026 02:08
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.

fix: parse serialized configured fields as JSON arrays with Bun SQL

1 participant