feat(cli)!: schema apply refuses a cluster-managed graph (RFC-011 D10) (#253)

`omnigraph schema apply` against a cluster-managed graph's storage root bypassed
the cluster ledger/recovery/approvals. Mirror `init`'s refusal: on the embedded
(direct-store) path, if the resolved URI is inside a cluster
(`cluster_root_for_graph_uri`), bail and point at `cluster apply`. The served
(`--server`) path is unaffected — it addresses a server, not a storage root.
`schema plan`/`show` (read-only) are untouched.

Two e2e tests injected "out-of-band drift" via this exact CLI path; since the
CLI now refuses it, they inject drift via a direct engine `apply_schema` against
the storage root instead — a faithful control-plane bypass, which is what
out-of-band drift is. New regression:
`schema_apply_refuses_a_cluster_managed_graph_and_signposts_cluster_apply`.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Andrew Altshuler 2026-06-15 23:11:42 +03:00 committed by GitHub
parent 4601e5f4bf
commit d2340f19e9
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 89 additions and 33 deletions

View file

@ -383,6 +383,24 @@ async fn main() -> Result<()> {
cli.store.as_deref(),
)
.await?;
// RFC-011 Decision 10: a graph managed by a cluster evolves via
// `cluster apply` (ledger/recovery/approvals), not a direct
// `schema apply` against its storage root — that would bypass the
// ledger. Mirrors `init`'s refusal. Only the embedded path can
// address a storage root; a served apply (`--server`) is the
// server's concern.
if !client.is_remote() {
if let Some(root) =
omnigraph_cluster::cluster_root_for_graph_uri(client.uri()).await
{
bail!(
"`{}` is inside cluster `{root}`. A graph in a cluster evolves via \
`cluster apply` (which records ledger, recovery, and approvals), not \
`schema apply`. Update the schema in cluster.yaml and run `cluster apply`.",
client.uri()
);
}
}
let schema_source = fs::read_to_string(&schema)?;
// The embedded (direct-store) arm carries no stored-query
// registry — the registry is cluster-owned (RFC-011), so a