Skip to content

feat: add tarball overlays for source archive modification#224

Draft
Tonisal-byte wants to merge 5 commits into
microsoft:mainfrom
Tonisal-byte:asalinas/tarball-overlays
Draft

feat: add tarball overlays for source archive modification#224
Tonisal-byte wants to merge 5 commits into
microsoft:mainfrom
Tonisal-byte:asalinas/tarball-overlays

Conversation

@Tonisal-byte

Copy link
Copy Markdown
Contributor

Adds tarball overlay support for modifying source archives by applying file overlays during repack.

This is part 2 of 2 in the tarball overlay feature stack.

Stacked PR: This PR builds on #223. Please review and merge #223 first. Once #223 is merged, this PR's diff will shrink to only the overlay-specific changes.

Copilot AI review requested due to automatic review settings June 3, 2026 17:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds support for “tarball overlays” that modify files inside source tarballs (extract/modify/repack) and updates sources preparation to account for in-place tarball changes.

Changes:

  • Introduces a tarball utility package for compression detection, extraction, and deterministic repacking.
  • Adds new overlay types (tarball-file-remove, tarball-search-replace, tarball-patch) plus grouping/application logic in source prep.
  • Updates sources file update flow to rehash tarballs modified by overlays and extends docs/tests accordingly.

Reviewed changes

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

Show a summary per file
File Description
internal/utils/tarball/tarball.go Implements compression detection, extraction, and deterministic repacking.
internal/utils/tarball/tarball_test.go Adds tests for compression detection, extract-root resolution, and deterministic repack.
internal/projectconfig/overlay.go Adds tarball overlay types, validation, and ModifiesTarball().
internal/projectconfig/overlay_test.go Extends validation/modification classification tests for tarball overlays.
internal/app/azldev/core/sources/tarballoverlays.go Implements tarball overlay grouping, extract/modify/repack pipeline, and patch application.
internal/app/azldev/core/sources/tarballoverlays_internal_test.go Adds unit tests for grouping and tarball overlay operations.
internal/app/azldev/core/sources/sourceprep.go Applies tarball overlays first and rehashes modified tarballs when updating sources.
internal/app/azldev/core/sources/sourceprep_test.go Updates expected error text for sources parsing failures.
internal/app/azldev/cmds/component/preparesources.go Refactors option wiring into helper to reduce cyclomatic complexity.
docs/user/reference/config/overlays.md Documents new tarball overlays and related fields/behavior.

Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/app/azldev/core/sources/tarballoverlays.go Outdated
Comment thread docs/user/reference/config/overlays.md Outdated
Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/utils/tarball/tarball_test.go Outdated
Comment thread internal/app/azldev/core/sources/tarballoverlays_internal_test.go Outdated
Comment thread internal/projectconfig/overlay.go Outdated
Comment thread internal/utils/tarball/tarball.go Fixed
Comment thread internal/utils/tarball/tarball.go Fixed
Comment thread internal/utils/tarball/tarball.go Fixed
Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/utils/tarball/tarball.go Outdated
Comment thread internal/app/azldev/core/sources/tarballoverlays.go Outdated

// globFilesInDir finds files under root matching a glob pattern.
// Supports doublestar patterns (e.g., "**/*.md").
func globFilesInDir(root, pattern string) ([]string, error) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do we not already have helpers to do this?

Comment thread docs/user/reference/config/overlays.md Outdated
Comment thread docs/user/reference/config/overlays.md Outdated
Comment thread docs/user/reference/config/overlays.md Outdated
@Tonisal-byte Tonisal-byte force-pushed the asalinas/tarball-overlays branch from a495c4d to 3eb0c57 Compare June 3, 2026 20:12
@Tonisal-byte Tonisal-byte marked this pull request as draft June 3, 2026 20:14
@Tonisal-byte Tonisal-byte force-pushed the asalinas/tarball-overlays branch from 3eb0c57 to ad0e582 Compare June 8, 2026 23:36
Antonio Salinas added 3 commits June 9, 2026 16:31
Add three new overlay types (tarball-file-remove, tarball-search-replace,
tarball-patch) that modify files inside source tarballs during source
preparation. Operations are performed in pure Go on the host.

