Skip to content

Fix CI lint/test failures#7

Open
marovole wants to merge 9 commits into
mainfrom
marovole/fix-ci
Open

Fix CI lint/test failures#7
marovole wants to merge 9 commits into
mainfrom
marovole/fix-ci

Conversation

@marovole
Copy link
Copy Markdown
Owner

@marovole marovole commented Jan 3, 2026

Fixes CI lint/test failures by updating mocks, tests, and rate limiter defaults, and sanitizing docs/scripts.
Tests: pnpm test -- src/tests/api/cache-stats.test.ts src/tests/services/expiry-monitor.test.ts

marovole and others added 9 commits December 10, 2025 09:12
- Add 20+ Budget-related type definitions to service-types.ts
  (NutritionInfo, AffordableFood, PlatformConfig, MealRecipe, etc.)
- Remove ~45 explicit 'any' types from budget services:
  - cost-optimizer.ts (4)
  - spending-analyzer.ts (5)
  - economic-mode.ts (20+)
  - savings-recommender.ts (5)
  - price-analyzer.ts (15+)
  - budget-tracker.ts (1)
- Refactor services layer with proper type definitions:
  - task-management.ts
  - shopping-list.ts
  - inventory-*.ts
  - expiry-monitor.ts
- Update openspec tasks to track progress

Note: Some pre-existing lint warnings remain (no-console, unused vars)
      as they are out of scope for this type refactoring PR.

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Create lib/constants/ directory with analytics.ts and budget.ts
- Extract analytics constants:
  - TREND_SLOPE_THRESHOLD (0.01) for trend stability detection
  - MOVING_AVERAGE_WINDOW (7) for smoothing window size
  - DEFAULT_PREDICTION_DAYS (7) for forecasting horizon
  - CHANGE_PERCENT_THRESHOLD (1) for period comparison
  - MS_PER_DAY for time calculations
- Extract budget constants:
  - BUDGET_ALERT_THRESHOLDS (80/100/110) for warning levels
  - DAILY_BUDGET_EXCESS_FACTOR (1.2) for daily overspend detection
  - BUDGET_NOTIFICATION_PRIORITY thresholds
  - BUDGET_NOTIFICATION_CHANNELS configuration
- Update trend-analyzer.ts to use named constants
- Update budget-tracker.ts to use named constants
- Update budget-notification-service.ts to use named constants
- Add JSDoc comments to all constants explaining their purpose

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
- Add reusable middleware: api-auth, api-rate-limit, api-consent, compose
- Refactor chat route from ~270 lines to 86 lines with handlers.ts
- Update analyze-health, generate-report, optimize-recipe to use middleware
- Replace console.error with structured logger
- Add unit tests for middleware composition

Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
* docs: add vNext concierge PRD + roadmap

* ci: make quality and type checks incremental

* fix: avoid overwriting global crypto

* ci: run unit tests incrementally

* ci: fix quality-check and unit tests

* chore: stabilize Cloudflare Pages build

* chore: pin pnpm for Pages build

* chore: add preview build env defaults

---------

Co-authored-by: marovole <marovole@gmail.com>
* perf: optimize Workers KV usage to reduce API calls by 60%+

优化 Cloudflare Workers KV 用量,解决接近配额限制的问题。

核心优化:
- 环境隔离: 非生产环境默认禁用 KV,节省 50% 用量
- 批量删除保护: 限制 deleteByPrefix 最多删除 100 个键,减少 86% Delete 用量
- API 调用监控: 新增 KvMetrics 指标追踪系统
- 智能告警: 用量 ≥ 50% 自动警告,提供优化建议
- 监控端点: 新增 /api/kv/metrics 实时查看用量

影响:
- 预计减少 60%+ API 调用
- Read: 60% → 30%
- Write: 100% → 30%
- Delete: 35% → 5%
- List: 10% → 1%

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

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

* style: fix prettier formatting issues in KV-related files

* fix: resolve ESLint issues and add overrides for cache/monitoring files

* fix: remove ESLint indent rule to avoid conflict with Prettier

---------

Co-authored-by: marovole <marovole@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
* feat: implement Butler Inbox v0.3.0 with daily reviews and tasks

- Add DailyReview model for AI-powered daily health summaries
- Extend Task model with vNext fields (metadata, actionUrl, priority scoring)
- Create TaskService, DailyReviewService, TaskGeneratorService
- Implement API endpoints for task management and focus tasks
- Add ButlerInbox page and TaskCard/DailyReviewCard components
- Configure Cloudflare Cron triggers for automated task generation

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

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

* fix: resolve CI linting warnings

- Remove console.log/error statements from API routes and services
- Fix unused variables and context parameters
- Replace any types with proper TypeScript types
- Fix missing useEffect dependencies in React components

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

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

* fix: resolve remaining ESLint warnings

- Fix any types with proper TypeScript types
- Remove unused variables and parameters with underscore prefix
- Extract TaskActions component to reduce TaskCard complexity
- Extract processMemberReview helper to reduce nesting depth
- Remove unused imports (LayoutDashboard, Task, TaskCategory, TaskPriority)

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

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

* fix: remove remaining unused variables and imports

- Remove unused parameters from countMissedHealthCheckIns and checkNutritionDeviations
- Remove unused TaskCategory and TaskPriority imports
- Update function calls to match new signatures

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

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

---------

Co-authored-by: marovole <marovole@gmail.com>
Co-authored-by: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant