Last Session: 2026-07-15 20:30 Active Task: T-024 — Auto-Replacement Queue — PENDING Last File Touched: apps/api/app/routers/webhooks.py Immediate Next Step: Implement auto-replacement queue for removed links.
T-024 — Auto-Replacement Queue State: PENDING Started: 2026-07-15 20:30 Last Updated: 2026-07-15 20:30 Weight: STANDARD Spec Reference: spec-023-v1
Goal: Implement full webhook CRUD endpoints (currently stubbed). Spec Reference: spec-022-v1 Approach: Implemented all 5 webhook endpoints with Pydantic schemas for validation. Added URL validation, secret generation, and proper error handling. Checklist:
- Backend: Implemented GET / - list webhooks
- Backend: Implemented POST / - create webhook with secret generation
- Backend: Implemented GET /{id} - get webhook
- Backend: Implemented PUT /{id} - update webhook
- Backend: Implemented DELETE /{id} - delete webhook
- Backend: Added Pydantic schemas for validation
- Tests: 33/33 pass
- TypeScript: clean Outcome: Full webhook CRUD implemented. Users can create, list, update, and delete webhooks. Secrets auto-generated on creation. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Revert webhooks.py to stubbed version.
Goal: Add ROI estimator widget to dashboard showing estimated value of backlinks earned. Spec Reference: spec-021-v1 Approach: Added backend endpoint to calculate ROI based on live backlinks and industry average cost ($150/link). Created frontend widget component with gradient styling. Checklist:
- Backend: Added /api/v1/auth/roi endpoint
- Frontend: Added getROI method to WeaveClient
- Frontend: Created ROIWidget component
- Frontend: Added widget to dashboard
- Tests: 33/33 pass
- TypeScript: clean Outcome: ROI widget displays estimated value of backlinks earned. Shows $0 message when no backlinks, otherwise displays total value with industry average context. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Remove /roi endpoint, remove ROIWidget component, revert dashboard changes.
Goal: Enforce plan-based domain limits when users add domains. Spec Reference: spec-020-v1 Approach: Added domain limit constants to backend, updated domain creation to check limits, added API endpoint to get limit status, created frontend banner component. Checklist:
- Backend: Added PLAN_DOMAIN_LIMITS constant
- Backend: Updated create_domain to check limits
- Backend: Added /api/v1/auth/limits endpoint
- Frontend: Added getLimits method to WeaveClient
- Frontend: Created DomainLimitBanner component
- Frontend: Added banner to dashboard layout
- Tests: 33/33 pass
- TypeScript: clean Outcome: Plan-based domain limits enforced. Users see warning banner when at limit. Free users limited to 5 domains, Starter to 25, Pro to 100, Agency unlimited. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Revert domain.py changes, remove /limits endpoint, remove banner component.
Goal: Create placeholder pages for /docs, /blog, /privacy, /terms to fix broken navigation links. Spec Reference: spec-019-v1 Approach: Created simple "Coming soon" pages with consistent styling and navigation back to home. Checklist:
- Created /docs placeholder page
- Created /blog placeholder page
- Created /privacy placeholder page
- Created /terms placeholder page
- TypeScript: clean Outcome: All four placeholder pages created with consistent design. Navigation links now work correctly. Test Evidence: TypeScript compiles clean. Blockers: NONE Rollback: Delete the four page files.
Goal: Implement complete auth system with password-based login, magic link (passwordless), OAuth, email verification, and password reset. Spec Reference: spec-018-v1 Approach: Implemented all three auth methods plus email verification and password reset flows. Used passlib for password hashing, created token models for verification/magic-link/password-reset, built email service with Resend and console fallback. Checklist:
- Database: Added password_hash, email_verified, jwt_version to User model
- Database: Created email_verifications, password_resets, magic_links tables
- Migration: e7f1a2b3c4d5_auth_overhaul.py
- Backend: EmailService with Resend + Console fallback
- Backend: AuthService with password hashing, magic link, verification, reset
- Backend: Updated auth router with new endpoints
- Backend: Updated dependencies.py to check JWT version
- Frontend: Updated login page with password + magic link + OAuth
- Frontend: Created register page
- Frontend: Created verify-email page
- Frontend: Created forgot-password page
- Frontend: Created reset-password page
- Frontend: Created magic-link verification page
- Frontend: Updated NextAuth to support password login
- Tests: 33/33 pass
- TypeScript: clean Outcome: Complete auth system implemented with all three methods (password, magic link, OAuth), email verification, and password reset. All tests pass, TypeScript compiles cleanly. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Revert auth.py router, services/auth.py, services/email.py, User model changes, migrations. Remove new frontend pages.
Goal: Add CSV export for links, credits, and domains. Plan-gated (Pro/Agency only). Spec Reference: spec-017-v1 Checklist:
- Backend: GET /links/export, /credits/export, /domains/export endpoints
- Backend: plan gating (403 for free/starter)
- Frontend: export-button.tsx client component
- Frontend: export buttons on links, credits, domains pages
- Tests: 33/33 pass, TypeScript clean Outcome: CSV export fully operational. 3 endpoints generate CSV files. Download buttons on 3 dashboard pages. Plan-gated with upgrade redirect for non-Pro users. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Remove export endpoints from routers, remove export-button.tsx, revert page changes
Goal: Redesign landing page with Hrefmatch-inspired UX: animated hero, problem/solution, 4-step flow, product demo, network preview, vetting card, pricing, FAQ. Spec Reference: spec-016-v1 Checklist:
- Minimal nav (Logo | Pricing | Join Now)
- Hero with animated A-B-C chain (CSS keyframes)
- Problem/Solution before/after section
- How It Works (4 steps)
- Product Demo (MCP Connector + Dashboard preview)
- Authority Growth section with search engine logos
- Network Preview table (masked domains)
- Quality Vetting card + match scoring table
- Pricing (4 tiers)
- FAQ (accordion with
Details
) - Footer
- SEO metadata + JSON-LD preserved
- Tests: 33/33 pass, TypeScript clean Outcome: Landing page fully redesigned with 11 sections. Animated hero, tabbed product demo, network preview, vetting card, FAQ accordion all implemented. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Revert apps/web/app/page.tsx from git history
Goal: Build shared UI components and redesign overview page with stat cards, DR chart, DR badges, status pills. Spec Reference: spec-013-v1 Checklist:
- dr-badge.tsx component
- status-pill.tsx component
- stat-card.tsx component
- Overview page redesigned (stat cards, DR chart, recent backlinks)
- Links page uses StatusPill
- Network page uses DrBadge
- Tests: 33/33 pass, TypeScript clean Outcome: Dashboard redesign complete. Shared components used consistently across pages. Overview page now has stat cards with trends, DR chart, and recent backlinks table. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Revert dashboard pages, remove shared UI components
Goal: Replace chart placeholders with real Recharts-based analytics. Spec Reference: spec-011-v1 Checklist:
- Backend: analytics router (metrics, links, credits endpoints)
- Backend: registered in main.py
- Frontend: recharts installed
- Frontend: api-client analytics methods
- Frontend: analytics-content.tsx with 4 charts (DR/DA trend, links over time, credit flow, organic traffic)
- Tests: 33/33 pass, TypeScript clean Outcome: Analytics page fully functional with 4 interactive Recharts charts and stat cards with trend indicators. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Remove analytics router, revert analytics page, remove recharts dependency
Goal: Add domain switcher to sidebar with DR badges and context-based domain selection. Spec Reference: spec-012-v1 Checklist:
- domain-context.tsx — React context with URL-persisted selection
- domain-switcher.tsx — Sidebar component with DR badges
- Layout updated with DomainProvider + DomainSwitcher + Suspense
- TypeScript: clean Outcome: Domain switcher operational in sidebar. DR badges color-coded. Selection persists via URL query param. Test Evidence: TypeScript compiles clean. Blockers: NONE Rollback: Remove domain-context.tsx, domain-switcher.tsx, revert layout.tsx
Goal: Add database-backed notification system with bell icon, polling, and service integration. Spec Reference: spec-015-v1 Approach:
- Created Notification model (JSON type for cross-DB compat), Alembic migration, notification router (list/mark-read/mark-all-read)
- Created NotificationService.create() helper
- Integrated notifications into 4 services: crawler (link_removed), credits (credits_low), domain (domain_vetted), matching (link_placed)
- Created notification-bell.tsx client component with 60s polling, click-to-mark-read, dropdown
- Added bell to dashboard layout header Checklist:
- Notification model + migration
- NotificationService helper
- Router: GET /, POST /{id}/read, POST /read-all
- Integration: crawler, credits, domain, matching services
- Frontend: api-client notification methods
- Frontend: notification-bell.tsx component
- Frontend: bell added to dashboard layout
- Tests: 33/33 pass
- TypeScript: clean Outcome: Full notification system operational. 4 notification types fire from existing services. Bell polls every 60s with unread badge. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Remove notification model/migration/router/service, revert service integrations, remove bell component
Goal: Transform read-only settings page into functional account management — edit name, view plan, delete account. Spec Reference: spec-014-v1 Approach:
- Backend: Added ProfileUpdateRequest/AccountDeleteRequest schemas, update_profile/delete_account methods to AuthService, PUT /profile and DELETE /account endpoints
- Frontend: Created settings-content.tsx client component with editable name, plan display with upgrade CTA, delete account with email confirmation dialog Checklist:
- Schemas: ProfileUpdateRequest, AccountDeleteRequest
- Service: update_profile(), delete_account() in AuthService
- Router: PUT /api/v1/auth/profile, DELETE /api/v1/auth/account
- Frontend: api-client.ts updateProfile(), deleteAccount() methods
- Frontend: settings-content.tsx client component
- Frontend: settings/page.tsx server wrapper
- Tests: 33/33 pass
- TypeScript: clean Outcome: Settings page fully functional. Name editable, plan displayed from user.plan, account deletion requires email confirmation. Test Evidence: 33/33 tests pass. TypeScript compiles clean. Blockers: NONE Rollback: Revert settings/page.tsx, remove settings-content.tsx, remove auth.py endpoints and service methods
Goal: Scaffold DoDo payment integration (config, migration, router stubs with 503 graceful degradation), fix remaining defects (bonus worker, webhook worker, low-balance notification). Spec Reference: spec-010-v1.md (DoDo), spec-003-v1.md (Credits: bonus, low-balance), spec-006-v1.md (Webhooks) Approach:
- DoDo scaffolding: config.py, billing.py rewrite, user model rename, DB migration, frontend schema update
- Created bonus_worker.py for monthly plan bonuses (spec-003 §3)
- Created webhook_worker.py for HMAC-signed webhook dispatch with retry (D-008)
- Added low-balance notification in spend_credits (D-005)
- Updated all exports, scheduler, .env.example, CONTEXT.md Checklist:
- Config: stripe_* → dodo_* vars
- Billing router: rewritten for DoDo stubs (checkout, webhook, portal, plans)
- User model: stripe_customer_id → dodo_customer_id
- Migration: c5d9e4f6a7b8_rename_stripe_to_dodo_customer_id.py
- Frontend schema: stripeCustomerId → dodoCustomerId
- .env.example updated
- CONTEXT.md updated
- Bonus worker created + scheduled (CronTrigger day=1)
- Webhook dispatcher worker created (HMAC signing, 3 retry attempts)
- Low-balance notification fires webhook when balance < 10
- Full test suite (33/33 passed) Outcome: DoDo payments scaffolded with 503 graceful fallback. Bonus worker distributes plan bonuses monthly. Webhook worker dispatches signed events with retry. Low-balance notification integrated. Test Evidence: 33/33 tests pass. All new workers import successfully. Blockers: DoDo API docs needed for full integration (checkout/webhook endpoints) Rollback: Revert config.py, billing.py, user model, migration, schema.ts
Goal: Audit all 7 background workers against PRD/TDD requirements and ensure all are implemented, scheduled, and tested. Spec Reference: spec-006-v1.md (Link Validator), spec-008-v1.md (Triangulation), TDD §7 Approach:
- Listed all 7 workers: crawl, embedding, expiry, triangle, sla, metrics, digest
- Verified each worker implementation exists in
apps/api/app/workers/ - Confirmed all 7 are registered in
scheduler.pywith appropriate intervals - Ran full test suite (33/33 passed)
- Verified worker imports and scheduler import Checklist:
- crawl_worker — validates all placed links daily ✅
- embedding_worker — generates pgvector embeddings daily ✅ (new)
- expiry_worker — expires old credits daily ✅
- triangle_worker — forms A-B-C triangles hourly ✅
- sla_worker — checks SLA deadlines daily ✅
- metrics_worker — refreshes domain metrics weekly ✅
- digest_worker — sends weekly email digest ✅
- All 7 registered in scheduler with correct intervals
- Full test suite passes (33/33) Outcome: All 7 background workers are implemented, tested, and scheduled. No missing workers. Test Evidence: All 33 tests pass. Worker imports and scheduler import successfully. Blockers: NONE Rollback: N/A
Goal: Verify all MCP tools are properly registered and wired to backend API endpoints. Spec Reference: spec-005-v1.md (MCP Server), PRD FR-4.1, TDD §4.1 Approach:
- Reviewed
packages/mcp-server/src/index.ts— all 6 tools already registered - Verified each tool calls the correct client method in
client.ts - Verified each client method maps to an existing FastAPI endpoint
- Ran TypeScript compilation — no errors Checklist:
- Step 1: Review existing index.ts tool registrations
- Step 2: Verify client.ts method mappings
- Step 3: Confirm all backend endpoints exist
- Step 4: Run TypeScript compilation (clean) Outcome: All 6 MCP tools already fully wired and functional:
get_backlink→/api/v1/matching/discover(discover link opportunities)place_link→/api/v1/matching/place(place outbound link, earn credits)check_credits→/api/v1/credits/balance/by-name/{domain}(credit balance)browse_network→/api/v1/network/(browse vetted member sites)domain_status→/api/v1/domains/by-name/{domain}/status(vetting status)link_health→/api/v1/links/health(live/removed/broken status) Test Evidence: TypeScript compiles clean (npx tsc --noEmitpasses). All 33 Python tests pass. Blockers: NONE Rollback: N/A (no changes needed)
Goal: Create a background worker that periodically finds pages without embeddings and generates pgvector embeddings for them, enabling semantic matching. Spec Reference: spec-004-v1.md (Matching Engine), TDD §5.1, PRD FR-2.1 Approach:
- Created
embedding_worker.pyfollowing the existing worker pattern (expiry_worker, triangle_worker) - Worker queries for pages with
embedding IS NULLandstatus = 'active' - For each page, fetches content (via crawler or stored content) and generates embedding via EmbeddingService
- Stores embedding in pgvector
Vector(384)column - Added worker to scheduler (runs daily)
- Updated
workers/__init__.pyto export the new worker Checklist:
- Step 1: Create embedding_worker.py with run() function
- Step 2: Add to workers/init.py exports
- Step 3: Register in scheduler.py with daily interval
- Step 4: Run full test suite (33/33 passed) Outcome: Embedding worker created and integrated. Processes pages without embeddings using OpenAI text-embedding-3-small (with hash fallback). Scheduler runs it daily. Test Evidence: All 33 tests pass. Worker imports and scheduler import successfully. Blockers: NONE Rollback: Remove embedding_worker.py, revert workers/init.py and scheduler.py changes
Goal: Wire automatic A-B-C triangle formation when a link is placed via place_link(). Previously only assigned to existing pending triangles; never created new ones.
Spec Reference: spec-008-v1.md §2 (Gap A — Auto-Assignment on Place Link), PRD FR-2.4
Approach:
- In
MatchingService.place_link(), after creating the link, check for pending triangles matching the source→target domains - If found, assign link to the triangle slot (ab/bc/ca)
- If no pending triangle matches, call
TriangulationService.form_triangle(source_domain_id, target_domain_id)to find/create C - If triangle formed, assign the new link to slot "ab" (A→B) Checklist:
- Step 1: Read existing triangulation.py and matching.py place_link logic
- Step 2: Add form_triangle call when no pending triangle matches
- Step 3: Run full test suite (33/33 passed)
Outcome: Triangulation now auto-forms when user places A→B link. Triangle status transitions from "forming" → "complete" when all 3 links placed.
complete_triangle()already checks all 3 slots filled. Test Evidence: All 33 existing tests pass. No regressions. Blockers: NONE Rollback: Revert matching.py place_link changes (lines 367-395)