Painel de Notícias

Tecnologia

7045 posts · 26 feeds · tópicos e interesse por Jev

Filtros
dev.to

How to Add Quality Gates to a GitHub Actions Pipeline (Step by Step)

Most CI pipelines run tests. Far fewer pipelines actually stop bad code from reaching production. The difference is a quality gate: a check that must pass before the pipeline is allowed to move to the next stage. In this tutorial, you'll build a GitHub Actions pipeline with four gates: Lint: code style and obvious errors Unit tests + coverage threshold: fail if coverage drops below a minimum API tests: verify the running service behaves correctly Manual approval: a human signs off before production By the end, a failed gate will block deployment automatically. A GitHub repository with a small Python web service (the same ideas apply to any language) Basic familiarity with YAML pytest and pytest-cov in your requirements.txt Step 1: Create the workflow file Create .github/workflows/pipeline.yml: # .github/workflows/pipeline.yml name: CI/CD Pipeline on: push: branches: [main] pull_request: jobs: lint: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" - run: pip install ruff - run: ruff check . This first job is your cheapest gate. Linting takes seconds, so it should run first and fail fast. Add a second job. The key line is --cov-fail-under=80, which makes pytest exit with an error if coverage drops below 80%. unit-tests: runs-on: ubuntu-latest needs: lint steps: - uses: actions/checkout@v4 - uses: actions/setup-python@v5 with: python-version: "3.12" - run: pip install -r requirements.txt - run: pytest tests/unit --cov=app --cov-fail-under=80 needs: lint creates the gate: this job only starts if linting passed. Tip: Don't start with an aggressive threshold on a legacy codebase. Measure your current coverage, set the threshold slightly below it, and raise it over time. A gate that always fails gets disabled. Unit tests check functions in isolation. API tests check that the service actually works when it runs. Start the app in the background, wait for it to be healthy, then run the tests: api-tests: run

DevInfra
Interesse
dev.to

Audit-Ready CI/CD: What Regulated Industries Teach Us About Shipping Software

In many startups, a release is a merge and a deploy button. In a regulated industry like banking, every release must also answer a set of questions, often months later, from an auditor: Who approved this change? What exactly was deployed? Was it tested, and where is the evidence? Could anyone have bypassed the process? For years, many teams answered these questions with spreadsheets, screenshots and change-request forms filled in by hand. That approach is slow, error-prone and painful for engineers. My view, after years of working on QA and DevOps in a regulated environment: a well-designed CI/CD pipeline is the best compliance tool you have. And the practices that make a pipeline audit-ready make it better for every team, regulated or not. If engineers can deploy from their laptops, no amount of documentation will satisfy an auditor, or protect you from mistakes. In practice, that means: Production credentials live only in the CI/CD system, never on developer machines. Branch protection prevents direct pushes to the main branch. Every production change, including configuration and infrastructure, goes through the same pipeline. Once the pipeline is the only road, its logs become a complete history of what changed in production. A classic control in regulated environments is that the person who writes a change should not be the only person who approves it. Modern tooling makes this easy to enforce rather than just document: Require at least one reviewer on pull requests, and prevent authors from approving their own. Use protected deployment environments with required approvers for production. Restrict who can change the pipeline definitions themselves, because whoever controls the pipeline controls the controls. The biggest shift is moving from collecting evidence after the fact to generating it automatically during every run. For each release, the pipeline can produce and store: Evidence Source Linked ticket or change request Commit message or PR metadata Reviewer

InfraDev
Interesse
dev.to

Node.js Uptime Health Monitoring API Explained (with Rollback-Safe Status Evidence)