Includes:
- internal/utils/tarball: reusable deterministic tar extract/repack library
- Overlay type registration, validation, and fingerprinting
- Source prep integration with sources file hash rehashing
- User documentation and TOML examples
@Tonisal-byte Tonisal-byte force-pushed the asalinas/tarball-overlays branch from ad0e582 to 3a1883c Compare June 9, 2026 16:42
Copilot AI review requested due to automatic review settings June 9, 2026 16:42

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 12 out of 12 changed files in this pull request and generated 3 comments.

Comment thread internal/projectconfig/overlay.go Outdated
Comment thread internal/projectconfig/overlay.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go Outdated
@Tonisal-byte Tonisal-byte requested a review from Copilot June 10, 2026 17:58

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 12 out of 12 changed files in this pull request and generated 12 comments.

Comment thread internal/projectconfig/overlay.go
Comment thread internal/projectconfig/overlay.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go Outdated
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
Comment thread internal/app/azldev/core/sources/sourceprep.go
Comment thread internal/projectconfig/overlay_test.go Outdated
Comment thread internal/app/azldev/core/sources/sourceprep.go Outdated
Comment thread internal/app/azldev/core/sources/sourceprep.go
Comment thread internal/app/azldev/core/sources/sourceprep.go

### Archive Overlays

A `file-remove` or `file-search-replace` overlay can modify files **inside** a source archive

@PawelWMS PawelWMS Jun 10, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Does this support removing/editing files in nested archives? I'm thinking about cases where a.tar.gz contains a/internal/archive.tar.gz and you want to remove a.tar.gz/a/internal/archive.tar.gz/nested/dir/file-to-remove.txt.

If it doesn't, I don't think it's a P0 (I believe all 10 scripts can be replaced without the nested archives supported), but with the new archive field required for differentiating between "regular" files and archives, adding this extension in the future may be tricky.

Considering that, do you think it would be possible to use the file path alone to denote the file to be removed/edited and automatically detect, if a file on the path is a directory vs an archive as in the a.tar.gz/a/internal/archive.tar.gz/nested/dir/file-to-remove.txt example? Starting with this would give us support for nested archives in one go.

PS Cool idea with re-using existing overlays.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thanks! The idea was originally Reubens but I'm glad the implementation is sound. I think it would be better if we revisited this nested archive format in the future. I do agree it's important, but it might introduce complexity to the overlay application process

Comment thread docs/user/reference/config/overlays.md Outdated
Copilot AI review requested due to automatic review settings June 10, 2026 20:41
@Tonisal-byte Tonisal-byte force-pushed the asalinas/tarball-overlays branch from 0d6a73d to 073e58f Compare June 10, 2026 20:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 25 out of 25 changed files in this pull request and generated 7 comments.

Comment thread internal/projectconfig/overlay.go
Comment thread internal/projectconfig/overlay.go
Comment thread internal/projectconfig/overlay.go Outdated
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
Comment thread docs/user/reference/cli/azldev.md Outdated
@Tonisal-byte Tonisal-byte force-pushed the asalinas/tarball-overlays branch from 073e58f to 96d9a9c Compare June 10, 2026 21:30
Copilot AI review requested due to automatic review settings June 10, 2026 21:43

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 15 out of 15 changed files in this pull request and generated 7 comments.

Comment thread internal/projectconfig/overlay.go
Comment thread internal/projectconfig/overlay.go
Comment thread internal/app/azldev/core/sources/sourceprep.go Outdated
Comment thread internal/app/azldev/core/sources/sourceprep.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
Comment thread internal/app/azldev/core/sources/archiveoverlays.go
@Tonisal-byte Tonisal-byte force-pushed the asalinas/tarball-overlays branch from 0a60b3e to 2a8345b Compare June 10, 2026 22:09
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.

5 participants