13 Commits

Author SHA1 Message Date
10fe6f95dd perf(vida): Phase 2-3 optimizations and FFmpeg hardware decode fallback
Performance optimizations:
- Frame accumulator: iterator-based loops, hot/cold path separation
- Morphology: dirty rect tracking for Zhang-Suen thinning
- Meteor detector: precomputed thresholds, sqrt elimination in centroid
- Async frame prefetch with producer-consumer pattern
- 2MB BufReader buffer to reduce syscalls

FFmpeg improvements:
- Hardware decoding with auto-fallback (VideoToolbox/VAAPI)
- 3-second timeout probe to detect unsupported codecs
- Automatic CPU fallback when hardware decode fails

Detection visualization:
- Draw fireball trajectories in red on maxpixel
- Draw meteor trajectories in green
- Save detection overlay as _detections.png

Test results (1024 frames @ 1080p):
- Detection processing: ~420ms/block (was ~987ms)
- AV1 video: auto-fallback to CPU decode
- H.264 video: uses hardware acceleration when available

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 20:23:18 +08:00
275fb05636 feat(edge-client): add OpenCV camera backend with macOS authorization support
- Add OpenCV as default camera backend, nokhwa as optional alternative
- Make camera backends mutually exclusive via feature flags (opencv_camera, nokhwa_camera)
- Remove deprecated hardware_camera feature, use nokhwa_camera instead
- Add main thread camera initialization for macOS TCC authorization
- Add pre-opened capture storage via static Mutex for async compatibility
- Add pixel format conversion utilities (pixel_convert.rs)
- Update all cfg guards from hardware_camera to nokhwa_camera

macOS requires camera authorization requests on main thread. OpenCV's
VideoCapture::new() is now called before tokio runtime starts, with
the handle stored for later use by async code.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-08 23:26:43 +08:00
6e819e0a53 feat: integrate Vida detection with event system and storage
- Add Vida detection events to SystemEvent enum:
  - AccumulatedFrameReady: 256-frame FTP block ready
  - VidaFireballDetected: fireball detection result
  - VidaMeteorDetected: meteor detection result

- Update StorageController to handle Vida events:
  - Save accumulated frames as FF files
  - Write FTPdetectinfo format for detections
  - Generate centroids CSV files

- Fix and simplify test files:
  - Update integration tests
  - Fix hierarchical cache tests
  - Simplify zero-copy tests

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 01:08:07 +08:00
6910a247b6 feat: implement Vida meteor detection algorithm
Implement the Vida detection algorithm for meteor and fireball detection
based on the RMS/CMN paper. Key features:

- Frame accumulator: 256-frame FTP compression (maxpixel, avepixel, stdpixel, maxframe)
- Meteor detector: K1=1.5 threshold, Hough transform, temporal propagation verification
- Fireball detector: K1=4 threshold, 3D point cloud analysis for very bright meteors
- Binary image downsampling with OR operation to preserve trajectory connectivity
- Star extraction for astrometric calibration
- FTPdetect format output for interoperability with RMS tools
- test-vida CLI command for testing detection on video files

Performance optimizations:
- Binary image downsampling instead of FTP downsampling (fixes false positives)
- Inline centroid calculation with bounding box scan
- ~100ms/block processing time (down from 377ms)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-07 00:02:16 +08:00
95353ae2d7 chore: clean up project structure
- Remove .bmad-core/ and web-bundles/ (AI tool configs)
- Remove tmp-home/ directories and cache files
- Move test scripts to scripts/ directory
- Move design file to docs/ directory
- Remove duplicate AGENTS.md (content in CLAUDE.md)
- Remove duplicate sample-app-config.toml
- Update .gitignore with missing entries
- Fix hardcoded credentials in check-migrations.js
- Update IMPLEMENTATION_SUMMARY.md date

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-20 00:08:01 +08:00
dd54b81262 lot 2025-11-03 00:11:13 +08:00
56f957a346 remove duplicate hardware 2025-08-14 23:40:32 +08:00
2c90276e3e fix: resolve cross-compilation issues for ARM64 Linux
- Replace OpenSSL with rustls for better cross-compilation support
- Fix tpm_attestation field name typos (was tmp_attestation)
- Add missing Debug traits to FramePool structs
- Fix borrow checker issue in device registration
- Add missing module declarations in main.rs

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-14 00:27:46 +08:00
13ce6ae442 feat: implement complete edge device registration system
- Add hardware fingerprinting with cross-platform support
- Implement secure device registration flow with X.509 certificates
- Add WebSocket real-time communication for device status
- Create comprehensive device management dashboard
- Establish zero-trust security architecture with multi-layer protection
- Add database migrations for device registration entities
- Implement Rust edge client with hardware identification
- Add certificate management and automated provisioning system

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-13 08:46:25 +08:00
b9c2b7e17d memory optimize 2025-08-12 07:21:41 +08:00
ca7e92a1a1 🎉 Epic 3 Complete: Production Readiness & Observability
Successfully implemented comprehensive monitoring and alerting infrastructure for the Meteor platform across all three stories of Epic 3:

**Story 3.5: 核心业务指标监控 (Core Business Metrics Monitoring)**
- Instrumented NestJS web backend with CloudWatch metrics integration using prom-client
- Instrumented Go compute service with structured CloudWatch metrics reporting
- Created comprehensive Terraform infrastructure from scratch with modular design
- Built 5-row CloudWatch dashboard with application, error rate, business, and infrastructure metrics
- Added proper error categorization and provider performance tracking

**Story 3.6: 关键故障告警 (Critical System Alerts)**
- Implemented SNS-based alerting infrastructure via Terraform
- Created critical alarms for NestJS 5xx error rate (>1% threshold)
- Created Go service processing failure rate alarm (>5% threshold)
- Created SQS queue depth alarm (>1000 messages threshold)
- Added actionable alarm descriptions with investigation guidance
- Configured email notifications with manual confirmation workflow

**Cross-cutting Infrastructure:**
- Complete AWS infrastructure as code with Terraform (S3, SQS, CloudWatch, SNS, IAM, optional RDS/Fargate)
- Structured logging implementation across all services (NestJS, Go, Rust)
- Metrics collection following "Golden Four Signals" observability approach
- Configurable thresholds and deployment-ready monitoring solution

The platform now has production-grade observability with comprehensive metrics collection, centralized monitoring dashboards, and automated critical system alerting.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-03 23:42:01 +08:00
46d8af6084 🎉 Epic 2 Milestone: Successfully completed the final story of Epic 2: Commercialization & Core User Experience with full-stack date filtering functionality.
📋 What Was Accomplished

  Backend Changes:
  -  Enhanced API Endpoint: Updated GET /api/v1/events to accept optional date query parameter
  -  Input Validation: Added YYYY-MM-DD format validation to PaginationQueryDto
  -  Database Filtering: Implemented timezone-aware date filtering in EventsService
  -  Controller Integration: Updated EventsController to pass date parameter to service

  Frontend Changes:
  -  Date Picker Component: Created reusable DatePicker component following project design system
  -  Gallery UI Enhancement: Integrated date picker into gallery page with clear labeling
  -  State Management: Implemented reactive date state with automatic re-fetching
  -  Clear Filter Functionality: Added "Clear Filter" button for easy reset
  -  Enhanced UX: Improved empty states for filtered vs unfiltered views

  🔍 Technical Implementation

  API Design:
  GET /api/v1/events?date=2025-08-02&limit=20&cursor=xxx

  Key Files Modified:
  - meteor-web-backend/src/events/dto/pagination-query.dto.ts
  - meteor-web-backend/src/events/events.service.ts
  - meteor-web-backend/src/events/events.controller.ts
  - meteor-frontend/src/components/ui/date-picker.tsx (new)
  - meteor-frontend/src/app/gallery/page.tsx
  - meteor-frontend/src/hooks/use-events.ts
  - meteor-frontend/src/services/events.ts

   All Acceptance Criteria Met

  1.  Backend API Enhancement: Accepts optional date parameter
  2.  Date Filtering Logic: Returns events for specific calendar date
  3.  Date Picker UI: Clean, accessible interface component
  4.  Automatic Re-fetching: Immediate data updates on date selection
  5.  Filtered Display: Correctly shows only events for selected date
  6.  Clear Filter: One-click reset to view all events

  🧪 Quality Assurance

  -  Backend Build: Successful compilation with no errors
  -  Frontend Build: Successful Next.js build with no warnings
  -  Linting: All ESLint checks pass
  -  Functionality: Feature working as specified

  🎉 Epic 2 Complete!

  With Story 2.9 completion, Epic 2: Commercialization & Core User Experience is now DONE!

  Epic 2 Achievements:
  - 🔐 Full-stack device status monitoring
  - 💳 Robust payment and subscription system
  - 🛡️ Subscription-based access control
  - 📊 Enhanced data browsing with detail pages
  - 📅 Date-based event filtering
2025-08-03 10:30:29 +08:00
a04d6eba88 🎉 Epic 1 Complete: Foundation, User Core & First Light
## Major Achievements 

### Story 1.14: 前端事件画廊页面 - Gallery Page Implementation
-  Protected /gallery route with authentication redirect
-  Infinite scroll with React Query + Intersection Observer
-  Responsive event cards with thumbnail, date, location
-  Loading states, empty states, error handling
-  Dark theme UI consistent with design system

### Full-Stack Integration Testing Framework
-  Docker-based test environment (PostgreSQL + LocalStack)
-  E2E tests with Playwright (authentication, gallery workflows)
-  API integration tests covering complete user journeys
-  Automated test data generation and cleanup
-  Performance and concurrency testing

### Technical Stack Validation
-  Next.js 15 + React Query + TypeScript frontend
-  NestJS + TypeORM + PostgreSQL backend
-  AWS S3/SQS integration (LocalStack for testing)
-  JWT authentication with secure token management
-  Complete data pipeline: Edge → Backend → Processing → Gallery

## Files Added/Modified

### Frontend Implementation
- src/app/gallery/page.tsx - Main gallery page with auth protection
- src/services/events.ts - API client for events with pagination
- src/hooks/use-events.ts - React Query hooks for infinite scroll
- src/components/gallery/ - Modular UI components (EventCard, GalleryGrid, States)
- src/contexts/query-provider.tsx - React Query configuration

### Testing Infrastructure
- docker-compose.test.yml - Complete test environment setup
- test-setup.sh - One-command test environment initialization
- test-data/seed-test-data.js - Automated test data generation
- e2e/gallery.spec.ts - Comprehensive E2E gallery tests
- test/integration.e2e-spec.ts - Full-stack workflow validation
- TESTING.md - Complete testing guide and documentation

### Project Configuration
- package.json (root) - Monorepo scripts and workspace management
- playwright.config.ts - E2E testing configuration
- .env.test - Test environment variables
- README.md - Project documentation

## Test Results 📊
-  Unit Tests: 10/10 passing (Frontend components)
-  Integration Tests: Full workflow validation
-  E2E Tests: Complete user journey coverage
-  Lint: No warnings or errors
-  Build: Production ready (11.7kB gallery page)

## Milestone: Epic 1 "First Light" Achieved 🚀

The complete data flow is now validated:
1. User Authentication 
2. Device Registration 
3. Event Upload Pipeline 
4. Background Processing 
5. Gallery Display 

This establishes the foundation for all future development.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-07-31 18:49:48 +08:00