TL;DR: A green Node.js status response is not enough evidence for a safe customer-support rollback. Keep app and job health as logs and metrics, preserve the release and request identifiers that let support reconstruct an incident, and use an external heartbeat monitor for scheduled work. The practical design is two signals: queryable runtime evidence for what happened, plus a dead-man's switch for work that never happened. My decision rule is blunt: do not roll back because one chart turned red. Roll back when the evidence ties a customer-visible failure to a release, and retain the account and request context needed to explain that decision later. A status page answers "is it responding now?" Incident evidence answers "what changed, who was affected, and will reversal make things safer?" A health handler normally proves that one process can answer one request. It does not prove that yesterday's ticket importer ran, that a particular model response reached the customer, or that a rollback stopped the same failure from recurring. Green can be dangerously incomplete. Silence is different. For a support system, record a small set of stable facts on each meaningful operation: release ID, operation name, outcome, customer or tenant pseudonym, timestamp, and request ID. Logs carry event detail. Metrics carry bounded aggregates such as success counts and latency distributions. A trace_id and span_id can correlate related logs when they exist, but those fields do not create a distributed trace explorer or a span tree. The rollback rule has two independent inputs. Runtime evidence indicates whether the current release is causing a defined failure. A heartbeat service indicates whether a scheduled importer, escalation job, or transcript scrubber stopped reporting altogether. That separation matters because a job that never starts emits neither a failure log nor a failure metric. I would keep both. Privacy requirements can change the tool choice. If the incident record must s

InfraDev
Interesse
dev.to

I wrote 187 tests for a Chrome extension. The three bugs that mattered were invisible to all of them.

My unit tests were green. My integration tests were green. The feature was broken in a way that produced no error, no warning, and no visual clue that anything was wrong. The feature was a CSS difference blend mode, used to compare a design mockup against a live page: matching pixels turn black, so only the differences light up. Mine turned nothing black. It looked exactly like normal mode, and I lost about a week to it. The cause was one line of CSS, and the reason no test caught it is the interesting part. Here is the overlay, simplified. A closed shadow root holds an image positioned over the page: #overlay-host { position: absolute; z-index: 2147483647; /* stay above the page */ } .overlay-image { mix-blend-mode: difference; } That looks fine. It is not. mix-blend-mode blends an element with its backdrop — but only within its own stacking context. And z-index on a positioned element creates a stacking context. So the host became a sealed box, and the image blended against the empty space inside that box instead of against the page underneath. The result isn't an error. It isn't even visibly wrong unless you know what difference should look like. The image just renders normally, as though you never set the property. The same applies to opacity below 1, filter, transform, isolation, backdrop-filter, mask, contain: paint and will-change of any of those. Any one of them on an ancestor silently disables blending. On a page you don't control — which is the entire premise of a browser extension — any of them might arrive from the site's own CSS. The fix was to stop creating a stacking context on the host and move z-index onto the children that actually need it: #overlay-host { position: absolute; /* No z-index, transform, opacity, filter, isolation or contain here: any of them creates a stacking context and silently kills blending. */ z-index: auto; } .overlay-image { z-index: 2147483646; mix-blend-mode: difference; } Plus a MutationObserver re-pinning those properties

Dev
Interesse
dev.to

6 Practical Ways to Fix Flaky Tests in Your CI Pipeline

A flaky test passes sometimes and fails sometimes, with no change to the code. One flaky test is an annoyance. Twenty of them destroy trust in your pipeline: developers start clicking "re-run" by reflex, and real failures slip through because everyone assumes it's "just flakiness again." After many years working on QA and release pipelines, I've found that most flaky tests come from a small number of root causes. Here are six practical fixes, roughly in the order you should try them. You can't fix what you can't see. Before changing any tests, find out which tests are flaky and how often. A simple approach: re-run your suite several times on the same commit and record which tests produce different results. # Run the suite 10 times and keep each JUnit report for i in $(seq 1 10); do pytest tests/ --junitxml=reports/run-$i.xml || true done Any test that both passed and failed across those runs is flaky. Many CI platforms and test-reporting tools can also track this automatically over time. Rank the flaky tests by failure rate and start with the worst offenders. This is the single most common cause I see, especially in UI and API tests: # Flaky: assumes the page loads within 2 seconds time.sleep(2) button = driver.find_element(By.ID, "submit") On a busy CI runner, two seconds is sometimes not enough. Wait for a condition instead of a duration: # Stable: waits up to 10 seconds, but continues as soon as the button is clickable from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.support import expected_conditions as EC button = WebDriverWait(driver, 10).until( EC.element_to_be_clickable((By.ID, "submit")) ) The same principle applies to services: poll a health endpoint until it responds rather than sleeping for a fixed time after startup. If test B only passes when test A runs first, you have hidden shared state. It usually shows up when tests run in parallel or in a different order. Common culprits: Tests that share a database row or user acco

