Skip to content

feat(sources): Reproducible Golang Vendor Packaging - #424

Open
Antonio Salinas (Tonisal-byte) wants to merge 18 commits into
mainfrom
tonisal-byte-special-lamp
Open

Antonio Salinas (Tonisal-byte) wants to merge 18 commits into
mainfrom
tonisal-byte-special-lamp

Conversation

@Tonisal-byte

@Tonisal-byte Antonio Salinas (Tonisal-byte) commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

Summary

origin.type = "go-vendor" generates a Go dependency archive from patched sources in mock without rewriting the published spec. filename is required: TOML names the generated artifact; azldev never infers its name from an upstream Source. The spec or its overlays must consume that filename. A collision with an upstream sources entry is an error unless replacement is explicitly declared.

Configuration

Containerd 2.3.5 deliberately replaces its existing vendor archive:

[[components.containerd.source-files]]
filename = "containerd-2.3.5-vendor-modified-azl4.tar.bz2"
origin.type = "go-vendor"
hash-type = "SHA512"
hash = "b3e40af18e08ce2d60ddaec531d5cd56cb98b07c40fc852b1cf0e1fca067c3d8d77bf2a61f6c97398f1121f146aa3100db3bcad311aff6bff1723ff00edd9e4c"

For a new archive, choose a distinct basename and omit both replacement fields. prepare-sources and builds generate and verify the archive. To bootstrap the digest, run prepare-sources without hash, review the result, then pin its hash-type and hash in TOML. render and render --check-only write that filename and pin to sources without generating or downloading the archive.

Vendor settings are optional and independent of the filename. By default, generation reuses the upstream vendor config when available, otherwise tool defaults. Set origin.config-file = "vendor-tools.toml" to use a declaration-relative native TOML file instead. It replaces upstream settings for generation only; it does not publish a new config or change which file the RPM uses for licensing. A checksum inside a native license entry identifies the license text, not the tarball.

Preserve upstream packaging while converting supported Go application specs and generating vendor archives from prepared sources. Wire configuration, history, documentation, and regression coverage across preparation, builds, rendering, and source diffs.

Validation: ./magefile.go check all passed, including Python lint and type checks. Build and unit phases passed. Full ./magefile.go all was attempted via Podman, but Docker-oriented scenario file-mount and network-isolation expectations fail in this environment; Docker WSL integration is unavailable.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Preserve upstream Source entries, tool configuration, and reviewed licenses when regenerating already-vendored packages.

Use a common spec plan and reusable Go-only generation backend. Keep command construction in Go, automatically clone component configuration while retaining shared back-references, and exclude payloads from rendered specs. Add regression coverage and document both workflows.

Validation: unit tests, build, and all quality checks passed. All ten prepared containerd files are byte-for-byte identical to the pre-refactor baseline. Full Mage scenarios remain blocked by Docker provider initialization in this WSL environment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the inline tool-config option with config-file, resolved relative to its declaring component configuration. Explicit files replace upstream settings, including empty files, and missing or invalid files fail without fallback.

Hash file contents rather than checkout paths for lock fingerprints and lock-free change detection. Preserve upstream settings when no file is selected, and update the schema, documentation, emitted guidance, and regression coverage.

Validation: unit tests and all quality checks passed. The changed-code mutation audit killed all 16 mutations. Containerd source generation with a separate vendor config reproduced the prior outputs, and a file-only edit invalidated its isolated lock fingerprint. Docker scenario initialization remains unavailable in this environment.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 20:11

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.

Comment thread internal/govendor/generate.go Resolved
Comment thread internal/rpm/spec/govendor.go Resolved
Comment thread internal/rpm/spec/govendor_existing.go Resolved
Comment thread internal/rpm/spec/govendor.go Resolved
Comment thread internal/rpm/spec/govendor_existing.go Resolved
Comment thread internal/rpm/spec/govendor_existing.go Resolved
Comment thread internal/govendor/generate.go Resolved
Address the eight unique findings in PR #424: reject source-file collisions, pin expanded archive names, snapshot regular chroot outputs without following symlinks, preserve module-aware checks, extract generated metadata after prep edits, reject ambiguous extraction layouts, honor native module subdirectories, and run archive hooks from staged dist-git.

Add regression coverage and update user documentation and emitted agent guidance. Unit and quality checks pass; changed-code mutation audit kills all 37 mutations. The containerd update/prepare/render/build flow and isolated RPM daemon smoke test pass, including staged-sidecar hook checks.

Ran ./magefile.go scenarioUpdate before pushing; the schema snapshot is current. Full Docker-dependent scenarios remain blocked by the unavailable Docker provider.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 20: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.

🟡 Changes recommended

