feat(hub): pre-install read surface + cache eviction#419
Merged
Conversation
Add a Lua read surface over the verified .wippy/vendor cache so a module can be fully inspected before install: hub.versions.open returns an owned package handle (fs.File-style, auto-closed via the resource store) exposing metadata, entries, resources, and a real fs handle over each embedded filesystem; flat hub.versions.resources / read_file cover one-shot reads. Adds hub.cache list/remove/prune (name+version addressed, lockfile as the pin set, mirroring pruneModuleArtifacts) so inspected-but-uninstalled artifacts can be reclaimed. Entry data is returned raw (placeholders/_env unresolved); the fs surface reuses the fs module (new fs.PushFS helper) rather than a parallel abstraction. Builds on #417's hub.versions.entries.
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.
Builds on #417 (its
hub.versions.entriesis the base of this branch) to give the hub module a full pre-install read surface — so a caller (esp. an AI agent) can inspect a module's metadata, entries, and actual file contents before installing it, to scan dependencies and run security checks — plus a cache-eviction surface so inspected-but-uninstalled artifacts don't accumulate forever.Design was reviewed for idiomaticity against the existing
registry/fs/resource/lockmodules (two independent passes) before implementation.Surface
Idioms followed
fs.Fileowned-handle pattern, not a resource lease — an uninstalled artifact has no registry entry toAcquire. It keeps the open*os.File+*wapp.Reader, registersresource.GetStore(ctx).AddCleanup(...)for frame-end auto-close, and:close()is idempotent. The file stays open sopkg:fs()reads lazily.pkg:fs()returns the real fs handle —wapp.Reader.GetFS→fsapi.NewReadOnlyFS→ the fs module (new exportedfs.PushFS), so callers use the standardstat/readdir/read_fileverbs. No parallel fs abstraction.id="ns:name"string, data converted structurally (raw —${env:...}/_envstay literal, matching the sealing model).pruneskips pinned,removerefuses pinned unlessforce— same semantics aspruneModuleArtifacts.Notes / decisions
.wappmodules. Unpacked-directory modules load entries from_index.yamlrather thanwapp.Reader; a directory-backed path can be a follow-up (pkg.packedalready exposes the distinction).Tests
read_surface_test.go: open → metadata/entries(raw + kind/include_data filters)/resources/pkg:fsread/close(+use-after-close); flat resources + read_file (incl. leading-slash + missing-file); cache list/remove(pinned-refusal + force)/prune(dry-run + orphan-only). Build, vet,go test, gofmt, andgolangci-lintall green.Credit to @msmakouz for the
entries()groundwork this builds on.