Allow packages without binaries or apps when they provide trigger actions or env vars - #598
Open
joahg wants to merge 2 commits into
Open
Allow packages without binaries or apps when they provide trigger actions or env vars#598joahg wants to merge 2 commits into
joahg wants to merge 2 commits into
Conversation
… env Hermit currently rejects any package manifest that does not declare at least one binary or app. This prevents composing content-only packages (e.g. a git-sourced payload that is materialised into the environment via "on unpack"/"on activate" actions) without adding a dummy no-op binary as a workaround. Relax the validation so a package with no binaries and no apps is still valid when it declares lifecycle triggers or environment variables. Manifests that provide none of these remain rejected with the existing ErrNoBinaries error. Buzz-Message: buzz://message?channel=573ff355-6c19-422d-b425-112853d0ec7e&id=16f5b666c0976829a1985868753407c7b20b393d89f99a8b39106be9fe6a1514 Amp-Thread-ID: https://ampcode.com/threads/T-019fce27-e59e-727c-b6d3-cdeeba894a4e Co-authored-by: Amp <amp@ampcode.com>
An empty trigger block such as 'on unpack {}' creates a trigger map
entry with no actions, so checking the number of trigger events alone
would accept packages that contribute nothing to the environment.
Count resolved trigger actions instead.
Buzz-Message: buzz://message?channel=573ff355-6c19-422d-b425-112853d0ec7e&id=37a4a83af83ddcf40f55a799a2d7e52e69f2908db5098993c82d4a96727015a6
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019fce44-560f-770d-bacb-fba12dd9ae31
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Context: #597 — composing agent-skills-style content packages from existing Hermit primitives.
Hermit currently rejects any package manifest that does not declare at least one binary or app. This prevents composing content-only packages (e.g. a git-sourced payload that is materialised into the environment via
on unpack/on activateactions) without adding a dummy no-op binary that pollutesbin/andPATH.This relaxes the validation so a package with no binaries and no apps is still valid when it declares at least one resolved lifecycle trigger action or environment variable. Empty trigger blocks such as
on unpack {}do not count, and manifests that provide none of these remain rejected with the existingErrNoBinarieserror.Tested with
go test ./...andgolangci-lint run.