feat: minimize v2 runtime images - #28
Conversation
Signed-off-by: Sertac Ozercan <sozercan@gmail.com>
There was a problem hiding this comment.
Pull request overview
Adds release-bound V2 runtime minimization while preserving V1 behavior and producing verifiable pruning evidence.
Changes:
- Prunes bounded development-only payloads from transitive core Formulae.
- Binds minimization to V2 policy, resolution, inventory, and evidence.
- Expands integration tests, release validation, and documentation.
Show a summary per file
| File | Description |
|---|---|
SECURITY.md |
Documents minimization guarantees. |
scripts/vm-live-validate.sh |
Accepts prune manifest v4. |
release/components-v2.example.json |
Updates policy digest. |
README.md |
Describes automatic minimization. |
policy/v2/policy.json |
Defines minimal profile rules. |
policy/v2/policy.go |
Models and validates the profile. |
policy/v2/policy_test.go |
Tests embedded profile integrity. |
internal/spec/canonical_order_test.go |
Rejects user profile selection. |
internal/runtimefs/types.go |
Adds schemas and prune reasons. |
internal/runtimefs/scan.go |
Implements minimization classification. |
internal/runtimefs/prune_compaction_test.go |
Tests attributed evidence compaction. |
internal/runtimefs/policy.go |
Normalizes and digests profiles. |
internal/runtimefs/minimal_profile_test.go |
Tests pruning and retention behavior. |
internal/runtimefs/evidence.go |
Produces compact attributed evidence. |
internal/runtimefs/assemble.go |
Verifies retained inventory policy. |
internal/resolution/v2.go |
Validates V2 profile identity. |
internal/resolution/v2_test.go |
Tests profile serialization behavior. |
internal/resolution/record.go |
Adds in-memory profile identity. |
internal/resolution/record_test.go |
Tests V1 profile rejection. |
internal/resolution/project_v2_test.go |
Tests profile projection. |
internal/policy/v2.go |
Binds the minimal V2 policy. |
internal/policy/v2_test.go |
Tests binding and replay inference. |
internal/materializer/v2_prepare_test.go |
Updates policy mismatch expectation. |
internal/frontend/handler.go |
Binds profile into effective input. |
internal/frontend/handler_test.go |
Tests effective-input identity. |
internal/buildfiles/release_workflow_test.go |
Tests release minimization gates. |
examples/live-redis.yaml |
Updates evidence schema check. |
examples/live-python.yaml |
Updates evidence schema check. |
examples/live-hf-curl.yaml |
Exercises minimized runtime behavior. |
examples/live-graphviz.yaml |
Updates evidence schema check. |
examples/live-glibc.yaml |
Updates evidence schema check. |
docs/usage.md |
Documents minimization contract. |
docs/release.md |
Adds release policy requirements. |
docs/architecture.md |
Explains minimization architecture. |
CONTRIBUTING.md |
Adds validation guidance. |
cmd/live-input-verify/main_test.go |
Tests profile-extension rejection. |
.github/workflows/release.yml |
Generates and validates release evidence. |
Review details
馃挕 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
- Files reviewed: 37/37 changed files
- Comments generated: 2
- Review effort level: Balanced
| if reason == PruneRuntimeDocs || reason == PruneRuntimeShareDoc || reason == PruneRuntimeShell { | ||
| if pathContainsLegalText(sub) { | ||
| return "" | ||
| } | ||
| } |
| if reason := minimalRuntimePruneReason(entry.Path, entry.Package, policy); reason != "" && (reason != PruneRuntimeStatic || entry.Type != TypeDirectory) { | ||
| if _, approvedAncestor := profileAncestors[entry.Path]; !approvedAncestor || entry.Type != TypeDirectory { | ||
| return runtimeError(CodeVerification, entry.Path, "inventory retains path forbidden by runtime profile (%s)", reason) | ||
| } |
There was a problem hiding this comment.
馃挕 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71e72753d2
鈩癸笍 About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 馃憤.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| func looksLikeLegalText(filename string) bool { | ||
| base := strings.ToLower(path.Base(filename)) | ||
| return strings.HasPrefix(base, "license") || strings.HasPrefix(base, "copying") || strings.HasPrefix(base, "notice") || strings.HasPrefix(base, "copyright") | ||
| for _, name := range []string{"license", "licenses", "copying", "notice", "notices", "copyright", "copyrights"} { |
There was a problem hiding this comment.
Preserve British-spelled licence files
For a transitive core Formula containing legal text such as share/doc/<pkg>/LICENCE or LICENCE.txt, this allowlist does not recognize the common British spelling, so minimalRuntimePruneReason classifies the file as non-legal documentation and removes it under PruneRuntimeShareDoc. This violates the V2 contract that legal and license text remains and can produce redistributed images without required licence notices; include licence/licences and other explicitly supported legal filename variants in this predicate.
AGENTS.md reference: AGENTS.md:L75-L77
Useful? React with 馃憤聽/ 馃憥.
Summary
homebrew/coreFormulae while preserving requested Formulae, runtime-critical content, legal files, and link integrityValidation
./scripts/check.shhf+curllive image: real HTTPS and model-weight downloads passed under the hardened non-root/read-only configurationNotes
HF_HOMEandXDG_CACHE_HOMEpaths, such as/models