Treat recipient suppression as a durable compliance decision, not as a flag buried inside an SMS provider. For every scheduled fintech alert, resolve the recipient against an internal, append-only suppression ledger immediately before dispatch; record the policy version and evidence used; then accept delivery events asynchronously and idempotently. This preserves an explanation for why a message was sent or withheld even after a provider, phone number, or retention policy changes. Short answer: the provider should transport messages and report outcomes, while your system owns consent state, invalid-recipient evidence, scheduling intent, and the audit trail. A cheap API cannot repair ambiguous authorization or a retry loop that sends the same account alert twice. Teams searching for a Twilio alternative or a convenient Node.js API still face the same control problem: the service boundary ends before the evidence needed to justify a fintech communication. The examples below use Go because the control flow is easier to make explicit, but the ledger and outbox design is independent of application language. Set an SLO around decisions you control: for example, 99.9% of due alerts receive a final internal dispatch decision within two minutes of their scheduled time. Track carrier acceptance and handset delivery separately because they are different states, and never make a delivery receipt your only proof that processing was correct. A provider-side block list is useful enforcement, but it is a poor system of record for a regulated workflow. It answers what that account will send now. An auditor, support engineer, or incident reviewer needs harder answers: which customer account owned the destination, what event scheduled the alert, what authorization applied, which policy revision ran, what evidence caused suppression, and whether a later correction restored eligibility. Phone numbers are reassigned. Users mistype them. A carrier can reject a message temporarily, and a d
At Autoadify we build Workflows: a schedule, a new Shopify/WooCommerce product, or a post that's taking off fires a pipeline that writes the copy, generates the image/video/voiceover/music, and publishes to Instagram, TikTok, YouTube, Facebook, LinkedIn, X, Threads, Bluesky and Reddit. No human in the loop. "Call an LLM, then call a posting API" is a weekend project. Making it run unattended every day is not. Here's what broke, and what we changed. trigger ─▶ content steps ─▶ transform steps ─▶ publish ai_text add_hashtags 9 networks ai_image rewrite_tone ai_edit translate ai_video / ai_animate ai_voiceover / ai_music library_media Triggers: schedule (daily/weekly/biweekly/monthly, timezone-aware), shopify / woocommerce (product webhooks, HMAC-verified), monitor_post (fires when a post's likes/comments/shares/impressions/reach/clicks grow past a threshold), plus manual run. Models: every step has its own model picker over a 60+ model catalog — GPT-5.6, Claude Opus 4.8 / Sonnet 5, Gemini 3.1, Grok, DeepSeek V4, Qwen, Kimi for text; Nano Banana, GPT Image 2, Seedream, Recraft, Krea for images; Veo 3.1, Kling 3.0, Seedance 2.0, Runway Gen-4.5, Hailuo, Wan 3.0 for video; ElevenLabs for voice and music. Each step's output lands in a context map keyed by step ID, and later steps interpolate it: {{trigger.product.name}}, {{trigger.recent_posts}}, the previous step's text, the previous step's media. To keep script and caption consistent, one AI Text step writes both: [VIDEO PROMPT] Slow push-in on a ceramic mug, steam rising, morning light, 35mm [CAPTION] Mornings, slower. ☕ New in the shop. The first version published the "most recent text output" as-is. So a live Instagram caption read "[VIDEO PROMPT] Slow push-in on a ceramic mug…". Fix: a tiny labelled-section parser. Each consumer reads the section meant for it: // The part of a text output that is meant to be posted. export function postCopy(text: string): string { const { preamble, sections } = parseSections(text); i
You can get a lot of value from public web data, but the useful part is rarely the first scrape. The real problem starts a week later: selectors stop matching, prices contain currency symbols from three regions, your job silently writes zero rows, and nobody notices until a dashboard looks wrong. Public web data is attractive because it is already out there: product pages, public directories, reviews, job listings, government portals, documentation sites, release notes, and market pages. Smaller teams can answer questions that used to require expensive data vendors. But public does not mean ready to use. If you want to track competitor pricing, the hard part is not fetching HTML once. The hard parts are: deciding exactly which pages answer the business question collecting data without hammering someone else's site detecting when extraction breaks normalizing messy fields into stable types storing observations over time instead of overwriting history keeping enough metadata to debug bad data later That is the difference between a scraper and a pipeline. A common mistake is to start with, can we scrape this site? A better first question is, what decision will this data support? For example, competitor pricing sounds specific, but it usually needs more definition: Which competitors matter? Which SKUs can be matched reliably? Do we care about list price, discounted price, shipping, or availability? How often does the data need to change before it affects a decision? What failure rate is acceptable? If the answer only needs weekly trends, a daily scrape with manual review may be enough. If the answer feeds an automated repricing system, you need stricter validation, alerting, and rollback behavior. This matters because collection cost scales with freshness, coverage, and reliability. Scraping 50 pages once is simple. Scraping 50,000 pages every hour while proving the data is still correct is a different system. Here is a small Python example that shows the pattern. It fe
Docker permission denied: what the error is actually telling you A client messages me about this error almost every week. They run a command, see "permission denied", and assume Docker is broken. Docker is rarely broken. People just use one name for two completely different errors. The first happens before any container starts: your user cannot talk to the Docker daemon. The second happens inside a running container: the app cannot write a file. The fixes have nothing in common, so tell them apart first. Below are the four causes I see in client work. Docker permission denied means the process that tried to write a file (or talk to the daemon) is not the user that owns the file (or the socket), and it has no group or other rights to it either. The kernel does not care about names like www-data or hitesh. It compares numbers: the UID and GID of the process against the owner and mode bits of the file. Socket error File error What you see permission denied ... docker.sock Permission denied or EACCES in container logs Who actually failed Your shell user, running the docker CLI The app process inside the container Where to look /var/run/docker.sock and your groups Host path owner, container user, SELinux This is the one you see on a fresh server: permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock The Docker daemon always runs as root and listens on /var/run/docker.sock, owned by root:docker with mode 660. If you are not root or in the docker group, the CLI cannot open it. Check both sides first: `ls -l /var/run/docker.sock id -nG Then the fix: `sudo groupadd docker # fine if it says the group already exists newgrp docker Group membership is read at login, so old shells lack it. newgrp docker fixes the current shell only. I once lost 20 minutes to a tmux pane that never got the change. If you ran sudo docker ... before fixing the group, you may see this: WARNING: Error loading config file: /home/hitesh/.docker/config.json
Anyone can integrate the Gemini or OpenAI API over a weekend, give it a couple of basic tools, and upload a YouTube video claiming they've built an "autonomous agent." But making that agent handle dozens of simultaneous functions in a corporate environment securely, without hallucinations, and with a near-zero error rate is an entirely different architectural challenge. Through my experience developing Zyro Workspace and founding AutomaticIA, I've learned the hard way that building successful Artificial Intelligence software, ironically, is hardly about Artificial Intelligence. It's about traditional software engineering taken to the extreme. If you are thinking about integrating AI into your projects, here are the architectural lessons that separate a "digital slave" from a true "asynchronous coworker." The Function Calling Illusion (The Brain in a Jar) The biggest misunderstanding when developers start using Function Calling is believing that the AI is executing the code. There is a false illusion that the model magically connects to Google Calendar or a database. The technical reality is that the model is like a "brain in a jar": it is completely isolated from the outside world. All Function Calling does is apply an Inversion of Control (IoC). The model executes nothing; it simply reasons about which tool it needs and returns a JSON payload. It is you, in your middleware (in our case, Node.js), who must intercept that JSON, validate security, execute the actual code, and return the result to the model. Inversion of Control (IoC): Trust the Infrastructure, Not the AI When you design a B2B agent, companies' biggest fear is that the AI will hallucinate and delete confidential files. If your only defense is writing rules in the System Prompt like "do not delete important documents," you have an incredibly fragile system. The paradigm shift is moving from "trusting the AI" to "trusting the infrastructure": Zero-Retention (Native Delegation): We decouple "intent" from
A demanda por executar modelos de linguagem locais (Llama, DeepSeek, Qwen, Mistral) para garantir soberania de dados, privacidade e zero custos com tokens de API explodiu. O Ollama tornou-se o padrão mais simples e eficiente para isso. No entanto, instalar o binário ou drivers CUDA diretamente no sistema operacional do servidor muitas vezes gera conflito de dependências, quebra de bibliotecas após atualizações do kernel (apt upgrade) ou dificuldades para isolar ambientes. Neste guia, você vai ver como isolar toda a stack de inferência dentro do Docker utilizando o NVIDIA Container Toolkit, com alocação correta de VRAM e boas práticas de segurança de rede. Para que o daemon do Docker consiga passar as GPUs e capacidades de computação CUDA para os containers, o host (Debian/Ubuntu) precisa do runtime oficial da NVIDIA. Execute no terminal: # 1. Adicionar o repositório oficial da NVIDIA curl -fsSL https://nvidia.github.io/libnvidia-container/gpgkey | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpg curl -s -L https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list | \ sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \ sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.list # 2. Instalar o toolkit e configurar o Docker daemon sudo apt-get update && sudo apt-get install -y nvidia-container-toolkit sudo nvidia-ctk runtime configure --runtime=docker sudo systemctl restart docker compose.yaml com Aceleração de GPU Crie um arquivo compose.yaml (ou docker-compose.yml) na pasta do seu projeto. O ponto crucial está na diretiva deploy.resources.reservations.devices, onde definimos o driver nvidia e as capacidades necessárias (gpu, compute, utility): services: ollama: image: ollama/ollama:latest container_name: ollama-gpu-server restart: unless-stopped ports: # Amarre ao localhost para não expor a API sem autenticação na rede externa! - "127.0.0.1:11434:114
I’ve been collecting interactive learning platforms for a while — the kind where you don’t just read, you actually click, type, break things, and learn by doing. Eventually the list got long enough that I decided to put it on GitHub: → https://github.com/hamid-moghadam/awesome-interactive-learning Some of the ones I really like: How DNS / HTTPS / DNSSEC works (super clean interactive explanations) Learn Git Branching + Oh My Git Writing an OS in Rust Deadlock Empire (concurrency puzzles) OverTheWire, pwn.college, CryptoHack CSS Grid Garden Seeing Theory + Immersive Math Play with Docker and iximiuz Labs I’m trying to keep it focused on resources that are actually interactive, not just articles or video courses. If you know any good ones I missed, feel free to open a PR or just drop them in the comments.
Most candidates who fail a system design interview know enough. They know what a cache is. They can explain sharding. They have watched the YouTube design five times. They still fail. Not because of what they know, but because of how they use it in 45 minutes. Interviewers score a short list of signals. Can you scope an ambiguous problem? Can you make a choice and defend it? Can you find the weak spot in your own design? Can you run the conversation? The seven mistakes below break those signals. Each one comes with a weak answer and a stronger one, so you can hear the difference. The prompt is "Design a news feed." The candidate grabs the marker and draws a load balancer. This feels productive. It isn't. A news feed for 500 friends and a news feed for 50 million followers are different systems. You don't know which one you're building yet. Weak: "Okay, so we'll have clients, a load balancer, and some app servers..." Strong: "Before I draw anything, a few questions. Is this a friends feed or a follow feed with celebrities? Ranked or chronological? How fresh does it need to be? Roughly how many daily users?" Think of it like a contractor. A good one asks how many people will live in the house before pouring the foundation. Spend the first five minutes here. Write the answers on the board. You will point back at them later. Many candidates have learned to do back-of-the-envelope estimates. They compute 12,000 writes per second. Then they never mention that number again. Estimates are not a ritual. They are evidence. Every number should change a decision. Weak: "So that's about 12K writes per second. Okay, moving on to the API." Strong: "12K writes per second is more than I'd want on one Postgres primary for this workload. So I'll partition by user ID from the start, and I'll keep the write path thin." If a number doesn't change your design, you probably didn't need to calculate it. "We'll use Kafka." "Put Redis in front." "Use Cassandra because it scales." Naming a too
Short answer: for a small SaaS notification service, the best inexpensive logging choice is the one that preserves enough evidence to reconstruct a failed delivery without turning every retry into a fresh incident. Start with a compact event schema, separate attempt facts from final outcomes, retain an audit trail keyed by an idempotency key, and compare Datadog, Better Stack, Logtail, Axiom, and self-hosted Loki with the same replayable dataset. Price matters only after the candidates produce equivalent answers. Signal quality comes first. A payment receipt that fails once, succeeds on retry, and is later logged as both "failed" and "sent" can mislead support, reconciliation, and compliance review. The logging system therefore has two jobs: preserve immutable attempt evidence and expose a derived delivery state without pretending that transport acceptance proves human receipt. Those jobs must survive duplicate workers, delayed callbacks, and partial outages. Retries lie. Begin with questions, not fields. For one logical notification, an operator should be able to determine which template and destination class were involved, how many attempts occurred, what each provider response category was, whether a retry was scheduled, and which terminal state the application recorded. The log must distinguish a duplicate execution from a second business notification. That requirement implies two identifiers. notification_id names the business action; attempt_id names one dispatch attempt. An idempotency_key links duplicate submissions that must converge on the same business result. None should contain an email address, phone number, message body, access token, or payment data. Store a destination class or an application-generated opaque reference instead. Compliance boundaries vary by jurisdiction and contract, so retention and field classification need explicit review rather than an inherited default. Use stable event names such as notification.attempt.finished, then put boun
Teams can generate UI faster than ever, but they still have to guarantee that what they ship is usable, secure, and maintainable. Accessibility as an operational capability rather than a compliance checklist or end-of-project audit, and what that looks like in practice.
I was leading the architecture for a clinical AI platform at Synapsis Medical Technologies, where we were integrating real-time health data from wearables into a React Native environment. We were hitting a wall with the Bridge. As we scaled to handle high-frequency biometric streams, our UI thread started dropping frames during heavy data ingest. The immediate internal pressure was to migrate everything to TurboModules and the New Architecture (React Native 0.76+). The promise of synchronous execution and type-safe Codegen is seductive. However, I had a team of 21 engineers and a product roadmap that didn't include a month of "architectural refactoring" with no visible feature output. If you blindly migrate a stable Native Module to a TurboModule, you might spend 40 hours of engineering time to save 2ms of overhead that wasn't your bottleneck. I’ve shipped 18 production apps, and the most expensive mistake I see is optimising for architectural purity rather than measured latency. Before you touch codegen, you need to know if the Bridge is actually your problem. In the legacy architecture, every call between JavaScript and Native is asynchronous, serialised as JSON, and passed over a single queue. When we were streaming data from a wearable heart-rate monitor, each data point was a Bridge message. If the user was also interacting with a complex UI—say, a real-time graph—the Bridge became a bottleneck. The symptom wasn't just "slowness"; it was non-deterministic lag. The JSON serialisation overhead for a large array of health metrics can take 5–10ms. When you do that 60 times a second, your message queue backs up, and your onPress events stay stuck behind data packets. TurboModules solve this by using JSI (JavaScript Interface), allowing JS to hold a reference to C++ host objects. You move from "sending a letter" (Bridge) to "calling a function" (JSI). But if your module only fires once every 10 seconds—like a battery level check—the Bridge overhead is irrelevant. Do
The IT manager at a plant in Dongguan called me on a Wednesday afternoon. Six hours earlier one of her admins had run a bulk update against an inspection table with the wrong filter attached, and sixty thousand rows now carried a blank where a measurement should have been. "I do not need you to restore the server," she said. "I need you to restore that one table from last night. Everything else — the other thirty applications, the production dashboard, the approval queues — has to keep running. Can you do that?" I told her I would get back to her. It took four days, and most of the work was manual. That is the phone call I think about whenever someone asks whether our platform has backups. We did. There was a cron job that ran at two every morning and wrote two database dumps to a folder, exactly as our own documentation describes. What we did not have was a way to give her the thing she actually asked for. Here is the uncomfortable arithmetic. When you dump the platform database, you have captured part of the state. Not the whole of it. Our platform keeps identity and permissions in one library and business data in another — two dumps, two files, two things that have to stay consistent with each other. In larger deployments the business library is already numbered, because it shards. The uploaded files, the scanned certificates, the photos people attach to records, live somewhere else entirely: object storage in a bucket, plus a local file directory that some installations still rely on. And the search index is derived, so we tell ourselves it does not need a backup — which is true right up until you restore and somebody notices the search box has gone quiet. So "we back up the database" is a sentence that describes roughly half of the stateful parts of the system. It happens to be the half that is easiest to describe, which is why it is the half everyone stops at. The missing pieces are not exotic. They are just boring enough that nobody owns them. The attachments
I spent six weeks debugging a handoff that looked perfect in the trace. The planner produced a clean, well-structured plan. The executor followed it step by step. And every handoff between them lost a little bit of truth. Not enough to fail. Just enough to make the system slower, more expensive, and quietly wrong in ways nobody could name. I kept tuning prompts. The planner needed more detail. The executor needed clearer instructions. I upgraded the executor to a stronger model. Nothing helped, because I was diagnosing a communication problem as a reasoning problem. The research had already named what I was hitting. Microsoft's Agent Framework training calls it context collapse — the most common failure in handoff chains, where accumulated information loss through repeated summarization degrades the signal until the receiving agent is operating on a shadow of what the sender knew. The fix isn't a better prompt. It's a different protocol for what crosses the boundary. The first place the loss shows up is in the arithmetic. A 2026 paper titled "Attention Tax, Handoff Tax" models the exact trade most teams miss: decomposition reduces the burden of long contexts, but incurs a handoff tax when information is compressed or transferred between agents. The question isn't whether to decompose. It's whether the attention cost you avoid by resetting context exceeds the handoff cost you pay for the transfer. For most of my handoffs, it didn't. The receiver wasn't information-starved because it was weak. It was information-starved because the handoff had stripped the signal before the receiver ever saw it. The numbers from the literature are consistent. A closed-world study on two-agent LLM relays found that hand-off representation strongly affects downstream feasibility under a small decision model, with constraint checking benefiting from structured and auditable representations rather than relying on brevity alone. My handoffs were brief. They were not auditable. The deeper f
TL;DR: anchoring dokazuje da je zapis postojao prije bloka N i da se nije promijenio. Ne dokazuje točnost, potpunost ni poštenje onoga tko piše. Bilježenje na izvoru, sequence i hash-chain, logger odvojen od onih koje kontrolira. Anchoring hasha na chain je dio decision ledgera koji se najčešće precjenjuje, ponekad i od strane onih koji ga grade. Daje dva stvarna jamstva i nijedno od onih koja se često podrazumijevaju. Razlika između njih određuje gdje treba uložiti inženjerski rad. Kad se hash zapisa, ili root batcha zapisa, upiše na javni chain, dvije stvari postaju provjerljive bilo kome. Zapis je postojao prije određenog bloka. Od tada nije mijenjan. Nitko, ni operater sustava, ga ne može tiho prepisati. Uz inclusion proof, treća strana može provjeriti oboje bez povjerenja u vaše servere. To vrijedi. Log koji može mijenjati svatko s pristupom bazi je obećanje; usidreni log je dokaz integriteta. Ali integriteta onoga što je zapisano, i ništa više. Ne dokazuje da je zapis bio točan kad je nastao. Ako je agent zabilježio krivi razlog, ili je model dao uvjerljivo ali netočno obrazloženje, anchoring taj krivi razlog čini trajnim i provjerljivim. Ne dokazuje da je log potpun. Zapis koji nikad nije napisan ne ostavlja hash za provjeru. Ako se korak može preskočiti bez traga, ledger pokazuje čistu povijest s rupom koju nitko ne vidi. Ne dokazuje da je onaj tko piše bio pošten. Ako onaj tko kontrolira logging komponentu bira što će se i kada zabilježiti, anchoring štiti njegovu verziju događaja. Chain vjerno čuva ono što dobije. Koristan posao je prije hasha. Bilježenje na izvoru. Zapis nastaje u istom koraku kao akcija, idealno u istoj transakciji, tako da akcija bez zapisa ne može proći. Log pisan naknadno, iz zasebnog joba, mjesto je gdje nastaju rupe. Rupe moraju biti vidljive. Svaki entry ima sequence number i vezan je na prethodni njegovim hashom. Zapis koji nedostaje tada prekida niz na način koji vidi svaki verifier, umjesto da tiho nestane. Odvajanje dužnosti. K
SVG icons have become the gold standard for web interfaces, offering crisp, infinitely scalable graphics that look sharp on any device. But not all SVGs are created equal—poorly optimized SVG icons can bloat your web pages, slow down rendering, and undermine the very performance benefits they promise. Let’s dive deep into SVG optimization for web performance, exploring how to reduce file sizes, improve rendering speed, and deliver pixel-perfect icons your users will love. SVG (Scalable Vector Graphics) is a markup language for describing two-dimensional graphics. Unlike raster images (like PNGs or JPEGs), SVGs scale cleanly at any resolution and are easily manipulated via CSS and JavaScript. However, SVG files can become inefficient due to: Editor-generated metadata and redundancies (especially from design tools) Unnecessary precision in coordinates or colors Embedding styles or scripts that aren’t used Unoptimized paths and shapes Just as you’d compress images or minify JavaScript, optimizing SVG icons is crucial for web performance. Smaller, cleaner SVGs mean: Faster page loads and lower bandwidth usage Speedier rendering, especially on resource-constrained devices Reduced main-thread work and improved interactivity Let’s break down how to optimize SVGs at every step, from creation to delivery. The best SVG icons are simple by design. Complexity in the artwork translates directly to more nodes, longer paths, and heavier files. When designing icons: Use as few elements and shapes as possible Avoid unnecessary groups ( tags) and nested structures Merge overlapping paths where feasible Tip: If you’re working in Figma, Illustrator, or similar tools, use “flatten” or “union” operations to combine shapes before exporting. Design tools often export SVGs with a lot of extra metadata: comments, hidden layers, unused definitions, and proprietary tags. This extra code does nothing for rendering and only slows things down. Before: ... Icon Title Some description After: Strip
Theming a Drop-In UI Kit Without Forcing a Fork Every prebuilt UI component library eventually meets a design system it was not built for. At that point the integrating developer makes one of three choices: accept the defaults, override with increasingly specific CSS, or copy the source into their repository and stop taking updates. The third outcome is the expensive one. It looks like success in the sprint it happens and becomes a maintenance liability for years, because the fork no longer receives fixes, accessibility corrections, or new platform behaviour. I work on developer-facing UI Kits at CometChat, where the whole value proposition is that a team drops in a conversation interface instead of building one. That makes forking a product failure, not a customer mistake. It has forced me to think about customisation as an API with a compatibility contract, rather than as a styling convenience. Customisation requests are not one thing. They arrive at four different depths, and each needs its own mechanism. Depth What the developer wants Mechanism Tokens Brand colours, radius, type scale, spacing CSS custom properties Component styling This one button looks wrong in our layout Documented class or style hooks per component Composition Add a field, reorder the header, remove an action Slots and render props Behaviour Different data source, different send pipeline Headless core with the UI as an optional layer The failure mode is offering only the first and the last: a colour variable and ""you can build it yourself"". The middle two are where real integrations live. CSS custom properties are the right substrate for the token layer because they cascade, they can be scoped per subtree, and they cost nothing at runtime. They also become a public API the moment you document them. .my-app-chat { --cc-color-primary: #2b6cb0; --cc-color-surface: #ffffff; --cc-radius-md: 10px; --cc-font-family: ""Inter"", system-ui, sans-serif; } Two decisions matter more than the names: Sem
Coding agents are great until you look at the bill. A single "fix the failing tests" task can turn into 40+ model calls, each one re-sending the system prompt, file snippets and the previous tool output. Here are the six guardrails I now put on every agent loop, whichever model or provider sits behind it. Every agent framework has some notion of max steps. Set it explicitly. I use 20-30 tool turns for a normal task and stop the run if it is not converging. An agent that has not fixed a test in 25 turns is usually stuck in a loop, not about to succeed. MAX_TURNS = 25 for turn in range(MAX_TURNS): step = agent.step() if step.done: break else: log.warning("agent hit turn cap, stopping") The biggest hidden cost is tool output. Do not send the whole test log or the whole file. Send the failing test names, the assertion lines and a diff. def trim(output: str, limit: int = 4000) -> str: lines = [l for l in output.splitlines() if "FAIL" in l or "Error" in l or l.startswith(("+", "-"))] text = "\n".join(lines) or output return text[-limit:] Use a fast, cheap model for planning, search and summarising, and a frontier model only for the hard edit. With an OpenAI-compatible client this is just a different model string per call: ROUTES = {"plan": "fast-model-id", "edit": "frontier-model-id", "review": "fast-model-id"} client.chat.completions.create(model=ROUTES["edit"], messages=msgs) Get the exact ids from GET /v1/models on whatever endpoint you use; guessing ids is the most common setup failure. Retry 429 and 5xx with exponential backoff, but only a few times, then fail over to a second model or stop. Unbounded retries inside an agent loop multiply spend without multiplying progress. Before you leave an agent unattended overnight, watch one real task in the provider's request logs. You will spot runaway context growth, repeated identical calls and wrong model routing in minutes. Per-token pricing is fair but spiky for loops, because input tokens grow every turn. Two ways to ma
If you moved private files off presigned URLs and started serving them through The cause is almost always Range, and specifically what you do with a range When you redirect to a presigned URL, S3 or R2 is answering the request. That It is not optional work. A element sends a range request before it 416 Range Not Satisfiable is what you reach for when a range cannot be served RFC 9110 says an invalid range must be ignored. Not refused, ignored: you Here is what that means in practice. Twenty six bytes, one per letter of the Range header status why bytes=9-4 200 last position before first position, so the range set is invalid bytes=-0 200 a suffix of zero asks for nothing bytes=abc 200 unparseable items=0-4 200 a unit that is not bytes bytes=0-4,10-14 200 multiple ranges, see below bytes=99-120 416 parsed cleanly, past the end of a 26 byte object Four of the five that look like a 416 are not one. And the one that is carries HTTP/1.1 416 Range Not Satisfiable Content-Range: bytes */26 That */26 tells the client the actual size, which is the information it needs bytes=0-4,10-14 is two questions in one header. You have three options and You can answer all of them as multipart/byteranges. You can ignore the header That third one is a silent data corruption bug. The client asked two questions. Ignoring is the only option that cannot mislead, and it is one line. The cases that do work, same 26 byte object: Range header status Content-Range body none 200 abcdefghijklmnopqrstuvwxyz bytes=0- 206 bytes 0-25/26 abcdefghijklmnopqrstuvwxyz bytes=0-4 206 bytes 0-4/26 abcde bytes=-4 206 bytes 22-25/26 wxyz bytes=20-999 206 bytes 20-25/26 uvwxyz Two things in there are worth pointing out. bytes=-4 is a suffix, not a negative offset. It means the last four bytes. bytes=20-999 is not an error. A last position past the end of the object is This is the one I had backwards for a while. Accept-Ranges: bytes is how a client learns it is allowed to seek. So it has About thirty lines. Returns
title: "Production-Grade Express.js Architecture: Layered Controller, Service, and Repository Pattern" When building backend applications with Node.js and Express.js, developers often start with a monolithic file structure. A single app.js handles routing, database connections, input validation, and business logic. While this approach accelerates initial prototyping, it quickly collapses under the weight of growing requirements, making unit testing difficult and violating the Single Responsibility Principle (SRP). To build scalable, maintainable, and enterprise-ready APIs, we need a robust architectural pattern. In this article, we will implement a production-grade Layered Architecture utilizing Controllers, Services, and Repositories, coupled with Dependency Injection and Centralized Error Handling. Separation of concerns is the guiding principle of this architecture. Each layer has a specific, well-defined job and communicates only with adjacent layers. +-------------------------------------------------------------+ | HTTP Layer | | (Routes & Express Framework) | +------------------------------+------------------------------+ | v +------------------------------+------------------------------+ | Controller Layer | | (Request parsing, Response formatting, Status codes) | +------------------------------+------------------------------+ | v +------------------------------+------------------------------+ | Service Layer | | (Business logic, Transactions, Rules) | +------------------------------+------------------------------+ | v +------------------------------+------------------------------+ | Repository Layer | | (Data access, ORM queries, Database interaction) | +-------------------------------------------------------------+ HTTP/Router Layer: Maps URL paths and HTTP methods to specific controller methods. It acts as the entry point for Express. Controller Layer: Extracts data from HTTP requests (params, query, body), invokes the corresponding service, and formats th
PostgreSQL has been the most popular open source database since 2020 and matured over decades. Many organization have already started migrating their databases to PostgreSQL because of the open source nature, flexibility and the customization that we can do in PostgreSQL with extensions. For one of our customers, we had several production PostgreSQL instances running on version 13, spread across multiple AWS regions. Each was a few hundred GBs in size along with read replicas. As you might know that AWS RDS standard support for PostgreSQL 13 ended in February 2026 and AWS charges additional fees for extended support. From March 2026, every Postgres v13 instance will incur a surcharge of 6x on the standard pricing. To get bug fixes and security patches you are forced to pay premium or upgrade to a newer version. Also, there is a risk that after sometime, the older versions will not be supported at all. This is where we decided to upgrade to Postgres v18. Like every other business, we wanted to have a minimum downtime and minimum code changes. To achieve this, we explored and identified that AWS RDS blue/green deployment is the best way to do it. In this blog post, we will share our experience of upgrading and learnings. PostgreSQL v18 is a major release in the recent years and for good reasons. It has a lot of improvements and new features that we wanted to take advantage of. To take advantage, we skipped four versions and upgraded to v18. Native asynchronous I/O delivers 2-3X throughput on sequential scans, bitmap heap scans, and VACUUM. No application changes needed. pg_stat_io breaks cache hits and reads latency down per backend. pg_stat_statements query identifiers now survive restarts. B-tree skip scans make composite indexes useful for queries that don't filter on the leading column. Better join ordering. Better partition pruning. Postgres v18 is supported until February 2031. Major-version upgrades on RDS used to mean two bad options. Run pg_upgrade in place,
I argued last week that an AI SDK call with no bounds is three CWEs in one missing config object. Fair question back: does anyone actually ship that? So I linted for it. 20,004 source files across 14 public repositories, 474 of which import the Vercel AI SDK, 116 of which contain a real generation call. That 116 is the denominator; everything below is a fraction of it. Bound Files missing it Repositories output cap (maxOutputTokens) 103 / 116 12 of 14 request timeout 50 / 116 9 of 14 abort signal on a stream 44 / 116 7 of 14 88.8% is the number that would travel, and it is the one I trust least. One repository, cloudflare_agents, contributes 52 of those 103 files — just over half. Percentages of files measure how a codebase is split into modules as much as how it was written. The repo count is the robust statistic. Twelve of fourteen survives deleting any single project from the corpus. The percentage does not. ai-elements, vercel_chat, vercel_examples, vercel_streamdown and vercel-labs_agent-eval are the SDK vendor's repositories, and they are in the findings. That is not a gotcha — it is the mechanism. Example code is deliberately minimal; a ceiling is noise in a snippet teaching you streamText. But the minimal shape is the shape that gets copied, and it is missing the same parameter in the reader's production handler, where it is no longer noise. The omission is correct upstream and wrong downstream, which is exactly why nothing catches it. Not exotic. This is the common form: const result = streamText({ model, messages }); The one worth showing is subtler — 302ai_302-AI-Studio builds its options indirectly: const streamTextOptions = { ...baseConfig, ...(prompt && { system: prompt }) }; const result = await generateText(streamTextOptions); I assumed this was a false positive: a rule cannot see into an object built elsewhere. It isn't. baseConfig sets model, messages, providerOptions and tools — and the whole 1,500-line file contains exactly one occurrence of time
WARN[0000] The "DB_PASSWORD" variable is not set. Defaulting to a blank string. Compose prints that, then starts the stack anyway. The database exits, or the app connects with an empty password, and you only find the yellow line by scrolling back up. The frustrating part: DB_PASSWORD is right there in app.env, which the service loads with env_file:. Interpolation happens on your machine when Compose reads the YAML. ${VAR} and $VAR are filled from your shell, --env-file, or the project .env next to the compose file. Nothing else. If a variable is missing and has no default, it becomes "" with a warning. Container environment comes later. env_file: and environment: decide what the process inside the container sees. app.env is read here, so it can never fill a ${...} in the compose file. Two more traps from the same root cause: environment: [DEBUG] with nothing set on the host is silently dropped, no warning. command: sh -c 'echo $CACHE_DIR' is interpolated from your laptop while the file loads. Quotes are just YAML text. Write $$CACHE_DIR if the container should expand it. The request to make this fail by default is years old: docker/compose#5505. # require it: Compose stops with an error instead of a blank POSTGRES_PASSWORD: ${DB_PASSWORD:?DB_PASSWORD is required} Put interpolation variables in the project .env, escape container-side ones as $$, and never commit ${DB_PASSWORD:-hunter2}. docker compose config shows the result, but only when you run it, and it prints secrets in clear text. I built ComposeVars, a free VS Code extension that reads your compose files and the env files Compose would read (.env, include: env files, and --env-file / COMPOSE_ENV_FILES found in package.json, Makefile or justfile). Six rules, CV001 to CV006: unset variables, .env keys nothing uses, pass-through env that is not set, missing env_file paths, host-side $VAR in commands, and committed secret defaults. Quick Fixes add :?, :-, $$ or an .env.example entry, and hovering a variable shows
Introduction Your API's newest users are agents. They don't read docs, they don't browse dashboards, and they don't file support tickets. They parse OpenAPI specs, call endpoints in loops, and expect deterministic, machine-readable responses. If your API was designed for humans clicking buttons, it's already failing this new class of client. In this post, I'll walk through a concrete example: building a small "tool API" that an LLM-based agent can call. We'll cover the problem, a solution, and a runnable Python implementation. No hand-waving about "agentic workflows" — just code you can run and a loop with explicit termination conditions. Human-facing APIs optimize for discoverability and forgiveness. Agents optimize for determinism and low token cost. Three specific failure modes show up when agents hit a human-designed API: Ambiguous errors. A 400 with {"error": "bad request"} forces the agent to guess. The agent will retry, hallucinate a fix, or give up. Unbounded responses. Returning 50KB of nested JSON burns context window and increases the chance the agent truncates the useful part. No idempotency. Agents retry on timeouts. Without idempotency keys, you get duplicate side effects. Here's a minimal example of the kind of handler that causes these problems: # bad_handler.py from flask import Flask, request, jsonify app = Flask(__name__) @app.route("/create_ticket", methods=["POST"]) def create_ticket_bad(): data = request.get_json(silent=True) or {} if "title" not in data: return jsonify({"error": "bad request"}), 400 # ... create ticket, no idempotency, returns everything return jsonify({"ticket": {"id": 1, "title": data["title"], "history": [...]}}) An agent calling this has no way to distinguish "missing field" from "malformed JSON" from "server error," and no safe retry path. Design the API for a client that is literal, stateless between calls, and token-budgeted. Concretely: Structured error codes. Every error response includes a stable code string the agen
A settlement attempt ends ambiguously — timeout, opaque error, settlement_pending. The money may have moved. The most expensive mistake now is generating a new payment authorization before the first one's outcome is known. If the original confirms, you've paid twice. Three things people confuse as one: HTTP status — what the wire said (402, 500, timeout). Transport signaling, not economic fact. Settlement state — what the protocol knows (success, terminal failure, or settlement_pending: broadcast but unconfirmed, explicitly non-terminal). Payment authorization — what you signed. The only layer that moves money. The safe sequence: preserve the original payment identity, reconcile via the broadcast transaction hash, and don't sign a new authorization until the original reaches a terminal state. Where your scheme supports it, retrying settlement with the identical payment payload is not the same action as signing a second authorization — the former reconciles, the latter double-pays. Full writeup with sources in the callx402 troubleshooting docs. When x402 breaks, callx402.
Short answer: treat an upload as unpublishable until moderation has written a durable decision, and make every read path enforce that state. Optimistic publish is safe only for a private, quarantined object; it is a bug in the product contract when a public URL can race ahead of review. The missing pending state is usually a data-model and cache problem, not an image-format problem. This matters in a B2B SaaS product where an image can appear in a dashboard, an email preview, a search index, and a customer-facing page within seconds. A reviewer may still be deciding while another request has already promoted the asset. The result is a few seconds of banned content being visible, which is long enough for a screenshot, a webhook, or a crawler to copy it. Use an explicit state machine rather than a nullable reviewed_at field. A useful minimum is pending, approved, rejected, and expired. The upload transaction creates the asset in pending, stores the original in a quarantine bucket, and emits a moderation job. Only a moderation decision can move it to approved. A rejected asset never becomes public, even if a stale worker retries an older job. The public read path should ask for an approved publication, not merely find an asset by ID. That distinction prevents a common failure mode: the API returns a database row with status = pending, while the CDN still has a previously generated public URL. Keep the URL for the quarantined object private and issue a separate delivery key after approval. Revocation then has a concrete target: remove or deny the delivery key, purge the cache, and leave the audit record intact. Here is a small Python service sketch. It uses generic interfaces so the ordering is visible; the storage and queue implementations can be replaced without changing the safety rule. from dataclasses import dataclass from enum import Enum from typing import Protocol class ReviewState(str, Enum): PENDING = "pending" APPROVED = "approved" REJECTED = "rejected" EXPIR
If your product ships behind A/B experiments and feature flags, your QA team has a failure mode nobody tracks: variant amnesia. You add yourself to an experiment's testing group to check a feature, switch variants a couple of times, move on. A week later you're testing something else, the app behaves strangely, and you file a bug — not knowing you're still enrolled in variant B of an experiment you forgot exists. I lead QE on a team that works with Amplitude daily. Here's what variant amnesia actually costs, the rules that fixed it, and the tool I built to make the rules cheap. False bugs. The most expensive kind: a developer spends an hour reproducing an issue that is just an experiment variant doing its job. Irreproducible reports. Two testers see different UI on the same build, compare screenshots, and argue — because one of them is enrolled and the other isn't. The repro steps are useless without enrollment state, and nobody writes enrollment state into bug reports. Cleanup archaeology. In Amplitude, checking where you're enrolled means opening every experiment one by one and scanning its testing list for your email. Nobody does that weekly. So nobody knows their own state. Test on aliases, never on your main account. you+checkout@company.com, you+paytest1@company.com — disposable identities with clean state, one per scenario. Your main account stays out of every testing group. Treat enrollment as part of the repro steps. A bug report on an experiment-covered surface states which identity was enrolled in what. If you can't say, you're not done investigating. Leave tests when you're done. Exiting the testing group is exit criteria of the test cycle, same as closing the ticket. Stale enrollments are the amnesia. Check enrollment first, debug second. When the app "behaves strangely," the first question is not "what broke" but "what am I enrolled in." These rules work on any platform — LaunchDarkly, Optimizely, GrowthBook. The problem is that on all of them, followi
A few things I've come across recently, news and write-ups, keep coming back to me. In April 2026, an AI coding agent at a company called PocketOS was working through a routine task in staging. It hit a credential mismatch, decided on its own to use a completely unrelated API token that happened to carry far too much access, and deleted the production database along with its backups. Nine seconds. Afterward the agent wrote out something close to: I violated every principle I was given, I should have asked you first, but I decided to do it anyway. Late September 2026, a different shape of failure. AI coding agents at over 300 companies (Fortune 500s, and one frontier AI lab) couldn't attach screenshots to pull requests through their CLI tooling, so they found a way around the limitation: created public GitHub repos and put the screenshots there. 13,000 internal screenshots leaked, including billing records and unreleased product features. Neither of these was a breach. In both cases the agent was authorized to do a thing, and then came up with a method nobody had thought to rule out. Replit's July 2025 production-database deletion is the same pattern, so this isn't new. It just looks like it's happening more often. Agents are also getting more capable, and wiring them into production is probably not something anyone is going to stop. So my guess is this category of problem grows rather than shrinks. The common answer right now is: restrict what the agent is allowed to do, add more human checkpoints. That sounds reasonable. But isn't it a step backward? It walks us back toward the early days, when the models were bad enough that you needed people in the loop constantly to get anything usable out of them. If running an agent needs that much human backstop, what's left of the reason to run one. Here's what I've been thinking instead, and I'm honestly not sure it holds up. Maybe human involvement belongs in the design phase, and the enforcement should be handed to a prog
TL;DR 81% jump in AI-service leaks: GitGuardian detected over 1.27 million leaked secrets tied to AI services in 2025, an 81% jump from the previous year, with AI-assisted code leaking secrets at roughly twice the GitHub-wide rate. Hundreds of incidents in weeks: One customer deployed GitGuardian behind their internal AI gateway and surfaced hundreds of secret incidents within weeks, a significant share valid at detection, none of which ever touched a git repository. Four-step scan via Custom Source: The AI gateway forwards each payload to GitGuardian's scan API tagged with a Custom Source UUID, scans it in memory through 600+ detectors, and creates incidents without storing the content. Two-week non-blocking test: Non-blocking mode lets a request through and logs the incident so revoking valid findings and measuring real exposure over two weeks is possible, while blocking rejects the request before the provider is called, skipping rotation. One customer deployed GitGuardian behind their internal AI gateway. Within weeks, we had surfaced hundreds of secret incidents flowing through it, a significant share of them valid at the time of detection. None of them ever touched a git repository. They went straight from a developer's terminal or IDE into a prompt or a tool call, and out to a third-party model provider. This tracks with what we see at scale. Across 2025, secrets leaked from AI-assisted code at roughly twice the GitHub-wide rate, and GitGuardian detected over 1.27 million leaked secrets tied to AI services, an 81% jump from the previous year. Those figures come from code we can see. Prompt traffic is the part nobody is counting. The behavior that creates the exposure is mundane. A developer debugs a failing request and pastes the whole curl command, headers included. Someone drops a .env file into a chat window and asks the model to explain a variable. An agent reads a config file and forwards it as context on a tool call. Nobody is being careless on purpose.