chihlasm 4727106141 fix: race condition hardening across auth, counters, and data fetching (#102)
* fix: prevent race conditions in token operations and auth flows

Backend:
- Refresh token rotation: use atomic UPDATE...WHERE revoked_at IS NULL
  to prevent concurrent refresh requests from both succeeding
- Account invite codes: SELECT FOR UPDATE to prevent double-spend
- Platform invite codes: SELECT FOR UPDATE to prevent double-spend
- Password reset tokens: SELECT FOR UPDATE to prevent double-use
- Email verification tokens: SELECT FOR UPDATE to prevent double-use

Frontend:
- Token refresh subscriber arrays: swap before iterating so a throwing
  callback doesn't leave the queue in a dirty state

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: atomic counters, plan limit re-check, and double-submit guard

Backend:
- Tree usage_count: use SQL-level UPDATE (Tree.usage_count + 1) instead
  of Python-level increment to prevent lost updates under concurrency
- Tag usage_count: same SQL-level atomic increment/decrement in both
  create_tree and update_tree (delete_tree already used this pattern)
- Plan tree limit: re-check count after db.flush() to close the TOCTOU
  window where two concurrent creates could both pass the pre-check

Frontend:
- TreeEditorPage: add isSaving early-return guard inside handleSaveDraft
  and handlePublish callbacks so Ctrl+S can't bypass the button disabled
  prop and fire duplicate save requests

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* fix: prevent stale API responses from overwriting newer data

- SessionHistoryPage: move loadSessions into effect with cancelled flag
  so rapid filter/tab changes discard outdated responses
- TreeLibraryPage: add request ID ref to loadTrees so stale responses
  from previous filter selections are discarded
- QuickStartPage: add request ID ref to debounced search so out-of-order
  responses don't overwrite newer search results

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* docs: add flexible intake design — deferred variables + prepared sessions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 01:57:22 -04:00

ResolutionFlow

Take the path MOST traveled.

ResolutionFlow is a SaaS platform for MSP professionals that provides guided troubleshooting flows, captures decisions and notes as you work, and generates professional ticket documentation with one click.

Production: resolutionflow.com


The Problem

MSP engineers face constant context switching between diverse technical issues — file shares, server outages, VPN failures, Active Directory problems. This creates:

  • Cognitive overload — 15-25 minutes to regain focus after each context switch
  • Inconsistent documentation — under pressure, notes are rushed or incomplete
  • Lost tribal knowledge — best troubleshooting paths live only in senior engineers' heads
  • Repeated work — same issues investigated from scratch each time

The Solution

An intelligent flow system that:

  • Guides engineers through proven troubleshooting paths
  • Captures decisions and notes automatically as you work
  • Generates professional ticket documentation with one click
  • Builds institutional knowledge that improves over time
  • Reduces cognitive load during high-stress situations

Features

Flow Types

  • Troubleshooting Flows — Decision trees with branching paths for diagnosing issues
  • Procedural Flows (Projects) — Step-by-step checklists for structured processes (onboarding, migrations, deployments)
  • Maintenance Flows — Scheduled recurring tasks with batch execution across multiple targets

Flow Editor

  • Form-based node editor with live canvas preview (React Flow + dagre layout)
  • Decision nodes (yes/no, multiple choice), action nodes, answer nodes
  • Cross-reference / loop-back support — link any node to any other node for re-verification patterns
  • Undo/redo, validation warnings, drag-to-reorder
  • Markdown support in descriptions and help text

AI Flow Assist

  • Conversational AI builder — describe what you need, get a complete flow generated
  • Multi-phase interview (scope, structure, details) with progressive tree generation
  • Live preview updates as the AI builds your flow
  • Save directly to your flow library

Session Engine

  • Step-by-step guided navigation with notes capture at each decision point
  • Session timer, keyboard shortcuts, scratchpad overlay (Ctrl+/)
  • Auto-recovery for interrupted sessions
  • Session sharing via link (authenticated and public views)
  • Export to Markdown, plain text, or HTML with configurable detail levels, editable preview, and sensitive data redaction

Organization & Management

  • Categories, tags (autocomplete), user folders (3-level hierarchy)
  • Full-text search across all flows
  • Pinned flows for quick access
  • Grid, list, and table views

Team & Admin

  • Role-based access control (super_admin, team_admin, engineer, viewer)
  • Admin panel — user management, invite codes, audit logs, feature flags, plan limits
  • Team-scoped visibility and permissions

Step Library

  • Shared library of reusable troubleshooting steps
  • Search, ratings, reviews, verified-use badges
  • Private, team, and public visibility levels

Tech Stack

Layer Technology
Frontend React 19, TypeScript, Vite, Tailwind CSS v3
State Zustand (immer + zundo for undo/redo)
Routing React Router v7
Canvas @xyflow/react (React Flow) + dagre
Backend Python FastAPI, async SQLAlchemy 2.0 + asyncpg
Database PostgreSQL 16
Migrations Alembic
Auth JWT (python-jose) + bcrypt, refresh token rotation
AI Anthropic Claude API
Scheduling APScheduler 3.x (async)
Hosting Railway (auto-deploy on push to main)

Project Structure

patherly/
├── backend/
│   ├── app/
│   │   ├── main.py                 # FastAPI entry point
│   │   ├── api/endpoints/          # Route handlers
│   │   ├── api/deps.py             # Auth dependencies
│   │   ├── api/router.py           # Route registration
│   │   ├── core/                   # Config, database, permissions, security, AI services
│   │   ├── models/                 # SQLAlchemy models
│   │   └── schemas/                # Pydantic schemas
│   ├── alembic/                    # Database migrations
│   ├── scripts/                    # Seed data scripts
│   └── tests/                      # pytest integration tests (100+)
├── frontend/
│   ├── src/
│   │   ├── api/                    # Axios client + endpoint modules
│   │   ├── components/             # UI components by domain
│   │   ├── hooks/                  # Custom React hooks
│   │   ├── pages/                  # Page components
│   │   ├── store/                  # Zustand stores
│   │   └── types/                  # TypeScript interfaces
│   └── tailwind.config.js
├── CLAUDE.md                       # AI assistant project context
├── CURRENT-STATE.md                # Detailed feature status
├── 03-DEVELOPMENT-ROADMAP.md       # Development roadmap
└── docs/plans/                     # Design docs & implementation plans

Development Setup

Prerequisites

  • Docker (for PostgreSQL)
  • Python 3.11+
  • Node.js 18+

Quick Start

# Start PostgreSQL
docker start patherly_postgres

# Backend
cd backend
python -m venv venv
source venv/bin/activate  # or .\venv\Scripts\Activate on Windows
pip install -r requirements.txt
alembic upgrade head
uvicorn app.main:app --reload

# Frontend (separate terminal)
cd frontend
npm install
npm run dev

URLs

Running Tests

# Backend (from backend/)
pytest --override-ini="addopts="

# Frontend type check
cd frontend && npm run build

Roadmap

See 03-DEVELOPMENT-ROADMAP.md for the full roadmap.

Current focus:

  • Step Library frontend UI
  • Procedural flows lifecycle improvements

Next up:

  • Quick Actions Dashboard (#70)
  • Tree Effectiveness Dashboard (#61)
  • PSA Integration — ConnectWise / Autotask (#63)

License

Proprietary. All rights reserved.

Description
Troubleshooting decision tree application for MSP engineers - automatically generates professional documentation from guided diagnostic workflows
Readme 16 MiB
Languages
Python 54.7%
TypeScript 43.5%
HTML 1.1%
CSS 0.6%