mirror of
https://github.com/ModernRelay/omnigraph.git
synced 2026-06-27 02:39:38 +02:00
feat(cli)!: unified load command; deprecate ingest as an alias
omnigraph load is now the single data-write command: - works against remote graphs (POSTs the server's /ingest endpoint with the same bearer/actor resolution as other remote commands) — previously load was the only data command forced to open Lance storage directly - --from <base> opts into fork-if-missing for --branch (the former ingest semantics); without --from a missing branch is an error, never a fork - --mode is now required: overwrite is destructive, so there is no implicit default (the old silent default was overwrite) - output gains base_branch/branch_created (and table sums on remote loads) omnigraph ingest stays as a deprecated alias (defaults preserved: --from main --mode merge) that prints a one-line warning to stderr, matching the read/change deprecation convention; removal in a later release. Docs updated in the same change: cli.md, cli-reference.md, policy.md, audit.md, execution.md (unified load section), AGENTS.md quick-flow, README.md. BREAKING CHANGE: scripts running omnigraph load without --mode must now pass it explicitly (previously defaulted to the destructive overwrite). Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
90676ef52f
commit
fa6af775c1
12 changed files with 342 additions and 68 deletions
|
|
@ -652,6 +652,8 @@ query add_friend($from: String, $to: String) {
|
|||
output_success(
|
||||
cli()
|
||||
.arg("load")
|
||||
.arg("--mode")
|
||||
.arg("overwrite")
|
||||
.arg("--data")
|
||||
.arg(&export_path)
|
||||
.arg(&imported_graph),
|
||||
|
|
@ -755,6 +757,71 @@ fn remote_ingest_creates_review_branch_and_keeps_it_readable() {
|
|||
assert_eq!(zoe["rows"][0]["p.name"], "Zoe");
|
||||
}
|
||||
|
||||
/// The unified `load` works against remote graphs through the server's
|
||||
/// `/ingest` endpoint: without `--from` a missing branch is a hard error
|
||||
/// (no implicit fork), with `--from` it forks like ingest did.
|
||||
#[test]
|
||||
#[ignore = "requires loopback socket permissions in sandboxed runners"]
|
||||
fn remote_load_round_trips_and_requires_from_for_new_branches() {
|
||||
let graph = SystemGraph::loaded();
|
||||
let server = graph.spawn_server();
|
||||
let config = graph.write_config("omnigraph.yaml", &remote_yaml_config(&server.base_url));
|
||||
let extra = graph.write_jsonl(
|
||||
"system-remote-load.jsonl",
|
||||
r#"{"type":"Person","data":{"name":"Zoe","age":33}}"#,
|
||||
);
|
||||
|
||||
// Missing branch without --from: refused remotely, nothing created.
|
||||
let failure = output_failure(
|
||||
cli()
|
||||
.arg("load")
|
||||
.arg("--config")
|
||||
.arg(&config)
|
||||
.arg("--mode")
|
||||
.arg("merge")
|
||||
.arg("--data")
|
||||
.arg(&extra)
|
||||
.arg("--branch")
|
||||
.arg("feature-load"),
|
||||
);
|
||||
assert!(
|
||||
String::from_utf8_lossy(&failure.stderr).contains("feature-load"),
|
||||
"error should name the missing branch"
|
||||
);
|
||||
|
||||
// With --from, the remote load forks and lands the rows.
|
||||
let payload = parse_stdout_json(&output_success(
|
||||
cli()
|
||||
.arg("load")
|
||||
.arg("--config")
|
||||
.arg(&config)
|
||||
.arg("--mode")
|
||||
.arg("merge")
|
||||
.arg("--data")
|
||||
.arg(&extra)
|
||||
.arg("--branch")
|
||||
.arg("feature-load")
|
||||
.arg("--from")
|
||||
.arg("main")
|
||||
.arg("--json"),
|
||||
));
|
||||
assert_eq!(payload["branch"], "feature-load");
|
||||
assert_eq!(payload["base_branch"], "main");
|
||||
assert_eq!(payload["branch_created"], true);
|
||||
assert_eq!(payload["nodes_loaded"], 1);
|
||||
|
||||
let snapshot = parse_stdout_json(&output_success(
|
||||
cli()
|
||||
.arg("snapshot")
|
||||
.arg("--config")
|
||||
.arg(&config)
|
||||
.arg("--branch")
|
||||
.arg("feature-load")
|
||||
.arg("--json"),
|
||||
));
|
||||
assert_eq!(snapshot["branch"], "feature-load");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[ignore = "requires loopback socket permissions in sandboxed runners"]
|
||||
fn remote_ingest_reuses_existing_branch_and_merges_updates() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue