Skip to content

feat: perform partial zip reads for extracting version and release date#472

Merged
majd merged 1 commit intomainfrom
feature/partial_zip_reads
May 2, 2026
Merged

feat: perform partial zip reads for extracting version and release date#472
majd merged 1 commit intomainfrom
feature/partial_zip_reads

Conversation

@majd
Copy link
Copy Markdown
Owner

@majd majd commented May 2, 2026

This pull request refactors how version metadata (specifically, display version and release date) is extracted from App Store IPA files. Instead of relying on metadata from the download API response, it now reads this information directly from the IPA's embedded Info.plist using partial HTTP range requests, improving accuracy and robustness. Comprehensive tests are added to verify the new extraction logic and its efficiency.

Key changes:

Core logic update:

  • Refactored GetVersionMetadata in appstore_get_version_metadata.go to extract version information by downloading and parsing the IPA's Info.plist, using the new readVersionMetadataFromIPA method, rather than trusting the API's metadata fields.

New implementation for partial ZIP reading:

  • Added appstore_partial_zip.go which implements a partial ZIP reader that fetches only necessary parts of the IPA file over HTTP, efficiently extracting DisplayVersion and ReleaseDate from Info.plist. It handles various date formats and fallback logic.

Testing improvements:

  • Added extensive tests in appstore_get_version_metadata_test.go:
    • Utility functions for generating test IPA files and serving them over HTTP with range support.
    • Tests for error handling (e.g., invalid release date), ensuring the new code path is exercised. [1] [2]
    • Tests for successful metadata extraction, including checks that only part of the IPA is downloaded (verifying efficiency). [1] [2] [3] [4]

Dependency injection:

  • Updated test setup to ensure the httpClient is properly initialized for use by the new partial ZIP logic.

Summary by cubic

Read version metadata directly from the remote IPA using HTTP Range requests to partially read the ZIP. Avoids full downloads and surfaces errors instead of falling back to API metadata.

  • New Features
    • Added httpRangeReaderAt to read ZIP segments via Range requests and detect file size from Content-Range.
    • Extracts from Info.plist using CFBundleShortVersionString/bundleShortVersionString and releaseDate variants; supports strings, numbers, and time.Time, trims whitespace, and falls back to the file’s modified time.
    • Updated GetVersionMetadata to always use IPA-derived metadata (no fallback to item.Metadata); errors are returned if IPA parsing fails.
    • Tests use a fake HTTP server to confirm partial reads only (no full GET) and minimal transferred bytes, with cases for invalid dates and unreadable IPAs, leveraging howett.net/plist.

Written for commit 4c1cb7a. Summary will update on new commits.

Closes #471.

Copilot AI review requested due to automatic review settings May 2, 2026 07:56
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

Adds a partial ZIP reader to extract version/release-date from an IPA via HTTP range requests, and updates GetVersionMetadata to use the IPA’s Info.plist rather than relying on response metadata.

Changes:

  • Introduces an HTTP io.ReaderAt implementation backed by Range requests and uses it with zip.NewReader to locate/read Payload/*.app/Info.plist.
  • Updates GetVersionMetadata to read display version + release date from the IPA instead of item.Metadata.
  • Expands tests with a range-capable httptest server to validate partial reads (no full GET) and error handling.

Reviewed changes

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

File Description
pkg/appstore/appstore_partial_zip.go Implements partial ZIP reading over HTTP ranges and parses version metadata from Info.plist.
pkg/appstore/appstore_get_version_metadata.go Switches GetVersionMetadata to extract metadata from the IPA URL.
pkg/appstore/appstore_get_version_metadata_test.go Adds range-server helpers and updates assertions to validate partial reads and new parsing behavior.

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

Comment thread pkg/appstore/appstore_partial_zip.go
Comment thread pkg/appstore/appstore_get_version_metadata.go Outdated
Comment thread pkg/appstore/appstore_partial_zip.go
@majd majd force-pushed the feature/partial_zip_reads branch from f60eb12 to 4c1cb7a Compare May 2, 2026 10:01
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 3 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Requires human review: Refactors core version extraction logic using new partial ZIP reading over HTTP. This is a significant logic change in a core path and requires human validation.

@majd majd changed the title feat: perform partial zip reads for extract version and release date feat: perform partial zip reads for extracting version and release date May 2, 2026
@majd majd merged commit abaecce into main May 2, 2026
14 checks passed
@majd majd deleted the feature/partial_zip_reads branch May 2, 2026 10:11
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.

Is it possible to get the version release date?

2 participants