Dev
Interesse
dev.to

Node.js API Approach for Moderating Uploaded Images, User Captions, and Compression Gates

Short answer: put byte validation and one review-sized derivative before publication, then defer the full compression matrix until approval. Model the workflow as explicit state transitions, and make telemetry answer queue-age and failure questions without turning every upload ID into a permanent label. That boundary matters for a developer tool that accepts screenshots and captions. A rejected item should not trigger six encodes, while an approved item should not make the first reader wait for a cold codec path. I count storage and cardinality together: a log line is bytes retained, and a label is a future index with a potentially unbounded value set. The architecture record starts with invariants, not a vendor choice. Original bytes are immutable and private. A moderation decision covers the image and its caption as one revision. Only an approved state can reach a public serving key. Retries are idempotent. Every generated derivative names the source hash, transformation policy, and output format so a policy change can replay from one source. There are three placement choices. Their failure boundaries are different. Placement Useful property Failure boundary All derivatives at upload Predictable reads after approval CPU and storage are spent on items that may be rejected All derivatives on demand Small upload critical path First approved read can encounter a timeout, stampede, or codec failure Review derivative at upload; final derivatives after approval Bounded review latency and regenerable outputs Requires two queues and explicit state transitions The third row is the decision rule here. It keeps the quarantine path small while preserving a replay point for future formats. It also makes the public read path simpler: a missing derivative is a build state, not permission to inspect a pending object. Keep that boundary boring. The API acknowledges an upload only after it has a durable object address and an idempotency key. The worker checks the bytes, not the file

Dev
Interesse
dev.to

How to build an internal tool without developers (a step-by-step example with AI)

