Skip to content

feat(compartment-mapper): add retainAll flag to captureFromMap #2893

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

boneskull
Copy link
Member

@boneskull boneskull commented Jul 15, 2025

Closes: #2886
Ref: #2894 (future implementation may make this PR unnecessary)

Description

This adds a boolean flag to captureFromMap() which instructs digestCompartmentMap() to ignore the retained flag on CompartmentDescriptors and ModuleDescriptors, which ensures no "unused" CompartmentDescriptor is dropped from the mapping.

Considered creating a new public function for this, but it did not seem worth the bother. Still, it would be feasible to:

  1. Create a new function captureAllFromMap()
  2. Extract common logic from captureFromMap() into a new module-scoped function
  3. Call that function from both captureFromMap() and captureAllFromMap()
  4. captureAllFromMap() would pass retainAll: true to the common function which would hand it off to digestCompartmentMap()

Security Considerations

n/a

Scaling Considerations

Use of this will result in a large compartment map, which may bloat whatever you're using it for.

Documentation Considerations

n/a

Testing Considerations

Added fixture and tests for the specific behavior with and without the flag.

Compatibility Considerations

This is backwards-compatible.

Upgrade Considerations

Update NEWS.md

@boneskull boneskull self-assigned this Jul 15, 2025
@boneskull boneskull added the enhancement New feature or request label Jul 15, 2025
@boneskull boneskull requested review from kriskowal, naugtur and leotm July 15, 2025 20:12
This adds a boolean flag to `captureFromMap()` which instructs `digestCompartmentMap()` to ignore the `retained` flag on `CompartmentDescriptor`s and `ModuleDescriptor`s, which ensures no "unused" `CompartmentDescriptor` is dropped from the mapping.

Closes #2886.
@boneskull boneskull force-pushed the boneskull/compartment-mapper-captureFromMap-incompatible-with-dynamic-requires-2886 branch from 00cb8cd to 7130e8e Compare July 15, 2025 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

compartment-mapper: captureFromMap incompatible with dynamic requires
1 participant