Skip to content

chore: bump ANcpLua.NET.Sdk to 3.4.29, delete WarningsNotAsErrors carve-out#15

Merged
ANcpLua merged 1 commit into
mainfrom
chore/bump-sdk-3.4.29-shrink-warnings-carveout
May 13, 2026
Merged

chore: bump ANcpLua.NET.Sdk to 3.4.29, delete WarningsNotAsErrors carve-out#15
ANcpLua merged 1 commit into
mainfrom
chore/bump-sdk-3.4.29-shrink-warnings-carveout

Conversation

@ANcpLua
Copy link
Copy Markdown
Owner

@ANcpLua ANcpLua commented May 13, 2026

Summary

  • Pin ANcpLua.NET.Sdk{,.Web,.Test} to 3.4.29 in global.json. The new SDK demotes 14 NetAnalyzers + 11 AL style rules from warningsuggestion globally, so the 25-rule WarningsNotAsErrors carve-out becomes deletable.
  • Delete Directory.Build.props (it was 100% the carve-out — no other content).
  • Surfaced 76 bug-class errors that the carve-out was hiding. Fixed every one in code, not via re-suppression.
  • Drive-by fix to Pipeline/Components/ITest.cs: the existing *.Unit.* / *.Integration.* namespace filters matched zero tests against *.Tests.Unit / *.Tests.Integration (no sub-namespace). Filter now correctly discovers all 273 unit tests.

What broke (and how each was fixed)

TimeProvider migration (AL0026 + RS0030):

  • Production RichProblemDetailsFactory switched to TimeProvider.System.GetUtcNow()
  • DateTime/DateTimeOffset.UtcNow / DateTime.Now replaced throughout PaperlessServices.Tests and PaperlessREST.Tests
  • PaperlessUI.Blazor Weather sample uses TimeProvider for the date column

Disposable hygiene (CA2000):

  • MinioOptions / ElasticsearchOptions: client construction inlined into the DI factory so disposal lifetime is container-owned, not options-record-owned
  • ReportProcessor wraps XmlReader.Create(...) in using
  • Integration-test fixtures switched from null!/default! to nullable backing fields + property accessor with throw-on-uninitialized (this is also what cleared IDE0370 — see below)
  • GlobalExceptionHandlerTests Activity wrapped in using var
  • DocumentEndpointTests.CreatePdfUploadAsync uses nested try/catch to cover the pre-Add() window; a single [SuppressMessage] justifies the standard HttpClient content-ownership-transfer pattern

ValueTask hygiene (CA2012):

  • TypedErrorOrAsyncExtensions.ToOkOr404 now extends ErrorOr<T> directly (was ValueTask<ErrorOr<T>>). Callers await first, then call the extension on the value — the analyzer sees a direct extension call instead of a ValueTask pipeline
  • DocumentEndpoints.GetDocumentById / GetSummary updated to await-first

Cryptographic randomness (CA5394):

  • Blazor Weather sample uses RandomNumberGenerator.GetInt32(...) instead of Random

Naming (IDE1006):

  • Test method renames from snake_case to PascalCase_When_Then style (matches existing convention in PaperlessREST.Tests/Unit/)

Suppression hygiene (IDE0370):

  • Removed redundant null-forgiving operators identified by the analyzer

Test plan

  • ./build.sh Compile --configuration Release — 0 errors, 0 warnings
  • dotnet build Paperless.slnx -c Release — 0 errors, 0 warnings
  • ./build.sh UnitTests --configuration Release — 273/273 pass (59 PaperlessServices.Tests.Unit + 214 PaperlessREST.Tests.Unit)
  • CI: backend job (Compile → UnitTests → IntegrationTests → Coverage → DotCov gate → Codecov)
  • CI: Angular + React UI builds (non-blocking, sanity)

Notes

🤖 Generated with Claude Code

…ve-out

