Skip to content

refactor: simplify codebase and standardize scripts#83

Closed
s205109 wants to merge 10 commits intomainfrom
feature/plan-c-script-standardization
Closed

refactor: simplify codebase and standardize scripts#83
s205109 wants to merge 10 commits intomainfrom
feature/plan-c-script-standardization

Conversation

@s205109
Copy link
Copy Markdown
Owner

@s205109 s205109 commented Apr 22, 2026

Summary

  • simplify backend startup and remove the thin development-environment seam
  • standardize supported PowerShell entry scripts on PowerShell 5.1 and extract shared deployment helpers
  • move the active backlog issue script into scripts\ and remove docs\scripts as a live script location
  • update deploy.ps1 to require a real .NET 10 SDK and dispatch the frontend deployment workflow after provisioning
  • align README, deployment docs, Docker docs, environment docs, and live instruction files with the supported local and Azure workflows
  • remove the empty AHKFlowApp.Domain.Tests project

Validation

  • dotnet build AHKFlowApp.slnx --configuration Release
  • dotnet test --configuration Release --no-build --verbosity normal

s205109 and others added 10 commits April 21, 2026 17:01
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Restore the test SDK and copy local lock-file assemblies so vstest can inspect AHKFlowApp.TestUtilities.dll without crashing during discovery while keeping the project marked as IsTestProject=false.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Simplify API and Blazor startup wiring, remove the redundant DevEnvironment wrapper, and replace the old environment seam with a single application-owned AppEnvironment type while keeping the useful UI test seams intact.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Standardize supported script entrypoints on PowerShell 5.1, extract shared deployment helpers, and simplify fail-fast behavior for the main Azure scripts.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Move the backlog issue creation script into the canonical scripts folder, make the backlog path default to the repo backlog, and update live references to the new entrypoint.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add a .NET 10 SDK preflight check to deploy.ps1 and dispatch the deploy-frontend workflow after Azure provisioning finishes and GitHub configuration is in place.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Trim the live docs down to the supported local and Azure paths, document the x64-only Docker limitation, and update deployment guidance to match the current deploy.ps1 behavior.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Differentiate TEST and PROD API deployment behavior after provisioning so deploy guidance matches deploy-api.yml trigger rules.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Drop the empty AHKFlowApp.Domain.Tests project from the solution and active guidance so verification no longer produces a no-tests warning.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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

Refactors backend startup/configuration and repository operational tooling to reduce indirection, standardize PowerShell entrypoints, and align documentation + repo layout around a single scripts/ source of truth.

Changes:

  • Simplifies API startup by extracting cohesive configuration blocks and replaces IDevEnvironment with a lightweight AppEnvironment value object.
  • Standardizes PowerShell scripts on Windows PowerShell 5.1, extracts shared helpers into scripts/Common.ps1, and moves the GitHub backlog issue generator into scripts/.
  • Updates docs and repo guidance to reflect the supported local/Azure workflows and removes the empty AHKFlowApp.Domain.Tests project.

Reviewed changes

Copilot reviewed 32 out of 32 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/AHKFlowApp.TestUtilities/AHKFlowApp.TestUtilities.csproj Adds test SDK/support properties used by shared test utilities.
tests/AHKFlowApp.Domain.Tests/AHKFlowApp.Domain.Tests.csproj Removes the unused/empty Domain test project.
tests/AHKFlowApp.Application.Tests/Hotstrings/SeedHotstringsCommandHandlerTests.cs Updates tests to use AppEnvironment directly (removes mock seam).
src/Frontend/AHKFlowApp.UI.Blazor/Program.cs Deduplicates HttpClient registration via a shared AddApiClient helper.
src/Backend/AHKFlowApp.Application/Commands/Dev/SeedHotstringsCommand.cs Switches dev-only seeding gate from IDevEnvironment to AppEnvironment.
src/Backend/AHKFlowApp.Application/AppEnvironment.cs Introduces a simple environment value object shared across layers.
src/Backend/AHKFlowApp.Application/Abstractions/IDevEnvironment.cs Removes the thin interface abstraction.
src/Backend/AHKFlowApp.API/Program.cs Extracts observability/service wiring/migrations into local functions; registers AppEnvironment.
src/Backend/AHKFlowApp.API/Extensions/ApiExtensions.cs Adds UseRootRedirect middleware helper for consistent root redirects.
src/Backend/AHKFlowApp.API/DevEnvironment.cs Removes the API-side DevEnvironment record.
scripts/update.ps1 Moves shared helpers (logging/config parsing/login checks) to Common.ps1; enforces PS 5.1.
scripts/teardown.ps1 Moves shared helpers to Common.ps1; enforces PS 5.1.
scripts/setup-entra-app.ps1 Lowers PowerShell requirement to 5.1 while keeping app registration setup behavior.
scripts/setup-dev-entra.ps1 Lowers PowerShell requirement to 5.1 and preserves local Entra wiring workflow.
scripts/run-coverage.ps1 Lowers PowerShell requirement to 5.1 for local coverage script entrypoint.
scripts/deploy.ps1 Enforces PS 5.1, factors shared helpers, adds .NET 10 SDK precheck, and triggers frontend workflow dispatch.
scripts/create-github-issues.ps1 New canonical issue-creation script under scripts/ with dry-run default.
scripts/Common.ps1 New shared helper library for script output, prereq checks, auth checks, and env file parsing.
docs/superpowers/specs/2026-04-21-repo-simplification-file-layout-design.md Adds design spec documenting the canonical repo layout rule for scripts/docs.
docs/superpowers/specs/2026-04-21-code-simplification-design.md Adds design spec motivating targeted code simplification choices.
docs/scripts/create-github-issues.ps1 Removes the old non-canonical script location under docs.
docs/environments.md Rewrites environment documentation to match the supported workflows and entry scripts.
docs/development/github-setup.md Updates references to the canonical script location under scripts/.
docs/development/docker-setup.md Clarifies compose stack scope and x64/amd64 limitation.
docs/deployment/getting-started.md Updates prerequisites and provisioning/deploy workflow descriptions for current scripts.
docs/deployment/entra-setup.md Updates post-provisioning guidance to match deploy.ps1 dispatch behavior.
README.md Updates local run options and clarifies supported DB/architecture constraints.
AHKFlowApp.slnx Removes the deleted AHKFlowApp.Domain.Tests project from the solution.
AGENTS.md Updates repo layout and environment guidance to match new supported workflows.
.claude/skills/cck-verify/SKILL.md Removes references to the deleted Domain tests from verification instructions.
.claude/skills/cck-testing/SKILL.md Removes references to the deleted Domain tests from testing skill documentation.
.claude/backlog/001_create-backlog-in-github.md Updates the backlog note to reference the canonical scripts/ issue-creation script.

