Repository navigation
feat(cli)!: exit with what a failed command's outcome says - #1078
Conversation
A request carrying omnigraph-expect-actor is refused with 412 actor_mismatch, after authentication and the contract check and before graph lookup, body work or effects, when its credential resolves to another actor. A match changes nothing, so the header only narrows a request and never supplies an actor. Every protected router and /mcp check it. The CLI sends it for --as on served writes and cluster --server commands, which no longer refuse --as. A mismatch is a not-started refusal and exits 4, like a failed graph-commit precondition.
Every error body carries an outcome object (execution, effects, action) that the server computes for the request it answered: not_started with no effects when it refused before submitting a write, or refused the write's one publication with a typed reason, which an engine gives only before it publishes; unknown otherwise, including a typed refusal after a load forked its branch. The next step a caller takes is retry, refresh, recover or reconcile. A write whose completion is uncertain answers outcome_unknown instead of internal. Errors that carried a reason only in their details gain registry codes: precondition_failed, recovery_required, external_blob_source and change_feed_gap. CLI data-write failures print the same object as outcome, in place of command_outcome, and take the server's when its request was the command's only effectful one.
The exit follows from the failure's outcome: a command that did not start exits 1, one whose effects are unknown 2, one refused for a condition the caller set 4, and one refused before starting with retry 75. A refused command line exits 64 (EX_USAGE) instead of Clap's 2. Read commands report the same failure envelope as data writes, always not_started with no effects, so a failed read prints its outcome too. An embedded engine write's own error now carries the engine's completion evidence, as a server's does: a typed refusal before any request, outside a load that forks its branch, did not start, so embedded load conflicts and failed conditions exit as served ones instead of claiming unknown effects. Any later error, such as one rendering a committed receipt, stays unknown. Embedded writes refuse a noncanonical branch name and read their data file before opening storage. Managed commands keep their own exits until the managed relay lands.
…es it A server built before `omnigraph-expect-actor` speaks the same HTTP contract and ignores the header, so `--as` on a served write would run as the credential's actor. Every response now lists the assertions its server enforces in `omnigraph-http-api-assertions`, and the CLI refuses before sending when discovery does not list `expect-actor`. A served `cluster plan` or `cluster apply` refused for another actor now exits 4 as a data write does: its requests are observed, and a refused assertion with nothing effectful sent before it is a condition, with or without `--json`.
`main` returned an undelivered failure as an error, so the process exited 1, the status that says nothing changed, after a write whose receipt met a closed stdout. It now reports the error as before and exits with the code the outcome chose. `alias` is a read, as `query` is, so its failures report an outcome and exit by it. Command classification is now an exhaustive match, so a new command declares how its failure reads.
The cluster skill page still said `cluster apply --server` refuses `--as`; it now names the assertion `cluster plan` and `cluster apply` send and its exit 4. The release note moves to `breaking`, since a matching `--as` now runs a write the CLI used to refuse. The server guide says `/mcp` has no contract check, an empty assertion joins the malformed-header test, and stale comments name the current behaviour.
|
A failed data command now exits with what its outcome says. Exit 1 means the command changed nothing. Exit 2 means the effects are unknown. Exit 4 means a condition the caller set did not hold. Exit 75 means the server refused before the start and a retry is allowed. Exit 64 means Clap refused the command line. Scripts that read exit 2 as a usage error, or exit 1 as every failure, must change. This is the right contract for the commands I recommend changes before merge. Three findings block. Three are optional. The pull request is still open at Blocking1. Embedded
|
Write facts survive task boundaries. Whether a request had submitted an owned write, and whether its load forked a branch, lived in a task-local, so an MCP tool call, which runs its handler in an owned read task and builds the error body in another, lost both: a load whose `from` forked a new branch and then met a key conflict reported not_started with no effects. ApiError now carries `compound` beside `owned_write`, an owned read keeps the request's record in its own task, and an error leaving it takes that record along; the outcome reads the error's own fields. The outcome unit test gains cases run through an owned read, the MCP write test a load that forks and then conflicts, and the HTTP load test its twin. A load is compound only when it forks. Both load routes marked it whenever `from` was set, so a refused load onto an existing branch reported unknown although its one publication never ran. The routes now mark it from the branch listing their authorization already reads, and only on the owned write's error. An earlier step's publication also outranks a refusal the write met before it started. The HTTP load test covers a key conflict onto an existing branch with `from`, which reports not_started. Every error the server answers has a code. ApiError's code is no longer optional, and the deployment status read that races an owner change answers 503 `service_unavailable` with a retry outcome instead of no code. Malformed input, unknown routes and unserved methods answer the error body. Handlers took axum's Json, Query and Path, whose rejections are plain text (422 for a JSON body of the wrong shape), and unrouted requests had empty bodies. ApiJson, ApiQuery and ApiPath refuse with ApiError (400, or the transport status for 413 and 415), the router's fallbacks answer not_found and method_not_allowed, and a source guard refuses a handler parameter of axum's own extractors. The three query structs whose parameter location came from the extractor's name declare it, so their optional parameters render as the other query parameters do. Embedded callers can render an engine failure as a served request with the same facts would: engine_error_output_after takes whether a write was submitted and whether an earlier step published, and engine_read_error_output renders a read, which never answers outcome_unknown. The RustFS S3 test expected the 424 external Blob source refusal to carry no code; it now asserts its code and outcome. The troubleshooting guide and the changelog note state the outcome decision table the server implements.
…efusals as the server does The merge keeps this branch's command kinds and ModernRelay#1074's served cluster `--as` exit: a cluster command is observed without being classified. An embedded `load --from` marked its write compound whenever `from` was set, so a refusal before its fork exited 2. It now marks it only when the branch is missing, as the server's load does, and an embedded write's own error goes through `engine_error_output_after`: a policy refusal precedes every publication, the fork's included, and any other refusal of a compound load follows the fork. A read's engine error keeps its own code instead of `outcome_unknown`, and the failure reporter no longer panics on a wrapped engine write error. The crossversion journeys read a `--json` read's refusal from stdout, where the failure now goes. The exit documentation says once that a failed condition exits 4 embedded or served, names the data commands the outcome table covers and the commands that keep their own exits, and says that only the argument parser's refusals exit 64.
|
Addressed at 04a9da5. That commit merges the updated #1076 and contains these fixes. Blocking
Optional: the Also fixed from CI:
|
…target's default graph The merge keeps this branch's typed-refusal branch in the failure reporter beside ModernRelay#1078's projection of embedded engine errors. `queries` and `policy` keep their explicit `--graph` filter and no longer take a target's `default_graph`, as RFC 0059 specifies for root tools, so their all-graph and ambiguity behaviour is the same whatever selected the root.
The stack's other changes to this page need its last line.
|
A script cannot tell a command that changed nothing from a command that may have changed the graph when both exit 1. This change gives each classified data command an exit that follows its outcome. Exit 0 is success. Exit 1 means the command did not start. Exit 2 means the effects are unknown. Exit 4 means a condition the caller set did not hold. Exit 75 means the server refused before the start and a retry is allowed. Exit 64 means the argument parser refused the command line.
Scripts that read exit 2 as a usage error, or exit 1 as every failure, must change. Maintenance, Reviewed head Earlier findings
The BlockingNone. Optional
RFC #1017 at
|
A server that predates `omnigraph-expect-actor` ignores it, so `--as` on a served write would run as the credential's actor. The earlier fence, a response header listing the assertions a server enforces, was a second compatibility record beside the contract version: two servers speaking 0.13 could disagree about the assertion, and every further assertion would extend an enum on every response. The contract moves to 0.14 instead, the one bump the access route, `outcome` and the code registry also ride. A 0.13 server answers discovery with its own contract, so the CLI refuses it before sending, and it refuses a 0.14 request before reading the header. The assertions header, its constant and the CLI's discovery check are gone, and so is the enum on every OpenAPI response. The guides, the developer pages, the skill, the version samples and the fixtures name 0.14, and a breaking note says to upgrade the CLI, server, Studio and HTTP integrations together. The server guide says a repeated, padded or empty header is refused, and that `/mcp` compares it after authentication; the cluster skill names the subcommands that take `--as`.
Brings in HTTP contract 0.14 and the removal of the assertions response header, so this branch speaks the contract its outcome field rides.
…failed A load names whether it forked its branch only from inside the engine: the routes took that fact from the branch listing their authorization reads, before the load lists the branches again and decides. A branch deleted between the two, as one can be while an NDJSON body is still arriving, was forked by the load, and a refusal of its rows then answered `not_started` with no effects although the fork had published. `CompletionEvidence::PartlyPublished` records that an earlier step of the owning operation published and a later one failed. The load marks every failure after its fork with it, the window between the fork and the rows included. It outranks the definite `BeforeEffect` and `Unpublished`, which no longer cover the operation, survives composition, and never hides `Uncertain`. The server reads it as the compound fact and leaves containment where no evidence leaves it, so a typed refusal keeps its code with `unknown` and `refresh`. The routes' list-derived flag and `in_compound_write` are gone, and `engine_error_output_after` drops its `compound` argument: embedded callers get the fact from the error. A route test deletes the branch while the NDJSON body waits and expects the fork reported; the core test pins the composition rules. The key conflict and `graph_unavailable` descriptions say what they now mean, and the breaking note names the plain query-parameter types in openapi.json.
Brings in HTTP contract 0.14 and the engine's mark of an earlier publication. The embedded load no longer lists the branches to predict a fork: the engine marks every failure after its fork with `PartlyPublished`, so `embedded_write_output` reads that mark, and `Evidence.compound` and `command_outcome::compound` are gone. A branch deleted after a list and before the load's own check can no longer report `not_started` after the fork published.
The outcome unit test passed even if `load` predicted a fork for every `--from`, because a policy refusal ignores the prediction. A process test now drives the call site. Onto a branch that exists, `--from` forks nothing, and a refused payload exits 1 with `not_started`. Onto a missing branch the fork publishes first, and the same refusal exits 2 with `unknown` while the branch stays. The troubleshooting guide's "exit alike" sentence is narrowed to those cases: a policy refusal is `not_started` on both planes, and a refusal after a fork that did publish is `unknown` on both.
Main replaced the legacy routing flags with explicit targets (ModernRelay#1090). The actor assertion sits on that structure: `GraphClient::from_target` and the served cluster client send `--as` as `Omnigraph-If-Actor` on a server target, where ModernRelay#1090 refused it, and only a managed target still refuses `--as`. `accepts_actor` keeps deciding which commands take it. The HTTP contract stays 0.14.
It brings main's explicit targets (ModernRelay#1090) and Lance 13. A target refusal that ModernRelay#1090 reports with the command's evidence carries `disposition`, as every other data-write failure does.
…ges within the cap The served cluster entry now takes the actor `--as` asserts. The server, CLI reference and cluster guides fold the merged text back under 350 lines.
Brings the actor branch's cluster remote test fix and its page trims.
Main's branch action route took axum's `Path` and answered 405 with no body. It takes the typed extractor, and its 405 carries `method_not_allowed` and the disposition beside the `Allow` header.
Brings in main through ModernRelay#1076, including ModernRelay#1090's explicit targets. The exit table keeps its classification: the removed use and profile commands leave it, and the target and credential commands, which keep their own failure reports, join the unclassified ones. ModernRelay#1078's tests move to --target, ModernRelay#1090's usage-error tests expect exit 64, and the diagnostics checks pass the destination line ModernRelay#1090 prints first.
…e result A review found two ways the exit table and the single-result stdout contract disagreed. A classified command's target refusal still exited 2, which the table reserves for unknown or partial effects; it now exits as its disposition says, 1 with action fix, while the target commands keep their own exit. And a JSON failure after part of a streamed result, such as a later page of diff or changes poll, was appended to stdout, leaving two documents in one stream; it now goes to stderr.
…s guards The router-wide method fallback replaced each protected route's default fallback, layers included, so a method the route does not serve answered 405 before bearer authentication, the contract check, the actor assertion and admission. Each protected router now installs the fallback before its guards, through one helper that owns their order.
|
This review covers WhyA script must tell a command that changed nothing from a command that may have changed the graph. The exit is that signal. Exit 2 means the effects are unknown or partial. A refusal that changed nothing must not use that exit. WhatThe pull request's own commits since Two contracts move.
How
The merge puts each protected router's 405 fallback behind the shared guards. Earlier findings
BlockingNone. Optional
LiabilityThe old target-refusal arm printed The cost that remains is local.
TradeoffCorrectness comes first. The failure document leaves the result stream, so a parser does not read an error object as a second value on stdout. A mid-stream ValidationReviewed head GQT cannot see a process exit or which stream holds a JSON failure. The owner is the CLI test. Before, at
Failed.
Failed. Stdout was the page prefix After, at
The cluster test passed: a data command's target refusal exits 1, and the cluster command exits 2.
CI on This change does not alter Lance dataset behavior. I did not re-fetch Lance format pages. No performance claim. |
The failure logs main added read ApiError's status, which this branch derives from its code.
…lication unpublished() returned an error unchanged once it carried any evidence, so a step marked after its operation recorded an earlier publication lost its own proof. It now sets step_unpublished on that evidence.
The 412 row now says what to do about actor_mismatch, the changelog names branch_start_refusal's two statuses, and the CLI reference says a served blob put, blob clear, commit publish and commit drop send --as as the actor assertion.
Brings in main through ModernRelay#1076: the ModernRelay#1074 squash, ModernRelay#1092 and ModernRelay#1103.
|
This review covers WhyA script must tell a command that changed nothing from a command that may have changed the graph. The exit is that signal. Exit 2 means the effects are unknown or an earlier step left effects. A step that proved it published nothing must not be described as an unknown publication. WhatThe code since Two facts move in the code.
The pull request's own diff against How
The server maps a true flag to The loader marks the inner failure
Earlier findings
BlockingNone. Optional
Liability
The cost that remains is local. TradeoffCorrectness comes first. The disposition matches the proof the engine recorded. The exit number for this case stays 2. The caller uses ValidationReviewed head GQT cannot see completion evidence or which stream holds a JSON failure. The owner is the core unit test. The server test projects that evidence into the error body. Before, at
Failed. Left:
Failed. Left: After, at
CI on This change does not alter Lance dataset behavior. I did not re-fetch Lance format pages. No performance claim. |
Stacked on #1076 (error
disposition), itself on #1074; review only the commits after #1076's head.What & why
The CLI's exit follows from a failure's
disposition, the same for every command: a command with no effects exits 1, one whose effects are unknown or partial 2, one refused for a condition the caller set 4, and one refused before starting withretry75. A refused command line exits 64 (EX_USAGE) instead of Clap's 2.dispositiontoo (JSON on stdout, thedispositionline on stderr).EngineWrite::engine_write), so an unwrapped error stays conservative.Managed commands, and the target and credential commands, keep their own exits for now.
Backing issue / RFC
Checklist
cli_data,cli_queries,cli_cluster,cli_cluster_e2e,cli_schema_config,parity_matrix(embedded and served now exit alike, including Blob preconditions at 4),system_remote(lost delivery exits 2), and the application unit testschangelog.d/cli-exit-follows-outcome.breaking.mdnot_startedfor an error it cannot attribute to the engine write itself (invariant 11)Local verification
cargo build -p omnigraph-server && RUST_MIN_STACK=16777216 cargo test -p omnigraph-cli -- --test-threads=6— 221 lib + 327 integration pass on main with feat(cli)!: replace legacy routing with explicit targets #1090RUST_MIN_STACK=16777216 cargo test -p omnigraph-server— all pass-D warnings,cargo fmt --all --check,python3 scripts/check-docs.py,typos— cleanNotes for reviewers
Breaking for scripts that read exit 2 as a usage error or exit 1 as every failure. Usage errors other than Clap's (for example the addressing guard) still exit 1.