global.json msbuild-sdks pinned to 3.4.29 (analyzer relaxations land:
14 NetAnalyzers + 11 AL style rules go warning → suggestion globally).
With that floor lowered, the 25-rule Directory.Build.props carve-out is
no longer needed — file deleted instead of trimmed.

Surfaced 76 real bug-class errors that the carve-out was hiding. Each
fixed at the code level, not re-suppressed:

  TimeProvider migration (AL0026 + RS0030):
    - Production: RichProblemDetailsFactory uses TimeProvider.System.GetUtcNow()
    - Tests: replaced DateTime/DateTimeOffset.UtcNow / DateTime.Now across
      PaperlessServices.Tests and PaperlessREST.Tests integration + unit suites
    - PaperlessUI.Blazor Weather demo uses TimeProvider for current date

  Disposable hygiene (CA2000):
    - MinioOptions / ElasticsearchOptions: client construction inlined into
      DI factory so disposal lifetime is owned by the container, not the
      options-record helper
    - ReportProcessor: XmlReader wrapped in using
    - GlobalExceptionHandlerTests: Activity wrapped in using var
    - Integration test fixtures: nullable backing fields with property
      accessors (replaces null!/default! initializers that triggered IDE0370)
    - DocumentEndpointTests: nested try/catch covers pre-Add() window for
      ByteArrayContent; SuppressMessage justifies the standard HttpClient
      content-ownership-transfer pattern

  ValueTask hygiene (CA2012):
    - TypedErrorOrAsyncExtensions.ToOkOr404 now extends ErrorOr<T> directly
      (was ValueTask<ErrorOr<T>>), so callers await first and the analyzer
      sees a direct extension call instead of a ValueTask pipeline
    - DocumentEndpoints GetDocumentById/GetSummary updated to await-first

  Cryptographic randomness (CA5394):
    - Blazor Weather sample: RandomNumberGenerator.GetInt32 instead of Random

  Naming (IDE1006):
    - Test method renames from snake_case to PascalCase_When_Then style
      (matches existing test naming convention in PaperlessREST.Tests/Unit)

  Suppression hygiene (IDE0370):
    - Removed redundant null-forgiving operators identified by the analyzer

Drive-by fix to Pipeline/Components/ITest.cs: the existing namespace filter
`*.Unit.*` / `*.Integration.*` matched zero tests because the project's
test namespaces are exactly `*.Tests.Unit` / `*.Tests.Integration` (no
sub-namespace). Filter now correctly discovers all 273 unit tests +
integration tests.

Verification (local, against packed 3.4.29):
  - `./build.sh Compile --configuration Release`: 0 errors, 0 warnings
  - `dotnet build Paperless.slnx -c Release`: 0 errors, 0 warnings
  - `./build.sh UnitTests --configuration Release`:
    PaperlessServices.Tests.Unit: 59/59 pass
    PaperlessREST.Tests.Unit:     214/214 pass

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 13, 2026 08:53
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 13, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: d3884379-d2e4-4879-8b5a-f6da0da3ed23

📥 Commits

Reviewing files that changed from the base of the PR and between 1a61158 and 1b9b2c5.

⛔ Files ignored due to path filters (35)
  • PaperlessREST.Tests/DocumentBuilder.cs is excluded by none and included by none
  • PaperlessREST.Tests/GlobalUsings.cs is excluded by none and included by none
  • PaperlessREST.Tests/Integration/BatchOrchestratorIntegrationTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Integration/DocumentAccessRepositoryIntegrationTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Integration/DocumentEndpointTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Integration/DocumentRepositoryIntegrationTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Integration/SharedRestContainerFixture.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/BatchOrchestratorTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/DocumentServiceTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/DocumentTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/EndpointsTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/ExceptionHandlerTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/GenAiResultListenerTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/GlobalExceptionHandlerTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/MappingTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/OcrResultListenerTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/Unit/ReportProcessorTests.cs is excluded by none and included by none
  • PaperlessREST/Configuration/ElasticsearchOptions.cs is excluded by none and included by none
  • PaperlessREST/Configuration/MinioOptions.cs is excluded by none and included by none
  • PaperlessREST/Features/BatchProcessing/Application/ReportProcessor.cs is excluded by none and included by none
  • PaperlessREST/Features/DocumentManagement/Presentation/Endpoints/DocumentEndpoints.cs is excluded by none and included by none
  • PaperlessREST/Host/Extensions/RichProblemDetailsFactory.cs is excluded by none and included by none
  • PaperlessREST/Host/Extensions/ServiceCollectionExtensions.cs is excluded by none and included by none
  • PaperlessREST/Host/Extensions/TypedErrorOrAsyncExtensions.cs is excluded by none and included by none
  • PaperlessServices.Tests/GlobalUsings.cs is excluded by none and included by none
  • PaperlessServices.Tests/Integration/FakeTextSummarizer.cs is excluded by none and included by none
  • PaperlessServices.Tests/Integration/OcrIntegrationTests.cs is excluded by none and included by none
  • PaperlessServices.Tests/Integration/SearchIndexIntegrationTests.cs is excluded by none and included by none
  • PaperlessServices.Tests/Integration/WorkerTestBase.cs is excluded by none and included by none
  • PaperlessServices.Tests/Unit/OcrProcessorTests.cs is excluded by none and included by none
  • PaperlessServices.Tests/Unit/OcrWorkerTests.cs is excluded by none and included by none
  • PaperlessServices.Tests/Unit/SearchIndexServiceTests.cs is excluded by none and included by none
  • PaperlessUI.Blazor/Components/Pages/Weather.razor is excluded by none and included by none
  • Pipeline/Components/ITest.cs is excluded by none and included by none
  • global.json is excluded by none and included by none
📒 Files selected for processing (1)
  • Directory.Build.props
💤 Files with no reviewable changes (1)
  • Directory.Build.props

Summary by CodeRabbit

Release Notes

  • Chores
    • Build-Konfiguration aktualisiert: Warnungsausnahmen wurden aus den Build-Einstellungen entfernt, was zu strengeren Qualitätsprüfungen im CI/Release-Prozess führt.

Walkthrough

Die Änderung entfernt die <WarningsNotAsErrors>-Ausnahmenliste aus Directory.Build.props, die zuvor Regel-IDs (AL*, RS*, CA*, IDE*) von der Behandlung als Fehler in CI/Release-Builds ausnahm.

Changes

Cohort / File(s) Summary
Build-Konfiguration
Directory.Build.props
Entfernung der WarningsNotAsErrors-Ausnahmenliste mit vier Regel-ID-Mustern (17 Zeilen gelöscht).

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Possibly related PRs

  • ANcpLua/Paperless#10: Direkter Konflikt – diese PR fügt die gleiche WarningsNotAsErrors-Ausnahmenliste hinzu, die hier entfernt wird.

Suggested labels

area:infra


Important

Pre-merge checks failed

Please resolve all errors before merging. Addressing warnings is optional.

❌ Failed checks (1 error, 1 warning)