Comment thread scripts/deploy.ps1
Comment on lines +90 to +105
function Assert-DotNetSdkVersion([string]$RequiredMajorVersion) {
$installedSdks = dotnet --list-sdks 2>$null
if ($LASTEXITCODE -ne 0) {
Write-Fail 'Unable to determine installed .NET SDK versions.'
exit 1
}

$requiredPrefix = "$RequiredMajorVersion."
if (-not ($installedSdks | Where-Object { $_.StartsWith($requiredPrefix) })) {
Write-Fail ".NET SDK $RequiredMajorVersion.x is required."
Write-Host ' Install from: https://dotnet.microsoft.com/download/dotnet/10.0' -ForegroundColor Yellow
exit 1
}

Write-Success ".NET SDK $RequiredMajorVersion.x found"
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

Assert-DotNetSdkVersion only checks for any installed SDK that starts with 10.. That will pass for older 10.0 feature bands and for preview SDKs, even though the repo’s global.json pins a specific 10.0 SDK version. To avoid confusing false-positives, consider validating against the global.json SDK version (or at least ensuring the required feature band/patch is present and excluding preview entries).

Copilot uses AI. Check for mistakes.
Comment on lines +25 to +26
7. Trigger the frontend deploy workflow on GitHub
8. Save your configuration to `scripts/.env.{environment}` for future use
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

The step ordering here doesn’t match what scripts/deploy.ps1 does: the script saves scripts/.env.{environment} first and only then triggers deploy-frontend.yml. Please either reorder these bullets or adjust the script so the documentation matches the actual workflow.

Suggested change
7. Trigger the frontend deploy workflow on GitHub
8. Save your configuration to `scripts/.env.{environment}` for future use
7. Save your configuration to `scripts/.env.{environment}` for future use
8. Trigger the frontend deploy workflow on GitHub

Copilot uses AI. Check for mistakes.
Comment on lines 68 to +79
await builder.Build().RunAsync();

IHttpClientBuilder AddApiClient<TClient, TImplementation>(Uri baseAddress)
where TClient : class
where TImplementation : class, TClient
{
return builder.Services.AddHttpClient<TClient, TImplementation>(client =>
{
client.BaseAddress = baseAddress;
client.Timeout = TimeSpan.FromSeconds(30);
});
}
Copy link

Copilot AI Apr 22, 2026

Choose a reason for hiding this comment

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

AddApiClient is declared after await builder.Build().RunAsync();. Since RunAsync blocks until shutdown, this makes the helper easy to miss and can confuse readers/tools that expect all setup helpers before the host is built. Consider moving AddApiClient above the first call site (and before Build().RunAsync()) so the composition flow reads top-to-bottom.

Copilot uses AI. Check for mistakes.
@s205109
Copy link
Copy Markdown
Owner Author

s205109 commented Apr 28, 2026

Superseded by #98, which ports just the changes that are still relevant given main has re-implemented most of the same plan via a different sequence of PRs.

Key items skipped from this PR:

  • already done on main: create-github-issues.ps1 move, #Requires -Version 5.1, docs/scripts/ removal, .NET 10 SDK preflight, deploy-frontend.yml auto-dispatch, TestUtilities xunit fix, AGENTS.md alignment, tier-aware deploy.ps1
  • no longer applies: AHKFlowApp.Domain.Tests deletion (main added real entity tests in commit 8ae9a9f after this PR was opened)
  • judged not worth the indirection: splitting Program.cs into Configure* methods

Closing in favour of #98.

@s205109 s205109 closed this in #98 Apr 28, 2026
s205109 added a commit that referenced this pull request Apr 28, 2026
chore: port still-relevant changes from PR #83 (close #83)
@s205109 s205109 deleted the feature/plan-c-script-standardization branch April 28, 2026 10:21
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