diff --git a/.bot/README.md b/.bot/README.md new file mode 100644 index 0000000..de97dce --- /dev/null +++ b/.bot/README.md @@ -0,0 +1,10 @@ +# .bot Workspace + +This folder is reserved for local-only AI working material such as: + +- brainstorm notes +- draft implementation plans +- design alternatives +- temporary agent state + +Keep this folder out of source control. Move only finalized, non-confidential guidance into `AGENTS.md` or `.github/copilot-instructions.md`. diff --git a/.github/copilot-instructions.md b/.github/copilot-instructions.md index c646bce..199810c 100644 --- a/.github/copilot-instructions.md +++ b/.github/copilot-instructions.md @@ -180,6 +180,28 @@ Internal classes and methods must be validated by exercising the public API that - Public entry points provide sufficient coverage of internal code paths. - The internal implementation exists solely as a helper or utility for public-facing functionality. +## 10. ExcludeFromCodeCoverage Prohibition + +**Do not use `ExcludeFromCodeCoverage` attribute on any code.** This includes: + +- Test classes or test methods +- Production code +- Configuration code +- Any other code path + +### Rationale + +- Excluding code from coverage hides gaps and creates false confidence in test completeness. +- If a code path cannot or should not be tested, refactor the code to eliminate that path rather than hiding it from metrics. +- Every executable line should be covered by tests or be genuinely unreachable (dead code to be removed). + +### Alternative Approaches + +- **Untestable code paths**: Refactor to separate concerns and eliminate the untestable path. +- **External dependencies**: Use test doubles (fakes, stubs, spies) instead of excluding from coverage. +- **Configuration-only code**: Move to configuration files or extract into testable methods. +- **Generated or third-party code**: These should not be in the primary codebase; use NuGet packages or dedicated vendor folders if necessary. + --- description: 'Writing Performance Tests' applyTo: "tuning/**, **/*Benchmark*.cs" diff --git a/.github/workflows/ci-pipeline.yml b/.github/workflows/ci-pipeline.yml index a55efa9..7110572 100644 --- a/.github/workflows/ci-pipeline.yml +++ b/.github/workflows/ci-pipeline.yml @@ -12,6 +12,10 @@ on: options: - Debug - Release + run_mac_tests: + type: boolean + description: Run the macOS test matrix despite the additional cost and runtime. + default: false permissions: contents: read @@ -21,6 +25,7 @@ jobs: name: initialize runs-on: ubuntu-24.04 outputs: + run-mac-tests: ${{ steps.vars.outputs.run-mac-tests }} run-privileged-jobs: ${{ steps.vars.outputs.run-privileged-jobs }} strong-name-key-filename: ${{ steps.vars.outputs.strong-name-key-filename }} build-switches: ${{ steps.vars.outputs.build-switches }} @@ -29,6 +34,12 @@ jobs: name: calculate workflow variables shell: bash run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" && "${{ inputs.run_mac_tests }}" == "true" ]]; then + echo "run-mac-tests=true" >> "$GITHUB_OUTPUT" + else + echo "run-mac-tests=false" >> "$GITHUB_OUTPUT" + fi + if [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.repository }}" ]]; then echo "run-privileged-jobs=false" >> "$GITHUB_OUTPUT" echo "strong-name-key-filename=" >> "$GITHUB_OUTPUT" @@ -104,10 +115,73 @@ jobs: build: true download-pattern: build-${{ matrix.configuration }}-${{ matrix.arch }} + test_mac: + if: ${{ needs.init.outputs.run-mac-tests == 'true' }} + name: call-test-mac + needs: [init, build] + strategy: + fail-fast: false + matrix: + arch: [X64, ARM64] + configuration: [Debug, Release] + uses: codebeltnet/jobs-dotnet-test/.github/workflows/default.yml@v3 + with: + projects: test/**/*.csproj + runs-on: ${{ matrix.arch == 'ARM64' && 'macos-26' || 'macos-26-intel' }} + configuration: ${{ matrix.configuration }} + build-switches: -p:SkipSignAssembly=true + restore: true + build: true + download-pattern: build-${{ matrix.configuration }}-${{ matrix.arch }} + + test_qualitygate: + if: ${{ always() }} + name: test-qualitygate + needs: [init, test_linux, test_windows, test_mac] + runs-on: ubuntu-24.04 + steps: + - name: Evaluate test results + shell: bash + env: + RUN_MAC_TESTS: ${{ needs.init.outputs.run-mac-tests }} + TEST_LINUX_RESULT: ${{ needs.test_linux.result }} + TEST_WINDOWS_RESULT: ${{ needs.test_windows.result }} + TEST_MAC_RESULT: ${{ needs.test_mac.result }} + run: | + require_success() { + local job_name="$1" + local job_result="$2" + + if [[ "$job_result" != "success" ]]; then + echo "::error::$job_name finished with '$job_result'." + exit 1 + fi + } + + require_success_or_skip() { + local job_name="$1" + local job_enabled="$2" + local job_result="$3" + + if [[ "$job_enabled" == "true" ]]; then + require_success "$job_name" "$job_result" + return + fi + + if [[ "$job_result" != "success" && "$job_result" != "skipped" ]]; then + echo "::error::$job_name finished with '$job_result' while disabled." + exit 1 + fi + } + + require_success "test_linux" "$TEST_LINUX_RESULT" + require_success "test_windows" "$TEST_WINDOWS_RESULT" + require_success_or_skip "test_mac" "$RUN_MAC_TESTS" "$TEST_MAC_RESULT" + sonarcloud: - if: ${{ needs.init.outputs.run-privileged-jobs == 'true' }} + if: ${{always() && needs.init.outputs.run-privileged-jobs == 'true' && needs.build.result == 'success' && needs.test_qualitygate.result == 'success'}} name: call-sonarcloud - needs: [init, build, test_linux, test_windows] + needs: [init, build, test_qualitygate] uses: codebeltnet/jobs-sonarcloud/.github/workflows/default.yml@v3 with: projects: src/**/*.csproj @@ -117,18 +191,18 @@ jobs: secrets: inherit codecov: - if: ${{ needs.init.outputs.run-privileged-jobs == 'true' }} + if: ${{always() && needs.init.outputs.run-privileged-jobs == 'true' && needs.build.result == 'success' && needs.test_qualitygate.result == 'success'}} name: call-codecov - needs: [init, build, test_linux, test_windows] + needs: [init, build, test_qualitygate] uses: codebeltnet/jobs-codecov/.github/workflows/default.yml@v1 with: repository: codebeltnet/globalization secrets: inherit codeql: - if: ${{ needs.init.outputs.run-privileged-jobs == 'true' }} + if: ${{always() && needs.init.outputs.run-privileged-jobs == 'true' && needs.build.result == 'success' && needs.test_qualitygate.result == 'success'}} name: call-codeql - needs: [init, build, test_linux, test_windows] + needs: [init, build, test_qualitygate] uses: codebeltnet/jobs-codeql/.github/workflows/default.yml@v3 with: projects: src/**/*.csproj @@ -138,7 +212,7 @@ jobs: deploy: if: github.event_name != 'pull_request' name: call-nuget - needs: [build, pack, test_linux, test_windows, sonarcloud, codecov, codeql] + needs: [build, pack, test_qualitygate, sonarcloud, codecov, codeql] uses: codebeltnet/jobs-nuget-push/.github/workflows/default.yml@v3 with: version: ${{ needs.build.outputs.version }} diff --git a/.gitignore b/.gitignore index 190b107..db2582b 100644 --- a/.gitignore +++ b/.gitignore @@ -377,4 +377,8 @@ FodyWeavers.xsd *.snk # Tooling -/tooling/gse/Surrogates \ No newline at end of file +/tooling/gse/Surrogates + +# Bot workspace (local-only AI agent ideation, PRDs, and agentic loop state) +.bot/* +!.bot/README.md \ No newline at end of file diff --git a/.nuget/Codebelt.Extensions.Globalization/PackageReleaseNotes.txt b/.nuget/Codebelt.Extensions.Globalization/PackageReleaseNotes.txt index 9aca67d..9859117 100644 --- a/.nuget/Codebelt.Extensions.Globalization/PackageReleaseNotes.txt +++ b/.nuget/Codebelt.Extensions.Globalization/PackageReleaseNotes.txt @@ -1,3 +1,9 @@ +Version: 10.0.8 +Availability: .NET 10, .NET 9 and .NET Standard 2.0 + +# ALM +- CHANGED Dependencies have been upgraded to the latest compatible versions for all supported target frameworks (TFMs) + Version: 10.0.7 Availability: .NET 10, .NET 9 and .NET Standard 2.0 diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..4e567c1 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,69 @@ +# Agent Instructions for Codebelt.Extensions.Globalization + +This document provides guidance for AI agents working in this repository. + +## Project Overview + +Codebelt.Extensions.Globalization is a .NET library providing uniform, opinionated, and extensible APIs for working with globalization, culture information, and locale-sensitive formatting. The solution targets .NET 10.0, .NET 9.0, and .NET Standard 2.0. It includes: + +- **Codebelt.Extensions.Globalization** — Core extensions for culture info, surrogate types for serialization-friendly globalization data, and culture-aware utilities. + +## Coding Standards + +- **Text encoding:** UTF-8 for text files (enforced via `.editorconfig`) +- **Template rewrites:** Preserve UTF-8 explicitly when scripts or tools rewrite text files; avoid locale-dependent encoding defaults +- **Namespaces:** File-scoped namespaces are required (enforced via `.editorconfig`) +- **Top-level statements:** Not allowed (enforced via `.editorconfig`) +- **Language version:** Always use the latest C# features (`LangVersion=latest`) +- **Nullable:** Enable nullable reference types in all new code +- **XML documentation:** All public APIs must have XML documentation comments +- **Testing:** Use xUnit v3 with Codebelt.Extensions.Xunit.App base classes + +## Project Structure + +- `src/` — Production source code + - `Codebelt.Extensions.Globalization/` — Core globalization extensions and surrogates +- `test/` — Unit and integration tests (project names end with `Tests`) +- `.nuget/` — Per-package NuGet metadata (icon, README, release notes) +- `.docfx/` — DocFX documentation configuration +- `.github/` — CI/CD workflows, contributing guidelines, Copilot instructions +- `tooling/` — Utility projects and tools for package generation + +## Test Conventions + +- Test project names must end with `Tests` (e.g., `{PROJECT_NAME}.Tests`) +- Test classes should inherit from the `Test` base class in `Codebelt.Extensions.Xunit` +- Use `Microsoft.Testing.Platform` as the test runner (`UseMicrosoftTestingPlatformRunner=true`) +- All tests are executable (`OutputType=Exe`) +- Test namespaces must match the SUT namespace (System Under Test), without `.Tests` suffix +- See `.github/copilot-instructions.md` for detailed test writing guidelines + +## Build & CI + +- Centralized package versions via `Directory.Packages.props` +- Resolve new or updated `Directory.Packages.props` versions from NuGet.org and keep them on the latest stable listed releases +- Centralized build configuration via `Directory.Build.props` +- MinVer for semantic versioning from Git tags +- Strong-name signing is enabled in CI environments (`CI=true`) +- Keep `.github/dependabot.yml` enabled at the repo root so central NuGet package management stays current + +## .bot/ Folder + +If a `.bot/` folder exists at the root, it contains **confidential, local-only** working material for AI agents — product requirement documents (PRDs), design proposals, agentic loop state, and brainstorming outputs. This folder is gitignored and never committed. + +When starting creative or design work (new features, architecture decisions, PRD drafts), use the [brainstorming skill](https://skills.sh/obra/superpowers/brainstorming) and save outputs to `.bot/`. Only move finalized, non-confidential instructions into `AGENTS.md` or `.github/copilot-instructions.md`. + +## Git Operations Safeguards + +Agents must never automatically commit code changes or push to remote repositories. Both actions require explicit user approval: + +- **Commits**: Always request confirmation from the user before staging and committing code. Present a clear summary of the changes and wait for approval before executing the commit. +- **Remote Operations**: Do not push, pull, fetch, or interact with `origin` or any remote repository without explicit user instruction. These operations modify repository history and can cause data loss if performed unexpectedly. + +**Rationale:** Automatic commits can clutter history with incomplete work, temporary debugging code, or unintended changes. Unexpected remote operations risk overwriting or losing commits on shared branches. Always require explicit user approval before performing these actions. + +## Official Documentation + +- Public API conventions belong in `.docfx/api/namespaces/` and should be treated as the official documentation source for library behavior and naming vocabulary. +- When adding or renaming public APIs, update the relevant namespace page in `.docfx/api/namespaces/` if the change introduces or clarifies a convention. +- Keep internal reasoning, exploratory notes, and agent discussion out of DocFX pages; summarize only stable public guidance. diff --git a/CHANGELOG.md b/CHANGELOG.md index e8181c5..d346886 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ For more details, please refer to `PackageReleaseNotes.txt` on a per assembly ba > [!NOTE] > Changelog entries prior to version 9.0.1 was migrated from previous versions of Cuemon.Extensions.Globalization. +## [10.0.8] - 2026-06-06 + +This is a service update that focuses on package dependencies. + ## [10.0.7] - 2026-05-23 This is a service update that focuses on package dependencies. diff --git a/Directory.Build.props b/Directory.Build.props index 6d0107c..5193801 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -6,6 +6,7 @@ $(MSBuildProjectDirectory.ToLower().StartsWith('$(MSBuildThisFileDirectory.ToLower())src')) $(MSBuildProjectDirectory.ToLower().StartsWith('$(MSBuildThisFileDirectory.ToLower())tooling')) $([MSBuild]::IsOSPlatform('Linux')) + $([MSBuild]::IsOSPlatform('OSX')) $([MSBuild]::IsOSPlatform('Windows')) true false @@ -52,7 +53,7 @@ - + net10.0;net9.0 diff --git a/Directory.Packages.props b/Directory.Packages.props index d42dfff..0d3a494 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -3,9 +3,9 @@ true - - - + + +