Skip to content

Comms flood protection, Dockerfile layer-cache optimisation & dependency bumps#43

Merged
f2calv merged 8 commits into
mainfrom
f2calv/2026-06-updates3
Jun 26, 2026
Merged

Comms flood protection, Dockerfile layer-cache optimisation & dependency bumps#43
f2calv merged 8 commits into
mainfrom
f2calv/2026-06-updates3

Conversation

@f2calv

@f2calv f2calv commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Summary

This branch adds flood-protection to the communications background service, optimises the Docker build layer caching, refreshes NuGet dependencies, and tidies up build/CI tooling and instructions.

Changes

Communications service — flood protection

Adds producer-flood protection to CommunicationsBgService so a burst of stream events can no longer be drip-fed to the Signal group over hours.

  • Token-bucket rate limiter (StreamSendThrottle) gates producer-driven stream events before the agent runs — suppressed events are acknowledged but dropped, and inference is skipped for them. Interactive replies to user messages are never throttled.
  • Stale-event dropping — events older than MaxEventAgeSeconds are acknowledged but dropped instead of delivered late.
  • Bounded reply channel — the previously unbounded reply queue is now a bounded channel (DropOldest) capped at ReplyQueueCapacity, so a flood cannot grow an unbounded backlog.
  • Drop-notice messages — a single rate-limited notice (DropNoticeIntervalMs) is sent to the group summarising how many rate-limited / stale notifications were dropped; the first drop emits immediately.
  • New LoggerMessage source-gen entries for suppressed / stale / drop-notice events.
  • Seven new CommsAgentConfig options (all with sensible defaults and [Range] validation): StreamSendThrottlingEnabled, StreamSendRatePerMinute, StreamSendBurst, StaleEventDroppingEnabled, MaxEventAgeSeconds, DropNoticeIntervalMs, ReplyQueueCapacity.

Docker build

  • Enable BuildKit (# syntax=docker/dockerfile:1) and replace the long hand-maintained per-project COPY list with COPY --parents src/**/*.csproj ./, so editing source files reuses the cached restore layer.
  • Restore is now performed before ARG TARGETPLATFORM so the platform-agnostic restore layer is shared across architectures.
  • Dockerfile.Debug uses the /./ pivot to land the sibling deps/ repos at the filesystem root and restores manifests only before copying source.
  • .dockerignore overhaul: broaden props/targets allow-list (!**/*.props, !**/*.targets), include the full deps/** tree for Debug builds, and explicitly exclude bin/obj/.git/.vs, appsettings.Local*.json, and **/*.Tests to keep the build context lean and avoid cache busts.

Dependencies

  • CasCap.Common.* 4.12.1 → 4.12.2
  • CasCap.Api.Azure.* 1.5.0 → 1.5.1
  • Spectre.Console* 0.57.0 → 0.57.1
  • Swashbuckle.AspNetCore 10.2.1 → 10.2.3
  • Microsoft.NET.Test.Sdk 18.6.0 → 18.7.0

CI / tooling

  • New package-cleanup.yml workflow (committed commented-out) wired to f2calv/gha-workflows for scheduled GHCR image pruning, with dry-run defaulted on until validated.
  • Bump actions/checkout v6 → v7 in _gitops-helm-update.yml and copilot-setup-steps.yml.
  • Ignore .copilot-tracking/ runtime artefacts in .gitignore.

Documentation

  • Clarify the C# class-per-file, generic-type filename (Foo{T}.cs), IOptions<T> access, and parameter-wrapping conventions in csharp.instructions.md.

Notes

  • No behavioural change to the happy path — flood protection only engages under burst/backlog conditions and is fully configurable (and disable-able) via CommsAgentConfig.
  • All new config options ship with safe defaults, so no appsettings changes are required to adopt.

@f2calv f2calv self-assigned this Jun 26, 2026
@f2calv f2calv added documentation Improvements or additions to documentation enhancement New feature or request dependencies Pull requests that update a dependency file labels Jun 26, 2026
@f2calv
f2calv merged commit f72bd68 into main Jun 26, 2026
4 checks passed
@f2calv
f2calv deleted the f2calv/2026-06-updates3 branch June 26, 2026 05:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant