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
4 changes: 2 additions & 2 deletions distributed_cli/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ use crate::{
};

const DISTRIBUTED_MANIFEST_SCHEMA_VERSION: u64 = 1;
const DISTRIBUTED_CLIENT_MANIFEST_VERSION: u64 = 7;
const DISTRIBUTED_CLIENT_MANIFEST_VERSION: u64 = 1;

#[derive(Args, Debug)]
pub struct ServiceArgs {
Expand Down Expand Up @@ -1845,7 +1845,7 @@ mod tests {
fn client_manifest_validator_accepts_only_current_version() {
let manifest = serde_json::json!({
"manifest_version": DISTRIBUTED_CLIENT_MANIFEST_VERSION,
"protocol_version": 2,
"protocol_version": 1,
"service_id": "orders",
"schema_fingerprint": "sha256:schema",
"protocol_fingerprint": "sha256:protocol",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ fn validate_command(
validate_exact_operation_hash(&command.operation, &command.operation_hash, "command")?;

let extensions = &command.extensions;
if extensions.version != 3 {
if extensions.version != 1 {
return Err(command_error(
command,
"client.manifest.command_extensions",
"extensions.version must be 3",
"extensions.version must be 1",
));
}
let consistency = &extensions.consistency;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ fn command() -> ManifestCommand {
operation: operation.into(),
operation_hash: hash_bytes(operation.as_bytes()),
extensions: ManifestCommandExtensions {
version: 3,
version: 1,
consistency: ManifestCommandConsistency {
version: 1,
kind: ManifestConsistencyKind::Fact,
Expand Down
2 changes: 1 addition & 1 deletion distributed_cli/src/client_compiler/graphql/arguments.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ pub(super) fn single_root_field<'a>(
return Err(source_error(
"client.operation.single_root",
format!(
"causal protocol v2 requires exactly one query root; found {}",
"causal protocol v1 requires exactly one query root; found {}",
fields.len()
),
document,
Expand Down
2 changes: 1 addition & 1 deletion distributed_cli/src/client_compiler/graphql/variables.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ pub(super) fn compile_variable_codec(
compiled_variables.insert(variable.name.clone(), input_type);
}
Ok(CompiledVariableCodec {
version: 2,
version: 1,
limits: CompiledVariableCodecLimits {
max_depth: manifest.execution.max_depth,
max_bool_width: manifest.execution.max_bool_width,
Expand Down
6 changes: 3 additions & 3 deletions distributed_cli/src/client_compiler/manifest/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ pub(crate) use projectors::*;
pub(crate) use roots::*;
pub(crate) use util::{validate_hash, validate_nonempty};

const MANIFEST_VERSION: u64 = 7;
const PROTOCOL_VERSION: u64 = 2;
const MANIFEST_VERSION: u64 = 1;
const PROTOCOL_VERSION: u64 = 1;
const PROTOCOL_FINGERPRINT: &str =
"sha256:7631d15b16e327ff08d728e97ac5f90f5150d00774938e720bbbc6830b77e0cf";
"sha256:30f19c9f4d29280a02ddf67c4df62cdc92c4e8090792f43d6b1bdafea3e31273";

pub(crate) use types::*;
pub(crate) use util::{canonical_json_value, hash_bytes, validate_exact_operation_hash};
Expand Down
2 changes: 1 addition & 1 deletion distributed_cli/src/client_compiler/render/artifact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ pub(super) fn render_operation_artifact_json(
variable_codec: &operation.variable_codec,
roots: vec![artifact_root(operation)],
protocol: ArtifactProtocol {
version: 2,
version: 1,
schema_hash: &manifest.schema_fingerprint,
surface: &manifest.surface,
operation: &operation.query_hash,
Expand Down
2 changes: 1 addition & 1 deletion distributed_cli/src/client_compiler/render/commands.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ fn command_artifact_json(
artifact.insert(
"protocol".into(),
serde_json::json!({
"version": 2,
"version": 1,
"schemaHash": manifest.schema_fingerprint,
"protocolHash": manifest.protocol_fingerprint,
"surface": &manifest.surface,
Expand Down
8 changes: 4 additions & 4 deletions distributed_cli/src/client_compiler/render/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn render_protocol(manifest: &ClientManifest) -> Result<String, ClientCompileErr
}
sections.push(format!(
"export const CLIENT_PROTOCOL = {{\n\
\tversion: 2,\n\
\tversion: 1,\n\
\tserviceId: {},\n\
\tschemaHash: {},\n\
\tprotocolHash: {},\n\
Expand All @@ -125,7 +125,7 @@ fn render_protocol(manifest: &ClientManifest) -> Result<String, ClientCompileErr
"document": &status.operation,
"operationHash": &status.operation_hash,
"protocol": {
"version": 2,
"version": 1,
"schemaHash": &manifest.schema_fingerprint,
"protocolHash": &manifest.protocol_fingerprint,
"surface": &manifest.surface,
Expand Down Expand Up @@ -169,8 +169,8 @@ fn render_compiler_manifest(
) -> Result<String, ClientCompileError> {
let provenance = CompilerManifest {
compiler_manifest_version: 1,
distributed_manifest_version: 7,
protocol_version: 2,
distributed_manifest_version: 1,
protocol_version: 1,
service_id: &manifest.service_id,
surface: &manifest.surface,
schema_fingerprint: &manifest.schema_fingerprint,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn scalar_only_operation_module_is_byte_exact_and_needs_no_replica_value_import(
let (manifest, operation) = compile_runtime_bridge_operation();
let module = render_operation_module(&operation, &manifest)
.expect("render scalar-only operation module");
assert_eq!(
assert_eq!(
module,
include_str!("../../tests/fixtures/generated-scalar-operation.ts"),
"the strict TypeScript scalar-only fixture must remain exact Rust compiler output"
Expand Down
24 changes: 12 additions & 12 deletions distributed_cli/src/client_compiler/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,12 +264,12 @@ fn aggregate_root() -> JsonValue {

pub(super) fn manifest() -> JsonValue {
let mut value = json!({
"manifest_version": 7,
"protocol_version": 2,
"manifest_version": 1,
"protocol_version": 1,
"service_id": "todos-service",
"surface": {"kind": "role", "name": "user"},
"schema_fingerprint": fingerprint("schema"),
"protocol_fingerprint": "sha256:7631d15b16e327ff08d728e97ac5f90f5150d00774938e720bbbc6830b77e0cf",
"protocol_fingerprint": "sha256:30f19c9f4d29280a02ddf67c4df62cdc92c4e8090792f43d6b1bdafea3e31273",
"execution": {
"max_depth": 8,
"max_complexity": 500,
Expand Down Expand Up @@ -484,7 +484,7 @@ fn projected_manifest() -> JsonValue {
"operation": mutation,
"operation_hash": fingerprint(mutation),
"extensions": {
"version": 3,
"version": 1,
"consistency": {"version": 1, "kind": "projected"},
"direct_projection": {
"topology": {
Expand Down Expand Up @@ -561,7 +561,7 @@ fn generated_command_types_manifest() -> JsonValue {
"operation": import,
"operation_hash": fingerprint(import),
"extensions": {
"version": 3,
"version": 1,
"consistency": {"version": 1, "kind": "accepted"}
}
}),
Expand All @@ -588,7 +588,7 @@ fn generated_command_types_manifest() -> JsonValue {
"operation": ping,
"operation_hash": fingerprint(ping),
"extensions": {
"version": 3,
"version": 1,
"consistency": {"version": 1, "kind": "accepted"}
}
}),
Expand Down Expand Up @@ -1332,12 +1332,12 @@ fn emits_executable_filter_order_and_pagination_plans_with_hidden_dependencies()
assert!(generated.contains("type Operation_Planned_Input_todo_order_by_Direction ="));
assert!(generated.contains("readonly \"order\"?: Operation_Planned_Input_todo_order_by | readonly Operation_Planned_Input_todo_order_by[] | null;"));
assert!(generated.contains("\"variableCodec\": {"));
assert!(generated.contains("\"version\": 2"));
assert!(generated.contains("\"version\": 1"));
assert!(generated.contains("\"maxBoolWidth\": 256"));
assert!(generated.contains("\"maxInList\": 1000"));
let provenance: JsonValue =
serde_json::from_str(file(&project, "manifest.json")).expect("compiler manifest JSON");
assert_eq!(provenance["distributed_manifest_version"], 7);
assert_eq!(provenance["distributed_manifest_version"], 1);
assert!(generated.contains(
"\"target\": {\n \"kind\": \"input\",\n \"name\": \"todo_bool_exp\""
));
Expand Down Expand Up @@ -1382,7 +1382,7 @@ fn generated_variable_codec_types_recursive_inputs_and_custom_scalars() {

let artifact = operation_artifact(&project);
assert_eq!(artifact["protocol"]["trustedPresets"], json!([]));
assert_eq!(artifact["variableCodec"]["version"], 2);
assert_eq!(artifact["variableCodec"]["version"], 1);
assert_eq!(
artifact["variableCodec"]["limits"],
json!({
Expand Down Expand Up @@ -2420,7 +2420,7 @@ fn command_protocol_and_extensions_are_preserved_exactly() {
"operation": mutation,
"operation_hash": fingerprint(mutation),
"extensions": {
"version": 3,
"version": 1,
"consistency": {"version": 1, "kind": "fact"},
"input_defaults": {
"version": 1,
Expand Down Expand Up @@ -2559,7 +2559,7 @@ fn generated_command_typescript_covers_typed_json_fields_and_no_input_wrappers()
))
.expect("compile generated command type fixture");
let commands = file(&project, "commands.ts");
assert_eq!(
assert_eq!(
commands,
include_str!("../../tests/fixtures/generated-commands.ts")
);
Expand Down Expand Up @@ -2732,7 +2732,7 @@ fn rejects_commands_without_causal_identity_or_normative_input_defaults() {
"operation": operation,
"operation_hash": fingerprint(operation),
"extensions": {
"version": 3,
"version": 1,
"consistency": {"version": 1, "kind": "projected"},
"input_defaults": {
"version": 1,
Expand Down
10 changes: 5 additions & 5 deletions distributed_cli/tests/cli_client.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//! Integration tests for `dctl client`: drive the real binary against a small
//! manifest-v7 project and verify generation, read-only drift checking,
//! manifest-v1 project and verify generation, read-only drift checking,
//! authorization-surface selection, document discovery, and explicit `@load`
//! route registration.

Expand All @@ -9,15 +9,15 @@ use std::path::{Path, PathBuf};
use std::process::{Command, Output};

const ROLE_MANIFEST: &str = r#"{
"manifest_version": 7,
"protocol_version": 2,
"manifest_version": 1,
"protocol_version": 1,
"service_id": "todos",
"surface": {
"kind": "role",
"name": "user"
},
"schema_fingerprint": "sha256:0d721d983c42fb732e10e8a2d45f0ab06497fb77fcddb9c9305f779b86c086c9",
"protocol_fingerprint": "sha256:7631d15b16e327ff08d728e97ac5f90f5150d00774938e720bbbc6830b77e0cf",
"schema_fingerprint": "sha256:fc1d0cdb83cb42d07d9dfaf0944b24ea3e95b1dafc63ad320f9e93ffe2e3d9b9",
"protocol_fingerprint": "sha256:30f19c9f4d29280a02ddf67c4df62cdc92c4e8090792f43d6b1bdafea3e31273",
"execution": {
"max_depth": 8,
"max_complexity": 500,
Expand Down
8 changes: 4 additions & 4 deletions distributed_cli/tests/cli_manifest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,18 @@ fn describe_emits_manifest_json() {
fn client_manifest_uses_service_surface_export() {
let json = dctl(&["client-manifest"]);
let manifest: serde_json::Value = serde_json::from_str(&json).unwrap();
assert_eq!(manifest["manifest_version"], 7);
assert_eq!(manifest["protocol_version"], 2);
assert_eq!(manifest["manifest_version"], 1);
assert_eq!(manifest["protocol_version"], 1);
assert_eq!(manifest["service_id"], "orders");
assert_eq!(manifest["surface"]["kind"], "role");
assert_eq!(manifest["surface"]["name"], "user");
assert_eq!(
manifest["schema_fingerprint"],
"sha256:b99b09420301b8e837cc5c734bff9114ce3de9c02429e1d05add1dda0ca2bf58"
"sha256:31a54d18b0104283e3ec26cb7da37bfb2c31a3d8e37e96e8297e83059cf56aa4"
);
assert_eq!(
manifest["protocol_fingerprint"],
"sha256:7631d15b16e327ff08d728e97ac5f90f5150d00774938e720bbbc6830b77e0cf"
"sha256:30f19c9f4d29280a02ddf67c4df62cdc92c4e8090792f43d6b1bdafea3e31273"
);
assert_eq!(manifest["models"][0]["id"], "OrderView");
assert_eq!(manifest["models"][0]["record_revisions"], true);
Expand Down
18 changes: 9 additions & 9 deletions distributed_cli/tests/fixtures/generated-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,14 @@ export const Command_importTodos: ReplicaCommandArtifact<Command_importTodos_Inp
},
"protocol": {
"operation": "sha256:e8e54238fd7618fa94e90ae60b1dfac8833943027d04e71be84cb03702f1cebf",
"protocolHash": "sha256:7631d15b16e327ff08d728e97ac5f90f5150d00774938e720bbbc6830b77e0cf",
"schemaHash": "sha256:a2e5ecf4c03332180004b59dee01100b62160c65aa857b645ce6656b2c4b0346",
"protocolHash": "sha256:30f19c9f4d29280a02ddf67c4df62cdc92c4e8090792f43d6b1bdafea3e31273",
"schemaHash": "sha256:e384dd6cdb8281665ceb58e3d51292e3d3c965972dfd2f70ebd3fbef89dd9c40",
"surface": {
"kind": "role",
"name": "user"
},
"trustedPresets": [],
"version": 2
"version": 1
},
"revalidation": {
"dependencies": [
Expand Down Expand Up @@ -141,14 +141,14 @@ export const Command_pingTodos: ReplicaCommandArtifact<Command_pingTodos_Input,
},
"protocol": {
"operation": "sha256:3cb3c1e96331b4e98191cc725ab6b01c0e9b04cc7cc0f37f4fa0ef394fee9acf",
"protocolHash": "sha256:7631d15b16e327ff08d728e97ac5f90f5150d00774938e720bbbc6830b77e0cf",
"schemaHash": "sha256:a2e5ecf4c03332180004b59dee01100b62160c65aa857b645ce6656b2c4b0346",
"protocolHash": "sha256:30f19c9f4d29280a02ddf67c4df62cdc92c4e8090792f43d6b1bdafea3e31273",
"schemaHash": "sha256:e384dd6cdb8281665ceb58e3d51292e3d3c965972dfd2f70ebd3fbef89dd9c40",
"surface": {
"kind": "role",
"name": "user"
},
"trustedPresets": [],
"version": 2
"version": 1
},
"revalidation": {
"dependencies": [
Expand Down Expand Up @@ -288,14 +288,14 @@ export const Command_projectTodo: ReplicaCommandArtifact<Command_projectTodo_Inp
},
"protocol": {
"operation": "sha256:f986d060555cdedfe94621914116306af704d8bb90e75289722a3b7119211d32",
"protocolHash": "sha256:7631d15b16e327ff08d728e97ac5f90f5150d00774938e720bbbc6830b77e0cf",
"schemaHash": "sha256:a2e5ecf4c03332180004b59dee01100b62160c65aa857b645ce6656b2c4b0346",
"protocolHash": "sha256:30f19c9f4d29280a02ddf67c4df62cdc92c4e8090792f43d6b1bdafea3e31273",
"schemaHash": "sha256:e384dd6cdb8281665ceb58e3d51292e3d3c965972dfd2f70ebd3fbef89dd9c40",
"surface": {
"kind": "role",
"name": "user"
},
"trustedPresets": [],
"version": 2
"version": 1
},
"revalidation": {
"dependencies": [
Expand Down
6 changes: 3 additions & 3 deletions distributed_cli/tests/fixtures/generated-operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ export const Operation_ScalarInputs: ReplicaOperationArtifact<Operation_ScalarIn
"column": 3
},
"variableCodec": {
"version": 2,
"version": 1,
"limits": {
"maxDepth": 8,
"maxBoolWidth": 256,
Expand Down Expand Up @@ -825,8 +825,8 @@ export const Operation_ScalarInputs: ReplicaOperationArtifact<Operation_ScalarIn
}
],
"protocol": {
"version": 2,
"schemaHash": "sha256:63737ff8cea51b1e2aae673c6644af9f59fc34a666f4efe743415be441b44567",
"version": 1,
"schemaHash": "sha256:9d0d6ec390c7402779a98490ce3e046de73c59f1e2534928927495e1407547fe",
"surface": {
"kind": "role",
"name": "user"
Expand Down
6 changes: 3 additions & 3 deletions distributed_cli/tests/fixtures/generated-scalar-operation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const Operation_RustRuntimeBridge: ReplicaOperationArtifact<Operation_Rus
"column": 3
},
"variableCodec": {
"version": 2,
"version": 1,
"limits": {
"maxDepth": 8,
"maxBoolWidth": 256,
Expand Down Expand Up @@ -116,8 +116,8 @@ export const Operation_RustRuntimeBridge: ReplicaOperationArtifact<Operation_Rus
}
],
"protocol": {
"version": 2,
"schemaHash": "sha256:932aaf585be36d8eb05c646a66a1c44c94303f398577c71512491d26347e78f5",
"version": 1,
"schemaHash": "sha256:7441d46de81cf919ae22ce29884bdbd7ba436d4f7bf56721156e9b1b8cbc3834",
"surface": {
"kind": "role",
"name": "user"
Expand Down
6 changes: 3 additions & 3 deletions distributed_cli/tests/fixtures/runtime-bridge-operation.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"column": 3
},
"variableCodec": {
"version": 2,
"version": 1,
"limits": {
"maxDepth": 8,
"maxBoolWidth": 256,
Expand Down Expand Up @@ -97,8 +97,8 @@
}
],
"protocol": {
"version": 2,
"schemaHash": "sha256:932aaf585be36d8eb05c646a66a1c44c94303f398577c71512491d26347e78f5",
"version": 1,
"schemaHash": "sha256:7441d46de81cf919ae22ce29884bdbd7ba436d4f7bf56721156e9b1b8cbc3834",
"surface": {
"kind": "role",
"name": "user"
Expand Down
Loading
Loading