Check name Status Explanation Resolution
Title check ❌ Error Der Titel überschreitet das 72-Zeichen-Limit (75 Zeichen) und enthält keinen Scope in Klammern wie erforderlich. Reduzieren Sie den Titel auf unter 72 Zeichen und fügen Sie einen Scope hinzu: 'chore(infra): bump ANcpLua.NET.Sdk 3.4.29' oder ähnlich.
Cancellationtoken Threading ⚠️ Warning 8 public async methods lack CancellationToken: PdfUploadFilter.InvokeAsync, CreatePdfExtractor.ExtractTextAsync, 3 TypedErrorOrAsyncExtensions methods, 3 ServiceCollectionExtensions methods. Add CancellationToken parameter to all public async methods in PdfUploadFilter, CreatePdfExtractor, TypedErrorOrAsyncExtensions, and ServiceCollectionExtensions files.
✅ Passed checks (6 passed)
Check name Status Explanation
Description check ✅ Passed Die Beschreibung dokumentiert detailliert die SDK-Aktualisierung, die Behebung aller 76 identifizierten Probleme und die Testabdeckung.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Otel Instrumentation Required ✅ Passed Keine neuen Services hinzugefügt. Nur bestehende DI-Registrierungen optimiert.
No Unbounded Mcp Responses ✅ Passed PR modifiziert keine MCP-Tools unter src/qyl.mcp/. Das Verzeichnis existiert nicht und der Commit befasst sich ausschließlich mit SDK-Bumping, Analyzer-Fixes und Build-Konfigurationen.
Duckdb Backpressure On Write Paths ✅ Passed PR enthält keine neuen DuckDB-Schreibpfade. Repository nutzt PostgreSQL. Änderungen sind Analyzer-Fixes und Code-Cleanup ohne neue Datenbankzugriffe.

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

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

This PR updates the repo to use ANcpLua.NET.Sdk 3.4.29 and removes the previous WarningsNotAsErrors carve-out by fixing the newly-surfaced analyzer issues directly in code. It also corrects the NUKE/MTP namespace filters so unit/integration targets actually match the existing test namespaces.

Changes:

  • Bump ANcpLua.NET.Sdk{,.Web,.Test} to 3.4.29 in global.json and delete Directory.Build.props (warnings carve-out removal).
  • Address analyzer findings across production and tests (TimeProvider migration, disposal fixes, ValueTask/extension usage updates, naming fixes).
  • Fix test discovery filters for unit/integration test targets in the pipeline.

Reviewed changes

