feat(seatbelt): add system power access - #1066
Open
Carlos Alexandro Becker (caarlos0) wants to merge 7 commits into
Open
feat(seatbelt): add system power access#1066Carlos Alexandro Becker (caarlos0) wants to merge 7 commits into
Carlos Alexandro Becker (caarlos0) wants to merge 7 commits into
Conversation
Add an opt-in capability for sleep/wake notifications and power assertions while keeping the default sandbox profile restricted. Co-authored-by: Copilot <[email protected]> Copilot-Session: 342a9bf7-a27a-457f-aaac-c910b8cd5535 Signed-off-by: Carlos Alexandro Becker <[email protected]>
Carlos Alexandro Becker (caarlos0)
requested review from
a team
and
a balanced review from Copilot
August 28, 2026 20:08
Carlos Alexandro Becker (caarlos0)
requested a review
from a team
as a code owner
August 28, 2026 20:08
|
Azure Pipelines: There may be pipelines that require an authorized user to comment /azp run to run. |
Copilot started reviewing on behalf of
Carlos Alexandro Becker (caarlos0)
August 28, 2026 20:08
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 2
New issues introduced by this change (3)
| Severity | Finding |
|---|---|
src/core/wxc_common/src/config_parser.rs — systemPowerAccess is mapped without any schema-version check. The production loaders still… |
|
src/core/mxc_engine/src/policy.rs — This public setter bypasses schema validation because build_request has already parsed the… |
|
docs/schema.md — This example places systemPowerAccess under experimental.seatbelt, but the parser explicitly… |
What changed in this PR
Adds opt-in macOS Seatbelt permissions for sleep/wake notifications and power assertions.
Changes:
- Extends schema, parser, Rust SDK, and Node SDK contracts.
- Emits narrowly scoped Seatbelt power-service rules.
- Adds unit tests, generated artifacts, and documentation.
| File | Description |
|---|---|
src/core/wxc_common/src/wire.rs |
Adds the wire field. |
src/core/wxc_common/src/models.rs |
Adds the domain setting and default. |
src/core/wxc_common/src/config_parser.rs |
Maps and tests the setting. |
src/core/wxc_common/src/config_contract_adapters/v0_8.rs |
Defaults the unavailable field. |
src/core/wxc_common/src/config_contract_adapters/v0_7.rs |
Defaults the unavailable field. |
src/core/wxc_common/src/config_contract_adapters/dev/one_shot.rs |
Adapts the 0.9 contract field. |
src/core/wxc_common/src/config_contract_adapters/dev/one_shot_tests/stable_candidate.rs |
Tests adapter mappings. |
src/core/mxc-sdk/README.md |
Documents Rust SDK usage. |
src/core/mxc_engine/src/policy.rs |
Adds the Rust SDK setter. |
src/core/mxc_config_contract/tests/version_boundaries/seatbelt.rs |
Tests 0.9 introduction. |
src/core/mxc_config_contract/tests/v0_9_0_alpha/seatbelt.rs |
Tests field typing. |
src/core/mxc_config_contract/tests/v0_9_0_alpha/optional_fields.rs |
Tests null rejection. |
src/core/mxc_config_contract/tests/v0_9_0_alpha/fixtures/one_shot/valid/seatbelt_complete.json |
Extends the valid fixture. |
src/core/mxc_config_contract/src/dev/stable.rs |
Adds the exact contract field. |
src/backends/seatbelt/common/src/profile_builder.rs |
Generates and tests power rules. |
sdk/node/src/types.ts |
Exposes the Node SDK option. |
sdk/node/src/generated/wire.ts |
Updates rolling generated types. |
sdk/node/src/generated/v0_9_0_alpha/wire.ts |
Updates exact generated types. |
sdk/node/README.md |
Documents Node SDK usage. |
schemas/dev/mxc-config.schema.0.9.0-dev.json |
Updates the rolling schema. |
schemas/dev/mxc-config.schema.0.9.0-alpha.json |
Updates the exact schema. |
docs/seatbelt/seatbelt-backend.md |
Documents backend behavior. |
docs/schema.md |
Updates the configuration example. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Copilot started reviewing on behalf of
Carlos Alexandro Becker (caarlos0)
August 28, 2026 20:14
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 2
Pre-existing issues (3)
| Severity | Finding |
|---|---|
src/core/mxc_engine/src/policy.rs — This public setter bypasses schema validation because build_request has already parsed the… View comment |
|
src/core/wxc_common/src/config_parser.rs — systemPowerAccess is mapped without any schema-version check. The production loaders still… View comment |
|
docs/schema.md — This example places systemPowerAccess under experimental.seatbelt, but the parser explicitly… View comment |
Suppressed comments (3)
src/core/mxc_engine/src/policy.rs:688
- This mutator bypasses the advertised 0.9 schema boundary: callers can build and validate a 0.7/0.8 request, then set this model field after parsing, and the Seatbelt runner applies it without checking
schema_version. The new test even exercises that path with0.7.0-alpha. Make the setter reject unsupported versions (or add an execution-time invariant covering directly constructed requests) so the Rust SDK cannot enable a 0.9-only capability under an older contract.
pub fn set_seatbelt_system_power_access(&mut self, allow: bool) -> &mut Self {
self.inner
.seatbelt
.get_or_insert_default()
.system_power_access = allow;
docs/schema.md:209
- This example places the new option under
experimental.seatbelt, but the parser explicitly rejects that section with “has moved to the stable section”; the supported path is top-levelseatbelt.systemPowerAccess. Move the Seatbelt example out of theexperimentalobject so readers can copy a valid 0.9 configuration.
"systemPowerAccess": false // Allow sleep/wake notifications and power assertions
src/core/wxc_common/src/config_parser.rs:623
systemPowerAccessis not version-gated in the production parser. Both production loaders still deserialize the rollingwire::MxcConfigdirectly, and the exact-contract adapters are explicitly not reachable from production, so a request declaring schema 0.7 or 0.8 can set this field totrueand reach the profile builder. The contract boundary test alone does not enforce the runtime boundary. Add a raw field-version check to both loader paths (similar to directional networking) and a production parser regression test that rejects this field before 0.9.
system_power_access: system_power_access.unwrap_or(false),
Gate systemPowerAccess at every one-shot loader and again before Seatbelt execution so post-parse SDK mutations cannot bypass schema 0.9. Move the documented Seatbelt block to its supported top-level location. Co-authored-by: Copilot <[email protected]> Copilot-Session: 342a9bf7-a27a-457f-aaac-c910b8cd5535 Signed-off-by: Carlos Alexandro Becker <[email protected]>
Copilot started reviewing on behalf of
Carlos Alexandro Becker (caarlos0)
August 29, 2026 16:39
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
docs/schema.md — This “Full Schema” example still declares "version": "0.6.0-alpha" at line 87, but the parser… |
Issues resolved since last review (3)
| Severity | Finding |
|---|---|
docs/schema.md — This example places systemPowerAccess under experimental.seatbelt, but the parser explicitly… View resolved comment |
|
src/core/mxc_engine/src/policy.rs — This public setter bypasses schema validation because build_request has already parsed the… View resolved comment |
|
src/core/wxc_common/src/config_parser.rs — systemPowerAccess is mapped without any schema-version check. The production loaders still… View resolved comment |
Copilot started reviewing on behalf of
Carlos Alexandro Becker (caarlos0)
August 29, 2026 16:43
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: 1
Pre-existing issues (1)
| Severity | Finding |
|---|---|
docs/schema.md — This “Full Schema” example still declares "version": "0.6.0-alpha" at line 87, but the parser… View comment |
Keep the full schema example consistent with its systemPowerAccess field. Co-authored-by: Copilot <[email protected]> Copilot-Session: 342a9bf7-a27a-457f-aaac-c910b8cd5535 Signed-off-by: Carlos Alexandro Becker <[email protected]>
Copilot started reviewing on behalf of
Carlos Alexandro Becker (caarlos0)
August 29, 2026 17:06
View session
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Balanced
Findings: None
Issues resolved since last review (1)
| Severity | Finding |
|---|---|
docs/schema.md — This “Full Schema” example still declares "version": "0.6.0-alpha" at line 87, but the parser… View resolved comment |
Resolve the Seatbelt policy move by keeping execution invariants in the backend and raw schema-version gates in wxc_common. Co-authored-by: Copilot <[email protected]> Copilot-Session: 342a9bf7-a27a-457f-aaac-c910b8cd5535 Signed-off-by: Carlos Alexandro Becker <[email protected]>
Copilot started reviewing on behalf of
Carlos Alexandro Becker (caarlos0)
August 31, 2026 12:05
View session
Copilot started reviewing on behalf of
Carlos Alexandro Becker (caarlos0)
August 31, 2026 17:36
View session
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.


📖 Description
Add opt-in
seatbelt.systemPowerAccesssupport for macOS workloads that needsleep/wake notifications or power assertions.
The capability is off by default. When enabled, the generated Seatbelt profile
allows only:
RootDomainUserClientcom.apple.PowerManagement.controlcom.apple.iokit.powerdxpcThe new field is available in schema
0.9.0-alphaand later. This change wiresit through the versioned contract, parser, Rust and Node SDKs, generated
artifacts, tests, and documentation. Published 0.7 and 0.8 schemas remain
unchanged.
🔗 References
None.
🔍 Validation
systemPowerAccess: falseandallowed with
systemPowerAccess: truethroughmxc-exec-mac.mainand reran the full PR validation.✅ Checklist
Cargo.lock, thedependency-feed-checkcheck passes (see docs/pull-requests.md)📋 Issue Type
GitHub Actions runs the PR validation build automatically. The ADO pipeline
(
MXC-PR-Build) is the Azure version of the PR pipeline, kept in parity with the GitHubActions build; it runs on merge to
main, and Microsoft reviewers with write access can trigger iton a PR with
/azp run. See docs/pull-requests.md.If the
dependency-feed-checkcheck fails on a new dependency, the crate must be added tothe feed before the PR can pass. See docs/pull-requests.md
for the steps.
Microsoft Reviewers: Open in CodeFlow