惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Threatpost
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
S
Security Affairs
N
News and Events Feed by Topic
T
Tenable Blog
P
Proofpoint News Feed
W
WeLiveSecurity
Simon Willison's Weblog
Simon Willison's Weblog
Google DeepMind News
Google DeepMind News
C
CERT Recently Published Vulnerability Notes
Help Net Security
Help Net Security
I
Intezer
T
Threat Research - Cisco Blogs
S
Secure Thoughts
C
Cyber Attacks, Cyber Crime and Cyber Security
L
Lohrmann on Cybersecurity
AWS News Blog
AWS News Blog
Google Online Security Blog
Google Online Security Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Know Your Adversary
Know Your Adversary
Project Zero
Project Zero
The Hacker News
The Hacker News
Security Archives - TechRepublic
Security Archives - TechRepublic
T
Tor Project blog
N
News | PayPal Newsroom
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Hacker News - Newest:
Hacker News - Newest: "LLM"
A
Arctic Wolf
Forbes - Security
Forbes - Security
O
OpenAI News
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
Security Latest
Security Latest
P
Palo Alto Networks Blog
S
Schneier on Security
S
Securelist
C
Cybersecurity and Infrastructure Security Agency CISA
H
Heimdal Security Blog
V
Vulnerabilities – Threatpost
www.infosecurity-magazine.com
www.infosecurity-magazine.com
博客园_首页
T
Troy Hunt's Blog
Latest news
Latest news
Recent Announcements
Recent Announcements
MyScale Blog
MyScale Blog
人人都是产品经理
人人都是产品经理
L
LINUX DO - 热门话题
M
MIT News - Artificial intelligence
N
Netflix TechBlog - Medium
V
Visual Studio Blog
H
Hacker News: Front Page

DEV Community

