53 Commits
Author SHA1 Message Date
zyberzero 9fd4e78065 Merge pull request 'Saliency-based smart crop' (#2) from smart-crop into main
Reviewed-on: #2
2026-11-03 18:12:20 +00:00
zyberzeroandClaude Opus 5.5 fcd8a1b2db Mark MQTT auto-reconnect increment done
Landed in #1 but the checkbox was never ticked.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 19:04:42 +01:00
zyberzeroandClaude Opus 5.5 d910187c53 Document smart crop in IMPLEMENTATION.md
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 19:04:42 +01:00
zyberzeroandClaude Opus 5.5 4695b65a1b Add unit tests for SaliencySmartCropper
The golden fixtures only prove determinism; these assert the crop
actually biases toward the edge-rich side on both axes, reaches the
source edge for an edge-hugging subject, and always returns an in-bounds
rect at the target aspect.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 19:04:25 +01:00
zyberzeroandClaude Opus 5.5 36782f15a1 Search only the max-fitting crop window, including edge positions
Edge energy is non-negative, so the 85% and 70% candidate windows could
never outscore the full-size window containing them; drop them. Also
always evaluate the last x/y position so a subject touching the right
or bottom edge isn't cut by up to one step of grid misalignment.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 19:03:53 +01:00
zyberzeroandClaude Opus 5.5 ac9a0b43a8 Add saliency-based smart crop before resize
Replace the center-crop cover resize with a Sobel edge-density search
that picks the target-aspect window with the most edge energy, so a
subject off-center isn't sliced when the input aspect differs from the
frame's. Failures fall back to the centered crop. Golden fixtures are
regenerated and an asymmetric-edges input exercises the bias.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 19:03:22 +01:00
zyberzero 675d206234 Merge pull request 'Reliable MQTT auto-reconnect' (#1) from mqtt-auto-reconnect into main
Reviewed-on: #1
2026-11-03 17:56:35 +00:00
zyberzeroandClaude Opus 5.5 917a149bc2 Reconnect MQTT on disconnect events with backoff
Replace the hardcoded 5 s IsConnected poll with a loop driven by
DisconnectedAsync (plus an idle safety check), retrying on the
ReconnectBackoffSeconds schedule. Disconnects are now logged with their
reason, and keep-alive and connect timeout come from config so dead
links are detected and connect attempts can't block for 100 s.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 18:51:43 +01:00
zyberzeroandClaude Opus 5.5 e22b2038d0 Add MQTT reconnect, keep-alive and connect timeout options
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 18:51:43 +01:00
zyberzeroandClaude Opus 5.5 8dd42d24bc Specify MQTT reconnect behavior
Add SPEC.md §5.2 describing reconnect requirements (backoff, keep-alive
detection, disconnect logging, unique ClientId), the new Mqtt config
keys, the matching PLAN.md design and verification steps, and
IMPLEMENTATION.md increment 6.6. Also drop the stale WithReconnectDelay
reference, which only exists on ManagedMqttClient.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-11-03 18:51:43 +01:00
zyberzero 96934b6824 Add support for forwarding headers 2026-06-07 20:20:44 +02:00
zyberzero fc8903c04e Add support for forwarding headers options 2026-06-07 20:20:40 +02:00
zyberzero a94c72861a Mark endpoints for Swagger 2026-06-07 19:14:28 +02:00
zyberzero d5ca01e636 Add support for multipart/data uploads in swagger 2026-06-07 19:14:14 +02:00
zyberzero 0ac29a3627 Fix Dockerfile 2026-06-07 19:13:50 +02:00
zyberzero f1e36621d2 Add Swagger 2026-06-07 18:51:13 +02:00
zyberzeroandClaude Opus 4.7 e9d9311748 11.2 README
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:28:31 +02:00
zyberzeroandClaude Opus 4.7 bf75ebc932 11.1 Run PLAN.md verification checklist top to bottom
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:27:03 +02:00
zyberzeroandClaude Opus 4.7 a886f123a7 10.2 docker-compose.yml
Compose stack with frame-processor (built from Dockerfile, frames.json
bind-mounted, /data/images on a named volume) and an eclipse-mosquitto
broker configured for anonymous access on a shared bridge network.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:13:01 +02:00
zyberzeroandClaude Opus 4.7 10188b41af 10.1 Dockerfile
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:11:18 +02:00
zyberzeroandClaude Opus 4.7 fddb674a79 9.1 Serilog wiring
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:08:07 +02:00
zyberzeroandClaude Opus 4.7 d6ebf89468 8.3 Wrap full pipeline in lock
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:05:02 +02:00
zyberzeroandClaude Opus 4.7 e1c35d7423 8.2 FrameLockProvider
Keyed per-frame SemaphoreSlim(1,1) over a ConcurrentDictionary with a
disposable releaser, so the next increment can serialize the upload
pipeline per FrameName.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:03:11 +02:00
zyberzeroandClaude Opus 4.7 475e8988b5 8.1 ApiKeyMiddleware
Enforce X-Api-Key on /api/* requests with constant-time comparison.
/i/{mac}.png and /health remain unauthenticated. No-op when the
configured key is empty.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 16:01:25 +02:00
zyberzero 3e01fa7980 7.2 FramesController.UploadImageUrl 2026-06-07 15:53:27 +02:00
zyberzeroandClaude Opus 4.7 3bef27b286 7.1 IImageUrlFetcher
Add IImageUrlFetcher with HttpClient-backed implementation that enforces
UrlFetch.TimeoutSeconds, MaxRedirects, and MaxBytes. Surfaces failures as
ImageFetchException so the URL-ingestion endpoint can map them to 502.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 15:51:16 +02:00
zyberzeroandClaude Opus 4.7 d94009690c 6.5 Background retry queue
On publish failure, enqueue the MAC in a dedup'd in-memory set and let a
background loop retry with the configured backoff sequence. Reconnects
signal an immediate drain so a transient broker outage no longer drops
the update.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 15:42:47 +02:00
zyberzeroandClaude Opus 4.7 0f681753c1 6.4 /health reports MQTT status
Inject MqttPublisher into HealthController and surface IsConnected as
mqttConnected, replacing the hardcoded false.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 15:20:21 +02:00
zyberzeroandClaude Opus 4.7 948515c9bf 6.3 Wire MQTT publish into FramesController
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 15:19:11 +02:00
zyberzeroandClaude Opus 4.7 cc0241ab53 6.2 MqttPublisher.PublishAsync
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 15:16:40 +02:00
zyberzeroandClaude Opus 4.7 a6c750d5c4 6.1 MqttPublisher hosted service
Persistent MQTTnet v4 IMqttClient wrapped in a BackgroundService:
attempts to connect on StartAsync (logging and continuing on failure)
and reconnects on a 5s loop while running. Exposes IsConnected so
6.4 can wire it into /health later. Honors username/password and
UseTls from MqttOptions; clean session is disabled.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 15:10:59 +02:00
zyberzeroandClaude Opus 4.7 521c95c10b 5.2 ImageController.GetImage
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:47:41 +02:00
zyberzeroandClaude Opus 4.7 abe896a7ab 5.1 FramesController.UploadImage (multipart)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:46:00 +02:00
zyberzeroandClaude Opus 4.7 a0fa0205e5 4.1 ImageStore
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:43:28 +02:00
zyberzeroandClaude Opus 4.7 ad62ce00a5 3.4 ImagePipelineTests golden fixtures
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:41:32 +02:00
zyberzeroandClaude Opus 4.7 5d0d5ed185 3.3 IImagePipeline + ImagePipeline
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:36:54 +02:00
zyberzeroandClaude Opus 4.7 54755c3808 3.2 DitheringRegistry
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:34:36 +02:00
zyberzeroandClaude Opus 4.7 0e757e4193 3.1 PaletteFactory
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:32:36 +02:00
zyberzeroandClaude Opus 4.7 0a936a9f04 2.4 Drop sample configs in repo root
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:31:16 +02:00
zyberzeroandClaude Opus 4.7 0dc0da8de1 2.3 Startup vs reload asymmetry (FramesRegistry)
FramesRegistry validates strictly on construction (fail-fast at startup) and
leniently on hot-reload (skip invalid frames with a warning, keep valid ones
serving). Exposes TryGetByName/TryGetByMac over the current valid set.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:27:20 +02:00
zyberzeroandClaude Opus 4.7 d0fa755534 2.2 FramesOptions (frames.json binding + validator)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:21:24 +02:00
zyberzeroandClaude Opus 4.7 20e6aafaa1 2.1 Configuration POCOs (Mqtt, Storage, UrlFetch, ApiKey)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:15:34 +02:00
zyberzeroandClaude Opus 4.7 79039623e8 1.7 ApiKey value type
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:12:16 +02:00
zyberzeroandClaude Opus 4.7 1b236e03af 1.6 DitherAlgorithm value type
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:10:43 +02:00
zyberzeroandClaude Opus 4.7 fa0081b923 1.5 PaletteEntry value type
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:09:15 +02:00
zyberzeroandClaude Opus 4.7 7d9c7ba338 1.4 Resolution value type
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 14:00:39 +02:00
zyberzeroandClaude Opus 4.7 c5f87d352a 1.3 Orientation value type
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 13:59:20 +02:00
zyberzeroandClaude Opus 4.7 cfaa4e86ab 1.2 FrameName value type
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 13:57:38 +02:00
zyberzeroandClaude Opus 4.7 c74dbd2602 1.1 MacAddress value type
Permissive parser (colon, hyphen, unseparated; case-insensitive; surrounding
whitespace) with canonical lowercase no-separator ToString. Implements
IParsable/ISpanParsable for ASP.NET route binding and ships a System.Text.Json
converter that normalizes on read.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 13:55:48 +02:00
zyberzeroandClaude Opus 4.7 ee77e5656e 0.3 Package references
Add SixLabors.ImageSharp 3.1.11 (last open-source version; 4.0 requires
a paid license), MQTTnet 4.3.7.1207 (v4 matches the APIs referenced in
SPEC/PLAN), and Serilog (AspNetCore + Console + File sinks).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 13:51:26 +02:00
zyberzeroandClaude Opus 4.7 65c398a578 0.2 Minimal Program.cs
Wire up MVC controllers and add GET /health returning
{ status: "Healthy", mqttConnected: false } (mqttConnected hardcoded
until the MQTT publisher lands). Switch launchSettings.json to port
8080 so the DoD curl works out of the box.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 13:48:02 +02:00
zyberzeroandClaude Opus 4.7 5f851ed621 0.1 Solution + projects
Scaffold FrameProcessor.slnx with src/FrameProcessor (net10.0 Web SDK) and
tests/FrameProcessor.Tests (xUnit) plus .gitignore and global.json pinning
the .NET 10 SDK. dotnet build, dotnet test, and dotnet format --verify-no-changes
all pass.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-06-07 13:45:39 +02:00
zyberzero 3fa14ff732 Initial plan 2026-06-07 13:32:14 +02:00