Skip to content

chore: port still-relevant changes from PR #83 (close #83)#98

Merged
s205109 merged 6 commits intomainfrom
chore/port-pr83-residuals
Apr 28, 2026
Merged

chore: port still-relevant changes from PR #83 (close #83)#98
s205109 merged 6 commits intomainfrom
chore/port-pr83-residuals

Conversation

@s205109
Copy link
Copy Markdown
Owner

@s205109 s205109 commented Apr 28, 2026

Summary

Ports the changes from #83 that are still relevant given main has independently re-implemented most of the same plan. Six small, focused commits on top of main.

What's ported

  • refactor(api): collapse the two duplicate app.Use(/) redirect blocks into a UseRootRedirect extension.
  • refactor(api): collapse IDevEnvironment (single field, single concrete impl) into a public AppEnvironment record.
  • refactor(blazor): dedupe the four AddHttpClient<> blocks across the test-auth and prod paths via a local AddApiClient helper.
  • refactor(scripts): extract the Write-Step / Write-Success / Write-Warn / Write-Fail / Confirm-Command helpers (duplicated across deploy.ps1, update.ps1, teardown.ps1 with three different glyph sets) into scripts\Common.ps1. Glyphs unified on ASCII to avoid BOM-anchored unicode.
  • docs: compress docs/environments.md from 280 lines to ~50 — the rest duplicated README, docker-setup, and getting-started.
  • docs: classify ARM64 / Raspberry Pi as unsupported for the bundled stack (no SQL Server ARM64 image).

What's skipped from #83 (already on main)

  • create-github-issues.ps1 move (commit 66fb99a)
  • #Requires -Version 5.1 across scripts
  • docs/scripts/ removal
  • .NET 10 SDK preflight in deploy.ps1 (commit 4319410)
  • Auto-dispatch of deploy-frontend.yml (commit 19b4fbd)
  • TestUtilities xunit fix (PR fix: make TestUtilities a proper xUnit test-discovery target #96)
  • AGENTS.md alignment (commit d5d0ea9)

What's skipped from #83 (no longer applies)

  • Deletion of AHKFlowApp.Domain.Tests — main added real Hotstring entity tests there since refactor: simplify codebase and standardize scripts #83 was opened (commit 8ae9a9f).
  • Splitting Program.cs into ConfigureObservability/Services/Middleware — current 250-line linear bootstrap is readable enough; UseRootRedirect already removed the duplication that was the strongest argument for splitting.

Test plan

  • dotnet build AHKFlowApp.slnx --configuration Release — 13 projects, 0 errors, 0 warnings
  • dotnet test AHKFlowApp.slnx --configuration Release — 155 tests, 0 failed
  • dotnet format --verify-no-changes
  • PowerShell parser check on Common.ps1, deploy.ps1, update.ps1, teardown.ps1
  • Common.ps1 smoke-test — . Common.ps1; Write-Step ...; Write-Success ...; Write-Warn ... produces expected output
  • Smoke docker compose up --build and verify http://localhost:5600/ redirects to /health, http://localhost:5601 loads as Local User
  • (optional) Run deploy.ps1 -SkipPrereqCheck in dry-run to confirm output helpers still work

After merge: close #83 with a comment pointing to this PR; delete feature/plan-c-script-standardization.

s205109 and others added 6 commits April 28, 2026 11:35
Collapses the two near-duplicate `app.Use(...)` blocks for `/` redirect
into a single `app.UseRootRedirect(devTarget, prodTarget)` call.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
The interface had a single field (IsDevelopment) and a single concrete
implementation. A record value is enough; drop the interface and the
NSubstitute mock in tests.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Both auth paths registered the two API clients separately. A small
local AddApiClient helper folds the four blocks into four calls,
keeping the test-auth/prod differences (base address shape, auth
handler) explicit at the call site.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…nd into Common.ps1

deploy.ps1, update.ps1, and teardown.ps1 each defined their own copy of
the same output helpers (with three different sets of glyphs). Move them
into scripts\Common.ps1 and dot-source from each consumer.

Glyphs unified on ASCII (+, x, !) since the helper file lives without
BOM-anchored unicode.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Most of the file duplicated README, docs/development/docker-setup.md, and
docs/deployment/getting-started.md. Strip down to: env table, config-file
load order (the genuinely unique content), connection-string snippets,
and a short troubleshooting list. Link out to the canonical docs.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
mcr.microsoft.com/mssql/server has no ARM64 image, so docker-compose up
silently fails on Apple Silicon and Pi. Make the limitation explicit in
README and docker-setup.md instead of leaving it implicit.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Test Results

2 tests   2 ✅  6s ⏱️
1 suites  0 💤
1 files    0 ❌

Results for commit 62ed6a6.

♻️ This comment has been updated with latest results.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 28, 2026

Summary

Summary
Generated on: 04/28/2026 - 10:05:09
Coverage date: 04/28/2026 - 10:03:31 - 04/28/2026 - 10:05:06
Parser: MultiReport (10x Cobertura)
Assemblies: 6
Classes: 66
Files: 56
Line coverage: 74.8% (488 of 652)
Covered lines: 488
Uncovered lines: 164
Coverable lines: 652
Total lines: 2269
Branch coverage: 48.9% (71 of 145)
Covered branches: 71
Total branches: 145
Method coverage: Feature is only available for sponsors
Tag: 124_25045881486

Coverage

AHKFlowApp.API - 63.3%
Name Line Branch
AHKFlowApp.API 63.3% 52.9%
AHKFlowApp.API.Auth.HttpContextCurrentUser 100% 46.1%
AHKFlowApp.API.Auth.TestAuthenticationHandler 100%
AHKFlowApp.API.Controllers.DevController 100%
AHKFlowApp.API.Controllers.HealthController 100%
AHKFlowApp.API.Controllers.HotstringsController 100%
AHKFlowApp.API.Controllers.VersionController 100%
AHKFlowApp.API.Controllers.WhoAmIController 100%
AHKFlowApp.API.DevDockerSqlServer 0% 0%
AHKFlowApp.API.Extensions.ApiExtensions 100% 100%
AHKFlowApp.API.Extensions.ProblemDetailsResultExtensions 100% 100%
AHKFlowApp.API.Middleware.GlobalExceptionMiddleware 100%
AHKFlowApp.API.Models.HealthResponse 100%
AHKFlowApp.API.OpenApi.Examples.CreateHotstringDtoExample 0%
AHKFlowApp.API.OpenApi.Examples.HotstringDtoExample 0%
AHKFlowApp.API.OpenApi.Examples.PagedHotstringsExample 0%
AHKFlowApp.API.OpenApi.Examples.UpdateHotstringDtoExample 0%
AHKFlowApp.Application - 98.1%
Name Line Branch
AHKFlowApp.Application 98.1% 47%
AHKFlowApp.Application.Behaviors.ValidationBehavior`2 100%
AHKFlowApp.Application.Commands.Dev.SeedHotstringsCommandHandler 100%
AHKFlowApp.Application.Commands.Hotstrings.CreateHotstringCommandHandler 66.6% 0%
AHKFlowApp.Application.Commands.Hotstrings.CreateHotstringCommandValidator 100%
AHKFlowApp.Application.Commands.Hotstrings.DeleteHotstringCommandHandler 100%
AHKFlowApp.Application.Commands.Hotstrings.UpdateHotstringCommandHandler 100% 58.3%
AHKFlowApp.Application.Commands.Hotstrings.UpdateHotstringCommandValidator 100%
AHKFlowApp.Application.DependencyInjection 100%
AHKFlowApp.Application.DTOs.CreateHotstringDto 100%
AHKFlowApp.Application.DTOs.HotstringDto 100%
AHKFlowApp.Application.DTOs.PagedList`1 100% 50%
AHKFlowApp.Application.DTOs.UpdateHotstringDto 100%
AHKFlowApp.Application.Mapping.HotstringMappings 100%
AHKFlowApp.Application.Queries.Hotstrings.GetHotstringQueryHandler 100%
AHKFlowApp.Application.Queries.Hotstrings.ListHotstringsQuery 100%
AHKFlowApp.Application.Queries.Hotstrings.ListHotstringsQueryHandler 100%
AHKFlowApp.Application.Queries.Hotstrings.ListHotstringsQueryValidator 100%
AHKFlowApp.Application.Validation.HotstringRules 100% 100%
AHKFlowApp.Domain - 100%
Name Line Branch
AHKFlowApp.Domain 100% ****
AHKFlowApp.Domain.Entities.Hotstring 100%
AHKFlowApp.Infrastructure - 100%
Name Line Branch
AHKFlowApp.Infrastructure 100% 50%
AHKFlowApp.Infrastructure.DependencyInjection 100%
AHKFlowApp.Infrastructure.Persistence.AppDbContext 100%
AHKFlowApp.Infrastructure.Persistence.Configurations.HotstringConfiguration 100%
AHKFlowApp.Infrastructure.Persistence.Configurations.TestMessageConfigurati
on
100%
AHKFlowApp.Infrastructure.Services.VersionService 100% 50%
AHKFlowApp.TestUtilities - 57.5%
Name Line Branch
AHKFlowApp.TestUtilities 57.5% 100%
AHKFlowApp.TestUtilities.Auth.TestAuthHandler 100% 100%
AHKFlowApp.TestUtilities.Auth.TestUserBuilder 77.7%
AHKFlowApp.TestUtilities.Builders.HealthResponseBuilder 0%
AHKFlowApp.TestUtilities.Builders.HotstringBuilder 0%
AHKFlowApp.TestUtilities.Fixtures.CustomWebApplicationFactory 100% 100%
AHKFlowApp.TestUtilities.Fixtures.SqlContainerFixture 100%
AutoGeneratedProgram 0%
AHKFlowApp.UI.Blazor - 76%
Name Line Branch
AHKFlowApp.UI.Blazor 76% 36.9%
AHKFlowApp.UI.Blazor.Auth.ApiAuthorizationMessageHandler 0%
AHKFlowApp.UI.Blazor.Auth.TestAuthenticationProvider 0%
AHKFlowApp.UI.Blazor.DTOs.ApiProblemDetails 100%
AHKFlowApp.UI.Blazor.DTOs.CreateHotstringDto 100%
AHKFlowApp.UI.Blazor.DTOs.HealthResponse 100%
AHKFlowApp.UI.Blazor.DTOs.HotstringDto 100%
AHKFlowApp.UI.Blazor.DTOs.PagedList`1 100%
AHKFlowApp.UI.Blazor.DTOs.UpdateHotstringDto 100%
AHKFlowApp.UI.Blazor.Layout.MainLayout 0%
AHKFlowApp.UI.Blazor.Pages.Health 100% 100%
AHKFlowApp.UI.Blazor.Pages.Hotstrings 90.9%
AHKFlowApp.UI.Blazor.Services.AhkFlowAppApiHttpClient 100%
AHKFlowApp.UI.Blazor.Services.ApiErrorMessageFactory 58.3% 26.6%
AHKFlowApp.UI.Blazor.Services.ApiResult 50%
AHKFlowApp.UI.Blazor.Services.ApiResult`1 100%
AHKFlowApp.UI.Blazor.Services.HotstringsApiClient 60% 41.6%
AHKFlowApp.UI.Blazor.Shared.LoginDisplay 0%
AHKFlowApp.UI.Blazor.Shared.RedirectToLogin 0%
AHKFlowApp.UI.Blazor.Validation.HotstringEditModel 100%

Per-assembly thresholds: Domain line≥85% br≥70% · Application line≥85% br≥45% · Infrastructure line≥70% br≥50% · API line≥57% br≥50% · UI.Blazor line≥65% br≥28%

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Ports a subset of still-relevant refactors and documentation/script cleanups from the previously opened PR #83, aligning backend environment handling, middleware setup, frontend HTTP client wiring, and PowerShell helper reuse.

Changes:

  • Replace IDevEnvironment/DevEnvironment with a simple AppEnvironment record and update consumers/tests.
  • Deduplicate root redirect middleware in the API via a UseRootRedirect extension.
  • Deduplicate Blazor AddHttpClient setup via a shared local helper and centralize PowerShell output/prereq helpers in scripts/Common.ps1, plus docs reductions/clarifications.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/AHKFlowApp.Application.Tests/Hotstrings/SeedHotstringsCommandHandlerTests.cs Updates tests to use AppEnvironment instead of an IDevEnvironment mock.
src/Frontend/AHKFlowApp.UI.Blazor/Program.cs Introduces AddApiClient helper to DRY up HttpClient + resilience configuration across auth modes.
src/Backend/AHKFlowApp.Application/Commands/Dev/SeedHotstringsCommand.cs Switches handler dependency from IDevEnvironment to AppEnvironment.
src/Backend/AHKFlowApp.Application/AppEnvironment.cs Adds the new AppEnvironment record type.
src/Backend/AHKFlowApp.Application/Abstractions/IDevEnvironment.cs Removes the no-longer-used IDevEnvironment abstraction.
src/Backend/AHKFlowApp.API/Program.cs Registers AppEnvironment and replaces duplicated “/” redirect middleware with UseRootRedirect.
src/Backend/AHKFlowApp.API/Extensions/ApiExtensions.cs Adds UseRootRedirect extension method for consistent root-path redirection.
src/Backend/AHKFlowApp.API/DevEnvironment.cs Removes obsolete DevEnvironment implementation.
scripts/update.ps1 Dot-sources Common.ps1 instead of duplicating output helpers.
scripts/teardown.ps1 Dot-sources Common.ps1 instead of duplicating output helpers.
scripts/deploy.ps1 Dot-sources Common.ps1 instead of duplicating output/prereq helpers.
scripts/Common.ps1 New shared script helper module for consistent output/prereq checks.
docs/environments.md Condenses environment documentation and points to canonical docs.
docs/development/docker-setup.md Documents x64/amd64-only constraint due to SQL Server image limitations.
README.md Adds the same x64/amd64-only note for Docker Compose setup.

@s205109 s205109 merged commit feafbb7 into main Apr 28, 2026
8 of 9 checks passed
@s205109 s205109 deleted the chore/port-pr83-residuals branch April 28, 2026 10:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants