Phase 3d: add actionable configuration parse errors#641
Open
MGudgin wants to merge 1 commit into
Open
Conversation
Base automatically changed from
user/gudge/versioning_phase3c_three_axis_docs
to
main
July 14, 2026 18:12
MGudgin
force-pushed
the
user/gudge/versioning_phase3d_actionable_parse_errors
branch
from
July 14, 2026 18:25
582b133 to
7c288be
Compare
MGudgin
force-pushed
the
user/gudge/versioning_phase3d_actionable_parse_errors
branch
from
July 15, 2026 17:52
7c288be to
fdf1f96
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a path-aware JSON deserialization layer to produce more actionable configuration parse errors (policy path + source location), while preserving the state-aware stdout envelope contract by routing parse/dispatch diagnostics only to auxiliary sinks.
Changes:
- Introduces
config_deserializeto distinguish JSON syntax errors vs typed policy-shape errors, including full JSON paths, source locations, control-character escaping, and secret-value redaction. - Refactors request loading/discrimination to borrow
RawValuefor state-aware discrimination (avoids building a full untyped JSON AST) and preserves byte/line locations by masking theexperimentalsubtree. - Adjusts logger + state-aware driver behavior to keep stdout reserved for envelopes/script output and avoid duplicating state-aware errors into primary stderr/buffer output.
Show a summary per file
| File | Description |
|---|---|
| src/core/wxc/src/main.rs | Logs state-aware dispatch errors only to auxiliary diagnostic sinks before emitting error envelopes. |
| src/core/wxc_common/src/wire.rs | Improves root-shape error messaging (expecting) and documents optionality expectations for experimental. |
| src/core/wxc_common/src/state_aware_request.rs | Uses path-aware deserialize for per-backend phase configs and prefixes errors with experimental.<backend>.<phase>. |
| src/core/wxc_common/src/state_aware_dispatch.rs | Extends tests to assert envelope-ready error paths for typed state-aware backend configs. |
| src/core/wxc_common/src/logger.rs | Adds log_diagnostic_line to write only to auxiliary sinks (file/diagnostic pipe), and refactors log_line accordingly. |
| src/core/wxc_common/src/lib.rs | Wires in the new internal config_deserialize module. |
| src/core/wxc_common/src/config_parser.rs | Refactors request parsing/logging, adds RawValue discriminator + experimental masking for location preservation. |
| src/core/wxc_common/src/config_deserialize.rs | New: central path-aware deserialize + formatting/redaction/escaping for diagnostics. |
| src/core/wxc_common/Cargo.toml | Enables serde_json raw_value support and adds serde_path_to_error. |
| src/Cargo.toml | Adds workspace dependency on serde_path_to_error. |
| src/Cargo.lock | Locks serde_path_to_error. |
| docs/versioning.md | Documents the new “actionable parse errors” behavior and guarantees. |
| docs/state-aware-lifecycle/mxc-state-aware-sandbox-api.md | Documents auxiliary-only routing for state-aware parse-phase failures. |
| .github/copilot-instructions.md | Updates documented config flow to include config_deserialize. |
Review details
- Files reviewed: 13/14 changed files
- Comments generated: 2
- Review effort level: Low
MGudgin
force-pushed
the
user/gudge/versioning_phase3d_actionable_parse_errors
branch
2 times, most recently
from
July 15, 2026 20:36
aec0002 to
cf263ca
Compare
huzaifa-d
reviewed
Jul 17, 2026
huzaifa-d
reviewed
Jul 17, 2026
MGudgin
force-pushed
the
user/gudge/versioning_phase3d_actionable_parse_errors
branch
4 times, most recently
from
July 23, 2026 00:50
deb054c to
14bd6cb
Compare
This PR adds actionable configuration parse errors: the parser reports malformed JSON separately from typed policy-shape errors and includes the full policy path plus whole-file source location in every diagnostic, without leaking secrets or letting untrusted text corrupt diagnostics or the state-aware stdout response envelope. Details * New config_deserialize module: a path-aware deserialize layer that distinguishes JSON syntax errors from typed policy errors, attaching the full JSON path and whole-file line/column, escaping control and invisible formatting characters (incl. U+2028/U+2029 and bidi overrides), and redacting secret-bearing values. * State-aware per-backend per-phase configs deserialize positionally from the retained request text, so typed errors carry whole-file coordinates matching base-config errors; navigation uses owned-key maps so escaped sibling keys never silently drop the location, with graceful fallback to the value-based path. * Request loading borrows RawValue to discriminate one-shot vs state-aware without building a full untyped AST, masking the experimental subtree to preserve base-config source locations. * Diagnostic routing keeps stdout reserved for the state-aware envelope and script output; parse and dispatch errors go to auxiliary sinks (log file / diagnostic pipe) only and are emitted exactly once. Filesystem-path and schema-version diagnostics escape untrusted text via the shared escape_diagnostic_text helper. * Exec dispatch drops the parsed request (and its retained source text) before the blocking child run and stdio relay. * Docs updated: versioning.md, the state-aware API doc, and the copilot-instructions config-flow description. Tests * Added parser coverage: syntax-vs-typed classification, whole-file line/column (computed, not hardcoded), escaped-sibling-key location preservation, exact column, CRLF line stability, positional secret redaction, source-present locator fallback, malformed-telemetry single auxiliary emission with an empty primary buffer, and a pinned serde_json positioned-error display-suffix contract. * cargo fmt --all -- --check: passed. * cargo clippy -p wxc_common -p wxc --all-targets -- -D warnings: clean. * cargo test -p wxc_common -p wxc: 514 + 26 passed. * node scripts/versioning/check-schema-codegen.js, check-sdk-types-codegen.js, check-schema-versions.js: passed. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Generated-with: gpt-5.6-sol Generated-with: claude-opus-4.8 Copilot-Session: dd87e65c-7e38-4d0e-8238-147c2153a0e8
MGudgin
force-pushed
the
user/gudge/versioning_phase3d_actionable_parse_errors
branch
from
July 23, 2026 15:50
14bd6cb to
e30ac71
Compare
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.
This PR adds actionable configuration parse errors: the parser reports
malformed JSON separately from typed policy-shape errors and includes the full
policy path plus whole-file source location in every diagnostic, without leaking
secrets or letting untrusted text corrupt diagnostics or the state-aware stdout
response envelope.
Details
config_deserializemodule: a path-aware deserialize layer thatdistinguishes JSON syntax errors from typed policy errors, attaching the full
JSON path and whole-file line/column, escaping control and invisible
formatting characters (incl. U+2028/U+2029 and bidi overrides), and redacting
secret-bearing values.
retained request text, so typed errors carry whole-file coordinates matching
base-config errors; navigation uses owned-key maps so escaped sibling keys
never silently drop the location, with graceful fallback to the value-based
path.
RawValueto discriminate one-shot vs state-awarewithout building a full untyped AST, masking the
experimentalsubtree topreserve base-config source locations.
script output; parse and dispatch errors go to auxiliary sinks (log file /
diagnostic pipe) only and are emitted exactly once. Filesystem-path and
schema-version diagnostics escape untrusted text via the shared
escape_diagnostic_texthelper.the blocking child run and stdio relay.
docs/versioning.md, the state-aware API doc, and thecopilot-instructions config-flow description.
Tests
(computed, not hardcoded), escaped-sibling-key location preservation, exact
column, CRLF line stability, positional secret redaction, source-present
locator fallback, malformed-telemetry single auxiliary emission with an empty
primary buffer, and a pinned
serde_jsonpositioned-error display-suffixcontract.
cargo fmt --all -- --check: passed.cargo clippy -p wxc_common -p wxc --all-targets -- -D warnings: clean.cargo test -p wxc_common -p wxc: 514 + 26 passed.node scripts/versioning/check-schema-codegen.js,check-sdk-types-codegen.js,check-schema-versions.js: passed.