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

推荐订阅源

S
Secure Thoughts
P
Proofpoint News Feed
D
Darknet – Hacking Tools, Hacker News & Cyber Security
Project Zero
Project Zero
Cyberwarzone
Cyberwarzone
K
Kaspersky official blog
AWS News Blog
AWS News Blog
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
N
News | PayPal Newsroom
S
Schneier on Security
O
OpenAI News
S
Security @ Cisco Blogs
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
月光博客
月光博客
GbyAI
GbyAI
T
Tenable Blog
B
Blog
人人都是产品经理
人人都是产品经理
Engineering at Meta
Engineering at Meta
T
Troy Hunt's Blog
量子位
S
Security Affairs
Security Archives - TechRepublic
Security Archives - TechRepublic
The Cloudflare Blog
W
WeLiveSecurity
U
Unit 42
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
The GitHub Blog
The GitHub Blog
Cloudbric
Cloudbric
A
About on SuperTechFans
Hacker News - Newest:
Hacker News - Newest: "LLM"
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Google DeepMind News
Google DeepMind News
博客园_首页
I
Intezer
P
Proofpoint News Feed
N
News and Events Feed by Topic
SecWiki News
SecWiki News
Microsoft Security Blog
Microsoft Security Blog
TaoSecurity Blog
TaoSecurity Blog
博客园 - 三生石上(FineUI控件)
NISL@THU
NISL@THU
Latest news
Latest news
H
Help Net Security
G
Google Developers Blog
博客园 - Franky
T
The Exploit Database - CXSecurity.com
Cisco Talos Blog
Cisco Talos Blog
Know Your Adversary
Know Your Adversary

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
Structured AI Interview Rebuilt the Core of an App
Patricio Gab · 2026-05-09 · via DEV Community

The bug that revealed the real problem

The trigger was a bug report on timed breathing sessions. The app was confusing rounds with reps. Hold values that made sense for counted breathing made no sense for timed breathing. The concept of "20 breaths per minute" and "a round lasts 30 seconds" were being shoehorned into the same fields. And the long full-lungs retention in hormesis — a 60–120 second hold after rapid breathing — was being modeled as just a very long in-rep hold, which broke everything about how retentions should work.

It wasn't a bug in the usual sense. It was a data model that couldn't express the domain it was trying to represent.


The old model

The engine was built around a Cycle: one inhale + optional holds + one exhale. Rounds were cyclesPerRound. The custom builder called cycles "rounds." Timed and counted modes were handled by a mode discriminator on each phase. Long retentions were just cycles with enormous hold values.

The types looked roughly like this:

type BreathPhase =
  | { mode: 'time'; inhaleSec: number; exhaleSec: number; holds: HoldConfig }
  | { mode: 'bpm'; bpm: number; holds: HoldConfig }

type Cycle = {
  phases: BreathPhase[]
  cyclesPerRound: number
  repeatLast?: boolean
}

Enter fullscreen mode Exit fullscreen mode

Three problems were baked in:

  1. Rounds vs reps conflated. cyclesPerRound was a mapping from internal engine cycles to user-visible rounds — a leaky abstraction that every UI component had to work around.
  2. Two breath modes that were almost the same. mode: 'time' and mode: 'bpm' both described a breath with four phases. The distinction forced a discriminator into every type, every render, every conversion.
  3. Retentions as long holds. A 90-second empty-lungs retention after hormesis power breathing was stored as holdAfterExhaleSec: 90 — the same field used for a 4-second box-breathing pause. Nothing in the model distinguished them.

The question wasn't how to fix the bug. The question was what the model should actually look like.


The interview

Instead of jumping to code, the session started with a structured design interview: one question at a time, each with a stated recommendation and an explicit trade-off. The goal was to lock every decision before a single line changed.

Here are the four questions that unlocked the architecture.

Q1 — Vocabulary

Right now the code has Cycle and cyclesPerRound. You're saying this is wrong. I think the right vocabulary is a 3-level hierarchy:

  • Rep = one inhale + optional hold + exhale + optional hold. The atomic breath unit.
  • Round = a sequence of reps, defined by either total reps (count mode) or total duration (timed mode).
  • Program = an ordered sequence of rounds.

Does this match your mental model?

User: yes that matches, program → round → rep, this also works for constructing any breathing

One exchange. Three levels. The entire naming problem resolved.


Q2 — One rep shape or two?

A rep is one inhale + optional holds + exhale + optional holds. The question is how it's parameterized.

Option A — One unified shape: 4 numbers.
Every rep is { inhaleSec, holdAfterInhaleSec, exhaleSec, holdAfterExhaleSec }. BPM is just a UI convenience — "20 bpm, equal split" maps to inhaleSec=1.5, exhaleSec=1.5. Internally there's only one rep type.

