Skip to content

fix(archive): sharpcompress 1.0 api-sprung fail-closed abfangen#104

Merged
tomtastisch merged 6 commits intomainfrom
codex/fix/sharpcompress-v1-api-compat
Feb 19, 2026
Merged

fix(archive): sharpcompress 1.0 api-sprung fail-closed abfangen#104
tomtastisch merged 6 commits intomainfrom
codex/fix/sharpcompress-v1-api-compat

Conversation

@tomtastisch
Copy link
Owner

@tomtastisch tomtastisch commented Feb 19, 2026

Ziel & Scope

Diese PR behebt den SharpCompress-API-Sprung bei Canary-Updates auf 1.0.0 und stellt sicher, dass sowohl Produktionscode als auch Test-Helfer gegen 0.46.x und 1.0.0 deterministisch kompatibel bleiben.

Umgesetzte Aufgaben (abhaken)

  • SharpCompress-Open-Aufrufe in der Produktions-Kompat-Schicht auf API-kompatible Reflection-Auflösung (OpenArchive/Open) umgestellt.
  • Testseitige Archive-Open-Aufrufe auf denselben Kompatibilitätsansatz migriert.
  • Testseitige Writer-Open-Aufrufe (OpenWriter/Open) kompatibel gemacht.
  • Lokale Canary-Verifikation für SharpCompress 1.0.0 erfolgreich ausgeführt.

Nachbesserungen aus Review (iterativ)

  • C#-Compile-Folgefehler (IArchiveEntry-Import) behoben.
  • Zusätzliche SharpCompress-Writer-Breaks (WriterFactory.OpenWriter) auf Kompat-Layer umgestellt.
  • Format-Gate (dotnet format --verify-no-changes) durch korrigierte using-Reihenfolge erfüllt.

Security- und Merge-Gates

  • Actions bleiben SHA-gepinnt; diese PR ändert keine Action-Pinnings.
  • Least-Privilege bleibt unverändert; keine neuen erhöhten Workflow-Rechte eingeführt.
  • Keine Secret-Werte werden geloggt; bestehende Guardrails bleiben unverändert.
  • Pflichtaussage: security/code-scanning/tools muss vor Merge auf 0 offene Alerts stehen.

Evidence (auditierbar)

  • dotnet format FileClassifier.sln --verify-no-changes -> erfolgreich
  • dotnet test tests/FileTypeDetectionLib.Tests/FileTypeDetectionLib.Tests.csproj -c Release -v minimal --filter "SharpCompress|ArchiveInternalsNestedBranchUnitTests|CoreAndArchiveInternalsFailClosedUnitTests|ArchiveSharpCompressCompatUnitTests" -> 35 passed
  • bash -euo pipefail tools/ci/bin/dependency-canary.sh SharpCompress 1.0.0 -> 35 passed (lokaler Canary-Nachweis)

DoD (mindestens 2 pro Punkt)

Umgesetzter Punkt DoD A (auditierbar) DoD B (auditierbar)
Produktions-Kompatibilität ArchiveInternals.vb nutzt keine statische Bindung mehr an nur OpenArchive Lokaler Canary-Lauf mit SharpCompress 1.0.0 erfolgreich
Test-Kompatibilität (Open) SharpCompressApiCompat.OpenArchive/OpenZipArchive vorhanden SharpCompress-Fokustestlauf grün
Test-Kompatibilität (Writer) SharpCompressApiCompat.OpenWriter vorhanden Betroffene Test-Helfer/Tests kompilieren und laufen unter 1.0.0
Fail-Closed-Verhalten Fehlende API führt deterministisch zu MissingMethodException statt stiller Fehlinterpretation Catch-/Guard-Pfade bleiben unverändert fail-closed

Copilot AI review requested due to automatic review settings February 19, 2026 19:41
@github-actions github-actions bot added area:tests feature New compatible feature or datatype versioning:minor New compatible functionality; requires MINOR bump impl:quality area:archive labels Feb 19, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4bd7f74a37

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Copy link
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

This PR addresses a breaking API change in SharpCompress when upgrading from version 0.46.x to 1.0.0. The changes implement a reflection-based compatibility layer that works with both API versions by dynamically resolving method names at runtime - trying the old method name first (OpenArchive/OpenWriter), then falling back to the new name (Open), and throwing MissingMethodException if neither exists.

Changes:

  • Created a new compatibility layer in production code (ArchiveInternals.vb) using reflection-based method resolution with explicit BindingFlags
  • Created a parallel test support compatibility class (SharpCompressApiCompat.cs) for test infrastructure
  • Migrated all direct SharpCompress API calls (both archive reading and writing) to use the compatibility layers
  • Enhanced exception handling to catch reflection-related exceptions (MissingMethodException, TargetInvocationException)

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/FileTypeDetection/Infrastructure/ArchiveInternals.vb Added reflection-based compatibility methods GetOpenCompatMethod, OpenArchiveFactoryCompat, and OpenGZipArchiveCompat with fail-closed exception handling
tests/FileTypeDetectionLib.Tests/Support/SharpCompressApiCompat.cs New test support class providing compatibility wrappers for OpenArchive, OpenZipArchive, and OpenWriter methods
tests/FileTypeDetectionLib.Tests/Support/ArchivePayloadFactory.cs Migrated all WriterFactory.OpenWriter calls to use SharpCompressApiCompat.OpenWriter
tests/FileTypeDetectionLib.Tests/Unit/SharpCompressArchiveBackendUnitTests.cs Updated test helper method to use compatibility layer for writer creation
tests/FileTypeDetectionLib.Tests/Unit/SharpCompressEntryModelNonNullUnitTests.cs Migrated archive/writer creation to compatibility layer, removed unused import
tests/FileTypeDetectionLib.Tests/Unit/CoreAndArchiveInternalsFailClosedUnitTests.cs Migrated archive opening to compatibility layer, removed unused imports
tests/FileTypeDetectionLib.Tests/Unit/ArchiveInternalsNestedBranchUnitTests.cs Migrated both archive opening and writer creation to compatibility layer, removed unused import

Copilot AI review requested due to automatic review settings February 19, 2026 19:56
Copy link
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

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

@tomtastisch tomtastisch enabled auto-merge (squash) February 19, 2026 20:09
@tomtastisch tomtastisch merged commit 40e2b86 into main Feb 19, 2026
26 checks passed
@tomtastisch tomtastisch deleted the codex/fix/sharpcompress-v1-api-compat branch February 19, 2026 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:archive area:tests feature New compatible feature or datatype impl:quality versioning:minor New compatible functionality; requires MINOR bump

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments