Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ Every agent-facing command should be treated as an envelope. With `--json` this

Errors use the same shape with `status: "error"` and an `error` object. Do not parse prose diagnostics. Check `error.code`, `error.recoverable`, `error.http.status`, `error.request_id`, and `next_actions`.

Some commands add non-fatal warnings. On successful `pcl deploy` envelopes they appear in `data.warnings`; if deploy later fails, they appear in the top-level `warnings` array alongside `status: "error"`. `pcl auth login` also reports warnings in a top-level `warnings` array. Each entry has `code` and `message`. `assertion_spec.v2_unsupported` means the target platform or chain runs the V1 assertion spec, so V2 triggers and precompiles are not supported there.

Output mode rules:

- default: human-readable output for people
Expand Down
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ All notable user-facing changes should be recorded here.

## Unreleased

### Added

- `pcl deploy` warns when the assertions it is about to release use the V2 spec but the target does not support it (the `app.phylax.systems` platform, or a Linea chain). The warning names the files and the V2 triggers/precompiles found in them, prints before the protocol-manager step and again at the end, and appears in `--json` output as `data.warnings`. It never blocks a deploy.
- `pcl auth login` warns when logging in to `app.phylax.systems` that the platform runs the V1 assertion spec and assertions must not be written against V2. Machine output carries it as a `warnings` array on the login envelope.

### Breaking changes

- Removed TOON output entirely: the `--toon` flag, the `--format toon` alias, and the TOON envelope renderer are gone. `--json` is the only machine output mode; agent guidance, manifest examples, and `next_actions` hints now use `--json`.
Expand Down
36 changes: 35 additions & 1 deletion crates/pcl/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,13 @@ fn phoundry_error_envelope(err: &PhoundryError) -> Value {
#[allow(clippy::too_many_lines)]
fn deploy_error_envelope(err: &DeployError) -> Value {
match err {
DeployError::WithWarnings { source, warnings } => {
let mut envelope = deploy_error_envelope(source);
if !warnings.is_empty() {
envelope["warnings"] = json!(warnings);
}
envelope
}
// Delegate wrapped errors to the mappers that know their structure —
// notably ConfirmAfterTx, whose envelope carries the landed tx hash
// and the nested API provenance.
Expand Down Expand Up @@ -764,7 +771,9 @@ fn deploy_error_envelope(err: &DeployError) -> Value {
DeployError::Json(_) | DeployError::Output(_) => {
("deploy.output_failed", false, Vec::new())
}
DeployError::Api(_) | DeployError::Apply(_) => unreachable!("delegated above"),
DeployError::Api(_)
| DeployError::Apply(_)
| DeployError::WithWarnings { .. } => unreachable!("delegated above"),
};
let mut error = serde_json::Map::new();
error.insert("code".to_string(), json!(code));
Expand Down Expand Up @@ -1396,4 +1405,29 @@ mod tests {
assert_eq!(envelope["next_actions"][0], "pcl auth refresh");
assert_eq!(envelope["next_actions"][1], "pcl auth login --force");
}

#[test]
fn deploy_api_failure_keeps_post_scan_spec_warnings() {
let warning = json!({
"code": "assertion_spec.v2_unsupported",
"message": "production runs V1",
});
let err = DeployError::WithWarnings {
source: Box::new(DeployError::Apply(ApplyError::Api {
endpoint: "/projects/id/releases".to_string(),
status: Some(400),
body: "unsupported assertion spec".to_string(),
})),
warnings: vec![warning],
};

let envelope = deploy_error_envelope(&err);

assert_eq!(envelope["status"], "error");
assert_eq!(
envelope["warnings"][0]["code"],
"assertion_spec.v2_unsupported"
);
assert_eq!(envelope["error"]["code"], "apply.failed");
}
}
Loading
Loading