Critical defects can break history-dependent rpmautospec processing, misplace module-specific vendor and license paths, and leave replacement configurations with stale manifest checksums and subject to deletion during rendering.

3 open issues
16 resolved since last review

Review effort: Balanced

Comment thread internal/govendor/generate.go Resolved
Comment thread internal/rpm/spec/govendor.go Resolved
The Go vendor configuration intentionally extends the schema, but scenarioUpdate refreshed only the local baseline when Docker was unavailable. CI reached the container schema check and failed on the missing 37 lines.

Update the container baseline to match the actual generated CLI schema and document that incomplete Docker runs can leave this second snapshot stale. Both stdout snapshots and the checked-in schema match the rebuilt CLI output byte-for-byte. Local scenario/scenarioUpdate runs remain blocked by the unavailable Docker provider.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 2, 2026 21:26

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.

🟡 Changes recommended

Critical issues in module-directory handling, shared configuration isolation, and Git-history preservation can break RPM builds, leak settings between components, and fail preparation for automatic-release specs.

4 open issues

Review effort: Balanced

Comment thread internal/projectconfig/component.go Resolved
@Tonisal-byte
Antonio Salinas (Tonisal-byte) marked this pull request as ready for review November 2, 2026 23:10

@reubeno reuben olinsky (reubeno) left a comment

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.

(Antonio Salinas (@Tonisal-byte) and I are chatting offline around the interface here.)

The Go vendor configuration intentionally extends the schema, but scenarioUpdate refreshed only the local baseline when Docker was unavailable. CI reached the container schema check and failed on the missing 37 lines.

Update the container baseline to match the actual generated CLI schema and document that incomplete Docker runs can leave this second snapshot stale. Both stdout snapshots and the checked-in schema match the rebuilt CLI output byte-for-byte. Local scenario/scenarioUpdate runs remain blocked by the unavailable Docker provider.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Add the go-vendor source origin with automatic vendor Source discovery, optional explicit filenames and expected hashes, declaration-relative native settings, and isolated generation after overlays. Keep generated output identity out of declarative fingerprints and reuse manifest replacement and render filtering.

Prepare only a private spec copy to avoid consuming the archive being generated. Do not convert published packaging, rewrite licenses, remove dependencies, or add offline build settings. Support local and upstream inputs with private rpmautospec history and reject ambiguous prep layouts.

Validated mage scenarioUpdate, mage all, mage check all, and targeted regression/mutation tests. A real mock-based fixture generated explicit and discovered archives, built and ran its offline RPM, rendered idempotently without the vendor payload, and rejected stale output hashes before publication.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Replace the earlier implementation with the source-files design on this PR, retaining the design history and avoiding automatic changes to published specs.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 00:40

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.

🟡 Changes recommended

Unresolved critical issues can make regenerated sources unavailable to downstream builds, redirect cleanup into shared build roots, and replace the wrong archive when extraction commands are macro-wrapped.

3 open issues
4 resolved since last review

Review effort: Balanced

Comment thread internal/govendor/generate.go Resolved
Comment thread internal/rpm/spec/vendorprep.go Resolved
Use the existing batched RPM metadata to resolve the selected Source. Generation remains part of prepare and build; require a reviewed digest for render rather than downloading sources and starting a private vendor root.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 01:17
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🟡 Changes recommended

Critical issues remain: inherited vendor sources can bypass validation and omit a pin, while root-location overrides can cause generation to initialize and scrub the normal build root instead of its private scratch root.

3 open issues
1 resolved since last review

Review effort: Balanced

Comment thread internal/projectconfig/configfile.go Resolved
Copilot AI balanced review requested due to automatic review settings November 25, 2026 01:25
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

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.

🔵 Needs a closer look

Vendor-source validation occurs before inherited defaults are merged, allowing multiple effective sources that preparation generates but rendering silently ignores after the first.

No open issues 🎉

3 resolved since last review

Review effort: Balanced

Copilot AI balanced review requested due to automatic review settings November 25, 2026 01:30

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.

🔵 Needs a closer look

Human assessment is needed because a critical bypass involving locally redefined prep macros can overwrite an assets archive with vendor data while preparation still consumes the original vendor input.

No open issues 🎉

Review effort: Balanced

Use the declared basename for generation and manifest rendering. Require explicit replacement of an existing upstream entry and retain upstream native config selection independently of the archive name.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 25, 2026 19:33

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.

🟡 Changes recommended

Vendor Source validation can pass before a synthetic-history Release bump, leaving the published spec referencing a nonexistent archive despite successful preparation.

1 open issue

Review effort: Balanced

Comment on lines +341 to +342
if p.generatesVendor(vendor) {
component, err = p.prepareVendorSources(ctx, component, outputDir)
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.

3 participants