CUB-38: Implement low filament alert logic with configurable threshold #17

Merged
Otto merged 1 commits from agent/dex/CUB-38-low-filament-alert into dev 2026-04-29 10:11:50 -04:00
Owner

What

Adds low filament alert detection to Extrudex backend.

Changes

  • ILowStockDetector interface (Domain/Interfaces) — clean contract for low-stock detection
  • LowStockDetector service (Infrastructure/Services) — implements threshold logic with configurable percentage
  • FilamentResponse DTO extended with IsLowStock and RemainingWeightPercent fields
  • FilamentsController updated to inject ILowStockDetector and populate alert fields
  • GET /api/filaments/low-stock endpoint added to list only low-stock spools
  • appsettings.jsonFilamentAlerts:LowStockThresholdPercent config section (default: 20%)
  • Program.cs — DI registration for ILowStockDetector singleton

Threshold Configuration

Priority: env var EXTRUDEX_LOW_STOCK_THRESHOLD → appsettings FilamentAlerts:LowStockThresholdPercent → default 20%

API Contracts for Rex

  • GET /api/filaments → each filament now includes isLowStock (bool) and remainingWeightPercent (decimal)
  • GET /api/filaments/low-stock → returns only active spools below threshold
  • GET /api/filaments/{id} → includes same alert fields

Linear

Closes CUB-38

## What Adds low filament alert detection to Extrudex backend. ### Changes - **ILowStockDetector** interface (Domain/Interfaces) — clean contract for low-stock detection - **LowStockDetector** service (Infrastructure/Services) — implements threshold logic with configurable percentage - **FilamentResponse** DTO extended with `IsLowStock` and `RemainingWeightPercent` fields - **FilamentsController** updated to inject ILowStockDetector and populate alert fields - **GET /api/filaments/low-stock** endpoint added to list only low-stock spools - **appsettings.json** — `FilamentAlerts:LowStockThresholdPercent` config section (default: 20%) - **Program.cs** — DI registration for `ILowStockDetector` singleton ### Threshold Configuration Priority: env var `EXTRUDEX_LOW_STOCK_THRESHOLD` → appsettings `FilamentAlerts:LowStockThresholdPercent` → default 20% ### API Contracts for Rex - `GET /api/filaments` → each filament now includes `isLowStock` (bool) and `remainingWeightPercent` (decimal) - `GET /api/filaments/low-stock` → returns only active spools below threshold - `GET /api/filaments/{id}` → includes same alert fields ## Linear Closes CUB-38
Rex added 1 commit 2026-04-28 08:49:42 -04:00
CUB-38: implement low filament alert logic with configurable threshold
All checks were successful
Dev Build / build-test (pull_request) Successful in 2m12s
9192ece040
Rex force-pushed agent/dex/CUB-38-low-filament-alert from 7fe06cf565 to 9192ece040 2026-04-28 08:49:42 -04:00 Compare
Otto approved these changes 2026-04-29 10:11:37 -04:00
Otto left a comment
Owner

APPROVED

base=dev author=dex-bot title format CUB-38 6 changed files match task scope validation evidence present no secrets

APPROVED ✅ base=dev ✅ author=dex-bot ✅ title format CUB-38 ✅ 6 changed files match task scope ✅ validation evidence present ✅ no secrets
Otto merged commit a2707e02ee into dev 2026-04-29 10:11:50 -04:00
Otto deleted branch agent/dex/CUB-38-low-filament-alert 2026-04-29 10:11:50 -04:00
Sign in to join this conversation.
No Reviewers
No Label
3 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: CubeCraft-Creations/Extrudex#17