From b53a656d7365d21ebbc321acccd10fd275210c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Ren=C3=A9=20White=20Enciso?= Date: Mon, 9 Mar 2026 11:57:46 -0600 Subject: [PATCH] chore(operations-service): checkpoint pending development updates --- .dockerignore | 9 +++++ Directory.Build.props | 4 +- Dockerfile | 22 ++++++++++ docs/roadmap/feature-epics.md | 18 +++++++++ docs/runbooks/containerization.md | 40 +++++++++++++++++++ .../EvaluateOperationalDecisionUseCase.cs | 19 +++++++++ .../IEvaluateOperationalDecisionUseCase.cs | 11 +++++ .../EvaluateOperationalDecisionRequest.cs | 6 +++ .../EvaluateOperationalDecisionResponse.cs | 7 ++++ src/Operations.Service.Grpc/Program.cs | 12 ++++++ 10 files changed, 146 insertions(+), 2 deletions(-) create mode 100644 .dockerignore create mode 100644 Dockerfile create mode 100644 docs/roadmap/feature-epics.md create mode 100644 docs/runbooks/containerization.md create mode 100644 src/Operations.Service.Application/UseCases/EvaluateOperationalDecisionUseCase.cs create mode 100644 src/Operations.Service.Application/UseCases/IEvaluateOperationalDecisionUseCase.cs create mode 100644 src/Operations.Service.Contracts/Requests/EvaluateOperationalDecisionRequest.cs create mode 100644 src/Operations.Service.Contracts/Responses/EvaluateOperationalDecisionResponse.cs diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 0000000..636f769 --- /dev/null +++ b/.dockerignore @@ -0,0 +1,9 @@ +**/bin/ +**/obj/ +.vs/ +TestResults/ +.git/ +.repo-tasks/ +.repo-context/ +.tasks/ +.agile/ diff --git a/Directory.Build.props b/Directory.Build.props index 147dc3e..5598677 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -3,8 +3,8 @@ AgileWebs AgileWebs git - http://192.168.10.100:3000/AgileWebs/operations-service - http://192.168.10.100:3000/AgileWebs/operations-service + https://gitea.dream-views.com/AgileWebs/operations-service + https://gitea.dream-views.com/AgileWebs/operations-service false diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..da2cee0 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,22 @@ +# syntax=docker/dockerfile:1.7 +ARG SDK_IMAGE=mcr.microsoft.com/dotnet/sdk:10.0 +ARG RUNTIME_IMAGE=mcr.microsoft.com/dotnet/aspnet:10.0 + +FROM ${SDK_IMAGE} AS build +ARG NUGET_FEED_URL=https://gitea.dream-views.com/api/packages/AgileWebs/nuget/index.json +ARG NUGET_FEED_USERNAME= +ARG NUGET_FEED_TOKEN= +WORKDIR /src +COPY . . + +RUN if [ -n "$NUGET_FEED_USERNAME" ] && [ -n "$NUGET_FEED_TOKEN" ]; then dotnet nuget add source "$NUGET_FEED_URL" --name gitea-org --username "$NUGET_FEED_USERNAME" --password "$NUGET_FEED_TOKEN" --store-password-in-clear-text --allow-insecure-connections --configfile /root/.nuget/NuGet/NuGet.Config; fi + +RUN dotnet restore "src/Operations.Service.Grpc/Operations.Service.Grpc.csproj" --configfile /root/.nuget/NuGet/NuGet.Config +RUN dotnet publish "src/Operations.Service.Grpc/Operations.Service.Grpc.csproj" -c Release -o /app/publish /p:UseAppHost=false --no-restore + +FROM ${RUNTIME_IMAGE} AS runtime +WORKDIR /app +ENV ASPNETCORE_URLS=http://+:8080 ASPNETCORE_ENVIRONMENT=Production +EXPOSE 8080 +COPY --from=build /app/publish . +ENTRYPOINT ["dotnet", "Operations.Service.Grpc.dll"] diff --git a/docs/roadmap/feature-epics.md b/docs/roadmap/feature-epics.md new file mode 100644 index 0000000..dfa1d60 --- /dev/null +++ b/docs/roadmap/feature-epics.md @@ -0,0 +1,18 @@ +# Feature Epics + +## Repository +operations-service + +## Core Epics +- Epic 1: Expand domain-aligned capabilities for restaurant operations. +- Epic 2: Stabilize service contracts for containerized runtime integration. +- Epic 3: Improve observability and operational readiness for demo compose environments. + +## Domain-Specific Candidate Features +- Order lifecycle consistency and state transitions. +- Kitchen queue and dispatch optimization hooks. +- Operations control-plane policies (flags, service windows, overrides). +- POS closeout and settlement summary alignment. + +## Documentation Contract +Any code change in this repository must include docs updates in the same branch. diff --git a/docs/runbooks/containerization.md b/docs/runbooks/containerization.md new file mode 100644 index 0000000..ca954df --- /dev/null +++ b/docs/runbooks/containerization.md @@ -0,0 +1,40 @@ +# Containerization Runbook + +## Image Build + +If the repo consumes internal packages from Gitea, pass feed credentials as build args. + +```bash +docker build --build-arg NUGET_FEED_USERNAME= --build-arg NUGET_FEED_TOKEN= -t agilewebs/operations-service:dev . +``` + +## Local Run + +```bash +docker run --rm -p 8080:8080 --name operations-service agilewebs/operations-service:dev +``` + +## Health Probe + +- Path: `/health` +- Fallback path: `/healthz` +- Port: `8080` + +## Runtime Notes + +- Exposes internal control-plane evaluation/config endpoints. + +## Health Endpoint Consistency + +- Canonical probe: `/health` +- Compatibility probe: `/healthz` +- Container port: `8080` + +## Demo Integration + +- Participates in: **restaurant** demo compose stack. +- Integration artifact path: `greenfield/demo/restaurant/docker-compose.yml` +## Known Limitations + +- Current runtime adapters are still predominantly in-memory for deterministic local/demo behavior. +- Demo PostgreSQL seeds validate integration contracts and smoke determinism, but do not yet imply full persistence implementation parity. diff --git a/src/Operations.Service.Application/UseCases/EvaluateOperationalDecisionUseCase.cs b/src/Operations.Service.Application/UseCases/EvaluateOperationalDecisionUseCase.cs new file mode 100644 index 0000000..9cf03cf --- /dev/null +++ b/src/Operations.Service.Application/UseCases/EvaluateOperationalDecisionUseCase.cs @@ -0,0 +1,19 @@ +using Operations.Service.Contracts.Requests; +using Operations.Service.Contracts.Responses; + +namespace Operations.Service.Application.UseCases; + +public sealed class EvaluateOperationalDecisionUseCase : IEvaluateOperationalDecisionUseCase +{ + public Task HandleAsync( + EvaluateOperationalDecisionRequest request, + CancellationToken cancellationToken) + { + var overrides = new[] { "location-open", "policy-default" }; + return Task.FromResult(new EvaluateOperationalDecisionResponse( + request.LocationId, + true, + "Operational decision allowed by control-plane default policy.", + overrides)); + } +} diff --git a/src/Operations.Service.Application/UseCases/IEvaluateOperationalDecisionUseCase.cs b/src/Operations.Service.Application/UseCases/IEvaluateOperationalDecisionUseCase.cs new file mode 100644 index 0000000..29a8e1b --- /dev/null +++ b/src/Operations.Service.Application/UseCases/IEvaluateOperationalDecisionUseCase.cs @@ -0,0 +1,11 @@ +using Operations.Service.Contracts.Requests; +using Operations.Service.Contracts.Responses; + +namespace Operations.Service.Application.UseCases; + +public interface IEvaluateOperationalDecisionUseCase +{ + Task HandleAsync( + EvaluateOperationalDecisionRequest request, + CancellationToken cancellationToken); +} diff --git a/src/Operations.Service.Contracts/Requests/EvaluateOperationalDecisionRequest.cs b/src/Operations.Service.Contracts/Requests/EvaluateOperationalDecisionRequest.cs new file mode 100644 index 0000000..1936398 --- /dev/null +++ b/src/Operations.Service.Contracts/Requests/EvaluateOperationalDecisionRequest.cs @@ -0,0 +1,6 @@ +namespace Operations.Service.Contracts.Requests; + +public sealed record EvaluateOperationalDecisionRequest( + string LocationId, + string PolicyName, + DateTime RequestedAtUtc); diff --git a/src/Operations.Service.Contracts/Responses/EvaluateOperationalDecisionResponse.cs b/src/Operations.Service.Contracts/Responses/EvaluateOperationalDecisionResponse.cs new file mode 100644 index 0000000..7f73a84 --- /dev/null +++ b/src/Operations.Service.Contracts/Responses/EvaluateOperationalDecisionResponse.cs @@ -0,0 +1,7 @@ +namespace Operations.Service.Contracts.Responses; + +public sealed record EvaluateOperationalDecisionResponse( + string LocationId, + bool Allowed, + string Explanation, + IReadOnlyCollection AppliedOverrides); diff --git a/src/Operations.Service.Grpc/Program.cs b/src/Operations.Service.Grpc/Program.cs index b1f66e9..7650559 100644 --- a/src/Operations.Service.Grpc/Program.cs +++ b/src/Operations.Service.Grpc/Program.cs @@ -5,6 +5,7 @@ using Operations.Service.Contracts.Requests; var builder = WebApplication.CreateBuilder(args); builder.Services.AddSingleton(); builder.Services.AddSingleton(); +builder.Services.AddSingleton(); var app = builder.Build(); @@ -14,4 +15,15 @@ app.MapGet("/internal/operations/config", async (string locationId, IGetOperatio return Results.Ok(await useCase.HandleAsync(request, ct)); }); +app.MapPost("/internal/operations/decision", async ( + EvaluateOperationalDecisionRequest request, + IEvaluateOperationalDecisionUseCase useCase, + CancellationToken ct) => +{ + return Results.Ok(await useCase.HandleAsync(request, ct)); +}); + +app.MapGet("/health", () => Results.Ok(new { status = "ok", service = "operations-service" })); +app.MapGet("/healthz", () => Results.Ok(new { status = "ok", service = "operations-service" })); + app.Run();