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
18 changes: 18 additions & 0 deletions pkgs/id/benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[package]
name = "id-benchmarks"
version = "0.1.0"
edition = "2021"
description = "Benchmark schema, synthetic workload fixture and reference oracle for the #9133 benchmark contract (C9133-01)"
license = "MIT OR Apache-2.0"

# Standalone crate: deliberately not a member of the pkgs/id workspace
# (the slice owns only this crate; the workspace root is a shared file
# this slice does not edit). Run via:
# cargo test --manifest-path pkgs/id/benchmarks/Cargo.toml --test workload_oracle
[workspace]

[dependencies]
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
sha2 = "0.11"
hex = "0.4"
187 changes: 187 additions & 0 deletions pkgs/id/benchmarks/fixtures/synthetic-workload.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,187 @@
{
"format": "id-atlas-synthetic-workload/v3",
"measurement_status": "synthetic correctness fixture; no timings measured",
"identity_profile": "fixture-only SHA256 over exact profile bytes; not a production ContentId algorithm claim",
"physical_key_profile": "fixture-only immutable generation-qualified keys; key non-reuse modeled, not provider-enforced",
"tenant": "tenant-a",
"expected_content_id": "sha256:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad",
"operations": [
{
"id": "blob_put_if_absent",
"input": { "bytes_hex": "616263", "metadata": { "owner": "fixture" } },
"expected": {
"accepted": true,
"created": true,
"generation": 1,
"physical_key": "fixture/sha256-ba7816bf/gen-1",
"lifecycle": "Live",
"row_revision": 1
},
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
},
{
"id": "blob_put_if_absent",
"input": { "bytes_hex": "616263", "metadata": { "owner": "fixture" } },
"expected": {
"accepted": true,
"created": false,
"generation": 1,
"lifecycle": "Live",
"reference_count": 0,
"row_revision": 1
},
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
},
{
"id": "blob_get",
"input": {},
"expected": { "bytes_hex": "616263", "generation": 1, "lifecycle": "Live" },
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
},
{
"id": "metadata_lookup",
"input": {},
"expected": { "metadata": { "owner": "fixture" }, "generation": 1 },
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
},
{
"id": "metadata_scan",
"input": { "tenant": "tenant-a", "prefix": "sha256:" },
"expected": { "content_ids": ["sha256:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"] },
"engine_support": { "d1": "supported", "r2": "unsupported", "redb": "supported", "turso": "supported" }
},
{
"id": "ref_commit_if_live",
"input": { "generation": 1, "reference": "loc-1" },
"expected": { "accepted": true, "generation": 1, "reference_count": 1 },
"engine_support": {
"d1": "supported",
"r2": "external-authority-required",
"redb": "supported",
"turso": "supported"
}
},
{
"id": "blob_put_if_absent",
"input": { "bytes_hex": "616263", "metadata": { "owner": "fixture" } },
"expected": {
"accepted": true,
"created": false,
"generation": 1,
"lifecycle": "Live",
"reference_count": 1,
"row_revision": 1
},
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
},
{
"id": "object_tombstone_delete",
"input": { "generation": 1 },
"expected": { "tombstoned": false, "reason": "references-present", "lifecycle": "Live" },
"engine_support": {
"d1": "authority-fence-only",
"r2": "external-authority-fence-required",
"redb": "authority-fence-only",
"turso": "authority-fence-only"
}
},
{
"id": "ref_remove",
"input": { "generation": 1, "reference": "loc-1" },
"expected": { "removed": true, "reference_count": 0 },
"engine_support": {
"d1": "supported",
"r2": "external-authority-required",
"redb": "supported",
"turso": "supported"
}
},
{
"id": "object_tombstone_delete",
"input": { "generation": 1 },
"expected": {
"tombstoned": true,
"generation": 1,
"physical_key": "fixture/sha256-ba7816bf/gen-1",
"lifecycle": "Tombstoned"
},
"engine_support": {
"d1": "authority-fence-only",
"r2": "external-authority-fence-required",
"redb": "authority-fence-only",
"turso": "authority-fence-only"
}
},
{
"id": "ref_commit_if_live",
"input": { "generation": 1, "reference": "late-ref" },
"expected": { "accepted": false, "reason": "generation-fenced" },
"engine_support": {
"d1": "supported",
"r2": "external-authority-required",
"redb": "supported",
"turso": "supported"
}
},
{
"id": "blob_put_if_absent",
"input": { "bytes_hex": "616263", "metadata": { "owner": "fixture" } },
"expected": {
"accepted": false,
"created": false,
"generation": 1,
"lifecycle": "Tombstoned",
"reason": "explicit-resurrection-required"
},
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
},
{
"id": "blob_put_if_absent",
"input": { "bytes_hex": "616263", "metadata": { "owner": "fixture" }, "resurrection": true },
"expected": {
"accepted": true,
"created": true,
"generation": 2,
"physical_key": "fixture/sha256-ba7816bf/gen-2",
"lifecycle": "Live",
"row_revision": 1,
"content_id": "sha256:ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad"
},
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
},
{
"id": "ref_commit_if_live",
"input": { "generation": 2, "reference": "loc-2" },
"expected": { "accepted": true, "generation": 2, "reference_count": 1 },
"engine_support": {
"d1": "supported",
"r2": "external-authority-required",
"redb": "supported",
"turso": "supported"
}
},
{
"id": "object_delete_captured_key",
"input": { "generation": 1 },
"expected": {
"deleted_key": "fixture/sha256-ba7816bf/gen-1",
"deleted": true,
"generation_2_key_present": true,
"generation_2_reference_count": 1,
"content_id_unchanged": true
},
"engine_support": {
"d1": "delete-captured-key-after-fence",
"r2": "plain-delete-captured-never-reused-key-after-fence",
"redb": "authority-then-plain-delete-captured-key",
"turso": "authority-then-plain-delete-captured-key"
}
},
{
"id": "blob_get",
"input": {},
"expected": { "bytes_hex": "616263", "generation": 2, "lifecycle": "Live" },
"engine_support": { "d1": "supported", "r2": "supported", "redb": "supported", "turso": "supported" }
}
]
}
77 changes: 77 additions & 0 deletions pkgs/id/benchmarks/result-v1.schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$id": "pkgs/id/benchmarks/result-v1.schema.json",
"title": "id-benchmarks result v1",
"description": "One engine's benchmark result document for the #9133 benchmark contract (S2.1-S2.3, S2.16). Local (redb/Turso laptop) and cloud (D1/R2) evidence follow-ups in benchmark-plan.json both emit this shape; local values are not cloud-comparable, and no result recommends a shard configuration.",
"type": "object",
"required": ["schema_version", "workload_id", "engine", "dataset_digest", "environment", "metrics"],
"additionalProperties": false,
"properties": {
"schema_version": { "const": 1 },
"workload_id": { "type": "string", "minLength": 1 },
"engine": { "enum": ["d1", "r2", "redb", "turso"] },
"dataset_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" },
"environment": {
"type": "object",
"required": [
"runner_version",
"git_revision",
"hardware_model",
"cpu_count",
"memory_bytes",
"os_kernel",
"runtime_versions",
"start_time_utc",
"cache_mode",
"storage_shard_count",
"dataset_digest"
],
"additionalProperties": false,
"properties": {
"runner_version": { "type": "string", "minLength": 1 },
"git_revision": { "type": "string", "minLength": 1 },
"hardware_model": { "type": "string", "minLength": 1 },
"cpu_count": { "type": "integer", "minimum": 1 },
"memory_bytes": { "type": "integer", "minimum": 1 },
"os_kernel": { "type": "string", "minLength": 1 },
"runtime_versions": { "type": "object" },
"start_time_utc": { "type": "string", "format": "date-time" },
"cache_mode": { "enum": ["cold", "warm"] },
"storage_shard_count": { "enum": [1, 4, 16, 64] },
"dataset_digest": { "type": "string", "pattern": "^sha256:[0-9a-f]{64}$" }
}
},
"metrics": {
"type": "object",
"required": ["p50_ms", "p95_ms", "p99_ms", "throughput_ops_s", "error_rate"],
"additionalProperties": false,
"properties": {
"p50_ms": { "type": "number", "minimum": 0 },
"p95_ms": { "type": "number", "minimum": 0 },
"p99_ms": { "type": "number", "minimum": 0 },
"throughput_ops_s": { "type": "number", "minimum": 0 },
"error_rate": { "type": "number", "minimum": 0, "maximum": 1 },
"native_billed_units": { "type": "number", "minimum": 0 },
"durability_rpo": { "type": "string" },
"replica_lag": { "type": "string" }
}
},
"raw_samples": {
"type": "array",
"items": { "type": "number", "minimum": 0 }
},
"correctness": {
"type": "object",
"description": "The workload-oracle summary for the fixture the run used; a result whose correctness block is absent or failing is not evidence.",
"required": ["fixture_digest_verified", "reference_transitions_executed_and_matched", "engine_operation_capability_mappings_checked"],
"additionalProperties": false,
"properties": {
"fixture_digest_verified": { "type": "boolean" },
"reference_transitions_executed_and_matched": { "type": "integer", "minimum": 0 },
"engine_operation_capability_mappings_checked": { "type": "integer", "minimum": 0 },
"timings_measured": { "type": "boolean" },
"provider_calls": { "type": "integer", "minimum": 0 }
}
}
}
}
Loading