fix(capsule): make component→root capability merge exhaustive (#1232) - #1381
Open
jvsteiner wants to merge 2 commits into
Open
fix(capsule): make component→root capability merge exhaustive (#1232)#1381jvsteiner wants to merge 2 commits into
jvsteiner wants to merge 2 commits into
Conversation
…d-runtime#1232) discovery.rs folded each [[component]].capabilities into the root manifest.capabilities field-by-field by hand-enumeration, silently dropping any field not listed: net_connect, uplink, kv, identity, allow_persistent, allow_prompt_injection (and bind_workers once the run-loop concurrency work lands). The security gate reads only the root, so a component-only declaration granted nothing -- no error, even though `astrid capsule show` displayed it. Replace the enumerated merge with an exhaustive CapabilitiesDef::merge_from (allowlists concatenated, flags OR-ed). It destructures the source struct with no `..` rest pattern, so adding a field fails to compile until it is handled -- this class of silent-drop bug can't recur. Adds merge_from_unions_every_field (exhaustiveness guard) and component_level_capabilities_merge_into_root (discovery-seam regression). Closes astrid-runtime#1232. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jvsteiner
marked this pull request as ready for review
July 26, 2026 12:27
Author
|
@joshuajbouw ready for review — exhaustive |
Member
|
Review outcome: technically worth advancing. The exhaustive capability merge and regression coverage look correct, and the substantive CI jobs are green. Please fix the required PR-template sections and add the changelog entry so the repository checks can pass. |
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.
Linked Issue
Closes #1232.
Summary
discovery.rsfolded each[[component]].capabilitiesinto the root manifest field-by-field by hand-enumeration, so any field not explicitly listed was silently dropped — the security gate reads only the root, so a component-only declaration granted nothing, with no error. Dropped fields:net_connect,uplink,kv,identity,allow_persistent,allow_prompt_injection. Concretely, a capsule declaringnet_connectat component level couldn't open the connections it asked for.Changes
CapabilitiesDef::merge_from(&mut self, other)(allowlists concatenated, flags OR-ed). It destructures the source struct with no..rest pattern, so adding a field toCapabilitiesDeffails to compile there until it's handled — this class of silent-drop can't recur.discovery.rsnow callsmanifest.capabilities.merge_from(caps)instead of the enumerated merge.Verification
cargo test -p astrid-capsule-types -p astrid-capsulegreen.merge_from_unions_every_field(fully-populated structs; every field unions) andcomponent_level_capabilities_merge_into_root(the discovery-seam regression: a component-onlynet_connectsurfaces in the root).Checklist