Authentication Security Deep Dive: From Brute Force to Salted Hashing (With Java Examples) Why AI Systems Don’t Fail — They Drift Spilling beans for how i learn for exam😁"Reinforcement Learning Cheat Sheet" I Replaced Chrome with Safari for AI Browser Automation. Here's What Broke (and What Finally Worked) How Python Borrows Other People's Work The $40 Architecture: Processing 1 Billion API Requests with 99.99% Uptime Vibe Coding: A Workflow Guide (From Zero to SaaS) Most webhook security guides protect the wrong side. The scary part is delivery. Headless CMS for TanStack Start: Build a Blog with Cosmic EU Age Verification App "Hacked in 2 Minutes" — What Actually Happened Comfy Cloud’s delete function does not actually remove files Running AI Models on GPU Cloud Servers: A Beginner Guide Event-driven media intelligence with AWS Step Functions and Bedrock I scored 500 AI prompts across 8 quality dimensions — here's what broke How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed) The Portal Protocol: Reclaiming Human Connection in the Age of AI How to Fix Your Team's Scattered Knowledge Problem With a Self-Hosted Forum Intro to tc Cloud Functors: A Graph-First Mental Model for the Modern Cloud Designing Multi-Tenant Backends With Both Ownership and Team Access I Built a Neumorphic CSS Library with 77+ Components — Here's What I Learned PostgreSQL Performance Optimization: Why Connection Pooling Is Critical at Scale Cómo construí un SaaS multi-rubro para gestionar expensas en Argentina con FastAPI + Vue 3 🚀 I Built an Ethical Hacking Scanner Tool – Open Source Project I Replaced /usage and /context in Claude Code With a Single Statusline A Pythonic Way to Handle Emails (IMAP/SMTP) with Auto-Discovery and AI-Ready Design I Collected 8.9 Million Polymarket Price Points — Here's What I Found About How Markets Really Move EcoTrack AI — Carbon Footprint Tracker & Dashboard Everyone's Using AI. No One Agrees How. 5 self-hosted ebook managers worth trying in 2026 Building Your First AI Agent with LangChain: From Chatbot to Autonomous Assistant Common SOC 2 Failures (Real World) Stop Vibe-Checking Your AI App: A Practical Guide to Evals How to Use SonarQube and SonarScanner Locally to Level Up Your Code Quality Your Next To-Do App Is Dead — I Replaced Mine with an OpenClaw AI Sign a Nostr event in 60 lines of Python using coincurve — no nostr-sdk, no nbxplorer, no rust toolchain ITGC Audit Explained Like You’re in Big 4 Patch Tuesday abril 2026: Microsoft parcha 163 vulnerabilidades y un zero-day en SharePoint Stop scraping everything: a better way to track competitor price changes Listing on MCPize + the Official MCP Registry while routing payments OUTSIDE the marketplace — how I kept 100% of my x402 revenue Building an AI-Powered Risk Intelligence System Using Serverless Architecture Why We Ripped Function Overloading Out of Our AI Toolchain Testing AI-Generated Code: How to Actually Know If It Works SaaS Churn Is Killing Your Business. Here Is What to Do About It (Without a Support Team) The Speed of AI Is No Longer Linear - And Self-Improving Models Are Why How to Implement RBAC for MCP Tools: A Practical Guide for Engineering Teams From Standard Quote to Persuasive Proposal: AI Automation for Arborists I built a CLI that scaffolds complete multi-tenant SaaS apps Axios CVE-2025–62718: The Silent SSRF Bug That Could Be Hiding in Your Node.js App Right Now The dashboard that ended our friendship Data Pipelines Explained Simply (and How to Build Them with Python) The Hidden Cost of AI Systems Nobody Talks About. undefined vs undeclared, and how typeof behaves Switching from file-based jobs to NATS/Kafka in Rust without changing code io_uring Adventures: Rust Servers That Love Syscalls Why Agentic AI is Killing the Traditional Database The POUR principles of web accessibility for developers and designers Quantum Neural Network 3D — A Deep Dive into Interactive WebGL Visualization How To Install Caveman In Codex On macOS And Windows Automation Pipeline Reliability: Why Your Workflow Breaks When Nobody Is Watching I Built an 'Open World' AI Coding Agent — It Works From ANY Folder From Freelancing to Product: A Tech Service Company's SaaS Transformation China's AI Giants: Adding Tencent Hunyuan & ByteDance Doubao to AI University (74 Providers) On the Vibe Coders and Their Lies clerk: Auto-Summarize Your Claude Code Sessions AI Weekly — 2026/04/10–04/17 | The Model Lockdown Is Here, but the Toolchain Is the Real Battleground AI 週報 — 2026/04/10–2026/04/17 模型封鎖潮來了,但工具鏈才是真戰場 Maybe this is how Open-Source apps are born... 🚀 Fine-Tune LLMs with LoRA and QLoRA: 2026 Guide tRPC v11 + Next.js App Router: End-to-End Type Safety Without the Boilerplate ShadCN UI in 2026: Why I Stopped Installing Component Libraries and Started Owning My Components SaaS Billing in React Server Components: Stripe + Supabase Without a Single `useEffect` Join our DEV Weekend Challenge — $1,000 in Prizes Across TEN winners! Submissions Due April 20 at 6:59 AM UTC. Implementing FSRS Spaced Repetition in Flutter + Supabase — Adding Memory Science to an AI Learning App "I Texted My Localhost From the Train — Claude Code Fixed the Bug Before I Got Home" I Built a Sales Prep AI and It Went Deeper Than Expected Design to Code #2: One JSON, Eleven Outputs Solving the 100M-Row Problem: A Summary Table Pattern for High-Volume Push Notification Logs Flutter Web With Wasm: What Actually Changes For Developers I Built 50 Royalty-Free Soundtracks for My Side Project in a Weekend Using AI Music Generation The Vibe Coding Security Checklist: 7 Things to Check Before You Ship Stop Letting Googlebot Guess Fix Your React App's SEO Right Desconstruindo o Streaming do LinkedIn: Como Criar um Engine de Extração de Vídeo de Alta Performance com HLS e FFmpeg (EDA Part-1) EDA (Exploratory Data Analysis) Explained With Real Life — Why Looking at Your Data Is the Most Important Step in Machine Learning Brand Relationship Management at Scale: Our 4-Touch Outreach System for 200+ Brands Why String.fromEnvironment() Might Return an Empty String in Dart JGuardrails 1.0.0 — Hardening Java LLM Apps Against Jailbreaks, Toxicity, and Prompt Injection Plan and Schedule a Full Week of Threads Content From One Claude Conversation Coding Cat Oran Ep3, Five Tables Changed Everything Updated: BFF Pattern I'm done watching freelancers get buried by 200 proposals. So I'm building the alternative. This is my first post BFS Algorithm in Java Step by Step Tutorial with Examples Tracking LLM Pricing Monthly: An Open Dataset for 22 AI Models How We Measure Content ROI on a Comparison Site: Revenue Attribution Without Perfect Data Introducing Nova AI Ops: The AI-Native Operating System for SRE Teams I built a free desktop video downloader for Windows — Grabbit How Talkie OCR Helps Vision-Impaired & Dyslexic Users Read the World Around Them VRCFaceTracking安装和iPhone面捕配置教程,有bug Even CrowdStrike Can't See Your Agents The Automation Gold Rush: What n8n Workflows and Claude Are Opening Up for Developers Right Now
Idempotent Data Reconciliation - Production Patterns That Don't Create Noise
137Foundry · 2026-05-13 · via DEV Community

