Background
ZipEntryInfo is a ZIP-format-specific struct that should not be part of the public API surface of Infrastructure.Archives.Zip. The multi-format architecture (ZIP + RAR + future formats) exposes format-agnostic interfaces (IArchiveStructureBuilder, IArchiveEntryExtractor, IPrefetchStrategy) through the Domain layer — format-specific types like ZipEntryInfo are implementation details.
Currently ZipEntryInfo is public, and it is embedded in the method signatures of IZipReader, ZipFormatMetadataStore, etc., which forces those types to also be public. None of these types are consumed outside the Infrastructure.Archives.Zip assembly (except via DI registration in Program.cs and integration tests).
Why
- Encapsulation: ZIP internals should not leak into the public API. Other assemblies should interact through Domain interfaces only.
- Freedom to change:
internal types can be refactored without breaking API contracts.
- Consistency: RAR provider types (
RarStructureBuilder, RarEntryExtractor) are already implementation details behind Domain interfaces.
Scope
The following types need to change from public to internal (cascading dependency chain):
| Type |
File |
Reason |
ZipEntryInfo |
ZipEntryInfo.cs |
Primary target — format-specific metadata struct |
IZipReader |
IZipReader.cs |
Method signature exposes ZipEntryInfo |
ZipReader |
ZipReader.cs |
Implements IZipReader |
IZipReaderFactory |
IZipReaderFactory.cs |
Returns IZipReader |
ZipReaderFactory |
ZipReaderFactory.cs |
Implements IZipReaderFactory |
ZipFormatMetadataStore |
ZipFormatMetadataStore.cs |
Methods expose ZipEntryInfo |
ZipEntryExtractor |
ZipEntryExtractor.cs |
Constructor takes IZipReaderFactory + ZipFormatMetadataStore |
ZipStructureBuilder |
ZipStructureBuilder.cs |
Constructor takes IZipReaderFactory + ZipFormatMetadataStore |
ZipPrefetchStrategy |
ZipPrefetchStrategy.cs |
Constructor takes ZipFormatMetadataStore |
How
- Change all 9 types from
public to internal
- Add
InternalsVisibleTo to ZipDrive.Infrastructure.Archives.Zip.csproj:
<InternalsVisibleTo Include="ZipDrive.Cli" />
<InternalsVisibleTo Include="ZipDrive.Infrastructure.Caching.Tests" />
(Already has entries for ZipDrive.Infrastructure.Caching and ZipDrive.Infrastructure.Archives.Zip.Tests)
- Verify:
dotnet build ZipDrive.slnx + dotnet test
- Optional follow-up: extract a
services.AddZipProvider() extension method to encapsulate DI registration, removing the need for InternalsVisibleTo on Cli
Risk
Low — pure visibility refactor, no behavioral change. All consumers are within the solution. InternalsVisibleTo ensures DI registration and tests continue to work.
Deferred from openspec task 11.1 (multi-format-archive-support) due to the cascade across 9 types + 4 InternalsVisibleTo entries.
Background
ZipEntryInfois a ZIP-format-specific struct that should not be part of the public API surface ofInfrastructure.Archives.Zip. The multi-format architecture (ZIP + RAR + future formats) exposes format-agnostic interfaces (IArchiveStructureBuilder,IArchiveEntryExtractor,IPrefetchStrategy) through the Domain layer — format-specific types likeZipEntryInfoare implementation details.Currently
ZipEntryInfoispublic, and it is embedded in the method signatures ofIZipReader,ZipFormatMetadataStore, etc., which forces those types to also bepublic. None of these types are consumed outside theInfrastructure.Archives.Zipassembly (except via DI registration inProgram.csand integration tests).Why
internaltypes can be refactored without breaking API contracts.RarStructureBuilder,RarEntryExtractor) are already implementation details behind Domain interfaces.Scope
The following types need to change from
publictointernal(cascading dependency chain):ZipEntryInfoZipEntryInfo.csIZipReaderIZipReader.csZipEntryInfoZipReaderZipReader.csIZipReaderIZipReaderFactoryIZipReaderFactory.csIZipReaderZipReaderFactoryZipReaderFactory.csIZipReaderFactoryZipFormatMetadataStoreZipFormatMetadataStore.csZipEntryInfoZipEntryExtractorZipEntryExtractor.csIZipReaderFactory+ZipFormatMetadataStoreZipStructureBuilderZipStructureBuilder.csIZipReaderFactory+ZipFormatMetadataStoreZipPrefetchStrategyZipPrefetchStrategy.csZipFormatMetadataStoreHow
publictointernalInternalsVisibleTotoZipDrive.Infrastructure.Archives.Zip.csproj:ZipDrive.Infrastructure.CachingandZipDrive.Infrastructure.Archives.Zip.Tests)dotnet build ZipDrive.slnx+dotnet testservices.AddZipProvider()extension method to encapsulate DI registration, removing the need forInternalsVisibleToonCliRisk
Low — pure visibility refactor, no behavioral change. All consumers are within the solution.
InternalsVisibleToensures DI registration and tests continue to work.Deferred from openspec task 11.1 (
multi-format-archive-support) due to the cascade across 9 types + 4InternalsVisibleToentries.