feat: implement strangler-fig-demo Session 1 (backend + smoke script)

Builds the four-seam, three-write-path reference demo backend: case-framework
(seam D stand-in), legacy-backend/frontend (SQL Server, seams A/B/C targets),
and new-backend (Domain/Application/Infrastructure.*/Api implementing the
source resolver, take/release-ownership, write-through translator, and owned
assessment flow), wired together via docker-compose with a plain placeholder
frontend standing in for the Angular portal until Session 2.

All 11 Architecture.Tests pass and scripts/smoke.sh passes end-to-end against
a fresh `docker compose up`, covering acceptance criteria 1-3 and 7-22.

Fixes two real domain bugs found only once the stack ran for real: the BSN
eleven-proof checksum trivially passes all-zero digits, and the adoption
mapper silently treated a partial legacy address as absent instead of failing
loudly. Also fixes several environment-specific integration issues (rootless
Podman/SELinux bind-mount permissions, a buildah NuGet layer-caching bug,
SqlClient's invariant-globalization incompatibility, and an nginx path-prefix
mismatch for the legacy frontend).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
eho
2026-07-31 07:57:26 +02:00
co-authored by Claude Sonnet 5
parent 09b27173a7
commit a6a1abbe9c
129 changed files with 6379 additions and 1 deletions
@@ -0,0 +1,62 @@
using System.Net.Http;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
using New.Application.Ports;
using New.Infrastructure.Legacy.Options;
namespace New.Infrastructure.Legacy;
/// <summary>
/// Composition-root entry point for this project - see
/// New.Infrastructure.Persistence.ServiceCollectionExtensions for why
/// Program.cs only ever calls extension methods like this one, never names
/// LegacyCaseSource/OwnedApplicationSource directly itself.
///
/// Every service below that depends on an `internal` type (LegacyBackendClient,
/// LegacyDetailsWriteThroughTranslator - both internal because their APIs are
/// shaped by legacy DTOs, see Architecture.Tests rule 3) is registered via an
/// explicit factory delegate rather than `services.AddScoped&lt;T&gt;()`'s
/// automatic constructor discovery. That auto-discovery goes through
/// reflection in a different assembly and is not guaranteed to see
/// non-public constructors; a factory delegate compiled here, in the same
/// assembly, calls the constructor directly under ordinary C# accessibility
/// rules - no reflection involved, so there's nothing to be uncertain about.
/// </summary>
public static class ServiceCollectionExtensions
{
private const string HttpClientName = "LegacyBackend";
public static IServiceCollection AddLegacyInfrastructure(this IServiceCollection services, IConfiguration configuration)
{
services.Configure<LegacyBackendOptions>(configuration.GetSection(LegacyBackendOptions.SectionName));
services.AddSingleton<LegacyCallCounter>();
services.AddTransient<LegacyCallCountingHandler>();
services.AddHttpClient(HttpClientName, (sp, http) =>
{
var options = sp.GetRequiredService<IOptions<LegacyBackendOptions>>().Value;
http.BaseAddress = new Uri(options.BaseUrl);
}).AddHttpMessageHandler<LegacyCallCountingHandler>();
services.AddScoped(sp =>
new LegacyBackendClient(sp.GetRequiredService<IHttpClientFactory>().CreateClient(HttpClientName)));
services.AddScoped(sp =>
new LegacyDetailsWriteThroughTranslator(sp.GetRequiredService<Microsoft.Extensions.Logging.ILogger<LegacyDetailsWriteThroughTranslator>>()));
services.AddScoped(sp =>
new LegacyCaseSource(sp.GetRequiredService<LegacyBackendClient>()));
services.AddScoped<ILegacyWorklistReader>(sp =>
new LegacyWorklistReader(sp.GetRequiredService<LegacyBackendClient>()));
services.AddScoped<ILegacyCaseGateway>(sp =>
new LegacyCaseGateway(
sp.GetRequiredService<LegacyBackendClient>(),
sp.GetRequiredService<LegacyDetailsWriteThroughTranslator>()));
return services;
}
}