Copilot reviewed 36 out of 36 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
Pipeline/Components/ITest.cs Fix namespace filters for Unit/Integration test targets.
PaperlessUI.Blazor/Components/Pages/Weather.razor Replace DateTime.Now/Random usage with TimeProvider + cryptographic RNG.
PaperlessServices.Tests/Unit/SearchIndexServiceTests.cs TimeProvider updates; settings disposal adjustments.
PaperlessServices.Tests/Unit/OcrWorkerTests.cs Ensure OcrWorker is disposed in tests.
PaperlessServices.Tests/Unit/OcrProcessorTests.cs TimeProvider updates; naming fixes (s_ statics).
PaperlessServices.Tests/Integration/WorkerTestBase.cs TimeProvider updates; Minio client setup/disposal changes.
PaperlessServices.Tests/Integration/SearchIndexIntegrationTests.cs TimeProvider updates; constant naming normalization.
PaperlessServices.Tests/Integration/OcrIntegrationTests.cs TimeProvider updates; constant naming normalization.
PaperlessServices.Tests/Integration/FakeTextSummarizer.cs Simplify fake summarizer behavior/cancellation handling.
PaperlessServices.Tests/GlobalUsings.cs Add System.Diagnostics.CodeAnalysis for suppressions.
PaperlessREST/Host/Extensions/TypedErrorOrAsyncExtensions.cs Refactor ToOkOr404/ToNoContentOr404 to avoid ValueTask analyzer issues.
PaperlessREST/Host/Extensions/ServiceCollectionExtensions.cs Inline Minio/Elasticsearch client construction in DI factories.
PaperlessREST/Host/Extensions/RichProblemDetailsFactory.cs Use TimeProvider.System.GetUtcNow() for metadata timestamps.
PaperlessREST/Features/DocumentManagement/Presentation/Endpoints/DocumentEndpoints.cs Await-first pattern to work with updated ErrorOr extensions.
PaperlessREST/Features/BatchProcessing/Application/ReportProcessor.cs Ensure XmlReader is disposed before schema compilation.
PaperlessREST/Configuration/MinioOptions.cs Tighten string comparison; remove client factory helper.
PaperlessREST/Configuration/ElasticsearchOptions.cs Remove client factory extension helper.
PaperlessREST.Tests/Unit/ReportProcessorTests.cs Naming update (s_ static).
PaperlessREST.Tests/Unit/OcrResultListenerTests.cs Dispose listener in tests; TimeProvider updates.
PaperlessREST.Tests/Unit/MappingTests.cs TimeProvider updates.
PaperlessREST.Tests/Unit/GlobalExceptionHandlerTests.cs Activity disposal pattern update; naming updates.
PaperlessREST.Tests/Unit/GenAiResultListenerTests.cs Dispose listener in tests; TimeProvider updates.
PaperlessREST.Tests/Unit/ExceptionHandlerTests.cs Use a more specific exception type for analyzer compliance.
PaperlessREST.Tests/Unit/EndpointsTests.cs TimeProvider updates; naming for static builders.
PaperlessREST.Tests/Unit/DocumentTests.cs Naming updates; TimeProvider usage.
PaperlessREST.Tests/Unit/DocumentServiceTests.cs TimeProvider updates.
PaperlessREST.Tests/Unit/BatchOrchestratorTests.cs TimeProvider updates in mocks.
PaperlessREST.Tests/Integration/SharedRestContainerFixture.cs Refactor fixture init; add configured factory class; Minio setup changes.
PaperlessREST.Tests/Integration/DocumentRepositoryIntegrationTests.cs Replace null-forgiving fields with guarded accessors; TimeProvider updates.
PaperlessREST.Tests/Integration/DocumentEndpointTests.cs Dispose multipart content; add CA2000 suppression + safer ownership transfer handling.
PaperlessREST.Tests/Integration/DocumentAccessRepositoryIntegrationTests.cs Replace null-forgiving fields with guarded accessors; TimeProvider updates; naming.
PaperlessREST.Tests/Integration/BatchOrchestratorIntegrationTests.cs Naming updates; TimeProvider updates; nullability cleanup.
PaperlessREST.Tests/GlobalUsings.cs Add System.Diagnostics.CodeAnalysis for suppressions.
PaperlessREST.Tests/DocumentBuilder.cs Default timestamps via TimeProvider.
global.json Bump ANcpLua.NET.Sdk versions to 3.4.29.
Directory.Build.props Delete warnings carve-out file.
Comments suppressed due to low confidence (1)

PaperlessREST.Tests/Integration/SharedRestContainerFixture.cs:155

  • NpgsqlDataSource is created here but not registered with DI or disposed. UseNpgsql(dataSource) does not make EF/Core own the data source lifetime, so this can leak connections/resources across test runs. Prefer registering the NpgsqlDataSource as a singleton in ConfigureTestServices (so the container disposes it), or avoid manually creating it and use a connection string overload instead.
				NpgsqlDataSource dataSource = new NpgsqlDataSourceBuilder(postgresConnectionString)
					.MapEnum<DocumentStatus>("document_status")
					.Build();

				services.AddPooledDbContextFactory<DocumentPersistence>(opts =>
					opts.UseNpgsql(dataSource));


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +70 to 75
using MinioClient minioClient = new();
minioClient
.WithEndpoint(minioEndpoint)
.WithCredentials(_minio.GetAccessKey(), _minio.GetSecretKey())
.Build();

await minioClient.MakeBucketAsync(new MakeBucketArgs().WithBucket(_bucketName));
Comment on lines +107 to 112
using MinioClient minioClient = new();
minioClient
.WithEndpoint(minioEndpoint)
.WithCredentials(_minio.GetAccessKey(), _minio.GetSecretKey())
.Build();
await minioClient.MakeBucketAsync(new MakeBucketArgs().WithBucket(_bucketName));
@ANcpLua ANcpLua merged commit b5132a2 into main May 13, 2026
6 checks passed
@ANcpLua ANcpLua deleted the chore/bump-sdk-3.4.29-shrink-warnings-carveout branch May 13, 2026 09:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants