Menu

The reviewer gets tired before the agent does
📰

The reviewer gets tired before the agent does

DEV Community: postgres·Odinaka Robert Nnamani·2 days ago
#t7TAygWS
#devtopostgresql#devto#dev#sends#null
Long article (480 words) — no AI summary yet.
Reading 0:00
15s threshold

The diff is green. The tests pass. Somewhere in the middle, a line now updates a row that used to be write-once. You scroll past it. You approve.

Review is a person reading, and people get tired. An agent can produce the next diff as quickly as the first. Which rules can you make the database check on every write?

Give retries a durable key

Try this in a disposable Postgres database:

CREATE TABLE sends ( id bigint GENERATED ALWAYS AS IDENTITY PRIMARY KEY , idempotency_key text NOT NULL UNIQUE , recipient text NOT NULL , status text NOT NULL CHECK ( status IN ( 'queued' , 'sent' , 'failed' ) ) ) ;

INSERT INTO sends ( idempotency_key , recipient , status ) VALUES ( 'order-42-receipt' , '[email protected]' , 'queued' ) ;

INSERT INTO sends ( idempotency_key , recipient , status ) VALUES ( 'order-42-receipt' , '[email protected]' , 'queued' ) ON CONFLICT ( idempotency_key ) DO NOTHING ;

SELECT count (*) FROM sends;

Enter fullscreen mode

Exit fullscreen mode

The count is one.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.