Option B — Two rep modes.
{ mode: 'time', ... } and { mode: 'bpm', ... }. Preserves a conceptual distinction between a metronome-paced breath and a time-paced breath.

Recommendation: Option A. The internal model stays a single 4-tuple. Animation can detect "fast equal split" and pulse instead of expanding smoothly — that's a render-time decision, not a data-model one.

User: Option A, but keep the count UX, we can count up if that's easier

This was the biggest design unlock. Collapsing two modes into one 4-number shape removed a discriminator from every type downstream. The data model went from "two kinds of breathing phases that mostly behave the same" to "every breath is the same shape; rounds vary." That simplification only became visible by writing it down and asking: is this distinction real?


Q4 — Retentions as a distinct round type

Hormesis's recovery is a 60–120s full-lungs hold. Box-breathing holds are 4–10s. These are not the same thing.

Option A — Retention is a distinct property of a breathing round. Hormesis = breathing round + retention, kept together.

Option B — Long holds are just long holds inside a rep.

Option C — Holds are first-class steps in a round's sequence.

Recommendation: A. Matches user mental model: "do 30 power breaths, then hold." Solves "hold values make no sense for timed version" naturally — the 10s cap applies to in-rep holds; retentions are a separate thing with their own range.

User: A

Two optional fields on RoundemptyLungsRetentionSec and fullLungsRetentionSec — replaced the entire confusion between short holds and long retentions.


Q6 — Infinite breathing

Box breathing currently uses repeatLast: true so the last cycle loops forever. Where does "breathe like this until I stop" fit in the new model?

User: there's no need for infinite, never asked for this, if it is in the code we can get rid of it

One of the most clarifying moments in any design session: discovering that a feature was never actually needed. repeatLast was removed entirely.


The new model

Eleven questions. Every decision locked. Then the types:

type Rep = {
  inhaleSec: number           // > 0
  holdAfterInhaleSec: number  // 0–10s
  exhaleSec: number           // > 0
  holdAfterExhaleSec: number  // 0–10s
}

type Round = {
  rep: Rep
  mode: 'count' | 'time'
  count?: number
  durationSec?: number
  emptyLungsRetentionSec?: number  // 0 or 30–180s
  fullLungsRetentionSec?: number   // 0 or 15–60s
}

type Program = {
  rounds: Round[]
  // id, name, category, level, ...
}

Enter fullscreen mode Exit fullscreen mode

The engine processes each round through five stages in order: reps → emptyRetention → transitionIn → fullRetention → transitionOut. Time-mode rounds finish the current rep before moving on — never cutting someone off mid-inhale. Skip button appears only on holds of 30 seconds or longer. Transitions between retention types are hardcoded at 2 seconds, matching how the body actually works.

The old model's concepts — Cycle, BreathPhase modes, cyclesPerRound, repeatLast — are gone entirely.


Implementation in numbers

The rewrite was planned as 9 phases and executed in order:

# Phase File(s)
1 Rewrite breath types packages/types/src/breath.ts
2a Rewrite breath engine packages/engine/src/breathEngine.ts
2b Rewrite catalog packages/engine/src/programs.ts
3 Rewrite custom programs storage apps/mobile/src/lib/customPrograms.ts
3b Supabase migration v2 supabase/migrations/…_custom_programs_v2.sql
4 Rewrite custom builder UI apps/mobile/src/screens/CustomBuilderScreen.tsx
5 Update SessionScreen apps/mobile/src/screens/SessionScreen.tsx
6 Update i18n keys packages/i18n/src/locales/{en,es}.ts
7 Cleanup and type-check CLAUDE.md

Single TypeScript pass. Zero errors across apps/mobile, packages/engine, and packages/types.

Two highlights worth noting: the engine became a stage machine — a central advance() function dispatches to the next step based on current stage and round configuration, which is far easier to reason about than the previous nested condition tree. And a pre-existing pause/resume bug (phase elapsed time not re-incremented after resume) was fixed by re-deriving phaseElapsed from phaseStartTime after the pause-duration shift — something that became obvious once the engine had a clear structure.


What the interview actually did

The architecture simplification in Q2 — one rep shape instead of two — was only visible because the design was written down and questioned. Free-form prompting would likely have produced code that preserved the mode discriminator, because that's what the existing code had and it's the path of least resistance.

The structured interview forced the question: is this distinction real? It wasn't. Removing it simplified every downstream type, every render, every test.

That's the pattern: before touching the codebase, spend the time to ask whether the distinctions in your current model reflect actual domain differences — or just accumulated implementation decisions that nobody questioned. An AI that asks focused questions with explicit recommendations and trade-offs is a useful forcing function for that conversation.

Eleven questions. Nine phases. One TypeScript pass. A breathing engine that can now express anything the domain actually needs.