The first version of a data reconciliation system almost always has the same failure mode: it works correctly, then gets deployed to production, and immediately generates hundreds of duplicate alerts. The same discrepancy is reported every time the job runs. Operators learn to ignore the alert channel within a week. The system that was supposed to improve data reliability becomes noise.

The root cause is the same in almost every case: the comparison engine was built as a stateless script. Each run produces a fresh list of discrepancies with no awareness of what previous runs found. Without state management, every run is the first run.

Making a reconciliation system idempotent - ensuring that running it multiple times produces the same observable outcome as running it once - requires both deterministic comparison logic and persistent state that survives between runs. This piece covers the patterns that make that work in production.

Why Idempotency Is the Right Frame

Idempotency is a property typically discussed in the context of API calls and database writes: calling an endpoint or executing a write multiple times should have the same effect as calling it once. The same principle applies to reconciliation runs.

A reconciliation run is idempotent when: running it twice on unchanged source data produces zero new alerts, no duplicate discrepancy records, and the same state in the tracking store as running it once. The run reads, compares, and updates state - but only creates new signals where something actually changed.

This property requires two things. First, the comparison engine must produce deterministic output from the same input. The same two records compared twice should produce the same list of discrepancies. Second, the discrepancy tracker must distinguish between "new discrepancy" and "discrepancy we already know about."

The Stable Discrepancy Identifier

The mechanism that enables idempotent state management is a stable identifier for each discrepancy. This identifier must be deterministic from the discrepancy's properties and stable across runs.

A practical stable identifier is a hash of the record's comparison key, the field name, and optionally the values from each source. The comparison key ensures the identifier is unique to a specific record. The field name ensures it is unique to a specific field on that record. Including the values is optional but useful if you want different values for the same field on the same record to generate distinct discrepancy records.

import hashlib
import json

def discrepancy_id(comparison_key, field_name, value_a=None, value_b=None):
    """
    Generates a stable identifier for a discrepancy.
    Omit value_a and value_b to make the ID value-independent
    (same discrepancy regardless of the specific values).
    """
    payload = {
        "key": str(comparison_key),
        "field": field_name,
    }
    if value_a is not None or value_b is not None:
        payload["values"] = [str(value_a), str(value_b)]

    canonical = json.dumps(payload, sort_keys=True)
    return hashlib.sha256(canonical.encode()).hexdigest()[:16]

Enter fullscreen mode Exit fullscreen mode

Using this identifier, the tracker upserts on each run. SQLAlchemy provides upsert support via its ORM and core layers for managing the discrepancy state table. Redis is useful as a deduplication cache for the current run's processed record set.: if a discrepancy with this identifier exists, update its last_seen timestamp. If it does not exist, create a new record and queue an alert.

The Discrepancy Lifecycle

A production discrepancy tracker manages four states:

Open: The discrepancy was detected and has not yet been resolved. Each subsequent run that still finds the discrepancy updates last_seen without creating a new alert.

Acknowledged: An operator has reviewed the discrepancy and flagged it as known. Acknowledged discrepancies do not generate repeat alerts even if they persist across runs. This is the key escape valve for cases where the discrepancy is a known acceptable difference (two systems intentionally representing the same entity differently) rather than an error.

Resolved: A run completed without finding the discrepancy. The tracker marks it resolved and can optionally send a resolution notification.

Escalated: The discrepancy has been open beyond a configured threshold and has been escalated to a higher-urgency channel or a human-review queue.

