|
| 1 | +# Numerics Local Development Rules |
| 2 | + |
| 3 | +## Technical Authority and Algorithm Change Control (NON-NEGOTIABLE) |
| 4 | + |
| 5 | +Haden Smith is the final technical and numerical authority for this repository. AI agents, |
| 6 | +including Codex and Claude, must never change an established algorithm, formula, |
| 7 | +probability-combination rule, numerical method, convergence rule, default tolerance, |
| 8 | +random-seed behavior, clipping or normalization policy, or reference-result contract without |
| 9 | +Haden Smith's explicit prior approval. A failing test authorizes diagnosis and a proposed fix |
| 10 | +only; it does not authorize tuning or replacing the algorithm. When an agent's reasoning |
| 11 | +conflicts with Haden Smith's direction or domain judgment, the agent must stop, present the |
| 12 | +evidence, and request a decision. AI confidence is not technical authority. |
| 13 | + |
| 14 | +## Quality Gate |
| 15 | + |
| 16 | +- No compiler errors. |
| 17 | +- No compiler warnings. |
| 18 | +- Do not suppress warnings to make a build pass; fix the code, XML documentation, or invalid reference. |
| 19 | +- Empty catch blocks are not allowed. Preserve exception context when rethrowing or wrapping. |
| 20 | + |
| 21 | +## XML Documentation |
| 22 | + |
| 23 | +- XML documentation is mandatory for all public API additions and changes. |
| 24 | +- Public classes, structs, interfaces, enums, constructors, properties, methods, events, and fields require accurate XML documentation. |
| 25 | +- Private or internal methods with non-obvious algorithms should also be documented. |
| 26 | +- Include `<summary>`, `<param>`, `<returns>`, `<exception>`, and `<remarks>` whenever they apply. |
| 27 | +- Use `<remarks>` for numerical method notes, assumptions, references, and domain-specific constraints. |
| 28 | +- XML documentation warnings `CS1570`, `CS1571`, `CS1572`, `CS1573`, `CS1574`, `CS1584`, `CS1587`, `CS1589`, and `CS1591` are build errors when `EnforceXmlDocumentation=true`. |
| 29 | + |
| 30 | +## Unit Tests |
| 31 | + |
| 32 | +- Every behavior change must include unit tests or an explicit reason no test is useful. |
| 33 | +- Every new public class requires corresponding coverage in `Test_Numerics`. |
| 34 | +- Statistical and numerical methods must cover known values, edge cases, invalid inputs, and regression cases. |
| 35 | +- Use small inline fixtures in tests unless a shared fixture already exists for the exact scenario. |
| 36 | + |
| 37 | +## Required Validation |
| 38 | + |
| 39 | +Run validation before committing: |
| 40 | + |
| 41 | +```powershell |
| 42 | +dotnet build -c Release |
| 43 | +dotnet test -c Release --no-build |
| 44 | +``` |
| 45 | + |
| 46 | +Both commands must complete with zero errors, zero warnings, and zero failed tests. If validation fails, fix the issue before committing. |
| 47 | + |
| 48 | +## Git Workflow |
| 49 | + |
| 50 | +- Commit after successful build and test validation for the completed logical change. |
| 51 | +- Stage only files that belong to the validated change. |
| 52 | +- Do not include unrelated tracked changes or untracked local files. |
| 53 | +- Use concise commit messages that describe the change. |
| 54 | +- Do not push unless explicitly asked. |
| 55 | + |
| 56 | +## PR and Release Workflow |
| 57 | + |
| 58 | +Use this workflow for release-preparation pull requests and public package releases. |
| 59 | + |
| 60 | +### Release PR Planning |
| 61 | + |
| 62 | +- Base release PRs on `bug-fixes-and-enhancements` targeting `main` unless the user gives a different branch plan. |
| 63 | +- Identify the last merged PR from the release branch and list every commit since that merge. |
| 64 | +- Merge `origin/main` into the release branch before editing so current README, JOSS, citation, and metadata updates are preserved. |
| 65 | +- Define the release outcome up front, including the exact `RMC.Numerics` version that NuGet.org must show as the latest public package after publishing. |
| 66 | + |
| 67 | +### Version and Metadata Checklist |
| 68 | + |
| 69 | +Update and cross-check every version-bearing file for each release: |
| 70 | + |
| 71 | +- `Numerics/Numerics.csproj`: set `Version`, `AssemblyVersion`, and `PackageReleaseNotes`. |
| 72 | +- `CITATION.cff`: set `version` and `date-released`. |
| 73 | +- `codemeta.json`: set `version` and `dateModified`. |
| 74 | +- `.github/workflows/Snapshot.yml`: advance the snapshot version to the next patch after the release. |
| 75 | +- Keep `PackageReleaseNotes` concise because NuGet.org displays this field on the package page. |
| 76 | + |
| 77 | +### PR Message Checklist |
| 78 | + |
| 79 | +Use a title like `Prepare vX.Y.Z release`. |
| 80 | + |
| 81 | +Include these sections in the PR body: |
| 82 | + |
| 83 | +- `Summary`: package, citation, CodeMeta, and snapshot metadata updates. |
| 84 | +- `Summary`: user-facing fixes, reliability changes, API changes, and test coverage added since the previous release branch merge. |
| 85 | +- `Validation`: required commands and package inspection results. |
| 86 | + |
| 87 | +Use this validation checklist: |
| 88 | + |
| 89 | +```markdown |
| 90 | +- [ ] `dotnet restore` |
| 91 | +- [ ] `dotnet build Numerics/Numerics.csproj -c Release /p:Version=X.Y.Z` |
| 92 | +- [ ] `dotnet test -c Release` with `VSTEST_CONNECTION_TIMEOUT=600` |
| 93 | +- [ ] `dotnet pack Numerics/Numerics.csproj -c Release /p:Version=X.Y.Z --no-build -o ./packages` |
| 94 | +- [ ] Inspect the `.nupkg` metadata and confirm version `X.Y.Z` and release notes are correct. |
| 95 | +``` |
| 96 | + |
| 97 | +### Release Message Checklist |
| 98 | + |
| 99 | +Create a GitHub Release titled `Numerics vX.Y.Z`. |
| 100 | + |
| 101 | +Include these sections in the release body: |
| 102 | + |
| 103 | +- `Highlights`: short release overview. |
| 104 | +- `Reliability and Fixes`: behavior fixes and reliability improvements. |
| 105 | +- Domain-specific sections for API, statistics, time-series, numerical methods, or other notable changes. |
| 106 | +- `Install`: package install command. |
| 107 | + |
| 108 | +Use this install command format: |
| 109 | + |
| 110 | +```bash |
| 111 | +dotnet add package RMC.Numerics --version X.Y.Z |
| 112 | +``` |
| 113 | + |
| 114 | +### Publish Workflow |
| 115 | + |
| 116 | +- Merge the validated PR to `main`. |
| 117 | +- Tag the merge commit as `vX.Y.Z`. |
| 118 | +- Push the tag so `.github/workflows/Release.yml` publishes to the internal Nexus feed. |
| 119 | +- Create and publish a non-draft, non-prerelease GitHub Release for `vX.Y.Z`. |
| 120 | +- Confirm `.github/workflows/NuGetPublish.yml` publishes `RMC.Numerics.X.Y.Z.nupkg` to NuGet.org. |
| 121 | +- Verify NuGet.org shows `RMC.Numerics X.Y.Z` as the latest public package. |
0 commit comments