Every small company has a job that lives in the wrong place. Who has which laptop. Which van is due for a service. Which client asked for what, and who's on it. It sits in a shared spreadsheet, a WhatsApp group and one person's head, and it works until that person goes on holiday. The usual answer is "we should build a proper tool for that", followed by nothing, because there's no developer free and the job isn't big enough to hire one. That gap is exactly where AI app builders are useful now: you describe the tool, it gets built with a real database, and the team signs in to use it. This post walks through building one end to end, with the actual prompts. The example is an equipment tracker (who has what, when it's due back, what needs maintenance), because almost every team with more than ten people has one hiding in a spreadsheet. I'll use Mythex because it's what I build, but the steps and the mistakes are the same in any AI builder. AI builders are quick at screens and bad at guessing how your company works. Ten minutes of writing saves an afternoon of patching. Answer four questions: What are the things? Equipment items: name, type (laptop, tool, vehicle), serial number, purchase date, condition, location, photo. What happens to them? They get checked out to a person, returned, sent for repair, retired. Each of those is a record with a date and a person, not an edit to a cell. Who does what? Everyone can see what's available and request an item. Office managers check items in and out. Only admins add or retire items. What question do you ask most? "Who has the projector?" and "What's overdue?" Those become the front page. If you can't answer question 3, stop and ask your team. Permissions are the part of an internal tool that's hardest to bolt on later. Paste the brief in nearly as written. Long is fine; every sentence is a decision the AI won't have to guess. Build an internal equipment tracker for a 40-person company. Items have a name, type (laptop, tool, v

IA
Interesse
dev.to

The last stall in the market never sells, unless?

AI is adding a new layer to a world where software has been packaged and sold as a commodity for a long time. The old-school players have formed a complex ecosystem with deep distribution networks and user bases — something that would take years to build and is extremely difficult to achieve in the short term unless it’s truly an idea that cannot be duplicated. However, the growing concern among these players is that every day, a new product or clone pops up that does and offers exactly the same thing to the same user base, but at a dirt-cheap cost — many a times free. And mind you, there is absolutely no quality degradation in these offerings. Most of the times there are highly concentrated, superior products being offered. I started with same idea, i.e., if I build a superior product and make it free, people will come to use it in flocks. I was in for a suprise, entering a brutal cutthroat world where before I stepped in, there were already hundreds with same idea. Now this was a fairly simple idea based on something I personally struggled with while looking for a job change. At that point — and this was 3–4 years ago — there was hardly any site that would let you build and export your resume for free unless they were scraping your data or locking you behind a paywall on the verylast screen after promising a free resume. The free part, later that my sorry soul would realise, included just building it. It took me 7 days to create my own resume builder with frontier model and host it on a fancy site. Another 7 days went into SEO, Reddit posts, and Product Hunt to generate some noise around it, and users started tickling in. For months, I continued adding bits and pieces. The stream of users remained consistent, averaging 4–5 per day, and that was wonderful for me — someone who never had the time or patience to build something that would take AI hours today, but in the old coding days would have taken months to build and debug, and even then you would still be far fr

IA
Interesse
dev.to

Publishing Markdown to Substack from an Agent Skill

This article provides a step by step guide to publishing a markdown article to Substack with publishing-kit, an agent skill for Claude Code, Codex and Antigravity. Substack is the kit's fifth destination, after dev.to, Medium, AWS Builder Center and LinkedIn, and every output below comes from publishing the kit's own walk-through to a Substack publication. https://github.com/xbill9/publishing-kit One markdown file goes in. A Substack post comes out, with every code block, image and link checked in the draft Substack saved before it goes live. Substack has no publishing API. A post goes in through its web editor, and that editor decides what survives. Pasting HTML into it, then reading back the draft Substack stored, gives this: Content In the saved draft Multi-line code blocks 🟢 kept, same line and character counts Images on public URLs 🟢 fetched and re-hosted by Substack, alt text kept Plain links 🟢 kept Tables ❌ no table element exists in the editor A link whose text is inline code ❌ the link is dropped, the code is kept Section headings ⚠️ kept at the level pasted, in six distinct sizes None of the failures produces an error. The table disappears, or a link becomes plain monospace text, and the editor saves it. Substack's editor is built on ProseMirror, and its schema lists every element and mark a post can hold. The code mark is declared with excludes: "_", which means inline code can carry no other mark: no bold, no italic, no link. So [`skills/publishing/SKILL.md`](https://github.com/xbill9/publishing-kit/blob/main/skills/publishing/SKILL.md) arrives as skills/publishing/SKILL.md , and the editor keeps the code and discards the link. The kit's walk-through has two links written that way, and pasted as-is, its saved draft holds 2 link targets out of 4. The fix is to take the out of the anchor before pasting. The link survives as plain text, which keeps the reader's way to the page. Both lack tables, so the kit feeds Substack the same HTML it builds for Mediu

Dev
Interesse
+1 fonte
Hacker News

OpenAI "rogue" agent activities found on Wikimedia projects

Article URL: https://diff.wikimedia.org/2026/10/05/openai-rogue-agent-activities-found-on-wikimedia-projects/ Comments URL: https://news.ycombinator.com/item?id=49968105 Points: 29 # Comments: 15

IASegurança
Interesse
9to5Mac

AirPods Pro 3 vs AirPods Pro 2: Three reasons to upgrade

Apple released AirPods Pro 3 last year, bringing several big updates to its in-ear headphones. If you’re currently using AirPods Pro 2, there are three key reasons to consider upgrading, based on my experience using them over the past year. Buy AirPods Pro 3: $179 (Reg. $249) more…

Mobile
Interesse
dev.to

Redacted Email Debugging for Safer Account Flows

Email verification failures are hard to investigate. A user says the message never arrived, support sees a failed attempt, and an engineer opens logs full of addresses, provider responses, and sometimes the verification token. The team can find the problem, but sensitive data is now spread across systems never meant to be mailboxes. I prefer treating email debugging as a small threat-modeling exercise. The goal is not to hide every detail from every operator. It is to make the useful detail available at the right boundary, for the shortest reasonable time, with a clear reason for each field. An email address is often used as an account identifier, so it tends to follow a request through application logs, queues, retries, dashboards, and support tickets. A disposable email account used in a test can look harmless, but the same logging path may handle a real customer address tomorrow. A dummy e mail value in a fixture does not make an unsafe logging design safe. Verification tokens deserve more care. They are usually bearer credentials: anyone who gets a live token may be able to complete an account action. Logging the full URL for “temporary troubleshooting” is therefore a credential leak. Logs and screenshots can outlive the token by a long time. The first design question should be: what decision is an engineer trying to make? Common answers are whether a message was queued, whether the provider accepted it, whether the user requested a newer code, or whether a worker exceeded its retry budget. None of these decisions requires the original message body or a full verification URL. A redacted event can still be precise: keep an internal event name, request reference, keyed account reference, delivery status, attempt number, and timestamp. Add a recipient domain or provider only when it answers a real operational question. The account_ref should be a stable, keyed reference rather than an unsalted email hash. A plain hash of a common address is easy to guess. A keyed H

SegurançaDev
Interesse
dev.to

Your agent loads every tool schema by default. Decide which ones it should see.

Before you change anything about your agent config, answer two questions: # 1. how many prompt tokens does your harness send on a cold start? # 2. how many of those tokens are tool schemas? # measure with your provider tokenizer, not by counting characters. Most teams cannot answer either question. On October 1, 2026, Earendil shipped Pi 1.0. The release notes list Deferred tool loading Codemode, a JavaScript sandbox where the model composes tool calls Both turn tool visibility into a per-tool setting. That is the whole Pi spent a year saying it did not need MCP. The landing page said it The stated reasons were that MCP had matured, and that the tool loading So the reversal was less a change of heart than a collision between two A tool schema is not free. It sits in the system prompt or the tool That cost shows up in three places. Money. Every request pays for those tokens again. Attention. A long tool list is noise the model has to read past on Reproducibility. When a result changes between runs, the first Pi reports a figure for its own codemode change: the changelog gives an Pi's metadata makes a tool one of three things. The choice is yours per Direct. The model sees the schema and calls it itself. Use this for Deferred. The tool is declared only when the task calls for it. Use Codemode only. The model never sees the schema. It writes code that The third mode is the interesting one, because it changes what reaches Do not start by rearranging tools. Start by measuring. Count the prompt tokens your harness sends on a cold start, with tools Then sort every tool into one of the three buckets, and write the list Two questions settle most cases: Does the model need to choose this tool by name? If no, it belongs in codemode or deferred. How often is it called? Frequent means direct. Rare means deferred. Earendil is unusually candid about this, and you should read the caveat The problem is largely on the server side. Many MCP servers were built Earendil's own framing is

IADev
Interesse
dev.to

How I built a time-travel debugger for LLM agents on Burr, and what "replay the unchanged branch and prove nothing changed" actually takes.

Rewind: counterfactual replay for agent pipelines Every agent trace tool I've used has the same ceiling. It shows me a waterfall of steps, I spot that step six produced something stupid, and then I'm stuck. To find out why — or whether it was the model, the retrieval, or the prompt — I have to re-run the whole pipeline and hope it lands in the same place. With a non-deterministic model it doesn't, so I can never separate my change from model jitter. So I built the other thing: fork a completed run at any step, change exactly one input, replay only the downstream steps, and diff the two trajectories. Rewind does that, and — this is the part that took real care — when you replay a branch you didn't change, every output hash comes back identical and the replay costs zero tokens. That's the difference between a diff you can trust and a diff that's just noise. Here's the whole thing: the architecture, the four design rules that make determinism provable, and the handful of traps I walked into so you don't have to. browser (Vite + React 18 + TS + Tailwind) Graph · NodeEditor · DiffPanel · CostBar · RawJSON · Settings │ /api (Vite proxy) ▼ FastAPI ──── spawns a daemon thread per run; client polls /graph for live nodes │ ▼ Burr application ── plan → research → analyse → critique → revise → compose → verify → publish │ (llm) (tool) (tool) (llm) (llm) (llm) (tool) (tool) ├── SQLitePersister("burr_state") ← state after every node; what forking reads └── NodeTelemetryHook(PostRunStepHook) ← inputs/outputs/latency/tokens/content-hash per node │ ▼ rewind.db (SQLite, WAL): runs · nodes · edges · cache · tool_cache · burr_state data/*.csv, data/*.json → artifacts/*.md Eight nodes, four real model calls, four real local computations over a real dataset file. The graph is deliberately boring — a linear chain — because the interesting axis is time, not topology. I expected to hand-roll "resume from step N". Burr 0.42 has it natively: builder.initialize_from( persister, resume_at_next_

IADev
Interesse
dev.to

Integración de DevSecOps con Bearer SAST y GitHub Actions: detección, bloqueo y remediación de vulnerabilidades

Autores: Saúl José Alvarado Urbano y Ana Cecilia Esteban Ramos Repositorio: github.com/saulalvarado1/Bearer_Articulo API en producción: bearer-articulo.onrender.com En el desarrollo de software moderno, la seguridad no debería incorporarse únicamente al final del proyecto o antes de publicar una aplicación en producción. El enfoque Shift-Left propone integrar controles de seguridad desde las primeras etapas del ciclo de vida del desarrollo de software. En este artículo presentamos la implementación práctica de un flujo DevSecOps aplicado a una API REST desarrollada con Node.js y Express. Para automatizar el análisis de seguridad se configuró un pipeline de Integración Continua mediante GitHub Actions, incorporando Bearer CLI como herramienta de análisis estático de seguridad de aplicaciones o SAST. El objetivo fue comprobar cómo una vulnerabilidad introducida intencionalmente dentro del código puede ser detectada automáticamente antes de continuar con el proceso de despliegue. Para la demostración se simuló la exposición de información sensible dentro de los logs de autenticación. Bearer detectó el problema, marcó el hallazgo con severidad alta y provocó que el pipeline finalizara con error. Posteriormente se realizó la corrección del código y se ejecutó nuevamente el análisis hasta obtener un pipeline exitoso, permitiendo continuar con el flujo de despliegue de la aplicación en Render. La solución integra desarrollo, control de versiones, análisis estático de seguridad, automatización y despliegue en la nube. [ Desarrollador ] │ │ git push ▼ [ Repositorio GitHub ] │ │ Trigger del Workflow ▼ [ GitHub Actions ] │ ├──► Checkout del código │ ├──► Escaneo SAST con Bearer CLI │ │ │ ├── HIGH / CRITICAL │ │ ▼ │ │ ❌ Pipeline fallido │ │ │ └── Sin hallazgos graves │ ▼ │ ✅ Pipeline exitoso ▼ [ Despliegue en Render ] Backend: Node.js y Express. Herramienta SAST: Bearer CLI. Integración continua: GitHub Actions. Repositorio de código: GitHub. Entorno Cloud / PaaS: Render. Tipo

SegurançaDev
Interesse
dev.to

🤯 I Thought I Found an LLM Vulnerability. I Was Wrong. Then I Found a Real One.

————————————————————————————————————————————————————————————————————— I built a sandboxed AI red-team lab to answer a simple question: can I actually find and validate security issues in an LLM application myself? ————————————————————————————————————————————————————————————————————— Every week there is another article about prompt injection, jailbreaks, or LLM application vulnerabilities. github.com/soluckyarya2-tech/ai-red-team-lab ————————————————————————————————————————————————————————————————————— The workflow that eventually produced every finding in this project was: Validate the attacker identity and token Establish a baseline Attack Run a control Re-test the authentication, authorization, and reproduction conditions Document the result — including what failed Step 1 exists because of the story in the next section. Step 6 exists because a findings list without evidence is just a list of claims. For authorization testing, I wanted every result to answer the same questions: Who is making the request? Is the credential actually valid? What can the legitimate owner do? What can the unauthorized user do? Does the response demonstrate access to the protected resource? Can the result be reproduced independently? That process became more important than any individual tool. ————————————————————————————————————————————————————————————————————— I tested Open WebUI’s API surface with two synthetic standard users. F1 — The files router holds the boundary ————————————————————————————————————————————————————————————————————— The chat authorization test became the project’s most important methodological lesson. ————————————————————————————————————————————————————————————————————— The real application-layer finding appeared when I followed the file into the RAG pipeline. One test account uploaded a file containing a unique marker: TOPSECRET-TEST2-4821 The other account attempted direct access to the file. Direct access returned 404. The unauthorized account submitted the owne

SegurançaDevIA
Interesse
dev.to

Nightly Data Cleanup With Cron, HTTP Endpoints, and Queue Workers

When a customer-support system retries outbound webhooks, the cleanup job is easy to underestimate. A nightly delete of old delivery records may fit in one request today and run for hours after the next growth spurt. Short answer: use cron to call a public HTTP cleanup endpoint for short work; for larger deletions, have that endpoint enqueue bounded batches for idempotent queue workers. The useful question is not “which cron package should I install?” It is: can a retry create a second destructive action? Standard queue delivery is at-least-once, so the worker must be safe to run twice. I keep a unique batch key in the database and make the delete conditional on that key. A repeated message then becomes a no-op instead of a second pass over the same rows. This matters for webhook history. Deleting a row is not the only side effect; an audit event, a usage counter, or a customer-visible status can also be touched. The worker should claim a batch, perform the bounded operation, and record completion in one transaction where the datastore allows it. FIFO deduplication is only a five-minute window, which is too short to be your correctness model. Three words: retry is normal. For a small table, the public endpoint can finish directly. A cron run is capped at 900 seconds, though, and the cron task only calls a public http_url; it does not host your Node.js process. That makes the endpoint a useful trigger, not a place to hide an unbounded vacuum operation. Here is the smallest shape I use. The endpoint accepts a signed request from the scheduler, publishes one bounded batch, and returns quickly. The worker owns deletion. The request includes an idempotency key so a timeout followed by a retry cannot enqueue a second logical batch. const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) throw new Error("INFRAI_API_KEY is required"); const apiBase = process.env.BACKEND_API_BASE; if (!apiBase) throw new Error("BACKEND_API_BASE is required"); async function postJson(path: "/

DevInfra
Interesse
dev.to

An Optional Property Isn't the Same as undefined

undefined Is Not the Same as Not Being There An optional property looks a lot like a property whose value can be undefined. But they are not quite the same thing. That difference becomes important when you care about whether a property exists at all. Consider these two objects: const a = {}; const b = { value: undefined, }; At a glance, they can look equivalent. Reading value gives you undefined in both cases: console.log(a.value); console.log(b.value); Both print: undefined But the objects are different. One does not have a value property. The other does. You can see that with: console.log("value" in a); console.log("value" in b); The result is: false true That distinction is easy to miss because normal property access hides it. Now look at this type: type Config = { value?: string; }; The ? means the property may be absent. So this is valid: const config: Config = {}; And this is also valid: const config: Config = { value: "hello", }; Depending on your TypeScript configuration, this can also be valid: const config: Config = { value: undefined, }; But those last two objects still represent different runtime states. The first has a value. The second has a property whose value is undefined. That difference matters when the presence of the property itself has meaning. Imagine an API where omitting a property means: "Don't change this setting." while explicitly passing undefined has a different meaning. Or imagine code that checks whether a property was supplied: if ("value" in config) { // the caller supplied the property } Now these two values are no longer interchangeable: const a: Config = {}; const b: Config = { value: undefined, }; The type might make them look similar. The runtime object does not. This becomes especially interesting when objects are passed between functions, merged together, serialized, or used as configuration. There is a compiler option specifically related to this distinction: { "compilerOptions": { "exactOptionalPropertyTypes": true } } With

Dev
Interesse
dev.to

DOCKERIZING A NOTE WEB APP THAT SAVES ITS DATA IN A PostgreSQL Database AND DEPLOYING IT ON AZURE IN THREE (3) DIFFERENT WAYS.

This blog shows three (3) different ways to host an app on Azure safely and efficiently. The three ways are as follows: Azure Container Instances. Web App for Containers + Azure Database for PostgreSQL. Virtual Machine + Docker Compose. REQUIREMENTS: No.1: Azure Container Instances. http://localhost:3000 in your browser. Publish Your Image to Docker Hub: At this moment, your app image exists only on your computer. Azure can't access your laptop, so you need to upload the image to a registry Azure can pull from. Now log into your Azure Account in your terminal using Azure CLI command and create a resource group. Also I create an aci-notes.yaml file that tells Azure which containers to run and how to configure them. Azure reads this file the way Docker Compose reads docker-compose.yaml. open in browser: No. 2: Web App for Containers and a Managed Database: Azure handles backups, patching, high availability and scaling for you. The app itself runs on Azure Web App for Containers, a platform built for hosting containerized web apps, with automatic HTTPS, scaling and deployment slots. This is the recommended pattern. Create the managed PostgreSQL server. Checking the server to capture its address. Creating the App Service plan. Creating the web app from your image. Point the app at the managed database. Restart the app and wait. No.3: Virtual Machine + Docker Compose: Sometimes you want full control over the server, custom software, specific networking, or simply to understand what platforms like Web App for Containers do behind the scenes. In this option you rent a Linux server, install Docker on it yourself, and run the same kind of compose file you used locally. You are now the system administrator. Create a resource group and a small Ubuntu Linux server inside it. Opening port 3000. Connecting to the VM. Refreshing the package list. Install Docker and Docker Compose on the VM. Install helper tools. Create a folder for repository keys. Download Docker's signing key. M

InfraDev
Interesse
dev.to

useRef in React

useRef is one of the important Hooks in React. It is mainly used to store a value that persists between renders without causing a re-render. It can also be used to directly access a DOM element. To use useRef, we need to import it from React: import { useRef } from "react"; useRef creates a reference object that contains a property called current. const myRef = useRef(initialValue); For example: const countRef = useRef(0); Conceptually, React creates an object like: { current: 0 } We can access or modify the value using: countRef.current The important point is that changing ref.current does not cause the component to re-render. One of the most common uses of useRef is accessing a DOM element directly. For example, suppose we have an input field and want to focus it when a button is clicked. import { useRef } from "react"; function App() { const inputRef = useRef(null); function handleFocus() { inputRef.current.focus(); } return ( Focus Input ); } export default App; Here, inputRef is attached to the input using: After React renders the input, inputRef.current refers to that actual DOM element. Therefore: inputRef.current.focus(); directly focuses the input. Think about a TV remote. The remote is used to directly control a particular TV. Similarly: useRef ↓ Reference ↓ DOM element ↓ Direct interaction This is the most important difference between useRef and useState. With useState: const [count, setCount] = useState(0); If we do: setCount(10); React updates the state and re-renders the component. But with useRef: const countRef = useRef(0); countRef.current = 10; The value changes, but React does not re-render the component. We can remember it like this: useState value changes ↓ re-render ↓ UI updates useRef value changes ↓ no re-render Both useState and useRef can store values, but they behave differently. useState useRef Stores state Stores a mutable reference Changing state causes re-render Changing current does not cause re-render Used when UI needs to update Use

Dev
Interesse