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
14 changes: 14 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,9 @@ jobs:
run: bash scripts/ci/check_pypi_publisher_metadata.sh dist

- name: Prepare generated Python live fixture
# The acceptance service is TypeDB 3.12.3, whose semantic profile is 3.12.1.
env:
TYPE_BRIDGE_ACCEPTANCE_SEMANTIC_PROFILE: typedb-3.12.1/v1
run: >-
scripts/ci/prepare_generated_live_fixture.sh python
tmp/release-generated-python
Expand Down Expand Up @@ -908,6 +911,9 @@ jobs:
run: npm run typecheck:projection-integration

- name: Prepare generated Node live fixture
# The acceptance service is TypeDB 3.12.3, whose semantic profile is 3.12.1.
env:
TYPE_BRIDGE_ACCEPTANCE_SEMANTIC_PROFILE: typedb-3.12.1/v1
run: >-
"$GITHUB_WORKSPACE/scripts/ci/prepare_generated_live_fixture.sh" node
"$GITHUB_WORKSPACE/tmp/release-generated-node"
Expand Down Expand Up @@ -1304,6 +1310,8 @@ jobs:
TYPEDB_ADDRESS: localhost:1729
TYPEDB_HTTP_PORT: "8000"
TYPE_BRIDGE_RUST_PROJECTION_INTG_DATABASE: release_rust_projection_live
# The service is TypeDB 3.12.3, whose semantic profile is 3.12.1.
TYPE_BRIDGE_ACCEPTANCE_SEMANTIC_PROFILE: typedb-3.12.1/v1
ACCEPTANCE_TARGET_DIR: ${{ runner.temp }}/release-rust-projection-target
run: >-
timeout --foreground 15m
Expand Down Expand Up @@ -1552,6 +1560,8 @@ jobs:
- name: Run exact-wheel generated Python application
env:
TYPE_BRIDGE_GENERATED_PARITY_REPORT: ${{ runner.temp }}/release-generated-parity.xml
# The service is TypeDB 3.12.3, whose semantic profile is 3.12.1.
TYPE_BRIDGE_ACCEPTANCE_SEMANTIC_PROFILE: typedb-3.12.1/v1
run: |
cd "$RUNNER_TEMP"
PATH="$RUNNER_TEMP/release-generated-parity/bin:$PATH" \
Expand Down Expand Up @@ -1631,6 +1641,10 @@ jobs:

- name: Run exact-package generated Node application
working-directory: type-bridge-core/crates/node
env:
# The service is TypeDB 3.12.3, whose semantic profile is 3.12.1.
TYPE_BRIDGE_ACCEPTANCE_SEMANTIC_PROFILE: typedb-3.12.1/v1
TYPEDB_VERSION: 3.12.3
run: >-
node --test --test-concurrency=1
"$TYPE_BRIDGE_GENERATED_NODE_STAGE/harness/tests/projection-integration/generated-package-live.test.js"
Expand Down
9 changes: 6 additions & 3 deletions docs/development/performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,12 @@ runners sit above the comparison noise threshold.

Each iteration builds its plans with the SDK plan builder, stages them on a
`Transaction`, commits and checks the answers. `type-bridge-perf` (a private
crate, never a dependency of a shipped crate) installs a `tracing` layer that
sums the [stage spans](#stage-spans): each span counts its wall time minus
that of its stage children, so nested stages never count twice.
crate, never a dependency of a shipped crate) installs the `tracing` layer of
`type-bridge-perf-stages`, which sums the [stage spans](#stage-spans): each
span counts its wall time minus that of its stage children, so nested stages
never count twice. The bindings' off-by-default `perf-stages` feature links
only that leaf crate, which has no path dependencies, so a binding's source
archive does not have to carry the SDK.
Time inside no span is SDK-side work, for example the Rust SDK checking the
schema package each time it builds a plan.

Expand Down
2 changes: 1 addition & 1 deletion scripts/ci/cargo_release_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
}
)
# Repository tooling that measures the product; never a dependency of it.
EXPECTED_PRIVATE_TOOLING = frozenset({"type-bridge-perf"})
EXPECTED_PRIVATE_TOOLING = frozenset({"type-bridge-perf", "type-bridge-perf-stages"})
# The one way a package may link tooling: a private binding's optional
# dependency enabled only by this off-by-default feature.
PERF_STAGES_FEATURE = "perf-stages"
Expand Down
8 changes: 8 additions & 0 deletions scripts/ci/cargo_release_inventory.toml
Original file line number Diff line number Diff line change
Expand Up @@ -215,3 +215,11 @@ classification = "private-tooling"
role = "perf-harness"
version-policy = "lockstep"
docs-target = "none"

[[packages]]
name = "type-bridge-perf-stages"
manifest = "crates/perf-stages/Cargo.toml"
classification = "private-tooling"
role = "perf-harness"
version-policy = "lockstep"
docs-target = "none"
4 changes: 2 additions & 2 deletions scripts/ci/validate_python_release_artifacts.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,12 @@
"vendor/typedb-protocol-b8",
"vendor/typedb-driver-b8",
)
# Maturin 1.14.1 does not discover the optional orm-derive path dependency
# Maturin 1.14.1 does not discover the optional orm-derive and perf-stages path dependencies
# while constructing the Python sdist. pyproject.toml therefore includes this
# source root explicitly. Unlike Cargo-packaged workspace members, the explicit
# include is copied byte-for-byte: its manifest keeps workspace inheritance,
# and Cargo resolves license-file to the archive's canonical root LICENSE.
CORE_SDIST_EXPLICIT_RAW_SOURCE_ROOTS = ("crates/orm-derive",)
CORE_SDIST_EXPLICIT_RAW_SOURCE_ROOTS = ("crates/orm-derive", "crates/perf-stages")
CORE_SDIST_SOURCE_ROOTS = (
CORE_SDIST_WORKSPACE_MEMBERS
+ CORE_SDIST_EXPLICIT_RAW_SOURCE_ROOTS
Expand Down
2 changes: 1 addition & 1 deletion tests/contracts/c-broad-case-ledger.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"source_commit": "177ce24ac182b94269561c8622e5533d29891a44",
"authorities": [
{"path": "tests/contracts/c-artifact-journey-v1.json", "sha256": "76e7057180129fd5e0e7d47a314cb6059c4fc69f99d59942b690e99331b5270f"},
{"path": "tests/contracts/c-distribution-v1.json", "sha256": "8c3a9dec2a676dc840ab9a2d89d50e5f01924c15a86d19d1b5e2f3d9c42c3938"}
{"path": "tests/contracts/c-distribution-v1.json", "sha256": "b74fa5acfe6eb429777b865d7397b174cac7b5a47be70a4a9778ca39d324fd67"}
]
}
},
Expand Down
2 changes: 1 addition & 1 deletion tests/contracts/c-distribution-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@
"source_authorities": [
{
"path": "type-bridge-core/crates/c/Cargo.toml",
"sha256": "c0ca37d12896cd32313b7f3ca65b568d7ead9c1f39c2697f98f6a72178aa354e"
"sha256": "a34c60b3e78207c720205312f0e0dc72081dc0ef5fa2e03114cc2f80755db763"
},
{
"path": "type-bridge-core/crates/c/CMakeLists.txt",
Expand Down
21 changes: 11 additions & 10 deletions tests/unit/compat/test_cargo_release_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,21 @@ def test_repository_inventory_closes_every_cargo_product_class() -> None:

assert inventory.release_version == "2.3.0"
assert inventory.first_party_msrv == "1.88"
assert len(inventory.packages) == 23
assert len(inventory.packages) == 24
assert len(inventory.public_packages) == 19
assert len(inventory.first_party_packages) == 17
assert len(inventory.immutable_packages) == 2
assert len(inventory.private_packages) == 4
assert len(inventory.private_packages) == 5
assert [package.publish_order for package in inventory.public_packages] == list(range(1, 20))
assert {package.name for package in inventory.binding_packages} == {
"type-bridge-c",
"type-bridge-core",
"type-bridge-node",
}
assert [package.name for package in inventory.tooling_packages] == ["type-bridge-perf"]
assert [package.name for package in inventory.tooling_packages] == [
"type-bridge-perf",
"type-bridge-perf-stages",
]
assert set(inventory.private_packages) == {
*inventory.binding_packages,
*inventory.tooling_packages,
Expand Down Expand Up @@ -222,9 +225,7 @@ def test_tooling_dependency_rule_accepts_the_checked_in_manifests() -> None:
assert inventory_module.tooling_dependency_violations(inventory, workspace) == []


PYTHON_PERF_DEPENDENCY = (
'type-bridge-perf = { path = "../perf", default-features = false, optional = true }'
)
PYTHON_PERF_DEPENDENCY = 'type-bridge-perf-stages = { path = "../perf-stages", default-features = false, optional = true }'


@pytest.mark.parametrize(
Expand All @@ -233,19 +234,19 @@ def test_tooling_dependency_rule_accepts_the_checked_in_manifests() -> None:
(
"crates/orm/Cargo.toml",
"[dependencies]\n",
'[dependencies]\ntype-bridge-perf = { path = "../perf", optional = true }\n',
'[dependencies]\ntype-bridge-perf-stages = { path = "../perf-stages", optional = true }\n',
"only a private binding may link tooling",
),
(
"crates/python/Cargo.toml",
PYTHON_PERF_DEPENDENCY,
'type-bridge-perf = { path = "../perf", default-features = false }',
'type-bridge-perf-stages = { path = "../perf-stages", default-features = false }',
"must be an optional normal dependency",
),
(
"crates/python/Cargo.toml",
PYTHON_PERF_DEPENDENCY,
'type-bridge-perf = { path = "../perf", optional = true }',
'type-bridge-perf-stages = { path = "../perf-stages", optional = true }',
"must be an optional normal dependency",
),
(
Expand All @@ -257,7 +258,7 @@ def test_tooling_dependency_rule_accepts_the_checked_in_manifests() -> None:
(
"crates/python/Cargo.toml",
"default = []",
'default = []\nprofiling = ["type-bridge-perf/pipelines"]',
'default = []\nprofiling = ["type-bridge-perf-stages/tracing"]',
"must be enabled by 'perf-stages' alone",
),
],
Expand Down
15 changes: 7 additions & 8 deletions tests/unit/compat/test_python_release_artifact_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -957,14 +957,13 @@ def test_core_sdist_rejects_non_generated_symbolic_and_nonregular_inputs(
validator.core_sdist_source_authorities(tmp_path)


def test_core_sdist_optional_derive_source_is_an_exact_raw_include() -> None:
assert "crates/orm-derive" in validator.CORE_SDIST_SOURCE_ROOTS
assert "crates/orm-derive" in validator.CORE_SDIST_EXPLICIT_RAW_SOURCE_ROOTS
assert "crates/orm-derive" not in validator.CORE_SDIST_WORKSPACE_MEMBERS
assert (
"crates/orm-derive/Cargo.toml" not in validator.CORE_SDIST_TRANSFORMED_FIRST_PARTY_MANIFESTS
)
assert "crates/orm-derive/LICENSE" not in validator.CORE_SDIST_GENERATED_LICENSES
@pytest.mark.parametrize("root", ["crates/orm-derive", "crates/perf-stages"])
def test_core_sdist_optional_path_sources_are_exact_raw_includes(root: str) -> None:
assert root in validator.CORE_SDIST_SOURCE_ROOTS
assert root in validator.CORE_SDIST_EXPLICIT_RAW_SOURCE_ROOTS
assert root not in validator.CORE_SDIST_WORKSPACE_MEMBERS
assert f"{root}/Cargo.toml" not in validator.CORE_SDIST_TRANSFORMED_FIRST_PARTY_MANIFESTS
assert f"{root}/LICENSE" not in validator.CORE_SDIST_GENERATED_LICENSES


def test_core_sdist_rejects_changed_raw_optional_derive_manifest(tmp_path: Path) -> None:
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/compat/test_release_identity_validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ def test_repository_cargo_graph_is_complete_and_ordered() -> None:
"type-bridge-core",
"type-bridge-node",
"type-bridge-perf",
"type-bridge-perf-stages",
]
dependency_order = report["cargo_manifest_dependency_order"]
assert isinstance(dependency_order, dict)
Expand Down Expand Up @@ -263,6 +264,7 @@ def test_repository_cargo_graph_is_complete_and_ordered() -> None:
"type-bridge-orm",
"type-bridge-orm-derive",
"type-bridge-perf",
"type-bridge-perf-stages",
"type-bridge-query",
"type-bridge-schema",
"type-bridge-schema-codegen",
Expand Down
21 changes: 17 additions & 4 deletions tests/unit/compat/test_rust_generated_parity_inventory.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,24 @@ def test_only_binding_perf_stages_features_depend_on_the_private_perf_harness()
dependents = sorted(
manifest.parent.name
for manifest in (workspace / "crates").glob("*/Cargo.toml")
if _depends_on(tomllib.loads(manifest.read_text(encoding="utf-8")), "type-bridge-perf")
if _depends_on(
tomllib.loads(manifest.read_text(encoding="utf-8")), "type-bridge-perf-stages"
)
)
assert dependents == ["c", "node", "python"]
perf = tomllib.loads((workspace / "crates/perf/Cargo.toml").read_text(encoding="utf-8"))
assert perf["package"]["publish"] is False
# The bindings and the pipelines harness, which re-exports the layer.
assert dependents == ["c", "node", "perf", "python"]
# The bindings link only the stage layer, never the pipelines harness.
assert not [
manifest.parent.name
for manifest in (workspace / "crates").glob("*/Cargo.toml")
if manifest.parent.name not in {"perf", "perf-stages"}
and _depends_on(tomllib.loads(manifest.read_text(encoding="utf-8")), "type-bridge-perf")
]
for crate in ("perf", "perf-stages"):
manifest = tomllib.loads(
(workspace / f"crates/{crate}/Cargo.toml").read_text(encoding="utf-8")
)
assert manifest["package"]["publish"] is False


def _assert_source_evidence(item: dict[str, Any]) -> None:
Expand Down
1 change: 1 addition & 0 deletions tests/unit/infra/test_release_artifact_gates.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ def test_core_sdist_includes_optional_rust_path_dependency() -> None:
"path": "crates/orm-derive/**/*",
"format": "sdist",
} in included
assert {"path": "crates/perf-stages/**/*", "format": "sdist"} in included
assert {"path": "LICENSE", "format": "sdist"} in included


Expand Down
18 changes: 13 additions & 5 deletions type-bridge-core/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions type-bridge-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ members = [
"crates/rust",
"crates/toml-transpiler",
"crates/perf",
"crates/perf-stages",
"vendor/typedb-protocol-b8",
"vendor/typedb-driver-b8",
]
Expand Down
4 changes: 2 additions & 2 deletions type-bridge-core/crates/c/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,13 @@ serde_json = "1"
tokio = { version = "1", features = ["full"] }
tracing = { version = "0.1", default-features = false, features = ["std"] }
# Private perf harness; only the off-by-default `perf-stages` feature links it.
type-bridge-perf = { path = "../perf", default-features = false, optional = true }
type-bridge-perf-stages = { path = "../perf-stages", default-features = false, optional = true }

[features]
default = []
# The private, non-ABI `tb_perf_stages_json` recorder for the perf drivers.
# Never enabled for shipped archives.
perf-stages = ["dep:type-bridge-perf"]
perf-stages = ["dep:type-bridge-perf-stages"]

[dev-dependencies]
sha2 = "0.10"
Expand Down
2 changes: 1 addition & 1 deletion type-bridge-core/crates/c/src/perf_stages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ pub(crate) fn entry() -> tracing::Span {
#[cfg(feature = "perf-stages")]
#[unsafe(no_mangle)]
pub unsafe extern "C" fn tb_perf_stages_json(buffer: *mut u8, capacity: usize) -> usize {
let Ok(times) = type_bridge_perf::stages::recorder() else {
let Ok(times) = type_bridge_perf_stages::recorder() else {
return usize::MAX;
};
let stages = times.take();
Expand Down
4 changes: 2 additions & 2 deletions type-bridge-core/crates/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ default = []
contract-test-adapter = []
# The private `_perfStages()` recorder for the perf drivers. Never enabled
# for shipped packages.
perf-stages = ["dep:type-bridge-perf"]
perf-stages = ["dep:type-bridge-perf-stages"]

[dependencies]
type-bridge-contract = { path = "../contract", version = "2.3.0" }
Expand All @@ -35,7 +35,7 @@ serde_json = "1.0"
tokio = { version = "1", features = ["rt-multi-thread", "sync"] }
tracing = { version = "0.1", default-features = false, features = ["std"] }
# Private perf harness; only the off-by-default `perf-stages` feature links it.
type-bridge-perf = { path = "../perf", default-features = false, optional = true }
type-bridge-perf-stages = { path = "../perf-stages", default-features = false, optional = true }

[build-dependencies]
napi-build = "2"
Expand Down
2 changes: 1 addition & 1 deletion type-bridge-core/crates/node/src/perf_stages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn entry() -> tracing::Span {
#[cfg(feature = "perf-stages")]
#[napi_derive::napi(js_name = "_perfStages")]
pub fn perf_stages() -> napi::Result<std::collections::HashMap<String, i64>> {
let times = type_bridge_perf::stages::recorder()
let times = type_bridge_perf_stages::recorder()
.map_err(|error| napi::Error::new(napi::Status::GenericFailure, error.to_string()))?;
Ok(times
.take()
Expand Down
23 changes: 23 additions & 0 deletions type-bridge-core/crates/perf-stages/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
[package]
name = "type-bridge-perf-stages"
version = "2.3.0"
edition = "2024"
rust-version = "1.88"
description = "Private perf harness: exclusive wall time per TypeBridge stage span"
license.workspace = true
license-file.workspace = true
repository.workspace = true
authors.workspace = true
# The SDK bindings' off-by-default perf-stages feature links this leaf crate;
# it has no path dependencies, so a binding's source archive stays loadable.
publish = false

[dependencies]
tracing = "0.1"
tracing-subscriber = { version = "0.3", default-features = false, features = ["registry", "std"] }

[dev-dependencies]
tokio = { version = "1", features = ["rt", "time"] }

[lints]
workspace = true
Loading
Loading