Skip to content

feat(sdk): adopt ANcpLua.NET.Sdk 3.4.27 across .NET projects#10

Merged
ANcpLua merged 1 commit into
mainfrom
feat/ancplua-net-sdk-adoption
May 12, 2026
Merged

feat(sdk): adopt ANcpLua.NET.Sdk 3.4.27 across .NET projects#10
ANcpLua merged 1 commit into
mainfrom
feat/ancplua-net-sdk-adoption

Conversation

@ANcpLua
Copy link
Copy Markdown
Owner

@ANcpLua ANcpLua commented May 12, 2026

Summary

  • Wire each .NET project to the appropriate ANcpLua.NET.Sdk flavor (3.4.27) via global.json's msbuild-sdks block; mirrors qyl's setup. Strict SDK defaults (AnalysisLevel=latest-all, Features=strict, NuGet audit, CPVM with transitive pinning, 9 auto-injected .editorconfig analyzer configs, banned-symbols, deterministic + embedded source link, CI/Release TreatWarningsAsErrors).
  • JS esproj projects opt into Debug build via <Build Solution="Debug|*"/> and bump Microsoft.VisualStudio.JavaScript.Sdk to 1.0.5483906; ShouldRunNpmInstall=false keeps dotnet build inert for them so pnpm-lock.yaml is preserved (frontends still build via their own pnpm CI jobs per CLAUDE.md).
  • Security pins: NuGet.Packaging 7.3.1 + System.Security.Cryptography.Xml 10.0.7 close GHSA-g4vj-cjjj-v7hg, GHSA-37gx-xxp4-5rgx, GHSA-w3x6-4m5h-cxqf transitive through Nuke.Common.
  • Fix the bug-class warnings surfaced by latest-all that can't be safely deferred (xUnit1051 cancellation tokens, CS1573 XML doc, IDE1006/IDE0370/IDE0052 in production). Migration-style warnings (AL0025/AL0026/AL0039/RS0030/CA2000/CA1034 etc., 371 mostly-test sites) are carved out of TreatWarningsAsErrors via WarningsNotAsErrors at Directory.Build.props, scheduled for follow-up cleanup PRs.

Project SDK mapping

Project Old SDK New SDK
Paperless.Contracts Microsoft.NET.Sdk ANcpLua.NET.Sdk
PaperlessREST Microsoft.NET.Sdk.Web ANcpLua.NET.Sdk.Web
PaperlessServices Microsoft.NET.Sdk.Worker ANcpLua.NET.Sdk (+ explicit OutputType=Exe + Microsoft.Extensions.* usings)
PaperlessREST.Tests Microsoft.NET.Sdk.Web ANcpLua.NET.Sdk.Web + IsTestProject=true (WAF needs Web SDK)
PaperlessServices.Tests Microsoft.NET.Sdk ANcpLua.NET.Sdk.Test
PaperlessUI.Blazor Microsoft.NET.Sdk.Web ANcpLua.NET.Sdk.Web
Pipeline/Build.csproj Microsoft.NET.Sdk unchanged — NUKE bootstrap is intentionally self-contained, opts out of root CPVM

Test plan

  • dotnet build Paperless.slnx -c Debug — 0 errors
  • dotnet build Paperless.slnx -c Release -p:ContinuousIntegrationBuild=true — 0 errors, 371 deferred-style warnings
  • ./build.sh Compile — Restore + Compile succeed
  • ./build.sh UnitTests — both test DLLs pass (0 failed, 0 skipped)
  • ./build.sh IntegrationTests — needs container stack; run in CI
  • CI green on push

Follow-up PRs

