Phase 11: Usage metering + strict PR workflow#1
Phase 11: Usage metering + strict PR workflow#1jeremylongshore wants to merge 10 commits intomainfrom
Conversation
Initial release of IntentVision - AI-powered SaaS metrics forecasting platform. Features: - Phases 0-10: Core pipeline implementation - Phase A: Stack alignment + SaaS tables - Phase B: Nixtla TimeGPT integration - Phase E2E: Single-metric forecast demo - Phase F: Cloud deployment infrastructure - Phase 7: Cloud Firestore wiring + live tests Infrastructure: - Cloud Firestore with ADC support - Cloud Run deployment ready - GitHub Actions CI/CD pipeline - Live Firestore test suite (opt-in) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Implement Firestore-backed notification preferences with Resend email integration. Features: - Firestore collections for notificationChannels and notificationPreferences - Alert dispatcher that routes alerts based on org preferences - Resend email channel fully implemented with HTML/text templates - Stub implementations for Slack, HTTP webhook, and PagerDuty channels - Test alert CLI script (npm run alert:test) - Unit and E2E tests Beads Tasks: - intentvision-uxb: Phase 8 Epic - intentvision-8xq: Firestore notification preferences model - intentvision-qb9: Wire alert engine to preferences - intentvision-lyq: Resend email channel Documentation: - 000-docs/039-AA-AACR-phase-8-notification-preferences-multi-channel-alerts.md - 000-docs/040-DR-ADRC-notification-preferences-alert-routing.md [Task: intentvision-uxb, intentvision-8xq, intentvision-qb9, intentvision-lyq] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 9 implementation [intentvision-4a8]: - Added centralized environment config (src/config/environment.ts) - Supports local/dev/staging/prod environments - Environment-prefixed Firestore collections for isolation - Added smoke test endpoint (POST /v1/internal/smoke) - Validates Firestore write/read/verify cycle - No auth required (infrastructure health check) - Returns environment, projectId, and timing info - Added cloud smoke test CLI script (npm run smoke:staging) - Configurable URL, timeout, verbose mode - Health check pre-flight - Detailed results table - Added CI job for cloud smoke tests - Runs after deploy on main branch - Configurable via INTENTVISION_STAGING_URL secret - Updated Firestore client for INTENTVISION_FIRESTORE_PROJECT_ID Beads Tasks: - intentvision-vf7: Firestore staging config - intentvision-cqe: Cloud Run staging wiring - intentvision-ltq: Smoke test script - intentvision-l2m: CI job 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…dashboard UI Phase 10: Customer Onboarding + Plans + Sellable Alpha Shell Backend API: - POST /v1/tenants - Self-service tenant onboarding (org + user + API key) - GET /v1/tenants/:slug - Get tenant info - GET /v1/dashboard - Dashboard overview with usage stats - GET /v1/dashboard/alerts - Paginated alert history - GET/PUT /v1/me/preferences/notifications - User notification preferences - POST /v1/me/preferences/notifications/test - Test notification Plan Model: - Free/Starter/Growth/Enterprise tiers with limits - maxMetrics, maxAlerts, maxForecastsPerDay enforcement - Feature gating for Slack, Webhook, TimeGPT Services: - plan.ts - Plan definitions and limit checking - usage-service.ts - Usage tracking and dashboard stats - user-preferences-service.ts - Per-user notification preferences - firebase-auth.ts - Firebase ID token authentication Dashboard UI: - /dashboard - Org info, API keys, usage stats - /alerts - Alert history table - /settings/notifications - Channel configuration Scripts: - seed-demo-tenant.ts - Demo tenant creation Documentation: - 043-AA-AACR-phase-10-sellable-alpha-shell.md - 044-DR-ADRC-sellable-alpha-plan-tenant-architecture.md Beads Epic: intentvision-e9n (CLOSED) Tasks: intentvision-yzd, intentvision-cv6, intentvision-s4z, intentvision-9xn, intentvision-5fa (ALL CLOSED) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Change workspace:* to * in operator package.json (npm compatible) - Remove unused User import in seed-demo-tenant.ts - Remove unused apiKey destructure in seed-demo-tenant.ts Build now succeeds, all 29 tests pass. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Phase 11 implementation adding usage tracking and plan limit enforcement: New Features: - Usage event tracking for forecast_call, alert_fired, metric_ingested, api_call - Plan limit enforcement with 429 responses when exceeded - Admin usage API endpoints for monitoring - Warning system at 80% usage threshold API Endpoints: - GET /admin/orgs/:orgId/usage/today - GET /admin/orgs/:orgId/usage/last-30d - GET /admin/orgs/:orgId/usage/overview Files Added: - packages/api/src/services/metering-service.ts - packages/api/src/routes/admin-usage.ts - 045-AA-AACR-phase-11-usage-metering.md - 046-DR-ADRC-usage-metering-plan-enforcement.md Beads Epic: intentvision-7ks 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…entFS - Fix pipeline test harness: Changed :memory: to file:memdb?mode=memory&cache=shared to enable shared in-memory SQLite DB across connections (220 tests now pass) - Align VERSION (0.13.0) and CHANGELOG with Phase 12/13 releases - Wire AgentFS decision logger with AGENTFS_ENABLED env flag - Add health endpoint unit tests (13 tests) - Add agent decision logger tests (9 tests) Total test count: 381 passing (was 110 partial due to DB failures) [Task: intentvision-rhs] 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Rename GitHub repo from intentvision to intent-vision - Enable branch protection on main (require CODEOWNERS review) - Add CODEOWNERS file (jeremylongshore owns all) - Add PR template with review checklist - Add CONTRIBUTING.md with git workflow docs - Update package.json URLs to new repo name Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Summary of ChangesHello @jeremylongshore, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly advances the IntentVision platform by integrating a sophisticated AI agent system, solidifying its deployment infrastructure, and establishing robust development and billing workflows. It ensures a high standard of code quality and operational readiness, while laying the groundwork for future monetization and AI-driven features. Highlights
Ignored Files
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This is a substantial pull request that introduces significant improvements across the repository. The changes include renaming the repository, adding stricter PR workflows with CODEOWNERS and templates, and implementing usage metering. The addition of numerous documentation files (AARs, ADRs, runbooks) is excellent for project maintainability. The new ADK scaffolding for Python agents is well-structured and the move to a standalone API service in the Dockerfile is a solid architectural improvement. I've identified a couple of areas for improvement related to error handling in the Docker build and a potential issue with data retrieval logic in the agent decision logger.
| RUN npm run build --workspace=@intentvision/contracts || true | ||
| RUN npm run build --workspace=@intentvision/pipeline || true | ||
| RUN npm run build --workspace=@intentvision/operator || true | ||
| RUN npm run build --workspace=@intentvision/agent || true | ||
| RUN npm run build --workspace=@intentvision/functions | ||
| RUN npm run build --workspace=@intentvision/functions || true |
There was a problem hiding this comment.
The use of || true can mask build failures for these workspaces. If any of these builds fail, the Docker image will still be created, potentially leading to runtime errors or an incomplete application. It's safer to remove || true and let the build fail if any workspace fails to compile. This ensures that only valid artifacts are produced.
RUN npm run build --workspace=@intentvision/contracts
RUN npm run build --workspace=@intentvision/pipeline
RUN npm run build --workspace=@intentvision/operator
RUN npm run build --workspace=@intentvision/agent
RUN npm run build --workspace=@intentvision/functions
| const possibleLogIds = [ | ||
| `${requestId}-route`, | ||
| `${requestId}-final`, | ||
| ...Array.from({ length: 10 }, (_, i) => `${requestId}-tool-select-${i + 1}`), | ||
| ...Array.from({ length: 10 }, (_, i) => `${requestId}-tool-exec-${i + 1}`), |
There was a problem hiding this comment.
This implementation for retrieving decisions for a request is not robust. It assumes a maximum of 10 tool selections and executions, which could lead to missed logs if a request involves more steps. Additionally, it performs multiple individual get requests, which is inefficient.
A more scalable approach would be to use a prefix query on decisions:${requestId}: if the underlying KV store of agentfs-sdk supports it. This would retrieve all decisions for a request in a single operation, regardless of how many there are.
Summary
intentvisiontointent-visionType of Change
Beads Task
Task:
intentvision-phase-11Testing
Checklist
Required Reviews:
🤖 Generated with Claude Code