SShortSingh.
Back to feed

Open-source Formbricks fixes partial database writes in AI demo response generator

0
·1 views

A developer auditing Formbricks, an open-source survey platform, discovered that its AI example-response generator could partially commit data to the database even when the operation reported a failure. The bug caused some records—such as tags and display entries—to be written before a response creation error rolled back only part of the transaction, leaving the database in an inconsistent state. Initial attempts to wrap the entire operation in a single outer transaction triggered a deadlock due to Prisma's connection pool constraints, forcing a redesign of the fix. The final solution separates the external model call from the database transaction, then acquires a FOR NO KEY UPDATE lock on the survey row before validating ownership, archive status, and response count, ensuring all synthetic entities are written atomically. The patch also enforces strict error propagation for quota-link failures so that no partial batch can silently persist during example generation.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

PostgreSQL RLS Can Cause 575x Query Slowdowns — Here Is How to Fix It

Row-Level Security (RLS) in PostgreSQL can silently degrade index scans to sequential scans in multi-tenant databases, causing p99 query latency to spike from milliseconds to seconds. The root cause is that PostgreSQL's current_setting() function is classified as VOLATILE, preventing the query planner from using it as a constant to drive index selection at plan time. Benchmarks on a 10-million-row table showed a roughly 575x performance regression when using a naive RLS policy compared to no RLS. The fix involves wrapping current_setting() in a STABLE function, which signals to the planner that the value is constant within a single query execution and allows index scans to resume. Pairing this with targeted partial indexes and using SET LOCAL inside explicit transactions — especially under connection poolers like PgBouncer — completes the performance-safe RLS setup.

0
ProgrammingDEV Community ·

Developer's own acceptance tests caught two bugs in n8n workflow pack before launch

A developer selling an n8n automation workflow pack discovered two critical bugs by running acceptance tests on a clean n8n instance before listing the product. The first bug involved Node.js's built-in 'crypto' module being blocked by n8n's Code node sandbox on standard installs, breaking deduplication logic that worked fine in a custom dev environment. The second bug caused a safety gate — designed to block message delivery until a specific environment variable was set — to crash instead of failing gracefully, because default n8n installs block environment variable access in code nodes. Both issues were invisible during local development and only surfaced when the workflows ran on a stock installation. The developer fixed both bugs and now ships every workflow with acceptance criteria and a buyer-facing checklist, arguing that running tests on a clean instance is the only reliable way to catch environment-specific failures.

0
ProgrammingDEV Community ·

Developer builds Mac tool to manage multiple AI coding agents without context switching

A developer has identified a productivity problem with running multiple AI coding agents in parallel: agents often sit idle waiting for user approval while the user is occupied elsewhere, wasting metered subscription time. The author found that most coding agents support lifecycle hooks, allowing an external program to intercept and respond to permission requests via stdin JSON. Leveraging this, they built a Mac app called Crew Tower that surfaces agent approval requests directly in the MacBook's notch area, visible regardless of which app is in focus. The tool lets users approve, deny, or respond to agent prompts in a single click without switching windows or terminals. It also displays remaining quota for services like Claude and Codex, addressing the same core concern of minimising idle time on metered plans.

0
ProgrammingDEV Community ·

Nash AI Workspace Goes Open Source with Image Generation and MCP Support

Nash, an AI productivity workspace developed by Backboard, has been made open source and is now publicly available on GitHub for anyone to use, fork, or self-host. The platform was originally built as an internal tool to serve as a full AI workspace rather than a simple chat interface. Alongside the open-source release, a major update introduces end-to-end image generation, document creation, and support for the Model Context Protocol (MCP), including Google MCP, allowing Nash to connect with external tools and services. A new Library feature automatically saves generated images so users can retrieve them across sessions without manual effort. The project welcomes community contributions including bug reports, pull requests, and custom MCP server integrations via its GitHub repository.