Follow-up cleanup PRs (one analyzer family per PR) will lift the carve-outs in Directory.Build.props:WarningsNotAsErrors once each rule reaches zero sites:

  1. ANcpLua.Analyzers tests (AL0025/AL0026/AL0039/AL0070/AL0081/AL0101/AL0114/AL0137)
  2. BannedSymbols / TimeProvider migration (RS0030, AL0026 in production)
  3. CA bug-class roundup (CA1002/CA1032/CA1034/CA1052/CA1056/CA1307/CA1725/CA1819/CA1822/CA1823/CA1852/CA1859/CA2000/CA2012/CA2201/CA5394)
  4. IDE naming + dead-code cleanup (IDE0370, IDE1006)

🤖 Generated with Claude Code

Wire each .NET project to the appropriate ANcpLua.NET.Sdk flavor (3.4.27)
through global.json's msbuild-sdks block, mirroring qyl's setup:

- Paperless.Contracts → ANcpLua.NET.Sdk (library)
- PaperlessREST, PaperlessUI.Blazor → ANcpLua.NET.Sdk.Web
- PaperlessServices → ANcpLua.NET.Sdk (worker; UseMicrosoftTestingPlatform=false,
  explicit OutputType=Exe + M.E.X usings replace Microsoft.NET.Sdk.Worker's
  implicit defaults)
- PaperlessREST.Tests → ANcpLua.NET.Sdk.Web + IsTestProject=true
  (WebApplicationFactory needs Web SDK; IsTestProject opts in Tests.targets)
- PaperlessServices.Tests → ANcpLua.NET.Sdk.Test
- Pipeline/Build.csproj stays on Microsoft.NET.Sdk by design (NUKE bootstrap
  self-contained, opts out of root CPVM)

What the SDK brings (Common.props):
  AnalysisLevel=latest-all, EnforceCodeStyleInBuild, Features=strict,
  Deterministic, embedded source link, CentralPackageTransitivePinningEnabled,
  NuGetAudit=all+low, TreatWarningsAsErrors in CI/Release, and 9 auto-injected
  editorconfigs (Global, CodingStyle, Compiler, GeneratedFiles, NamingConvention,
  per-analyzer for NetAnalyzers/BannedApiAnalyzers/xunit/AwesomeAssertions/ANcpLua).
Test projects also auto-receive AwesomeAssertions + xunit.v3.mtp-v2.

JS frontends opt into the Debug solution config via <Build Solution="Debug|*"/>
in Paperless.slnx and bump Microsoft.VisualStudio.JavaScript.Sdk to 1.0.5483906
(latest on nuget.org); <ShouldRunNpmInstall>false</ShouldRunNpmInstall> keeps
dotnet build inert for them so pnpm-lock.yaml is preserved (CI builds them via
their own pnpm jobs per CLAUDE.md).

Security: pin NuGet.Packaging 7.3.1 and System.Security.Cryptography.Xml 10.0.7
directly on Pipeline/Build.csproj (closes GHSA-g4vj-cjjj-v7hg,
GHSA-37gx-xxp4-5rgx, GHSA-w3x6-4m5h-cxqf transitive through Nuke.Common); the
same pins live in Directory.Packages.props so Paperless projects under CPVM
get them via transitive pinning.

Genuine bugs surfaced by latest-all are fixed in-tree:
  - xUnit1051: cancellation tokens threaded through Task.Delay calls in
    DocumentRepositoryIntegrationTests + ErrorOr<>.UploadDocumentAsync calls
    in DocumentServiceErrorMappingTests
  - CS1573: Document.CreateFromUpload XML doc gains <param name="timeProvider">
  - IDE0052 + IDE1006: unused TypedResults.NotFound()/NoContent() statics in
    TypedErrorOrAsyncExtensions inlined at use sites
  - IDE1006: ReportProcessor.Serializer renamed to s_serializer; SInitLock /
    SInitializedIndices renamed to s_initLock / s_initializedIndices in
    SearchIndexService
  - IDE0370: unneeded null-forgiving operators dropped on DocumentService
    TryMapStorageException return and ServiceCollectionExtensions.AddPostgres
    connection string

Style/migration warnings (AL0025/AL0026/AL0039/RS0030 BannedSymbols, CA2000,
CA1034, etc. — 371 sites mostly in test code) are surfaced as warnings but
carved out of TreatWarningsAsErrors at Directory.Build.props via
WarningsNotAsErrors, scheduled for follow-up cleanup PRs per qyl's pattern.

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

coderabbitai Bot commented May 12, 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: 6bd8b96a-295c-46dc-98e2-ad77db62d249

📥 Commits

Reviewing files that changed from the base of the PR and between 771910e and c624e76.

⛔ Files ignored due to path filters (20)
  • .nuke/build.schema.json is excluded by none and included by none
  • Paperless.Contracts/Paperless.Contracts.csproj is excluded by none and included by none
  • Paperless.slnx is excluded by none and included by none
  • PaperlessREST.Tests/Integration/DocumentRepositoryIntegrationTests.cs is excluded by none and included by none
  • PaperlessREST.Tests/PaperlessREST.Tests.csproj is excluded by none and included by none
  • PaperlessREST.Tests/Unit/DocumentServiceErrorMappingTests.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/Application/Document.cs is excluded by none and included by none
  • PaperlessREST/Features/DocumentManagement/Application/DocumentService.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
  • PaperlessREST/PaperlessREST.csproj is excluded by none and included by none
  • PaperlessServices.Tests/PaperlessServices.Tests.csproj is excluded by none and included by none
  • PaperlessServices/Features/OcrProcessing/Infrastructure/Search/SearchIndexService.cs is excluded by none and included by none
  • PaperlessServices/PaperlessServices.csproj is excluded by none and included by none
  • PaperlessUI.Angular/PaperlessUI.Angular.esproj is excluded by none and included by none
  • PaperlessUI.Blazor/PaperlessUI.Blazor.csproj is excluded by none and included by none
  • PaperlessUI.React/PaperlessUI.React.esproj is excluded by none and included by none
  • Pipeline/Build.csproj is excluded by none and included by none
  • global.json is excluded by none and included by none
📒 Files selected for processing (2)
  • Directory.Build.props
  • Directory.Packages.props
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (1)
**/*.props

⚙️ CodeRabbit configuration file

MSBuild property files (Directory.Build.props, Directory.Packages.props, Version.props). Review for: Central Package Management correctness, version consistency, and that new packages are added with explicit version pins. Flag transitive dependency promotions that aren't justified. Verify TFM targeting is correct (.NET 10).

Files:

  • Directory.Packages.props
  • Directory.Build.props
🔇 Additional comments (3)
Directory.Build.props (1)

3-15: Temporäre Suppression ist akzeptabel, aber Priorisierung beachten.

Die Struktur ist korrekt – $(WarningsNotAsErrors); bewahrt bestehende Werte. Allerdings: CA5394 (kryptographisch unsicheres Random) und CA2000 (Ressourcen-Leaks) sind sicherheitsrelevant und sollten in den Follow-up PRs priorisiert werden.

Directory.Packages.props (2)

7-9: Korrekte Aktivierung von Transitive Pinning.

Das ermöglicht die Propagierung der Security-Pins in transitive Dependencies. Notwendig für die GHSA-Fixes weiter unten.


78-83: ⚡ Quick win

Security-Pins korrekt gepinnt.

NuGet.Packaging 7.3.1 adressiert GHSA-g4vj-cjjj-v7hg (vulnerable: 7.3.0, patched: 7.3.1). System.Security.Cryptography.Xml 10.0.7 adressiert GHSA-37gx-xxp4-5rgx und GHSA-w3x6-4m5h-cxqf (beide patched in 10.0.6). Die Dokumentation ist präzise und die Versionen sind gerechtfertigt.


Summary by CodeRabbit

Verbesserungen

  • Chores
    • Build-Konfiguration optimiert: Verbesserte Handhabung von Compilerwarnungen durch gezielt konfigurierte Ausnahmen für spezifische Analyseregeln und Warnmeldungen in den Continuous-Integration- und Release-Prozessen für bessere Kontrolle und Transparenz.
    • Abhängigkeitsverwaltung aktualisiert: Zentrale Verwaltung transitiver Abhängigkeitsversionen ist nun aktiviert. Sicherheitskritische Pakete wurden auf aktuelle sichere Versionen aktualisiert zur Gewährleistung hoher Sicherheitsstandards.

Walkthrough

Die Pull-Request aktualisiert zwei zentrale Konfigurationsdateien: Directory.Build.props entfernt die globale TestingPlatformDotnetTestSupport-Eigenschaft und definiert stattdessen WarningsNotAsErrors mit spezifischen Regel-IDs. Directory.Packages.props aktiviert zentrale transitive Versionsverwaltung, entfernt AwesomeAssertions-Einträge und fügt Sicherheitsüberschreibungen für NuGet.Packaging und System.Security.Cryptography.Xml hinzu.

Changes

Build- und Warnkonfiguration

Layer / File(s) Summary
Behandlung von Compiler-Warnungen
Directory.Build.props
TestingPlatformDotnetTestSupport wird entfernt und durch WarningsNotAsErrors ersetzt, das explizit aufgelistete Regel-IDs aus der Fehlerbehandlung ausnimmt; dies priorisiert kritische Verstöße für CI/Release-Builds.

Zentrale Paketverwaltung und Abhängigkeitsversionen

Layer / File(s) Summary
Transitive Versionsverwaltung aktivieren
Directory.Packages.props
CentralPackageTransitivePinningEnabled wird aktiviert, um zentrale Versionen auf transitive Abhängigkeiten auszuweiten; AwesomeAssertions-Einträge werden entfernt (Versionen kommen aus ANcpLua.NET.Sdk.Test).
Sicherheitsüberschreibungen für bekannte Schwachstellen
Directory.Packages.props
Explizite Versionen für NuGet.Packaging (7.3.1) und System.Security.Cryptography.Xml (10.0.7) werden als transitive Sicherheitsüberschreibungen hinzugefügt.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

  • ANcpLua/Paperless#2: Beide PRs ändern Directory.Packages.props und zentrale Paketversionierung durch PackageVersion-Einträge und Verwaltungsfeatures.

Suggested labels

area:infra

🚥 Pre-merge checks | ✅ 6 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Otel Instrumentation Required ⚠️ Warning PR registers 14+ new injectable services without ActivitySource/Meter instrumentation (DocumentService, OcrProcessor, OcrWorker, BatchOrchestrator, SearchIndexService, StorageService). Add ActivitySource/Meter to services or document exemption from OTel tracing/metrics.
Cancellationtoken Threading ⚠️ Warning Die öffentliche async-Methode ExtractTextAsync in IPdfExtractor/CreatePdfExtractor hat keinen CancellationToken-Parameter. Alle anderen geprüften async-Methoden haben korrekt CancellationToken. Füge CancellationToken-Parameter zu IPdfExtractor.ExtractTextAsync und CreatePdfExtractor.ExtractTextAsync hinzu und leite den Token an Pdf.Load().OcrAsync() weiter, falls unterstützt.
✅ Passed checks (6 passed)
Check name Status Explanation
Title check ✅ Passed Der PR-Titel folgt dem Conventional-Commits-Format (feat mit sdk-Scope), ist aussagekräftig und unter 72 Zeichen.
Description check ✅ Passed Die Beschreibung ist detailliert, umfasst SDK-Migration, Sicherheits-Pins, Test-Plan und Follow-up-Roadmap.
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.
No Unbounded Mcp Responses ✅ Passed No MCP tool definitions under src/qyl.mcp/ were added or modified. Changes are exclusively SDK configuration and application code.
Duckdb Backpressure On Write Paths ✅ Passed PR änders nur Konfigurationsdateien. Keine neuen DuckDB-Schreibpfade oder Datenbankoperationen. Keine DuckDB-Referenzen im Projekt.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


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 migrates the repository’s .NET projects to the ANcpLua.NET.Sdk (v3.4.27) via global.json SDK mapping, aligns solution/build behavior for JS .esproj projects, and applies security-related dependency pins plus analyzer/warning policy adjustments to keep CI builds unblocked.

Changes:

  • Adopt ANcpLua.NET.Sdk / .Web / .Test across projects via global.json msbuild-sdks, with corresponding csproj updates.
  • Update JS SDK version for .esproj projects and prevent dotnet build from running npm install; restrict solution builds for JS projects to Debug.
  • Add transitive security pins and carve out selected analyzer IDs from warnings-as-errors via Directory.Build.props.

Reviewed changes

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

Show a summary per file
File Description
Pipeline/Build.csproj Adds explicit security override package references for the NUKE toolchain.
PaperlessUI.React/PaperlessUI.React.esproj Bumps JavaScript SDK version; disables npm install during build.
PaperlessUI.Blazor/PaperlessUI.Blazor.csproj Switches to ANcpLua.NET.Sdk.Web; adjusts packability settings.
PaperlessUI.Angular/PaperlessUI.Angular.esproj Bumps JavaScript SDK version; disables npm install during build.
PaperlessServices/PaperlessServices.csproj Switches SDK; sets OutputType and restores worker implicit usings explicitly.
PaperlessServices/Features/OcrProcessing/Infrastructure/Search/SearchIndexService.cs Renames static fields to comply with analyzers/naming rules.
PaperlessServices.Tests/PaperlessServices.Tests.csproj Switches to test SDK and relies on SDK-injected test dependencies; enables MTP usage.
PaperlessREST/PaperlessREST.csproj Switches to ANcpLua.NET.Sdk.Web; removes now-SDK-provided properties; sets packability.
PaperlessREST/Host/Extensions/TypedErrorOrAsyncExtensions.cs Removes cached typed-result instances and constructs typed results inline.
PaperlessREST/Host/Extensions/ServiceCollectionExtensions.cs Adjusts Postgres data source construction (now without null-forgiving operator).
PaperlessREST/Features/DocumentManagement/Application/DocumentService.cs Removes null-forgiving default branch in storage exception mapping.
PaperlessREST/Features/DocumentManagement/Application/Document.cs Updates XML docs to include timeProvider parameter.
PaperlessREST/Features/BatchProcessing/Application/ReportProcessor.cs Renames static serializer field to match naming rules.
PaperlessREST.Tests/Unit/DocumentServiceErrorMappingTests.cs Passes test cancellation tokens to UploadDocumentAsync.
PaperlessREST.Tests/PaperlessREST.Tests.csproj Switches to ANcpLua.NET.Sdk.Web and opts into test targets via IsTestProject.
PaperlessREST.Tests/Integration/DocumentRepositoryIntegrationTests.cs Adds cancellation tokens to Task.Delay calls.
Paperless.slnx Restricts JS .esproj projects to build only under Debug configurations.
Paperless.Contracts/Paperless.Contracts.csproj Switches to ANcpLua.NET.Sdk.
global.json Adds msbuild-sdks mapping for ANcpLua.NET.Sdk* v3.4.27.
Directory.Packages.props Enables transitive central pinning and adds security pin versions; removes central AA versions.
Directory.Build.props Adds WarningsNotAsErrors carve-outs for deferred analyzer cleanup.
.nuke/build.schema.json Adds Verify target to NUKE schema enum list.

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

private IServiceCollection AddPostgres(IConfiguration config)
{
NpgsqlDataSource dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("PaperlessDb")!)
NpgsqlDataSource dataSource = new NpgsqlDataSourceBuilder(config.GetConnectionString("PaperlessDb"))
Comment thread Directory.Packages.props
Comment on lines +7 to +8
<!-- Apply central versions to transitive deps too, so the GHSA pins below propagate
into Pipeline (which still runs on Microsoft.NET.Sdk for NUKE compatibility). -->
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