Skip to content

feat: Add zip-contains rule for asserting zip archive entry existence#47

Draft
Copilot wants to merge 3 commits into
mainfrom
copilot/add-zip-file-checking-rules
Draft

feat: Add zip-contains rule for asserting zip archive entry existence#47
Copilot wants to merge 3 commits into
mainfrom
copilot/add-zip-file-checking-rules

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 12, 2026

Pull Request

Description

Adds a zip-contains assertion rule enabling FileAssert to validate that zip archives (including .nupkg, .jar, etc.) contain expected entries, with optional min/max count constraints and glob pattern matching.

New rule: zip-contains

rules:
  - type: zip-contains
    entries:
      - pattern: 'lib/net8.0/MyLib.dll'
        min: 1
        max: 1
      - pattern: 'lib/**/*.dll'
        min: 1

Entry paths are normalized to forward slashes before matching; glob patterns are resolved via Microsoft.Extensions.FileSystemGlobbing (same mechanism as FileAssertFile). No new NuGet dependencies — uses System.IO.Compression from the BCL.

Changes

  • Modeling/FileAssertZipAssert.cs — new rule implementation; opens zip via ZipFile.OpenRead, collects all entry names, applies Matcher per pattern, enforces min/max
  • Configuration/FileAssertData.cs — new FileAssertZipEntryData and FileAssertZipData DTOs
  • Modeling/FileAssertRule.cs — registers "zip-contains" type
  • README.md — documents new rule with YAML examples
  • Documentation — design, requirements (reqstream), and verification docs added under docs/; introduction.md and .reviewmark.yaml updated to include the new unit

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code quality improvement

Related Issues

Closes #

Pre-Submission Checklist

Before submitting this pull request, ensure you have completed the following:

Build and Test

  • Code builds successfully and all tests pass: pwsh ./build.ps1
  • Code produces zero warnings

Code Quality

  • New code has appropriate XML documentation comments
  • Static analyzer warnings have been addressed

Quality Checks

  • All linters pass: pwsh ./lint.ps1

Testing

  • Added unit tests for new functionality
  • Updated existing tests if behavior changed
  • All tests follow the AAA (Arrange, Act, Assert) pattern
  • Test coverage is maintained or improved

Documentation

  • Updated README.md (if applicable)
  • Updated docs/ documentation (if applicable)
  • Added code examples for new features (if applicable)
  • Updated requirements.yaml (if applicable)

Additional Notes

zip-contains intentionally checks only entry existence. Recursive content inspection of zip entries (text/HTML/JSON/etc.) is explicitly deferred — it would require abstracting the file-system interface used by existing rules.

Copilot AI linked an issue May 12, 2026 that may be closed by this pull request
3 tasks
Copilot AI and others added 2 commits May 12, 2026 21:07
Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
…ME table alignment

Co-authored-by: Malcolmnixon <1863707+Malcolmnixon@users.noreply.github.com>
Copilot AI changed the title [WIP] Add zip contents checking rules using FileAssert feat: Add zip-contains rule for asserting zip archive entry existence May 12, 2026
Copilot AI requested a review from Malcolmnixon May 12, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Zip contents checking

2 participants