Repository navigation
[Config json format consolidation] #4 Remove deprecated config fallbacks and bump schema to v2 - #60
Conversation
ac826ff to
f2deb71
Compare
There was a problem hiding this comment.
Pull request overview
Removes legacy/dual-read config parsing paths and completes the move to the consolidated v2 config format (with process required), updating runners to rely on container_id + lifecycle instead of deprecated per-backend/legacy fields.
Changes:
- Removed deprecated config fields/fallbacks (script/workingDirectory/timeout/appContainer.name/lxc.containerName/etc.) and made
processrequired; bumped supported schema major version to 2. - Updated runtime components (AppContainer/LXC runners, NetworkManager, models) to use
container_idandlifecyclefor naming and cleanup decisions. - Updated schema/docs/tests and test configs to reflect the v2 format and removed deprecated
removeRulesOnExitfields.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| test_configs/network_firewall_test.json | Removes deprecated removeRulesOnExit from network config. |
| test_configs/network_default_test.json | Removes deprecated removeRulesOnExit from network config. |
| test_configs/network_capabilities_test.json | Removes deprecated removeRulesOnExit from network config. |
| test_configs/network_both_test.json | Removes deprecated removeRulesOnExit from network config. |
| src/wxc_common/src/validator.rs | Updates tests to use container_id instead of deprecated policy naming fields. |
| src/wxc_common/src/network_manager.rs | Passes container name explicitly to proxy coordinator; stop_all now uses a cleanup boolean. |
| src/wxc_common/src/models.rs | Removes deprecated fields from ContainerPolicy and LxcConfig; relies on LifecycleConfig for cleanup semantics. |
| src/wxc_common/src/config_parser.rs | Removes legacy parsing fallbacks; requires process; bumps SUPPORTED_MAJOR_VERSION to 2; updates parser tests accordingly. |
| src/wxc_common/src/appcontainer.rs | Derives effective container name from container_id; cleanup driven by lifecycle.preserve_policy. |
| src/wxc/src/main.rs | Logs container name using container_id (fallback to “CLI”). |
| src/lxc_common/src/lxc_runner.rs | Runner now takes container_id + lifecycle and uses them for naming/cleanup. |
| src/lxc/src/main.rs | Wires lifecycle/container_id into LxcScriptRunner and logs container name from container_id. |
| schemas/mxc-config.v2.schema.json | Updates schema $id and description to v2. |
| docs/schema.md | Points to v2 schema and expands/updates schema versioning documentation for major-version compatibility. |
Comments suppressed due to low confidence (1)
schemas/mxc-config.v2.schema.json:5
- The v2 schema now positions itself as the canonical format, but the
versionproperty later in this schema still documents semver-style values (e.g. "0.1.0") and even has an unmatched quote in its description. This conflicts with the parser/docs, which requireversionto start with a positive integer major ("1", "2", or "2.x"), and will reject "0.3.0-alpha". Please update the schema’sversionfield description/examples/pattern accordingly so JSON Schema validation matches runtime behavior.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| @@ -16,7 +16,6 @@ | |||
| "defaultPolicy": "block", | |||
| "enforcementMode": "firewall", | |||
| "allowedHosts": [ "api.github.com" ], | |||
| "blockedHosts": [], | |||
| "removeRulesOnExit": true | |||
| "blockedHosts": [] | |||
There was a problem hiding this comment.
This config still declares "version": "0.3.0-alpha" (top of file), which will now be rejected by validate_schema_version() because major version 0 is invalid (must be >= 1) and SUPPORTED_MAJOR_VERSION is 2. Please update this test config to use a supported major (e.g. "2") or omit version so it remains runnable.
| @@ -15,7 +15,6 @@ | |||
| "network": { | |||
| "defaultPolicy": "block", | |||
| "allowedHosts": ["api.github.com"], | |||
| "blockedHosts": [], | |||
| "removeRulesOnExit": true | |||
| "blockedHosts": [] | |||
There was a problem hiding this comment.
This config still declares "version": "0.3.0-alpha" (top of file), which will now be rejected by validate_schema_version() because major version 0 is invalid (must be >= 1) and SUPPORTED_MAJOR_VERSION is 2. Please update this test config to use a supported major (e.g. "2") or omit version so it remains runnable.
| @@ -16,7 +16,6 @@ | |||
| "defaultPolicy": "block", | |||
| "enforcementMode": "capabilities", | |||
| "allowedHosts": ["api.github.com"], | |||
| "blockedHosts": [], | |||
| "removeRulesOnExit": true | |||
| "blockedHosts": [] | |||
There was a problem hiding this comment.
This config still declares "version": "0.3.0-alpha" (top of file), which will now be rejected by validate_schema_version() because major version 0 is invalid (must be >= 1) and SUPPORTED_MAJOR_VERSION is 2. Please update this test config to use a supported major (e.g. "2") or omit version so it remains runnable.
| @@ -16,7 +16,6 @@ | |||
| "defaultPolicy": "block", | |||
| "enforcementMode": "both", | |||
| "allowedHosts": ["api.github.com"], | |||
| "blockedHosts": [], | |||
| "removeRulesOnExit": true | |||
| "blockedHosts": [] | |||
There was a problem hiding this comment.
This config still declares "version": "0.3.0-alpha" (top of file), which will now be rejected by validate_schema_version() because major version 0 is invalid (must be >= 1) and SUPPORTED_MAJOR_VERSION is 2. Please update this test config to use a supported major (e.g. "2") or omit version so it remains runnable.
| let container_name = if request.container_id.is_empty() { | ||
| "CLI".to_string() | ||
| } else { | ||
| request.container_id.clone() | ||
| }; | ||
| self.app_container_sid = Self::create_app_container_sid(&container_name)?; | ||
| self.app_container_name = container_name; |
There was a problem hiding this comment.
container_name is derived from request.container_id here and then re-derived again later in run(). Consider centralizing this (e.g., a small helper that returns the effective container name, or reusing self.app_container_name after initialize()) to avoid future divergence if the default name logic changes.
f2deb71 to
4b3af02
Compare
Removes all dual-read fallback code for legacy config fields (script, workingDirectory, top-level timeout, appContainer.name, lxc.containerName, lxc.destroyOnExit, clearPolicyOnExit, removeRulesOnExit, container alias). Process section is now required. Runners read from container_id and lifecycle instead of removed ContainerPolicy/LxcConfig fields. Bumps SUPPORTED_MAJOR_VERSION to 2. Schema renamed to v2. Co-authored-by: Copilot <[email protected]>
All example configs, test configs, schema file, and docs now use version '2' to match SUPPORTED_MAJOR_VERSION. The previous '0.3.0-alpha' would be rejected by the version validator (major 0 is invalid). Co-authored-by: Copilot <[email protected]>
6b1b561 to
097eb99
Compare
|
|
||
| ### Full Schema | ||
|
|
||
| ```json | ||
| { | ||
| "version": "0.3.0-alpha", // Schema version (current: "0.3.0-alpha") | ||
| "version": "2", // Schema version (current: "2") |
There was a problem hiding this comment.
No. SemVer. This should be 0.4.0-alpha.
| higher than the binary supports are rejected with an error suggesting to upgrade | ||
| `wxc-exec`. Missing `version` is accepted (treated as version 1). Additive | ||
| changes (new optional fields) do not require a version bump. | ||
| MXC config files include an optional `version` field that declares the schema |
There was a problem hiding this comment.
If this is optional, the latest must be assumed. Do we require backward compatibility of all changes to the schema?
| "type": "object", | ||
|
|
||
| "required": ["process"], | ||
|
|
||
| "properties": { | ||
| "version": { | ||
| "type": "string", | ||
| "description": "MXC config schema version. Current: '0.3.0-alpha.", | ||
| "examples": ["0.1.0"] | ||
| "description": "MXC config schema version. Current: '2'.", |
Replaces integer version ('2') with proper semver ('0.4.0-alpha') per
https://semver.org/. Parser now compares major.minor (pre-release labels
ignored). Schema file renamed from mxc-config.v2.schema.json to
mxc-config.schema.json (version is inside the file, not the filename).
Co-authored-by: Copilot <[email protected]>
Step 4 of multi-step consolidation process.
Removes all dual-read fallback code for legacy config fields (script, workingDirectory, top-level timeout, appContainer.name, lxc.containerName, lxc.destroyOnExit, clearPolicyOnExit, removeRulesOnExit, container alias). Process section is now required. Runners read from container_id and lifecycle instead of removed ContainerPolicy/LxcConfig fields. Bumps SUPPORTED_MAJOR_VERSION to 2. Schema renamed to v2.
PR 1 ✅ Merged
version,containerId,processsection with dual-read fallback.Vm/MicroVmenum variants.Manual
DefaultforCodexRequest.PR 2 ✅ Merged
schemas/mxc-config.v1.schema.json. Schema version validation.idleTimeoutMsdual-read.containerId→app_container_namemapping. Migrate 15 examples + 16 test configs. Updatedocs/schema.md.PR 3 ✅ Merged
LifecycleConfigstruct. Parselifecycle.destroyOnExit/preservePolicywith dual-read from legacyfields.
wslcalias forcontainerkey. Updatesdk/src/types.ts,cli/README.md,cli/ARCHITECTURE.md,sdk/README.md.PR 4 🔄 In review -> This PR
script,workingDirectory, top-leveltimeout,containeralias,appContainer.name,lxc.containerName,lxc.destroyOnExit,clearPolicyOnExit,removeRulesOnExitfrom parser. BumpSUPPORTED_MAJOR_VERSIONto 2.