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

推荐订阅源

云风的 BLOG
云风的 BLOG
The GitHub Blog
The GitHub Blog
A
About on SuperTechFans
P
Proofpoint News Feed
G
Google Developers Blog
Stack Overflow Blog
Stack Overflow Blog
IT之家
IT之家
Microsoft Security Blog
Microsoft Security Blog
F
Fortinet All Blogs
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
C
Check Point Blog
Microsoft Azure Blog
Microsoft Azure Blog
aimingoo的专栏
aimingoo的专栏
月光博客
月光博客
美团技术团队
D
Docker
博客园 - Franky
Y
Y Combinator Blog
大猫的无限游戏
大猫的无限游戏
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
博客园 - 【当耐特】
罗磊的独立博客
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报

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
The warmup engine that worked perfectly and did nothing
Deva · 2026-06-26 · via DEV Community

Deva

The bug that broke my warmup engine was not a missing save call. That is the obvious culprit when state does not persist, and it is wrong here. The real problem is that my code masked a missing field so thoroughly that the system had no way to detect its own broken state.

Here is what happened. The x engine runs a gradual warmup: fresh accounts start at phase 0 (very low post volume) and advance through phases as dwell time accumulates. Each phase has a minimum floor. The account must have been in that phase for at least N hours before it can graduate. The anchor for that timer is phase_started_unix, stored in the state JSON on disk.

evaluate() reads the state, checks the dwell, and decides whether to advance. It calls a helper, _wstate, to populate a warmup state object from the persisted blob. _wstate is defensive: if phase_started_unix is missing, it defaults it to now(). This is sensible in memory because the system needs something to work with. But evaluate() has two paths: one for a state change (persists everything) and one for no_change (persists nothing, returns early).

On a fresh account, the first evaluate() call always landed on the no change path because nothing actually needed to change yet. _wstate set started to now in memory, the no change path returned, nothing was written to disk, and on the next tick the whole thing repeated. Every tick, started re defaulted to now. The dwell gate never passed. The account was permanently silent.

The subtlety is the masking. When I read _wstate output inside evaluate(), the field is always populated, always looks healthy. There is no visible gap. The bug is invisible unless you diff the in memory object against the raw persisted blob before _wstate runs.

The fix: before calling _wstate, read the raw blob directly. If phase_started_unix is absent in the raw data, this is the first live evaluate. Seed the anchor, write it to disk, then proceed. Once seeded it is stable. Dwell accumulates normally. The engine advances.

Dry run mode never touches disk, which is the correct invariant for dry run calls everywhere in this system. So the seeding is gated on live mode only. Dry run output will always show phase 0 on a fresh account, but that is accurate, not a bug.

I added four regression tests: fresh account seeds on first live evaluate, does not seed on dry run, does not re seed on subsequent runs, and advances phase once dwell is satisfied. Suite stayed at 141 green.

What I would do differently: _wstate should not silently default missing timestamps. It should return the raw missing sentinel and let the caller decide what to do. Defensive defaulting inside a deserialization helper looks helpful but it distributes the 'what does missing mean' decision across every caller, and in this case two callers had different correct answers: memory says default to now, disk says seed and persist. Keep that policy at the call site. When a helper hides the absence of a value, you lose the ability to distinguish 'field was set' from 'field was defaulted,' and that distinction is exactly what this bug required.