The state machine transitions:

  • New detection -> Open (alert fires once)
  • Open, found again -> Open (update last_seen, no new alert)
  • Open, not found -> Resolved (optional resolution notification)
  • Open, beyond threshold -> Escalated
  • Acknowledged, found again -> Acknowledged (no alert, no state change)
  • Acknowledged, not found -> Resolved
def process_discrepancy(tracker, disc_id, field_name, val_a, val_b):
    existing = tracker.get(disc_id)
    if existing is None:
        tracker.create(disc_id, field_name, val_a, val_b, status="open")
        alert(disc_id, field_name, val_a, val_b)
    elif existing["status"] == "open":
        tracker.update_last_seen(disc_id)
    elif existing["status"] == "acknowledged":
        pass  # known, no action needed

Enter fullscreen mode Exit fullscreen mode

Handling Resolved Discrepancies

Detecting resolution requires comparing the set of open discrepancies against the set of discrepancies found in the current run. Any open discrepancy that does not appear in the current run's findings has resolved.

def resolve_cleared(tracker, current_run_ids):
    open_discrepancies = tracker.get_by_status("open")
    for disc in open_discrepancies:
        if disc["id"] not in current_run_ids:
            tracker.mark_resolved(disc["id"])

Enter fullscreen mode Exit fullscreen mode

This logic must account for partial comparisons. If the current run only compared a subset of records (incremental mode), discrepancies for records not included in this run's comparison should not be marked resolved - they were simply not checked. The resolution check should only run against discrepancies whose records were included in the current run's comparison scope.

One practical approach: tag each discrepancy with the comparison scope (date range, record ID range, or full) at creation time, and only attempt resolution for discrepancies whose scope is covered by the current run.

Comparison Determinism

Idempotent alerting is only possible if the comparison engine itself is deterministic. The same two records compared twice must produce the same discrepancy output. Non-determinism typically enters through:

Floating-point comparison without a tolerance. Direct equality comparison of float values can produce inconsistent results when the same underlying value is represented with different floating-point precision across systems. Always use a tolerance threshold for float comparisons and enforce it consistently.

Timestamp handling without normalization. Comparing timestamps from two systems without normalizing to UTC and stripping subsecond precision that one system tracks and the other does not will produce spurious discrepancies on repeated comparisons of the same records.

Null handling inconsistency. If your comparison treats null-in-A vs value-in-B as a discrepancy in some contexts but not others, the same pair of records can produce different results on different runs depending on which code path evaluates them.

Document and enforce the comparison rules for each field type before writing the state management layer. Non-determinism in comparison logic makes the state management layer impossible to reason about.

The Value of Acknowledged State

The acknowledged state deserves emphasis because it is the pattern that makes reconciliation systems sustainable in environments where not every discrepancy is an error.

Two systems that represent the same customer entity will sometimes have legitimately different representations of certain fields. A billing system rounds currency amounts; the CRM does not. An analytics system uses a different timezone for date fields than the operational system. These are not errors - they are design decisions. But they will surface as discrepancies in any comparison.

Without acknowledged state, operators must either tune the comparison to exclude these fields (reducing coverage) or accept that those discrepancy alerts will fire on every run forever (producing noise). Acknowledged state gives you a third option: detect the discrepancy once, review it, and mark it as an accepted difference that should not generate alerts on subsequent runs but should still appear in audit reports.

The guide on data reconciliation system design at 137Foundry covers the full architecture including the discrepancy tracker schema and how the state machine integrates with the comparison engine and scheduling layer.

Production Deployment Checklist

Before deploying a reconciliation system to production:

  • Verify comparison logic is deterministic: run it twice on the same data and compare the output byte-for-byte
  • Test resolution detection with a controlled discrepancy that you clear between runs
  • Verify that acknowledged discrepancies do not generate alerts on re-detection
  • Test partial-scope runs to confirm they do not incorrectly resolve out-of-scope discrepancies
  • Use Prefect or a similar orchestration tool to handle scheduling, retry policies, and run health monitoring. Set up monitoring on the reconciliation job itself: how long each run takes, how many records were compared, how many discrepancies were found
  • Define alert thresholds for escalation before any real discrepancies appear

A reconciliation system that generates reliable, low-noise, actionable signals is worth significantly more than one that technically detects everything but has trained its operators to filter the channel. Idempotency is the engineering property that makes the difference between the two.