You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
Copy file name to clipboardExpand all lines: .github/copilot-instructions.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -120,7 +120,7 @@ The Rust workspace (`src/`) implements multiple sandboxing backends behind the `
120
120
121
121
### Config flow
122
122
123
-
1. User provides JSON config (file or base64) → `config_parser.rs`deserializes into the typed wire model (`wxc_common::wire`) → validates and maps to `ExecutionRequest` (the internal execution model in `models.rs`)
123
+
1. User provides JSON config (file or base64) → `config_deserialize.rs`performs path-aware typed deserialization into the wire model (`wxc_common::wire`) → `config_parser.rs`validates and maps it to `ExecutionRequest` (the internal execution model in `models.rs`)
124
124
2.`ExecutionRequest` includes the containment backend selection, process config, filesystem/network policies, and optional experimental features
125
125
3. The appropriate `ScriptRunner` implementation executes the process and returns `ScriptResponse`
126
126
@@ -212,7 +212,7 @@ The workspace is organized into six top-level directories under `src/`:
212
212
213
213
### Config parser pattern
214
214
215
-
The parser deserializes JSON directly into the typed wire model (`wxc_common::wire`), the single source of truth for the config shape (it also generates the JSON schema). `config_parser.rs` then maps the wire types to the validated domain structs in `models.rs`. The stable surface uses `deny_unknown_fields` (closed); the `experimental` block is permissive.
215
+
The parser deserializes JSON directly into the typed wire model (`wxc_common::wire`), the single source of truth for the config shape (it also generates the JSON schema). All typed config deserialization goes through `config_deserialize.rs`, which distinguishes syntax errors from typed policy errors and adds the complete JSON path plus source line/column when available; state-aware backend errors are prefixed with their full `experimental.<backend>.<phase>` location. `config_parser.rs` then maps the wire types to the validated domain structs in `models.rs`. The stable surface uses `deny_unknown_fields` (closed); the `experimental` block is permissive.
0 commit comments