Skip to content

armgit / cua

Public Imported from GitHub
0

Scale computer-use 2.0 with open-source drivers, cross-OS sandboxes, and benchmarks for training, evaluation, and data generation.

feat(osgym): add creation TTL for pools and claims (#7058)

r33drichardsb67e9ae1cafc
diff --git a/libs/fleet/scripts/check_sdk_binding_contract_sources.py b/libs/fleet/scripts/check_sdk_binding_contract_sources.py
index e1b24c9084..a901cbc9ec 100755
--- a/libs/fleet/scripts/check_sdk_binding_contract_sources.py
+++ b/libs/fleet/scripts/check_sdk_binding_contract_sources.py
@@ -128,6 +128,35 @@ def strip_ruby_comments(text: str) -> str:
return "".join(output)
+def strip_yaml_comments(text: str) -> str:
+ output = []
+ quote = None
+ for line in text.splitlines(keepends=True):
+ kept = []
+ index = 0
+ while index < len(line):
+ character = line[index]
+ if quote is None and character == "#" and (index == 0 or line[index -1].isspace()):
+ break
+ kept.append(character)
+ if quote is None and character in {"'", '"'}:
+ quote = character
+ elif quote == "'":
+ if character == "'" and index + 1 < len(line) and line[index + 1] == "'":
+ kept.append(line[index + 1])
+ index += 1
+ elif character == "'":
+ quote = None
+ elif character == "\\" and index + 1 < len(line):
+ kept.append(line[index + 1])
+ index += 1
+ elif character == '"':
+ quote = None
+ index += 1
+ output.append("".join(kept))
+ return "".join(output)
+
+
def executable_source(path: Path) -> str:
text = path.read_text(encoding="utf-8")
if path.suffix == ".py":
@@ -136,6 +165,8 @@ def executable_source(path: Path) -> str:
return strip_c_like_comments(text)
if path.suffix == ".rb":
return strip_ruby_comments(text)
+ if path.suffix in {".yml", ".yaml"}:
+ return strip_yaml_comments(text)
return text
@@ -158,6 +189,296 @@ def require_kotlin_build(path: Path) -> None:
require_all(executable_source(path), path, KOTLIN_BUILD_CHECKS)
+def yaml_mapping_block(source: str, key: str, indent: int, path: Path) -> str:
+ lines = source.splitlines(keepends=True)
+ prefix = " " * indent + f"{key}:"
+ start = next(
+ (
+ index
+ for index, line in enumerate(lines)
+ if line.startswith(prefix) and not line[len(prefix):].strip()
+ ),
+ None,
+ )
+ if start is None:
+ raise ContractFailure(f"binding contract check failed: YAML block {key} ({path})")
+
+ end = len(lines)
+ for index in range(start + 1, len(lines)):
+ line = lines[index]
+ if line.strip() and len(line) - len(line.lstrip(" ")) <= indent:
+ end = index
+ break
+ return "".join(lines[start:end])
+
+
+def yaml_job_block(source: str, name: str, path: Path) -> str:
+ return yaml_mapping_block(yaml_mapping_block(source, "jobs", 0, path), name, 2, path)
+
+
+def yaml_step_blocks(job: str, path: Path) -> list[str]:
+ steps = yaml_mapping_block(job, "steps", 4, path)
+ lines = steps.splitlines(keepends=True)
+ starts = [index for index, line in enumerate(lines) if line.startswith(" - ")]
+ if not starts:
+ raise ContractFailure(f"binding contract check failed: YAML step blocks ({path})")
+ return ["".join(lines[start:end]) for start, end in zip(starts, starts[1:] + [len(lines)])]
+
+
+def yaml_named_step(steps: list[str], name: str, path: Path) -> str:
+ pattern = rf"^ - name:\s*{re.escape(name)}\s*$"
+ for step in steps:
+ if re.search(pattern, step, flags=re.MULTILINE):
+ return step
+ raise ContractFailure(f"binding contract check failed: workflow step {name} ({path})")
+
+
+def is_trusted_uniffi_ec2_event(
+ event_name: str,
+ is_fork: bool,
+ head_repository: str,
+ repository: str,
+ actor: str,
+) -> bool:
+ return event_name != "pull_request" or (
+ not is_fork and head_repository == repository and actor != "dependabot[bot]"
+ )
+
+
+def sdk_bindings_route(
+ trusted_event: bool,
+ start_result: str,
+ run_attempt: str,
+ run_id: str,
+) -> tuple[bool, str | None]:
+ if not trusted_event:
+ return True, "ubuntu-24.04"
+ if start_result == "success":
+ return True, f"cyclops-sdk-diag-{run_attempt}-{run_id}"
+ return False, None
+
+
+def require_sdk_bindings_workflow(path: Path) -> None:
+ source = executable_source(path)
+ permissions = yaml_mapping_block(source, "permissions", 0, path)
+ environment = yaml_mapping_block(source, "env", 0, path)
+ start = yaml_job_block(source, "start-sdk-bindings-runner", path)
+ sdk = yaml_job_block(source, "sdk-bindings", path)
+ stop = yaml_job_block(source, "stop-sdk-bindings-runner", path)
+ diagnostics_tests = yaml_job_block(source, "uniffi-diagnostics-tests", path)
+
+ for trigger_path in (
+ ".github/scripts/uniffi-diagnostics/**",
+ ".github/scripts/tests/test_run_with_otel.py",
+ ):
+ if source.count(f'"{trigger_path}"') != 2:
+ raise ContractFailure(
+ f"binding contract check failed: diagnostic path trigger {trigger_path} ({path})"
+ )
+
+ require_all(permissions, path, [
+ ("workflow contents permission", r"^ contents:\s*read\s*$"),
+ ])
+ forbid(permissions, "workflow-level EC2 OIDC permission", r"^ id-token:\s*write\s*$", path)
+ require_all(environment, path, [
+ ("EC2 AWS region", r"^ AWS_REGION:\s*us-west-2\s*$"),
+ ("EC2 AWS account", r"^ AWS_ACCOUNT_ID:\s*['\"]?296062593712['\"]?\s*$"),
+ ("EC2 runner role", r"^ EC2_RUNNER_IAM_ROLE:\s*github-actions-nixos-ami\s*$"),
+ ("EC2 diagnostic instance type", r"^ EC2_RUNNER_INSTANCE_TYPE:\s*m7i\.2xlarge\s*$"),
+ ("EC2 runner subnet", r"^ EC2_RUNNER_SUBNET_ID:\s*subnet-0ca86dea50cd84d24\s*$"),
+ ("EC2 runner security group", r"^ EC2_RUNNER_SECURITY_GROUP_ID:\s*sg-078f4e7b96883e60e\s*$"),
+ ])
+
+ diagnostics_test_steps = yaml_step_blocks(diagnostics_tests, path)
+ diagnostics_test_checkout = yaml_named_step(diagnostics_test_steps, "Checkout code", path)
+ diagnostics_test_python = yaml_named_step(diagnostics_test_steps, "Set up Python", path)
+ diagnostics_test_run = yaml_named_step(diagnostics_test_steps, "Run UniFFI diagnostic wrapper tests", path)
+ require_all(diagnostics_tests, path, [
+ ("diagnostic test runner host", r"^ runs-on:\s*ubuntu-latest\s*$"),
+ ])
+ require_all(diagnostics_test_checkout, path, [
+ ("diagnostic test checkout", r"uses:\s*actions/checkout@[^\n]+"),
+ ])
+ require_all(diagnostics_test_python, path, [
+ ("diagnostic test Python setup", r"uses:\s*actions/setup-python@[^\n]+"),
+ ("diagnostic test Python version", r"python-version:\s*['\"]?3\.11['\"]?"),
+ ])
+ require_all(diagnostics_test_run, path, [
+ ("diagnostic test requirements", r"python3\s+-m\s+pip\s+install\s+--disable-pip-version-check\s+-r\s+\.github/scripts/uniffi-diagnostics/requirements\.txt"),
+ ("diagnostic wrapper test command", r"python3\s+\.github/scripts/tests/test_run_with_otel\.py\s+-v"),
+ ("diagnostic workflow contract command", r"cyclops-cs/scripts/check-sdk-binding-contract-sources\.sh"),
+ ("diagnostic workflow contract self-test", r"cyclops-cs/scripts/check-sdk-binding-contract-sources\.sh\s+--self-test"),
+ ])
+
+ start_permissions = yaml_mapping_block(start, "permissions", 4, path)
+ start_steps = yaml_step_blocks(start, path)
+ start_credentials = yaml_named_step(start_steps, "Configure AWS credentials", path)
+ ami_lookup = yaml_named_step(start_steps, "Get latest Ubuntu 24.04 AMI", path)
+ start_runner = yaml_named_step(start_steps, "Start EC2 runner", path)
+ resolve = yaml_named_step(start_steps, "Resolve EC2 runner instance", path)
+ require_all(start, path, [
+ ("EC2 start waits for diagnostic tests", r"^ needs:\s*uniffi-diagnostics-tests\s*$"),
+ ("EC2 start runner host", r"^ runs-on:\s*ubuntu-latest\s*$"),
+ ('trusted EC2 start guard', "^ if:\\s*\\$\\{\\{\\s*github\\.event_name\\s*!=\\s*'pull_request'\\s*\\|\\|\\s*\\(\\s*github\\.event\\.pull_request\\.head\\.repo\\.full_name\\s*==\\s*github\\.repository\\s*&&\\s*github\\.event\\.pull_request\\.head\\.repo\\.fork\\s*==\\s*false\\s*&&\\s*github\\.actor\\s*!=\\s*'dependabot\\[bot\\]'\\s*\\)\\s*\\}\\}\\s*$"),
+ ("EC2 start instance output", r"^ ec2-instance-id:\s*\$\{\{\s*steps\.resolve-ec2\.outputs\.ec2-instance-id\s*\}\}\s*$"),
+ ])
+ forbid(start, "EC2 action output reliance", r"steps\.start-ec2\.outputs\.ec2-instance-id", path)
+ require_all(start_permissions, path, [
+ ("EC2 start OIDC permission", r"^ id-token:\s*write\s*$"),
+ ])
+ require_all(start_credentials, path, [
+ ("EC2 start AWS credentials action", r"uses:\s*aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c"),
+ ("EC2 start AWS role", r"role-to-assume:\s*arn:aws:iam::\$\{\{\s*env\.AWS_ACCOUNT_ID\s*\}\}:role/\$\{\{\s*env\.EC2_RUNNER_IAM_ROLE\s*\}\}"),
+ ("EC2 start AWS region", r"aws-region:\s*\$\{\{\s*env\.AWS_REGION\s*\}\}"),
+ ])
+ require_all(ami_lookup, path, [
+ ("EC2 AMI lookup id", r"id:\s*ami\s*$"),
+ ("EC2 Ubuntu AMI lookup", r"aws ec2 describe-images"),
+ ("EC2 Ubuntu AMI owner", r"--owners\s+099720109477"),
+ ("EC2 Ubuntu Noble AMI filter", r"--filters\s+\"Name=name,Values=ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24\.04-amd64-server-\*\""),
+ ("EC2 latest AMI query", r"--query\s+'sort_by\(Images,\s*&CreationDate\)\[-1\]\.ImageId'"),
+ ("EC2 AMI nonempty validation", r"test\s+-n\s+\"\$AMI_ID\""),
+ ("EC2 AMI None validation", r"test\s+\"\$AMI_ID\"\s*!=\s*\"None\""),
+ ("EC2 Ubuntu AMI output", r"echo\s+\"ami_id=\$AMI_ID\"\s*>>\s*\"\$GITHUB_OUTPUT\""),
+ ])
+ require_all(start_runner, path, [
+ ("EC2 start action id", r"id:\s*start-ec2\s*$"),
+ ("EC2 start action SHA", r"uses:\s*unblocked/ec2-action-builder@504a3cf746c6090065a66896a3addc2bb101b4ba"),
+ ("EC2 runner PAT secret", r"github_token:\s*\$\{\{\s*secrets\.QEMU_BUILD_GH_PERSONAL_ACCESS_TOKEN\s*\}\}"),
+ ("EC2 runner AWS access key", r"aws_access_key_id:\s*\$\{\{\s*env\.AWS_ACCESS_KEY_ID\s*\}\}"),
+ ("EC2 runner AWS secret key", r"aws_secret_access_key:\s*\$\{\{\s*env\.AWS_SECRET_ACCESS_KEY\s*\}\}"),
+ ("EC2 runner AWS session token", r"aws_session_token:\s*\$\{\{\s*env\.AWS_SESSION_TOKEN\s*\}\}"),
+ ("EC2 runner AWS region", r"aws_region:\s*\$\{\{\s*env\.AWS_REGION\s*\}\}"),
+ ("EC2 runner subnet wiring", r"ec2_subnet_id:\s*\$\{\{\s*env\.EC2_RUNNER_SUBNET_ID\s*\}\}"),
+ ("EC2 runner security group wiring", r"ec2_security_group_id:\s*\$\{\{\s*env\.EC2_RUNNER_SECURITY_GROUP_ID\s*\}\}"),
+ ("EC2 runner instance type wiring", r"ec2_instance_type:\s*\$\{\{\s*env\.EC2_RUNNER_INSTANCE_TYPE\s*\}\}"),
+ ("EC2 runner AMI wiring", r"ec2_ami_id:\s*\$\{\{\s*steps\.ami\.outputs\.ami_id\s*\}\}"),
+ ("EC2 runner root disk", r"ec2_root_disk_size_gb:\s*['\"]?60['\"]?"),
+ ("EC2 on-demand strategy", r"ec2_spot_instance_strategy:\s*None"),
+ ("EC2 runner TTL", r"ec2_instance_ttl:\s*60"),
+ ("EC2 runner version", r"github_action_runner_version:\s*['\"]?2\.333\.1['\"]?"),
+ ("EC2 attempt-unique label", r"github_action_runner_label_prefix:\s*cyclops-sdk-diag-\$\{\{\s*github\.run_attempt\s*\}\}-"),
+ ("EC2 instance tags", r"ec2_instance_tags:\s*>-"),
+ ("EC2 run-attempt tag", r"\"Key\":\s*\"github_run_attempt\"\s*,\s*\"Value\":\s*\"\$\{\{\s*github\.run_attempt\s*\}\}"),
+ ("EC2 repository ID tag", r"\"Key\":\s*\"github_repository_id\"\s*,\s*\"Value\":\s*\"\$\{\{\s*github\.repository_id\s*\}\}"),
+ ("EC2 diagnostic marker tag", r"\"Key\":\s*\"uniffi_diagnostic\"\s*,\s*\"Value\":\s*\"true\""),
+ ])
+ require_all(resolve, path, [
+ ("EC2 resolve step id", r"id:\s*resolve-ec2\s*$"),
+ ("unconditional EC2 resolve", r"^ if:\s*always\(\)\s*$"),
+ ("EC2 resolve query", r"aws\s+ec2\s+describe-instances"),
+ ("EC2 resolve run-id tag", r"Name=tag:github_job_id,Values=\$\{\{\s*github\.run_id\s*\}\}"),
+ ("EC2 resolve repository tag", r"Name=tag:github_repo,Values=\$\{\{\s*github\.event\.repository\.name\s*\}\}"),
+ ("EC2 resolve repository ID tag", r"Name=tag:github_repository_id,Values=\$\{\{\s*github\.repository_id\s*\}\}"),
+ ("EC2 resolve run-attempt tag", r"Name=tag:github_run_attempt,Values=\$\{\{\s*github\.run_attempt\s*\}\}"),
+ ("EC2 resolve diagnostic tag", r"Name=tag:uniffi_diagnostic,Values=true"),
+ ("EC2 resolved instance output", r"echo\s+\"ec2-instance-id=\$INSTANCE_ID\"\s*>>\s*\"\$GITHUB_OUTPUT\""),
+ ])
+
+ sdk_steps = yaml_step_blocks(sdk, path)
+ prerequisites = yaml_named_step(sdk_steps, "Install EC2 runner prerequisites", path)
+ gradle_setup = yaml_named_step(sdk_steps, "Set up Gradle", path)
+ if sdk_steps.index(prerequisites) >= sdk_steps.index(gradle_setup):
+ raise ContractFailure(f"binding contract check failed: EC2 runner prerequisites ordering ({path})")
+ require_all(prerequisites, path, [
+ ('self-hosted EC2 runner prerequisite route', "^ if:\s*\$\{\{\s*runner\.environment\s*==\s*'self-hosted'\s*\}\}\s*$"),
+ ("EC2 runner apt metadata refresh", r"sudo\s+apt-get\s+update"),
+ ("EC2 runner unzip prerequisite", r"sudo\s+apt-get\s+install\s+--yes\s+unzip"),
+ ])
+
+ checkout = yaml_named_step(sdk_steps, "Checkout code", path)
+ node_setup = yaml_named_step(sdk_steps, "Set up Node.js", path)
+ binding_harness = yaml_named_step(sdk_steps, "Check generated bindings and generator regression harness", path)
+ if not (sdk_steps.index(checkout) < sdk_steps.index(node_setup) < sdk_steps.index(binding_harness)):
+ raise ContractFailure(f"binding contract check failed: SDK Node setup ordering ({path})")
+ forbid(node_setup, "conditional SDK Node setup", r"^ if:", path)
+ require_all(node_setup, path, [
+ ("SDK Node setup action", r"uses:\s*actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020"),
+ ("SDK Node version file", r"node-version-file:\s*['\"]?cyclops-cs/\.nvmrc['\"]?"),
+ ])
+
+ go_index = next(
+ (index for index, step in enumerate(sdk_steps) if "uses: actions/setup-go@" in step),
+ None,
+ )
+ if go_index is None:
+ raise ContractFailure(f"binding contract check failed: SDK bindings Go setup ({path})")
+ go_setup = sdk_steps[go_index]
+ require_all(go_setup, path, [
+ ("SDK bindings Go setup action", r"uses:\s*actions/setup-go@[^\n]+"),
+ ("SDK bindings Go version file", r"go-version-file:\s*cyclops-cs/backend/go\.mod"),
+ ])
+
+ python_index = next(
+ (index for index, step in enumerate(sdk_steps) if re.search(r"^ - name:\s*Set up Python\s*$", step, flags=re.MULTILINE)),
+ None,
+ )
+ if python_index is None or python_index + 1 == len(sdk_steps):
+ raise ContractFailure(f"binding contract check failed: SDK diagnostics placement ({path})")
+ diagnostics = sdk_steps[python_index + 1]
+ generator = yaml_named_step(sdk_steps, "Install compatibility binding generator with telemetry", path)
+ fallback_generator = yaml_named_step(sdk_steps, "Install compatibility binding generator", path)
+ generator_index = sdk_steps.index(generator)
+ if go_index >= generator_index:
+ raise ContractFailure(f"binding contract check failed: SDK Go setup ordering ({path})")
+ generator_steps = [step for step in sdk_steps if "uniffi-bindgen-go.git" in step]
+ if generator_steps != [generator, fallback_generator]:
+ raise ContractFailure(f"binding contract check failed: mutually exclusive compatibility generator installs ({path})")
+ require_all(sdk, path, [
+ ("SDK job waits for diagnostic tests and runner", r"^ needs:\s*\[\s*uniffi-diagnostics-tests\s*,\s*start-sdk-bindings-runner\s*\]\s*$"),
+ ('SDK coverage and diagnostic test guard', "^ if:\\s*\\$\\{\\{\\s*always\\(\\)\\s*&&\\s*needs\\.uniffi-diagnostics-tests\\.result\\s*==\\s*'success'\\s*&&\\s*\\(\\s*\\(\\s*github\\.event_name\\s*==\\s*'pull_request'\\s*&&\\s*\\(\\s*github\\.event\\.pull_request\\.head\\.repo\\.full_name\\s*!=\\s*github\\.repository\\s*\\|\\|\\s*github\\.event\\.pull_request\\.head\\.repo\\.fork\\s*!=\\s*false\\s*\\|\\|\\s*github\\.actor\\s*==\\s*'dependabot\\[bot\\]'\\s*\\)\\s*\\)\\s*\\|\\|\\s*needs\\.start-sdk-bindings-runner\\.result\\s*==\\s*'success'\\s*\\)\\s*\\}\\}\\s*$"),
+ ('SDK dynamic runner selection', "^ runs-on:\\s*\\$\\{\\{\\s*\\(\\s*github\\.event_name\\s*!=\\s*'pull_request'\\s*\\|\\|\\s*\\(\\s*github\\.event\\.pull_request\\.head\\.repo\\.full_name\\s*==\\s*github\\.repository\\s*&&\\s*github\\.event\\.pull_request\\.head\\.repo\\.fork\\s*==\\s*false\\s*&&\\s*github\\.actor\\s*!=\\s*'dependabot\\[bot\\]'\\s*\\)\\s*\\)\\s*&&\\s*needs\\.start-sdk-bindings-runner\\.result\\s*==\\s*'success'\\s*&&\\s*format\\(\\s*'cyclops-sdk-diag-\\{0\\}-\\{1\\}'\\s*,\\s*github\\.run_attempt\\s*,\\s*github\\.run_id\\s*\\)\\s*\\|\\|\\s*'ubuntu-24\\.04'\\s*\\}\\}\\s*$"),
+ ])
+ forbid(sdk, "SDK job EC2 OIDC permission", r"^ id-token:\s*write\s*$", path)
+ require_all(diagnostics, path, [
+ ("SDK diagnostic dependency step", r"^ - name:\s*Install UniFFI diagnostic dependencies\s*$"),
+ ('trusted diagnostic dependency route', "^ if:\\s*\\$\\{\\{\\s*github\\.event_name\\s*!=\\s*'pull_request'\\s*\\|\\|\\s*\\(\\s*github\\.event\\.pull_request\\.head\\.repo\\.full_name\\s*==\\s*github\\.repository\\s*&&\\s*github\\.event\\.pull_request\\.head\\.repo\\.fork\\s*==\\s*false\\s*&&\\s*github\\.actor\\s*!=\\s*'dependabot\\[bot\\]'\\s*\\)\\s*\\}\\}\\s*$"),
+ ("Pinned telemetry dependencies", r"python3\s+-m\s+pip\s+install\s+--disable-pip-version-check\s+-r\s+\.github/scripts/uniffi-diagnostics/requirements\.txt"),
+ ])
+ require_all(generator, path, [
+ ('trusted telemetry generator route', "^ if:\\s*\\$\\{\\{\\s*github\\.event_name\\s*!=\\s*'pull_request'\\s*\\|\\|\\s*\\(\\s*github\\.event\\.pull_request\\.head\\.repo\\.full_name\\s*==\\s*github\\.repository\\s*&&\\s*github\\.event\\.pull_request\\.head\\.repo\\.fork\\s*==\\s*false\\s*&&\\s*github\\.actor\\s*!=\\s*'dependabot\\[bot\\]'\\s*\\)\\s*\\}\\}\\s*$"),
+ ("Telemetry endpoint", r"OTEL_EXPORTER_OTLP_ENDPOINT:\s*https://otel\.cua\.ai"),
+ ("Telemetry instance type", r"EC2_INSTANCE_TYPE:\s*\$\{\{\s*env\.EC2_RUNNER_INSTANCE_TYPE\s*\}\}"),
+ ("Telemetry wrapper invocation", r"python3\s+\.github/scripts/uniffi-diagnostics/run_with_otel\.py\s*\\\s*--service-name\s+gha-uniffi-runner-diagnostic\s*\\\s*--heartbeat-seconds\s+30\s*\\\s*--sample-seconds\s+5\s*\\\s*--\s+env\s+CARGO_PROFILE_DEV_DEBUG=0\s+cargo\s+install\s+--debug"),
+ ("Telemetry wrapper pinned generator", r"--git\s+https://github\.com/NordSecurity/uniffi-bindgen-go\.git\s*\\\s*--tag\s+['\"]v0\.7\.1\+v0\.31\.0['\"]\s*\\\s*--locked\s*\\\s*uniffi-bindgen-go"),
+ ])
+ require_all(fallback_generator, path, [
+ ('untrusted hosted fallback route', "^ if:\\s*\\$\\{\\{\\s*github\\.event_name\\s*==\\s*'pull_request'\\s*&&\\s*\\(\\s*github\\.event\\.pull_request\\.head\\.repo\\.full_name\\s*!=\\s*github\\.repository\\s*\\|\\|\\s*github\\.event\\.pull_request\\.head\\.repo\\.fork\\s*!=\\s*false\\s*\\|\\|\\s*github\\.actor\\s*==\\s*'dependabot\\[bot\\]'\\s*\\)\\s*\\}\\}\\s*$"),
+ ("hosted fallback plain generator command", r"CARGO_PROFILE_DEV_DEBUG=0\s+cargo\s+install\s+--debug\s*\\\s*--git\s+https://github\.com/NordSecurity/uniffi-bindgen-go\.git\s*\\\s*--tag\s+['\"]v0\.7\.1\+v0\.31\.0['\"]\s*\\\s*--locked\s*\\\s*uniffi-bindgen-go"),
+ ])
+
+ stop_permissions = yaml_mapping_block(stop, "permissions", 4, path)
+ stop_steps = yaml_step_blocks(stop, path)
+ stop_credentials = yaml_named_step(stop_steps, "Configure AWS credentials", path)
+ terminate = yaml_named_step(stop_steps, "Terminate EC2 runner instances", path)
+ require_all(stop, path, [
+ ("EC2 stop dependencies", r"^ needs:\s*\[\s*start-sdk-bindings-runner\s*,\s*sdk-bindings\s*\]\s*$"),
+ ("EC2 stop runner host", r"^ runs-on:\s*ubuntu-latest\s*$"),
+ ('trusted unconditional EC2 cleanup', "^ if:\\s*\\$\\{\\{\\s*always\\(\\)\\s*&&\\s*\\(\\s*github\\.event_name\\s*!=\\s*'pull_request'\\s*\\|\\|\\s*\\(\\s*github\\.event\\.pull_request\\.head\\.repo\\.full_name\\s*==\\s*github\\.repository\\s*&&\\s*github\\.event\\.pull_request\\.head\\.repo\\.fork\\s*==\\s*false\\s*&&\\s*github\\.actor\\s*!=\\s*'dependabot\\[bot\\]'\\s*\\)\\s*\\)\\s*\\}\\}\\s*$"),
+ ])
+ require_all(stop_permissions, path, [
+ ("EC2 stop OIDC permission", r"^ id-token:\s*write\s*$"),
+ ])
+ require_all(stop_credentials, path, [
+ ("EC2 stop AWS credentials action", r"uses:\s*aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c"),
+ ("EC2 stop AWS role", r"role-to-assume:\s*arn:aws:iam::\$\{\{\s*env\.AWS_ACCOUNT_ID\s*\}\}:role/\$\{\{\s*env\.EC2_RUNNER_IAM_ROLE\s*\}\}"),
+ ("EC2 stop AWS region", r"aws-region:\s*\$\{\{\s*env\.AWS_REGION\s*\}\}"),
+ ])
+ require_all(terminate, path, [
+ ("Unconditional EC2 termination step", r"^ if:\s*always\(\)\s*$"),
+ ("resolved EC2 instance output consumption", r"needs\.start-sdk-bindings-runner\.outputs\.ec2-instance-id"),
+ ("EC2 cleanup fallback query", r"aws\s+ec2\s+describe-instances"),
+ ("EC2 fallback run-id tag", r"Name=tag:github_job_id,Values=\$\{\{\s*github\.run_id\s*\}\}"),
+ ("EC2 fallback repository tag", r"Name=tag:github_repo,Values=\$\{\{\s*github\.event\.repository\.name\s*\}\}"),
+ ("EC2 fallback repository ID tag", r"Name=tag:github_repository_id,Values=\$\{\{\s*github\.repository_id\s*\}\}"),
+ ("EC2 fallback run-attempt tag", r"Name=tag:github_run_attempt,Values=\$\{\{\s*github\.run_attempt\s*\}\}"),
+ ("EC2 fallback diagnostic tag", r"Name=tag:uniffi_diagnostic,Values=true"),
+ ("EC2 fallback nonterminated states", r"Name=instance-state-name,Values=pending,running,shutting-down,stopping,stopped"),
+ ("EC2 fallback empty result normalization", r"if\s+\[\s+\"\$MATCHING_INSTANCE_IDS\"\s*=\s*\"None\"\s+\];\s*then\s+MATCHING_INSTANCE_IDS=\"\""),
+ ("EC2 multi-ID splitting", r"tr\s+'\\t\s+'\s+'\\n'"),
+ ("EC2 terminate instance command", r"aws\s+ec2\s+terminate-instances\s*\\\s*--instance-ids\s+\"\$\{INSTANCE_IDS\[@\]\}\"\s*\\\s*--region\s+\"\$\{\{\s*env\.AWS_REGION\s*\}\}"),
+ ])
+
def require_lifecycle(source: str, path: Path, label: str, queue_marker: str, calls: list[str], exhausted: str) -> None:
checks = [(f"{label} request queue", queue_marker)]
checks.extend((f"{label} lifecycle {call}", call) for call in calls)
@@ -266,6 +587,8 @@ def check(root: Path) -> None:
"kotlin_build": bindings / "kotlin/build.gradle.kts",
"swift_runner": root / "cyclops-cs/scripts/run-swift-sdk-binding.sh",
"ruby_runner": root / "cyclops-cs/scripts/run-ruby-sdk-binding.sh",
+ "compat_generator": root / "cyclops-cs/scripts/generate-compat-sdk-bindings.sh",
+ "sdk_bindings_workflow": root / ".github/workflows/ci-cyclops-cs.yml",
}
source = {name: executable_source(path) for name, path in files.items()}
@@ -287,6 +610,12 @@ def check(root: Path) -> None:
("Ruby runner Windows loader path", r"PATH=\"\$library_dir:\$PATH\""),
])
+ require_all(source["compat_generator"], files["compat_generator"], [
+ ("Compatibility generator gofmt prerequisite", r"if ! command -v gofmt >/dev/null 2>&1; then"),
+ ("Compatibility generator gofmt guidance", r"gofmt is required to normalize compatibility Go bindings"),
+ ])
+ require_sdk_bindings_workflow(files["sdk_bindings_workflow"])
+
require_all(source["kotlin_live"], files["kotlin_live"], [
("Kotlin live HTTP callback", r"class\s+JavaHttpClient\s*:\s*HttpClient"),
("Kotlin live typed pool", r"OsGymSandboxWarmPoolSpec\(.*SandboxTemplateRef\(templateName\)"),
@@ -439,17 +768,265 @@ tasks.register<JavaExec>(\"example\") {
"""
+def sdk_bindings_workflow_fixture() -> str:
+ return """on:
+ push:
+ paths:
+ - ".github/scripts/uniffi-diagnostics/**"
+ - ".github/scripts/tests/test_run_with_otel.py"
+ pull_request:
+ paths:
+ - ".github/scripts/uniffi-diagnostics/**"
+ - ".github/scripts/tests/test_run_with_otel.py"
+permissions:
+ contents: read
+env:
+ AWS_REGION: us-west-2
+ AWS_ACCOUNT_ID: "296062593712"
+ EC2_RUNNER_IAM_ROLE: github-actions-nixos-ami
+ EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge
+ EC2_RUNNER_SUBNET_ID: subnet-0ca86dea50cd84d24
+ EC2_RUNNER_SECURITY_GROUP_ID: sg-078f4e7b96883e60e
+jobs:
+ uniffi-diagnostics-tests:
+ name: UniFFI diagnostic wrapper tests
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
+ - name: Set up Python
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
+ with:
+ python-version: "3.11"
+ - name: Run UniFFI diagnostic wrapper tests
+ run: |
+ python3 -m pip install --disable-pip-version-check -r .github/scripts/uniffi-diagnostics/requirements.txt
+ python3 .github/scripts/tests/test_run_with_otel.py -v
+ cyclops-cs/scripts/check-sdk-binding-contract-sources.sh
+ cyclops-cs/scripts/check-sdk-binding-contract-sources.sh --self-test
+ start-sdk-bindings-runner:
+ name: Start UniFFI EC2 Runner
+ needs: uniffi-diagnostics-tests
+ if: ${{ github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]') }}
+ permissions:
+ id-token: write
+ runs-on: ubuntu-latest
+ outputs:
+ ec2-instance-id: ${{ steps.resolve-ec2.outputs.ec2-instance-id }}
+ steps:
+ - name: Configure AWS credentials
+ uses: aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c
+ with:
+ role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.EC2_RUNNER_IAM_ROLE }}
+ aws-region: ${{ env.AWS_REGION }}
+ - name: Get latest Ubuntu 24.04 AMI
+ id: ami
+ run: |
+ AMI_ID=$(aws ec2 describe-images \\
+ --region "${{ env.AWS_REGION }}" \\
+ --owners 099720109477 \\
+ --filters "Name=name,Values=ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" \\
+ --query 'sort_by(Images, &CreationDate)[-1].ImageId' \\
+ --output text)
+ test -n "$AMI_ID"
+ test "$AMI_ID" != "None"
+ echo "ami_id=$AMI_ID" >> "$GITHUB_OUTPUT"
+ - name: Start EC2 runner
+ id: start-ec2
+ uses: unblocked/ec2-action-builder@504a3cf746c6090065a66896a3addc2bb101b4ba
+ with:
+ github_token: ${{ secrets.QEMU_BUILD_GH_PERSONAL_ACCESS_TOKEN }}
+ aws_access_key_id: ${{ env.AWS_ACCESS_KEY_ID }}
+ aws_secret_access_key: ${{ env.AWS_SECRET_ACCESS_KEY }}
+ aws_session_token: ${{ env.AWS_SESSION_TOKEN }}
+ aws_region: ${{ env.AWS_REGION }}
+ ec2_subnet_id: ${{ env.EC2_RUNNER_SUBNET_ID }}
+ ec2_security_group_id: ${{ env.EC2_RUNNER_SECURITY_GROUP_ID }}
+ ec2_instance_type: ${{ env.EC2_RUNNER_INSTANCE_TYPE }}
+ ec2_ami_id: ${{ steps.ami.outputs.ami_id }}
+ ec2_root_disk_size_gb: "60"
+ ec2_spot_instance_strategy: None
+ ec2_instance_ttl: 60
+ ec2_instance_tags: >-
+ [{"Key":"github_run_attempt","Value":"${{ github.run_attempt }}"},{"Key":"github_repository_id","Value":"${{ github.repository_id }}"},{"Key":"uniffi_diagnostic","Value":"true"}]
+ github_action_runner_version: "2.333.1"
+ github_action_runner_label_prefix: cyclops-sdk-diag-${{ github.run_attempt }}-
+ - name: Resolve EC2 runner instance
+ id: resolve-ec2
+ if: always()
+ run: |
+ INSTANCE_ID="$(aws ec2 describe-instances \\
+ --region "${{ env.AWS_REGION }}" \\
+ --filters \\
+ "Name=tag:github_job_id,Values=${{ github.run_id }}" \\
+ "Name=tag:github_repo,Values=${{ github.event.repository.name }}" \\
+ "Name=tag:github_repository_id,Values=${{ github.repository_id }}" \\
+ "Name=tag:github_run_attempt,Values=${{ github.run_attempt }}" \\
+ "Name=tag:uniffi_diagnostic,Values=true" \\
+ --query 'Reservations[].Instances[].InstanceId' \\
+ --output text)"
+ if [ "$INSTANCE_ID" = "None" ]; then
+ INSTANCE_ID=""
+ fi
+ echo "ec2-instance-id=$INSTANCE_ID" >> "$GITHUB_OUTPUT"
+ sdk-bindings:
+ name: UniFFI SDK bindings (Linux)
+ needs: [uniffi-diagnostics-tests, start-sdk-bindings-runner]
+ if: ${{ always() && needs.uniffi-diagnostics-tests.result == 'success' && ((github.event_name == 'pull_request' && (github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.head.repo.fork != false || github.actor == 'dependabot[bot]')) || needs.start-sdk-bindings-runner.result == 'success') }}
+ runs-on: ${{ (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]')) && needs.start-sdk-bindings-runner.result == 'success' && format('cyclops-sdk-diag-{0}-{1}', github.run_attempt, github.run_id) || 'ubuntu-24.04' }}
+ timeout-minutes: 45
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5
+ - name: Install EC2 runner prerequisites
+ if: ${{ runner.environment == 'self-hosted' }}
+ run: |
+ sudo apt-get update
+ sudo apt-get install --yes unzip
+ - name: Setup Go
+ uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5
+ with:
+ go-version-file: cyclops-cs/backend/go.mod
+ - name: Set up Node.js
+ uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020
+ with:
+ node-version-file: cyclops-cs/.nvmrc
+ - name: Set up Gradle
+ uses: gradle/actions/setup-gradle@0b6dd653ba04f4f93bf581ec31e66cbd7dcb644d
+ - name: Set up Python
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065
+ - name: Install UniFFI diagnostic dependencies
+ if: ${{ github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]') }}
+ run: python3 -m pip install --disable-pip-version-check -r .github/scripts/uniffi-diagnostics/requirements.txt
+ - name: Install compatibility binding generator with telemetry
+ if: ${{ github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]') }}
+ env:
+ OTEL_EXPORTER_OTLP_ENDPOINT: https://otel.cua.ai
+ EC2_INSTANCE_TYPE: ${{ env.EC2_RUNNER_INSTANCE_TYPE }}
+ run: |
+ python3 .github/scripts/uniffi-diagnostics/run_with_otel.py \\
+ --service-name gha-uniffi-runner-diagnostic \\
+ --heartbeat-seconds 30 \\
+ --sample-seconds 5 \\
+ -- env CARGO_PROFILE_DEV_DEBUG=0 cargo install --debug \\
+ --git https://github.com/NordSecurity/uniffi-bindgen-go.git \\
+ --tag 'v0.7.1+v0.31.0' \\
+ --locked \\
+ uniffi-bindgen-go
+ - name: Install compatibility binding generator
+ if: ${{ github.event_name == 'pull_request' && (github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.head.repo.fork != false || github.actor == 'dependabot[bot]') }}
+ run: |
+ CARGO_PROFILE_DEV_DEBUG=0 cargo install --debug \\
+ --git https://github.com/NordSecurity/uniffi-bindgen-go.git \\
+ --tag 'v0.7.1+v0.31.0' \\
+ --locked \\
+ uniffi-bindgen-go
+ - name: Check generated bindings and generator regression harness
+ run: cyclops-cs/scripts/test-generate-sdk-bindings.sh
+ stop-sdk-bindings-runner:
+ name: Terminate UniFFI EC2 Runner
+ needs: [start-sdk-bindings-runner, sdk-bindings]
+ runs-on: ubuntu-latest
+ if: ${{ always() && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]')) }}
+ permissions:
+ id-token: write
+ steps:
+ - name: Configure AWS credentials
+ uses: aws-actions/configure-aws-credentials@ff717079ee2060e4bcee96c4779b553acc87447c
+ with:
+ role-to-assume: arn:aws:iam::${{ env.AWS_ACCOUNT_ID }}:role/${{ env.EC2_RUNNER_IAM_ROLE }}
+ aws-region: ${{ env.AWS_REGION }}
+ - name: Terminate EC2 runner instances
+ if: always()
+ env:
+ RESOLVED_INSTANCE_ID: ${{ needs.start-sdk-bindings-runner.outputs.ec2-instance-id }}
+ run: |
+ MATCHING_INSTANCE_IDS="$(aws ec2 describe-instances \\
+ --region "${{ env.AWS_REGION }}" \\
+ --filters \\
+ "Name=tag:github_job_id,Values=${{ github.run_id }}" \\
+ "Name=tag:github_repo,Values=${{ github.event.repository.name }}" \\
+ "Name=tag:github_repository_id,Values=${{ github.repository_id }}" \\
+ "Name=tag:github_run_attempt,Values=${{ github.run_attempt }}" \\
+ "Name=tag:uniffi_diagnostic,Values=true" \\
+ "Name=instance-state-name,Values=pending,running,shutting-down,stopping,stopped" \\
+ --query 'Reservations[].Instances[].InstanceId' \\
+ --output text)"
+ if [ "$MATCHING_INSTANCE_IDS" = "None" ]; then
+ MATCHING_INSTANCE_IDS=""
+ fi
+ mapfile -t INSTANCE_IDS < <(printf '%s\\n' "$RESOLVED_INSTANCE_ID" "$MATCHING_INSTANCE_IDS" | tr '\\t ' '\\n' | awk 'NF && !seen[$0]++')
+ if ((${#INSTANCE_IDS[@]})); then
+ aws ec2 terminate-instances \\
+ --instance-ids "${INSTANCE_IDS[@]}" \\
+ --region "${{ env.AWS_REGION }}"
+ else
+ echo "No matching EC2 instances found"
+ fi
+"""
+
+def validate_yaml_fixture(workflow: str) -> None:
+ try:
+ import yaml
+ except ImportError:
+ first = next((line for line in workflow.splitlines() if line.strip()), "")
+ if first not in {"on:", "permissions:"} or workflow.startswith("\\"):
+ raise ContractFailure("workflow fixture has an invalid prefix")
+ return
+
+ try:
+ yaml.safe_load(workflow)
+ except yaml.YAMLError as error:
+ raise ContractFailure(f"workflow fixture is not valid YAML: {error}") from error
+
+
+def require_workflow_rejected(path: Path, workflow: str, description: str) -> None:
+ validate_yaml_fixture(workflow)
+ path.write_text(workflow, encoding="utf-8")
+ try:
+ require_sdk_bindings_workflow(path)
+ except ContractFailure: # lint-ignore: swallowed-exception
+ return
+ raise ContractFailure(f"{description} unexpectedly passed")
+
+
def self_test() -> None:
samples = {
"kotlin": (strip_c_like_comments, "/* throw HttpException.Transport() */\n", r"HttpException\.Transport"),
"swift": (strip_c_like_comments, "// actor ScriptedHttpClient: HttpClient\n", r"actor\s+ScriptedHttpClient"),
"ruby": (strip_ruby_comments, "=begin\nThread.new do\n=end\n# Mutex.new\n", r"Thread\.new|Mutex\.new"),
"python": (strip_python_comments_and_strings, '\"\"\" asyncio.gather(sdk.service_request()) \"\"\"\n# expected_service_calls()\n', r"asyncio\.gather|expected_service_calls"),
+ "yaml": (strip_yaml_comments, "# ec2_instance_type: m7i.2xlarge\n", r"ec2_instance_type"),
}
for language, (stripper, comment_only, pattern) in samples.items():
if re.search(pattern, stripper(comment_only), flags=re.DOTALL):
raise ContractFailure(f"comment-only negative self-test failed for {language}")
+ quoted_yaml = strip_yaml_comments(
+ "SINGLE: 'it''s first\n # retained-single\n final' # removed-single\n"
+ 'DOUBLE: "first \"quoted\"\n # retained-double\n final" # removed-double\n'
+ )
+ if (
+ "# retained-single" not in quoted_yaml
+ or "# retained-double" not in quoted_yaml
+ or "# removed-single" in quoted_yaml
+ or "# removed-double" in quoted_yaml
+ ):
+ raise ContractFailure("YAML multiline quoted-scalar comment stripping self-test failed")
+
+ matrix = [
+ ("trusted same-repository PR", "pull_request", False, "cloud", "cloud", "member", "success", True, "cyclops-sdk-diag-2-100"),
+ ("untrusted fork PR", "pull_request", True, "fork", "cloud", "contributor", "skipped", True, "ubuntu-24.04"),
+ ("Dependabot PR", "pull_request", False, "cloud", "cloud", "dependabot[bot]", "skipped", True, "ubuntu-24.04"),
+ ]
+ for description, event_name, is_fork, head_repository, repository, actor, start_result, expected_runs, expected_runner in matrix:
+ trusted = is_trusted_uniffi_ec2_event(event_name, is_fork, head_repository, repository, actor)
+ runs, runner = sdk_bindings_route(trusted, start_result, "2", "100")
+ if (runs, runner) != (expected_runs, expected_runner):
+ raise ContractFailure(f"SDK runner routing matrix failed for {description}")
+ if sdk_bindings_route(True, "failure", "2", "100") != (False, None):
+ raise ContractFailure("trusted EC2 start failure unexpectedly falls back")
+
with tempfile.TemporaryDirectory() as directory:
fixture = Path(directory) / "build.gradle.kts"
fixture.write_text(kotlin_build_fixture(), encoding="utf-8")
@@ -472,6 +1049,241 @@ def self_test() -> None:
pass
else:
raise ContractFailure("comment-only .kts Gradle wiring unexpectedly passed")
+
+ fixture = Path(directory) / "ci-cyclops-cs.yml"
+ workflow = sdk_bindings_workflow_fixture()
+ validate_yaml_fixture(workflow)
+ first_line = next(line for line in workflow.splitlines() if line.strip())
+ if first_line not in {"on:", "permissions:"} or workflow.startswith("\\"):
+ raise ContractFailure("workflow fixture has a stray prefix")
+ fixture.write_text(workflow, encoding="utf-8")
+ require_sdk_bindings_workflow(fixture)
+
+ require_workflow_rejected(
+ fixture,
+ workflow.replace(
+ " EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge",
+ " # EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge",
+ ),
+ "comment-only EC2 workflow requirement",
+ )
+
+ require_workflow_rejected(
+ fixture,
+ workflow.replace(
+ ' ec2_root_disk_size_gb: "60"',
+ ' # ec2_root_disk_size_gb: "60"',
+ )
+ + """\
+ unrelated:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Misplaced EC2 setting
+ uses: unblocked/ec2-action-builder@504a3cf746c6090065a66896a3addc2bb101b4ba
+ with:
+ ec2_root_disk_size_gb: "60"
+""",
+ "unrelated-job EC2 workflow requirement",
+ )
+
+ require_workflow_rejected(
+ fixture,
+ workflow.replace(
+ " - name: Install compatibility binding generator with telemetry",
+ " - name: Install compatibility binding generator\n"
+ " run: CARGO_PROFILE_DEV_DEBUG=0 cargo install --debug --git https://github.com/NordSecurity/uniffi-bindgen-go.git --tag 'v0.7.1+v0.31.0' --locked uniffi-bindgen-go\n"
+ " - name: Install compatibility binding generator with telemetry",
+ ).replace(
+ " -- env CARGO_PROFILE_DEV_DEBUG=0 cargo install --debug \\\n",
+ " -- ./generate.sh\n",
+ ),
+ "split wrapper and compatibility generator install",
+ )
+
+ require_workflow_rejected(
+ fixture,
+ workflow.replace(
+ " EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge\n",
+ ' UNRELATED: "quoted # EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge"\n',
+ ),
+ "quoted-scalar EC2 workflow injection",
+ )
+
+ for mutated_workflow, description in [
+ (
+ workflow.replace(" aws-region: ${{ env.AWS_REGION }}\n", "", 1),
+ "start AWS region requirement",
+ ),
+ (
+ workflow.rsplit(" aws-region: ${{ env.AWS_REGION }}\n", 1)[0]
+ + workflow.rsplit(" aws-region: ${{ env.AWS_REGION }}\n", 1)[1],
+ "stop AWS region requirement",
+ ),
+ (
+ workflow.replace(
+ " uses: actions/setup-go@d35c59abb061a4a6fb18e82ac0862c26744d6ab5\n",
+ "",
+ 1,
+ ),
+ "SDK Go setup action",
+ ),
+ (
+ workflow.replace(" go-version-file: cyclops-cs/backend/go.mod\n", "", 1),
+ "SDK Go version file",
+ ),
+ (
+ workflow.replace(" --owners 099720109477 \\\n", "", 1),
+ "EC2 Ubuntu AMI owner",
+ ),
+ (
+ workflow.replace(
+ ' --filters "Name=name,Values=ubuntu/images/hvm-ssd-gp3/ubuntu-noble-24.04-amd64-server-*" \\\n',
+ "",
+ 1,
+ ),
+ "EC2 Ubuntu Noble AMI filter",
+ ),
+ (
+ workflow.replace(" --query 'sort_by(Images, &CreationDate)[-1].ImageId' \\\n", "", 1),
+ "EC2 latest AMI query",
+ ),
+ (
+ workflow.replace(' test -n "$AMI_ID"\n', "", 1),
+ "EC2 AMI nonempty validation",
+ ),
+ (
+ workflow.replace(' test "$AMI_ID" != "None"\n', "", 1),
+ "EC2 AMI None validation",
+ ),
+ (
+ workflow.replace(" contents: read\n", " id-token: write\n contents: read\n", 1),
+ "workflow-level EC2 OIDC permission",
+ ),
+ (
+ workflow.replace(" if: ${{ github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]') }}\n", "", 1),
+ "trusted EC2 start guard",
+ ),
+ (
+ workflow.replace(" if: ${{ always() && (github.event_name != 'pull_request' || (github.event.pull_request.head.repo.full_name == github.repository && github.event.pull_request.head.repo.fork == false && github.actor != 'dependabot[bot]')) }}\n", " if: ${{ always() }}\n", 1),
+ "trusted unconditional EC2 cleanup",
+ ),
+ (
+ workflow.replace("github_action_runner_label_prefix: cyclops-sdk-diag-${{ github.run_attempt }}-", "github_action_runner_label_prefix: cyclops-sdk-diag-"),
+ "attempt-unique EC2 label",
+ ),
+ (
+ workflow.replace(" if: ${{ always() && needs.uniffi-diagnostics-tests.result == 'success' && ((github.event_name == 'pull_request' && (github.event.pull_request.head.repo.full_name != github.repository || github.event.pull_request.head.repo.fork != false || github.actor == 'dependabot[bot]')) || needs.start-sdk-bindings-runner.result == 'success') }}\n", "", 1),
+ "SDK coverage and diagnostic test guard",
+ ),
+ (
+ workflow.replace("format('cyclops-sdk-diag-{0}-{1}', github.run_attempt, github.run_id) || 'ubuntu-24.04'", "'ubuntu-24.04'"),
+ "SDK dynamic runner selection",
+ ),
+ (
+ workflow.replace("tr '\\t ' '\\n'", "tr ' ' '\\n'", 1),
+ "EC2 multi-ID splitting",
+ ),
+ (
+ workflow.replace('"Key":"github_run_attempt","Value":"${{ github.run_attempt }}"', '"Key":"github_run_attempt","Value":"1"'),
+ "EC2 run-attempt tag",
+ ),
+ (
+ workflow.replace(" - name: Resolve EC2 runner instance\n", " # - name: Resolve EC2 runner instance\n", 1),
+ "EC2 resolve step",
+ ),
+ (
+ workflow.replace('".github/scripts/uniffi-diagnostics/**"', '".github/scripts/uniffi-diagnostics-missing/**"', 1),
+ "diagnostic dependency path trigger",
+ ),
+ (
+ workflow.replace(' needs: uniffi-diagnostics-tests\n', '', 1),
+ "EC2 start diagnostic test gate",
+ ),
+ (
+ workflow.replace(' needs: [uniffi-diagnostics-tests, start-sdk-bindings-runner]\n', ' needs: start-sdk-bindings-runner\n', 1),
+ "SDK diagnostic test gate",
+ ),
+ (
+ workflow.replace('"Key":"github_repository_id","Value":"${{ github.repository_id }}"', '"Key":"github_repository_id","Value":"0"', 1),
+ "EC2 repository ID tag",
+ ),
+ (
+ workflow.replace('"Name=tag:github_repository_id,Values=${{ github.repository_id }}"', '"Name=tag:github_repository_id,Values=0"', 1),
+ "EC2 resolve repository ID tag",
+ ),
+ (
+ workflow.rsplit('"Name=tag:github_repository_id,Values=${{ github.repository_id }}"', 1)[0]
+ + workflow.rsplit('"Name=tag:github_repository_id,Values=${{ github.repository_id }}"', 1)[1],
+ "EC2 cleanup repository ID tag",
+ ),
+ (
+ workflow.replace(' - name: Set up Node.js\n', " - name: Set up Node.js\n if: ${{ runner.environment == 'self-hosted' }}\n", 1),
+ "unconditional SDK Node setup",
+ ),
+ (
+ workflow.replace(' - name: Set up Node.js\n', ' - name: Missing Node.js setup\n', 1),
+ "SDK Node setup step",
+ ),
+ (
+ workflow.replace('actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020', 'actions/setup-node@0000000000000000000000000000000000000000', 1),
+ "SDK Node setup action SHA",
+ ),
+ (
+ workflow.replace(' node-version-file: cyclops-cs/.nvmrc\n', ' node-version-file: cyclops-cs/missing.nvmrc\n', 1),
+ "SDK Node version file",
+ ),
+ (
+ workflow.replace(
+ ' - name: Set up Node.js\n uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020\n with:\n node-version-file: cyclops-cs/.nvmrc\n',
+ '',
+ 1,
+ ).replace(
+ ' - name: Check generated bindings and generator regression harness\n run: cyclops-cs/scripts/test-generate-sdk-bindings.sh\n',
+ ' - name: Check generated bindings and generator regression harness\n run: cyclops-cs/scripts/test-generate-sdk-bindings.sh\n - name: Set up Node.js\n uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020\n with:\n node-version-file: cyclops-cs/.nvmrc\n',
+ 1,
+ ),
+ "SDK Node setup ordering",
+ ),
+ (
+ workflow.replace(' - name: Install EC2 runner prerequisites\n', ' - name: Missing EC2 runner prerequisites\n', 1),
+ "EC2 runner prerequisite step",
+ ),
+ (
+ workflow.replace(' sudo apt-get install --yes unzip\n', ' sudo apt-get install --yes curl\n', 1),
+ "EC2 runner unzip prerequisite",
+ ),
+ (
+ workflow.replace(' - name: Install UniFFI diagnostic dependencies\n if:', ' - name: Install UniFFI diagnostic dependencies\n # if:', 1),
+ "trusted diagnostic dependency route",
+ ),
+ (
+ workflow.replace(' - name: Install compatibility binding generator\n if:', ' - name: Install compatibility binding generator\n # if:', 1),
+ "untrusted hosted fallback route",
+ ),
+ (
+ workflow.replace('MATCHING_INSTANCE_IDS="$(aws ec2 describe-instances', 'MATCHING_INSTANCE_IDS="" # aws ec2 describe-instances', 1),
+ "EC2 cleanup fallback query",
+ ),
+ (
+ workflow.replace(' if [ "$MATCHING_INSTANCE_IDS" = "None" ]; then\n MATCHING_INSTANCE_IDS=""\n fi\n', '', 1),
+ "EC2 cleanup empty result normalization",
+ ),
+ (
+ workflow.replace(
+ " EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge\n",
+ " UNRELATED: 'first\n # EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge\n final'\n",
+ ),
+ "multiline single-quoted EC2 workflow injection",
+ ),
+ (
+ workflow.replace(
+ " EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge\n",
+ ' UNRELATED: "first\n # EC2_RUNNER_INSTANCE_TYPE: m7i.2xlarge\n final"\n',
+ ),
+ "multiline double-quoted EC2 workflow injection",
+ ),
+ ]:
+ require_workflow_rejected(fixture, mutated_workflow, description)
print("SDK binding source checker comment-only self-test passed.")
@@ -481,13 +1293,15 @@ def main() -> int:
args = parser.parse_args()
root = Path(__file__).resolve().parents[2]
try:
- check(root)
if args.self_test:
self_test()
+ else:
+ check(root)
except (ContractFailure, tokenize.TokenError) as error:
print(error, file=sys.stderr)
return 1
- print("SDK binding source contract checks passed.")
+ if not args.self_test:
+ print("SDK binding source contract checks passed.")
return 0
diff --git a/libs/fleet/scripts/generate-compat-sdk-bindings.sh b/libs/fleet/scripts/generate-compat-sdk-bindings.sh
new file mode 100755
index 0000000000..88825d5f94
--- /dev/null
+++ b/libs/fleet/scripts/generate-compat-sdk-bindings.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+set -euo pipefail
+
+usage() {
+ echo "Usage: generate-compat-sdk-bindings.sh [--check]" >&2
+}
+
+case "${1:-}" in
+ "") check_only=false ;;
+ --check) check_only=true ;;
+ *) usage; exit 2 ;;
+esac
+[ "$#" -le 1 ] || { usage; exit 2; }
+
+if ! command -v gofmt >/dev/null 2>&1; then
+ echo "error: gofmt is required to normalize compatibility Go bindings; install Go (for example, with actions/setup-go) and ensure gofmt is on PATH" >&2
+ exit 127
+fi
+
+required_go_generator_version="uniffi-bindgen 0.7.1+v0.31.0"
+if ! command -v uniffi-bindgen-go >/dev/null 2>&1; then
+ echo "error: uniffi-bindgen-go $required_go_generator_version is required; install it with: CARGO_PROFILE_DEV_DEBUG=0 cargo install --debug --git https://github.com/NordSecurity/uniffi-bindgen-go.git --tag 'v0.7.1+v0.31.0' --locked uniffi-bindgen-go" >&2
+ exit 127
+fi
+actual_go_generator_version="$(uniffi-bindgen-go --version)"
+if [ "$actual_go_generator_version" != "$required_go_generator_version" ]; then
+ echo "error: expected uniffi-bindgen-go $required_go_generator_version, found $actual_go_generator_version" >&2
+ exit 1
+fi
+
+repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
+cyclops_root="$repo_root/cyclops-cs"
+normalizer="$cyclops_root/scripts/normalize-compat-sdk-bindings.py"
+temporary="$(mktemp -d "${TMPDIR:-/tmp}/cyclops-compat-bindings.XXXXXX")"
+trap 'rm -rf "$temporary"' EXIT
+
+library="$("$cyclops_root/scripts/build-sdk-bindings-native.sh")"
+(
+ cd "$cyclops_root/sdk"
+ uniffi-bindgen-go --library "$library" --out-dir "$temporary/go" --no-format
+ npx --yes [email protected] ubrn generate napi bindings \
+ --library --no-format --ts-dir "$temporary/node" --lib-colocated "$library"
+)
+
+arguments=(--raw-go "$temporary/go/cyclops_sdk_schema/cyclops_sdk_schema.go" --raw-node "$temporary/node/cyclops_sdk_schema.ts")
+if [ "$check_only" = true ]; then
+ arguments+=(--check)
+fi
+"$normalizer" "${arguments[@]}"
diff --git a/libs/fleet/scripts/normalize-compat-sdk-bindings.py b/libs/fleet/scripts/normalize-compat-sdk-bindings.py
new file mode 100755
index 0000000000..53c049d9ca
--- /dev/null
+++ b/libs/fleet/scripts/normalize-compat-sdk-bindings.py
@@ -0,0 +1,300 @@
+#!/usr/bin/env python3
+"""Normalize third-party Go and Node UniFFI output to the compatibility ABI."""
+
+from __future__ import annotations
+
+import argparse
+import re
+import subprocess
+from pathlib import Path
+
+
+ROOT = Path(__file__).resolve().parents[2]
+GO_OUTPUT = ROOT / "cyclops-cs/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go"
+NODE_OUTPUT = ROOT / "cyclops-cs/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts"
+BUILDER_NAME = "Builder"
+GO_BUILDER_TYPE = re.compile(
+ r"^type (?P<name>[A-Za-z_][A-Za-z0-9_]*Builder) (?:struct|interface)",
+ re.MULTILINE,
+)
+GO_DECLARATION = re.compile(r"(?=^(?:type|func|var|const) )", re.MULTILINE)
+NODE_DECLARATION = re.compile(
+ r"^(?:export\s+)?(?P<kind>interface|type|class|enum|const|function)\s+"
+ r"(?P<name>[A-Za-z_$][A-Za-z0-9_$]*)",
+ re.MULTILINE,
+)
+
+
+def require_all(source: str, snippets: list[str], label: str) -> None:
+ missing = [snippet for snippet in snippets if snippet not in source]
+ if missing:
+ raise ValueError(f"raw {label} generator output is missing: {missing[0]!r}")
+
+
+def normalize_trailing_whitespace(source: str) -> str:
+ lines = [line.rstrip() for line in source.splitlines()]
+ while lines and not lines[-1]:
+ lines.pop()
+ return "\n".join(lines) + "\n"
+
+
+def matching_brace(source: str, opening_brace: int) -> int:
+ """Return the matching closing brace while skipping Go string and comment text."""
+ depth = 0
+ index = opening_brace
+ state = "code"
+ while index < len(source):
+ character = source[index]
+ following = source[index + 1] if index + 1 < len(source) else ""
+ if state == "code":
+ if character == '"':
+ state = "string"
+ elif character == "'":
+ state = "rune"
+ elif character == "`":
+ state = "raw_string"
+ elif character == "/" and following == "/":
+ state = "line_comment"
+ index += 1
+ elif character == "/" and following == "*":
+ state = "block_comment"
+ index += 1
+ elif character == "{":
+ depth += 1
+ elif character == "}":
+ depth -= 1
+ if depth == 0:
+ return index
+ elif state in {"string", "rune"}:
+ if character == "\\":
+ index += 1
+ elif (state == "string" and character == '"') or (
+ state == "rune" and character == "'"
+ ):
+ state = "code"
+ elif state == "raw_string" and character == "`":
+ state = "code"
+ elif state == "line_comment" and character == "\n":
+ state = "code"
+ elif state == "block_comment" and character == "*" and following == "/":
+ state = "code"
+ index += 1
+ index += 1
+ raise ValueError("raw Go generator output has an unmatched brace")
+
+
+def go_builder_classes(source: str) -> set[str]:
+ return {match.group("name") for match in GO_BUILDER_TYPE.finditer(source)}
+
+
+def remove_go_builder_checksums(source: str, builder_classes: set[str]) -> str:
+ marker = "func uniffiCheckChecksums() {"
+ start = source.index(marker)
+ opening_brace = source.index("{", start)
+ closing_brace = matching_brace(source, opening_brace)
+ checksums = source[opening_brace + 1 : closing_brace]
+ builder_symbols = {builder_class.lower() for builder_class in builder_classes}
+ normalized: list[str] = []
+ last = 0
+ for match in re.finditer(r"^\t\{", checksums, re.MULTILINE):
+ block_end = matching_brace(checksums, match.start()) + 1
+ block = checksums[match.start() : block_end]
+ if any(f"{symbol}_" in block for symbol in builder_symbols):
+ normalized.append(checksums[last : match.start()])
+ last = block_end
+ normalized.append(checksums[last:])
+ return source[: opening_brace + 1] + "".join(normalized) + source[closing_brace:]
+
+
+def go_builder_identifiers(builder_classes: set[str]) -> set[str]:
+ identifiers: set[str] = set()
+ for builder_class in builder_classes:
+ identifiers.update(
+ {
+ builder_class,
+ f"{builder_class}Interface",
+ f"FfiConverter{builder_class}",
+ f"FfiConverter{builder_class}INSTANCE",
+ f"FfiDestroyer{builder_class}",
+ f"New{builder_class}",
+ f"LiftFromExternal{builder_class}",
+ f"LowerToExternal{builder_class}",
+ }
+ )
+ return identifiers
+
+
+def remove_go_builder_declarations(source: str, builder_classes: set[str]) -> str:
+ declarations = GO_DECLARATION.split(source)
+ builder_identifiers = go_builder_identifiers(builder_classes)
+ source = "".join(
+ declaration
+ for declaration in declarations
+ if not builder_identifiers.intersection(
+ re.findall(r"[A-Za-z_][A-Za-z0-9_]*", declaration)
+ )
+ )
+ if "runtime." not in source:
+ source = source.replace('\n\t"runtime"\n', "\n")
+ return source
+
+
+def format_go(source: str) -> str:
+ formatted = subprocess.run(
+ ["gofmt"], input=source, text=True, capture_output=True, check=False
+ )
+ if formatted.returncode:
+ raise ValueError(f"could not gofmt compatibility Go output: {formatted.stderr}")
+ return formatted.stdout
+
+
+def normalize_go(raw: str) -> str:
+ require_all(
+ raw,
+ [
+ "TtlSecondsAfterCreated *uint32",
+ "FfiConverterOptionalUint32INSTANCE.Write(writer, value.TtlSecondsAfterCreated)",
+ ],
+ "Go",
+ )
+ builder_classes = go_builder_classes(raw)
+ if not builder_classes:
+ raise ValueError("raw Go generator output is missing builder declarations")
+ return format_go(
+ normalize_trailing_whitespace(
+ remove_go_builder_declarations(
+ remove_go_builder_checksums(raw, builder_classes), builder_classes
+ )
+ )
+ )
+
+
+def node_builder_classes(declarations: list[re.Match[str]]) -> set[str]:
+ return {
+ declaration.group("name")
+ for declaration in declarations
+ if declaration.group("kind") == "class"
+ and declaration.group("name").endswith(BUILDER_NAME)
+ }
+
+
+def node_builder_declaration_names(
+ declarations: list[re.Match[str]], builder_classes: set[str]
+) -> set[str]:
+ names = {
+ declaration.group("name")
+ for declaration in declarations
+ if declaration.group("name").endswith(BUILDER_NAME)
+ }
+ for builder_class in builder_classes:
+ names.update(
+ {
+ f"{builder_class}Like",
+ f"{builder_class}Interface",
+ f"uniffiType{builder_class}ObjectFactory",
+ f"FfiConverterType{builder_class}",
+ }
+ )
+ return names
+
+
+def remove_node_builder_checksums(source: str, builder_classes: set[str]) -> str:
+ builder_symbols = {builder_class.lower() for builder_class in builder_classes}
+
+ def replace(match: re.Match[str]) -> str:
+ return "" if any(f"{symbol}_" in match.group() for symbol in builder_symbols) else match.group()
+
+ return re.sub(
+ r"^ if \(nativeModule\(\)\.[^\n]*\n.*?^ \}\n",
+ replace,
+ source,
+ flags=re.MULTILINE | re.DOTALL,
+ )
+
+
+def remove_node_builder_default_exports(source: str, builder_names: set[str]) -> str:
+ marker = "export default Object.freeze({"
+ before, separator, exports = source.partition(marker)
+ if not separator:
+ raise ValueError("raw Node generator output is missing default converter exports")
+ builder_converters = {
+ builder_name
+ for builder_name in builder_names
+ if builder_name.startswith("FfiConverterType")
+ }
+ return before + separator + "".join(
+ line
+ for line in exports.splitlines(keepends=True)
+ if line.strip().rstrip(",") not in builder_converters
+ )
+
+
+def remove_node_builder_declarations(
+ source: str, declarations: list[re.Match[str]], builder_names: set[str]
+) -> str:
+ normalized: list[str] = [source[: declarations[0].start()]]
+ for index, declaration in enumerate(declarations):
+ end = declarations[index + 1].start() if index + 1 < len(declarations) else len(source)
+ if declaration.group("name") not in builder_names:
+ normalized.append(source[declaration.start() : end])
+ return "".join(normalized)
+
+
+def normalize_node(raw: str) -> str:
+ require_all(
+ raw,
+ [
+ "ttlSecondsAfterCreated?: number",
+ "ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)",
+ "FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into)",
+ ],
+ "Node",
+ )
+ declarations = list(NODE_DECLARATION.finditer(raw))
+ if not declarations:
+ raise ValueError("raw Node generator output is missing top-level declarations")
+ builder_classes = node_builder_classes(declarations)
+ builder_names = node_builder_declaration_names(declarations, builder_classes)
+ source = remove_node_builder_default_exports(
+ remove_node_builder_checksums(raw, builder_classes), builder_names
+ )
+ return normalize_trailing_whitespace(
+ remove_node_builder_declarations(
+ source, list(NODE_DECLARATION.finditer(source)), builder_names
+ )
+ )
+
+
+def check_no_builders(source: str, path: Path) -> None:
+ if path == NODE_OUTPUT:
+ for declaration in NODE_DECLARATION.finditer(source):
+ if declaration.group("name").endswith(BUILDER_NAME):
+ raise ValueError(f"compatibility binding exposes builder ABI: {path}")
+ return
+ if GO_BUILDER_TYPE.search(source):
+ raise ValueError(f"compatibility binding exposes builder ABI: {path}")
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser()
+ parser.add_argument("--raw-go", type=Path, required=True)
+ parser.add_argument("--raw-node", type=Path, required=True)
+ parser.add_argument("--check", action="store_true")
+ arguments = parser.parse_args()
+
+ outputs = (
+ (GO_OUTPUT, normalize_go, arguments.raw_go, "Go"),
+ (NODE_OUTPUT, normalize_node, arguments.raw_node, "Node"),
+ )
+ for output, normalize, raw_path, label in outputs:
+ normalized = normalize(raw_path.read_text())
+ check_no_builders(normalized, output)
+ if arguments.check:
+ if output.read_text() != normalized:
+ raise SystemExit(f"normalized {label} binding drift detected: {output}")
+ else:
+ output.write_text(normalized)
+
+
+if __name__ == "__main__":
+ main()
diff --git a/libs/fleet/scripts/test-generate-sdk-bindings.sh b/libs/fleet/scripts/test-generate-sdk-bindings.sh
index f4683407cb..d0b9f89175 100755
--- a/libs/fleet/scripts/test-generate-sdk-bindings.sh
+++ b/libs/fleet/scripts/test-generate-sdk-bindings.sh
@@ -4,6 +4,8 @@ set -euo pipefail
repo_root="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
workspace_dir="$repo_root/cyclops-cs"
generator="$workspace_dir/scripts/generate-sdk-bindings.sh"
+compat_generator="$workspace_dir/scripts/generate-compat-sdk-bindings.sh"
+compat_normalizer="$workspace_dir/scripts/normalize-compat-sdk-bindings.py"
bindings_dir="$workspace_dir/sdk-bindings"
temporary_directory="$(mktemp -d "${TMPDIR:-/tmp}/cyclops-sdk-bindings-test.XXXXXX")"
if cargo_bin="$(command -v cargo)" && [ -n "$cargo_bin" ]; then
@@ -22,8 +24,22 @@ cargo_config_directory="$workspace_dir/.cargo"
cargo_config_file="$cargo_config_directory/config.toml"
cargo_config_directory_created=false
cargo_config_active=false
+compat_go_backup=""
+compat_node_backup=""
+compat_snapshots_mutated=false
+
+restore_compat_snapshots() {
+ [ "$compat_snapshots_mutated" = true ] || return 0
+ [ -n "$compat_go_backup" ] && [ -f "$compat_go_backup" ] || return 1
+ [ -n "$compat_node_backup" ] && [ -f "$compat_node_backup" ] || return 1
+ cp "$compat_go_backup" "$go_schema_source"
+ cp "$compat_node_backup" "$node_schema_source"
+ compat_snapshots_mutated=false
+}
-cleanup() {
+cleanup_resources() {
+ cleanup_directory="$1"
+ restore_compat_snapshots
if [ "$cargo_config_active" = true ] && [ -f "$cargo_config_file" ]; then
rm -f "$cargo_config_file"
fi
@@ -31,9 +47,30 @@ cleanup() {
# Trap cleanup must not override the harness result if the directory is nonempty.
rmdir "$cargo_config_directory" 2>/dev/null || true # lint-ignore: error-masking
fi
- rm -rf "$temporary_directory"
+ rm -rf "$cleanup_directory"
+}
+
+handle_exit() {
+ status=$?
+ cleanup_directory="$1"
+ trap - EXIT HUP INT TERM
+ set +e
+ cleanup_resources "$cleanup_directory"
+ exit "$status"
+}
+
+handle_signal() {
+ cleanup_directory="$1"
+ signal_status="$2"
+ trap - EXIT HUP INT TERM
+ set +e
+ cleanup_resources "$cleanup_directory"
+ exit "$signal_status"
}
-trap cleanup EXIT HUP INT TERM
+trap 'handle_exit "$temporary_directory"' EXIT
+trap 'handle_signal "$temporary_directory" 129' HUP
+trap 'handle_signal "$temporary_directory" 130' INT
+trap 'handle_signal "$temporary_directory" 143' TERM
mode_for() {
if stat -f '%Lp' "$1" >/dev/null 2>&1; then
stat -f '%Lp' "$1"
@@ -54,6 +91,37 @@ expect_check_failure() {
fi
}
+expect_compat_signal_restore() {
+ signal_name="$1"
+ expected_status="$2"
+ compat_cleanup_probe="$temporary_directory/compat-cleanup-$signal_name"
+ mkdir "$compat_cleanup_probe"
+ cp "$go_schema_source" "$compat_cleanup_probe/go"
+ cp "$node_schema_source" "$compat_cleanup_probe/node"
+ if (
+ compat_go_backup="$compat_cleanup_probe/go"
+ compat_node_backup="$compat_cleanup_probe/node"
+ compat_snapshots_mutated=true
+ trap 'handle_exit "$compat_cleanup_probe"' EXIT
+ trap 'handle_signal "$compat_cleanup_probe" 129' HUP
+ trap 'handle_signal "$compat_cleanup_probe" 130' INT
+ trap 'handle_signal "$compat_cleanup_probe" 143' TERM
+ printf '\n// compat cleanup %s probe\n' "$signal_name" >> "$go_schema_source"
+ printf '\n// compat cleanup %s probe\n' "$signal_name" >> "$node_schema_source"
+ kill -s "$signal_name" "$BASHPID"
+ ); then
+ actual_status=0
+ else
+ actual_status=$?
+ fi
+ if [ "$actual_status" -ne "$expected_status" ]; then
+ fail "compat cleanup trap returned $actual_status for $signal_name, expected $expected_status"
+ fi
+ if grep -Fq -- "compat cleanup $signal_name probe" "$go_schema_source" || grep -Fq -- "compat cleanup $signal_name probe" "$node_schema_source"; then
+ fail "compat cleanup trap did not restore snapshots after $signal_name"
+ fi
+}
+
tree_hash() {
root="$1"
(
@@ -346,12 +414,156 @@ swift_schema_source="$bindings_dir/swift/CyclopsSdkSchema.swift"
ruby_sdk_source="$bindings_dir/ruby/cyclops_sdk/sdk.rb"
ruby_schema_source="$bindings_dir/ruby/cyclops_sdk/schema.rb"
node_sdk_source="$bindings_dir/ts-uniffi/fleet_sdk.ts"
+node_schema_source="$bindings_dir/ts-uniffi/cyclops_sdk_schema.ts"
browser_sdk_source="$bindings_dir/ts-uniffi-browser/ts/fleet_sdk.ts"
browser_schema_source="$bindings_dir/ts-uniffi-browser/ts/cyclops_sdk_schema.ts"
go_sdk_source="$bindings_dir/go-uniffi/fleet_sdk/fleet_sdk.go"
+go_schema_source="$bindings_dir/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go"
+
+compat_go_backup="$temporary_directory/compat-go-backup"
+compat_node_backup="$temporary_directory/compat-node-backup"
+compat_raw_go="$temporary_directory/compat-raw.go"
+compat_raw_node="$temporary_directory/compat-raw.ts"
+cp "$go_schema_source" "$compat_go_backup"
+cp "$node_schema_source" "$compat_node_backup"
+
+grep -Fq -- 'required_go_generator_version="uniffi-bindgen 0.7.1+v0.31.0"' "$compat_generator" || fail "compat generator does not pin uniffi-bindgen-go"
+grep -Fq -- "CARGO_PROFILE_DEV_DEBUG=0 cargo install --debug --git https://github.com/NordSecurity/uniffi-bindgen-go.git --tag 'v0.7.1+v0.31.0' --locked uniffi-bindgen-go" "$compat_generator" || fail "compat generator does not document the resource-safe install command"
+grep -Fq -- 'command -v gofmt' "$compat_generator" || fail "compat generator does not require gofmt"
+grep -Fq -- 'gofmt is required to normalize compatibility Go bindings' "$compat_generator" || fail "compat generator does not explain a missing gofmt"
+grep -Fq -- 'command -v uniffi-bindgen-go' "$compat_generator" || fail "compat generator does not reject a missing uniffi-bindgen-go"
+grep -Fq -- "actual_go_generator_version=\"\$(uniffi-bindgen-go --version)\"" "$compat_generator" || fail "compat generator does not validate uniffi-bindgen-go version"
+"$compat_generator" --check
+
+node - "$node_schema_source" <<'NODE'
+const fs = require("node:fs");
+
+const source = fs.readFileSync(process.argv[2], "utf8");
+const declarations = new Set(
+ [...source.matchAll(/^const\s+(FfiConverterType[A-Za-z0-9_]+)\s*=/gm)].map(
+ (match) => match[1],
+ ),
+);
+const references = new Set(
+ [...source.matchAll(/\b(FfiConverterType[A-Za-z0-9_]+)\b/g)].map(
+ (match) => match[1],
+ ),
+);
+const missing = [...references].filter((reference) => !declarations.has(reference));
+if (!declarations.has("FfiConverterTypeJsonValueError")) {
+ throw new Error("Node compatibility snapshot omits FfiConverterTypeJsonValueError");
+}
+if (!declarations.has("FfiConverterTypeSchemaBuildError")) {
+ throw new Error("Node compatibility snapshot omits FfiConverterTypeSchemaBuildError");
+}
+if (missing.length > 0) {
+ throw new Error(`Node compatibility snapshot has unresolved converters: ${missing.join(", ")}`);
+}
+NODE
+
+compat_cleanup_probe="$temporary_directory/compat-cleanup-probe"
+mkdir "$compat_cleanup_probe"
+cp "$go_schema_source" "$compat_cleanup_probe/go"
+cp "$node_schema_source" "$compat_cleanup_probe/node"
+if (
+ compat_go_backup="$compat_cleanup_probe/go"
+ compat_node_backup="$compat_cleanup_probe/node"
+ compat_snapshots_mutated=true
+ trap 'handle_exit "$compat_cleanup_probe"' EXIT
+ trap 'handle_signal "$compat_cleanup_probe" 129' HUP
+ trap 'handle_signal "$compat_cleanup_probe" 130' INT
+ trap 'handle_signal "$compat_cleanup_probe" 143' TERM
+ printf '\n// compat cleanup probe\n' >> "$go_schema_source"
+ printf '\n// compat cleanup probe\n' >> "$node_schema_source"
+ exit 97
+); then
+ fail "compat cleanup probe unexpectedly succeeded"
+fi
+if grep -Fq -- 'compat cleanup probe' "$go_schema_source" || grep -Fq -- 'compat cleanup probe' "$node_schema_source"; then
+ fail "compat cleanup trap did not restore snapshots after a failing subprocess"
+fi
+expect_compat_signal_restore INT 130
+expect_compat_signal_restore TERM 143
+cp "$go_schema_source" "$compat_raw_go"
+cp "$node_schema_source" "$compat_raw_node"
+cat >> "$compat_raw_go" <<'EOF_COMPAT_GO'
+
+// compat raw fixture
+type CompatFixtureBuilder struct{}
+
+func (CompatFixtureBuilder) Build() {}
+
+type CompatFixtureRecordBuilderMetadata struct{}
+EOF_COMPAT_GO
+cat >> "$compat_raw_node" <<'EOF_COMPAT_NODE'
+
+// compat raw fixture
+export class CompatFixtureBuilder {
+ build(): void {}
+}
+export const CompatFixtureBuildError = Object.freeze({});
+const FfiConverterTypeCompatFixtureBuildError = Object.freeze({});
+export class CompatFixtureRecordBuilderMetadata {}
+const FfiConverterTypeCompatFixtureRecordBuilderMetadata = Object.freeze({});
+function compatFixtureChecksums() {
+ if (nativeModule().uniffi_compat_record_builder_metadata() !== 1) {
+ throw new Error("record builder metadata");
+ }
+}
+EOF_COMPAT_NODE
+compat_snapshots_mutated=true
+if ! "$compat_normalizer" --raw-go "$compat_raw_go" --raw-node "$compat_raw_node"; then
+ restore_compat_snapshots
+ fail "compat normalizer rejected the raw fixture"
+fi
+if ! grep -Fq -- 'compat raw fixture' "$go_schema_source" || ! grep -Fq -- 'compat raw fixture' "$node_schema_source"; then
+ restore_compat_snapshots
+ fail "compat normalizer did not derive snapshots from raw fixture output"
+fi
+if grep -Fq -- 'CompatFixtureBuilder' "$go_schema_source" || grep -Fq -- 'CompatFixtureBuilder' "$node_schema_source"; then
+ restore_compat_snapshots
+ fail "compat normalizer retained builder ABI from raw fixture output"
+fi
+if ! grep -Fq -- 'CompatFixtureRecordBuilderMetadata' "$go_schema_source"; then
+ restore_compat_snapshots
+ fail "compat normalizer removed interior Builder Go fixture symbols"
+fi
+if ! grep -Fq -- 'CompatFixtureBuildError' "$node_schema_source" || ! grep -Fq -- 'FfiConverterTypeCompatFixtureBuildError' "$node_schema_source"; then
+ restore_compat_snapshots
+ fail "compat normalizer removed non-builder BuildError fixture symbols"
+fi
+if ! grep -Fq -- 'CompatFixtureRecordBuilderMetadata' "$node_schema_source" || ! grep -Fq -- 'FfiConverterTypeCompatFixtureRecordBuilderMetadata' "$node_schema_source"; then
+ restore_compat_snapshots
+ fail "compat normalizer removed interior Builder fixture symbols"
+fi
+if ! grep -Fq -- 'uniffi_compat_record_builder_metadata' "$node_schema_source"; then
+ restore_compat_snapshots
+ fail "compat normalizer removed an interior builder snake-case symbol"
+fi
+if ! "$compat_normalizer" --raw-go "$compat_raw_go" --raw-node "$compat_raw_node" --check; then
+ restore_compat_snapshots
+ fail "compat normalizer does not reproduce fixture output"
+fi
+restore_compat_snapshots
-for separate_binding in "$node_sdk_source" "$go_sdk_source"; do
- if grep -Fq -- "VmTemplateBuilder" "$separate_binding" || grep -Fq -- "CreatePoolRequestBuilder" "$separate_binding"; then
+compat_snapshots_mutated=true
+printf '\n// stale manual compatibility edit\n' >> "$go_schema_source"
+if "$compat_generator" --check > "$temporary_directory/compat-stale-go.log" 2>&1; then
+ restore_compat_snapshots
+ fail "compat --check accepted a stale manual Go snapshot edit"
+fi
+restore_compat_snapshots
+compat_snapshots_mutated=true
+printf '\n// stale manual compatibility edit\n' >> "$node_schema_source"
+if "$compat_generator" --check > "$temporary_directory/compat-stale-node.log" 2>&1; then
+ restore_compat_snapshots
+ fail "compat --check accepted a stale manual Node snapshot edit"
+fi
+restore_compat_snapshots
+"$compat_generator" --check
+
+for separate_binding in "$node_sdk_source" "$node_schema_source" "$go_sdk_source" "$go_schema_source"; do
+ if grep -Fq -- "Builder" "$separate_binding"; then
fail "separately generated Go/Node binding unexpectedly contains authoritative builders: $separate_binding"
fi
done
@@ -408,6 +620,78 @@ grep -Fq -- "attr_reader :namespace, :name, :labels, :creation_timestamp" "$ruby
grep -Fq -- "creationTimestamp?: string" "$node_sdk_source" || fail "Node bindings omit creationTimestamp"
grep -Fq -- "CreationTimestamp *string" "$go_sdk_source" || fail "Go bindings omit CreationTimestamp"
+for typescript_binding in "$node_schema_source" "$browser_schema_source"; do
+ grep -Fq -- "ttlSecondsAfterCreated?: number" "$typescript_binding" || fail "TypeScript bindings omit ttlSecondsAfterCreated: $typescript_binding"
+ grep -Fq -- "ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)" "$typescript_binding" || fail "TypeScript bindings do not read ttlSecondsAfterCreated: $typescript_binding"
+ grep -Fq -- "FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into)" "$typescript_binding" || fail "TypeScript bindings do not write ttlSecondsAfterCreated: $typescript_binding"
+done
+node - "$node_schema_source" "$browser_schema_source" <<'NODE'
+const fs = require("node:fs");
+
+function converterBlock(source, label, start, end) {
+ const startIndex = source.indexOf(start);
+ const endIndex = source.indexOf(end, startIndex + start.length);
+ if (startIndex < 0 || endIndex < 0) {
+ throw new Error(`${label} converter block is missing`);
+ }
+ return source.slice(startIndex, endIndex);
+}
+
+function requireOrder(source, label, first, second) {
+ const firstIndex = source.indexOf(first);
+ const secondIndex = source.indexOf(second, firstIndex + first.length);
+ if (firstIndex < 0 || secondIndex < 0) {
+ throw new Error(`${label} has stale record field order`);
+ }
+}
+
+for (const path of process.argv.slice(2)) {
+ const source = fs.readFileSync(path, "utf8");
+ const defaults = source.match(/ttlSecondsAfterCreated: undefined/g) ?? [];
+ if (defaults.length < 2) {
+ throw new Error(`${path} omits an optional TTL constructor default`);
+ }
+ const claim = converterBlock(
+ source,
+ `${path} ClaimSpec`,
+ "const FfiConverterTypeClaimSpec = (() => {",
+ "export type OsGymSandboxClaimCondition",
+ );
+ const warmPool = converterBlock(
+ source,
+ `${path} WarmPool`,
+ "const FfiConverterTypeOSGymSandboxWarmPoolSpec = (() => {",
+ "export type OsGymSandboxWarmPoolStatus",
+ );
+ requireOrder(
+ claim,
+ `${path} ClaimSpec read`,
+ "lifecycle: FfiConverterOptionalTypeClaimLifecycle.read(from)",
+ "ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)",
+ );
+ requireOrder(
+ claim,
+ `${path} ClaimSpec write`,
+ "FfiConverterOptionalTypeClaimLifecycle.write(value.lifecycle, into)",
+ "FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into)",
+ );
+ requireOrder(
+ warmPool,
+ `${path} WarmPool read`,
+ "autoscaling: FfiConverterOptionalTypeWarmPoolAutoscaling.read(from)",
+ "ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)",
+ );
+ requireOrder(
+ warmPool,
+ `${path} WarmPool write`,
+ "FfiConverterOptionalTypeWarmPoolAutoscaling.write(",
+ "FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into)",
+ );
+}
+NODE
+grep -Fq -- "TtlSecondsAfterCreated *uint32" "$go_schema_source" || fail "Go bindings omit TtlSecondsAfterCreated"
+grep -Fq -- "FfiConverterOptionalUint32INSTANCE.Write(writer, value.TtlSecondsAfterCreated)" "$go_schema_source" || fail "Go bindings do not write TtlSecondsAfterCreated"
+
for typescript_binding in "$node_sdk_source" "$browser_sdk_source"; do
grep -Fq -- "timeoutSecs?: bigint" "$typescript_binding" || fail "TypeScript bindings omit HttpRequest.timeoutSecs: $typescript_binding"
grep -Fq -- "timeoutSecs: FfiConverterOptionalUInt64.read(from)" "$typescript_binding" || fail "TypeScript bindings do not read HttpRequest.timeoutSecs: $typescript_binding"
diff --git a/libs/fleet/sdk-bindings/README.md b/libs/fleet/sdk-bindings/README.md
index 56ae860968..4cf5055609 100644
--- a/libs/fleet/sdk-bindings/README.md
+++ b/libs/fleet/sdk-bindings/README.md
@@ -11,8 +11,13 @@ four-language binding surface; separate UniFFI snapshots are described below.
`go-uniffi` and `ts-uniffi` (Node.js) are checked-in compatibility snapshots
produced by `uniffi-bindgen-go` and `uniffi-bindgen-react-native`, not outputs
-of `generate-sdk-bindings.sh`. They retain direct record constructors and do
-not advertise builders.
+of `generate-sdk-bindings.sh`. `generate-compat-sdk-bindings.sh` owns their
+narrow repository compatibility normalization: every snapshot is derived from
+fresh raw generator output, then deterministic removal excludes only generated
+builder ABI. It retains all non-builder generated content, including record
+fields and serialization such as TTL fields, so these snapshots continue to
+expose direct record constructors only. The normalizer never uses a checked-in
+snapshot as transformation input.
`ts-uniffi-browser` (Browser/WASM) regenerates from Rust metadata during its
build, commits its TypeScript record modules, and verifies that generated
@@ -30,8 +35,10 @@ checked-in scope, and runtime API.
CRD bundle at `clusters/base/osgym/crd.yaml` is derived from that schema with
`generate-crds`; it is not hand-maintained and must not be post-processed.
Short-term compatibility breaks in this evolving API are intentional. Update
-the schema and raw CRD together rather than adding compatibility shims,
-rewriters, or binding-specific post-processing.
+the schema and raw CRD together rather than adding compatibility shims or
+rewriters. The only binding-specific exception is the repository-owned Go/Node
+compatibility normalization above: it deterministically removes generated
+builder ABI from fresh raw output and does not alter the schema or CRD source.
Generated binding source is committed so review and drift checks are
reproducible. Native libraries, Cargo target output, Gradle caches, and staged
@@ -84,6 +91,8 @@ wrapper around UniFFI `0.31.0`:
```sh
"$REPO_ROOT/cyclops-cs/scripts/generate-sdk-bindings.sh"
"$REPO_ROOT/cyclops-cs/scripts/generate-sdk-bindings.sh" --check
+"$REPO_ROOT/cyclops-cs/scripts/generate-compat-sdk-bindings.sh"
+"$REPO_ROOT/cyclops-cs/scripts/generate-compat-sdk-bindings.sh" --check
"$REPO_ROOT/cyclops-cs/scripts/test-generate-sdk-bindings.sh"
```
diff --git a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
index 9dee5beea3..75b562eff1 100644
--- a/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
+++ b/libs/fleet/sdk-bindings/go-uniffi/cyclops_sdk_schema/cyclops_sdk_schema.go
@@ -369,6 +369,7 @@ func uniffiCheckChecksums() {
// If this happens try cleaning and rebuilding your project
panic("cyclops_sdk_schema: UniFFI contract version mismatch")
}
+
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_schema_checksum_method_preservedjson_to_json()
@@ -378,6 +379,7 @@ func uniffiCheckChecksums() {
panic("cyclops_sdk_schema: uniffi_cyclops_sdk_schema_checksum_method_preservedjson_to_json: UniFFI API checksum mismatch")
}
}
+
{
checksum := rustCall(func(_uniffiStatus *C.RustCallStatus) C.uint16_t {
return C.uniffi_cyclops_sdk_schema_checksum_constructor_preservedjson_from_json()
@@ -387,6 +389,7 @@ func uniffiCheckChecksums() {
panic("cyclops_sdk_schema: uniffi_cyclops_sdk_schema_checksum_constructor_preservedjson_from_json: UniFFI API checksum mismatch")
}
}
+
}
type FfiConverterUint16 struct{}
@@ -722,10 +725,11 @@ func (_ FfiDestroyerClaimLifecycle) Destroy(value ClaimLifecycle) {
}
type ClaimSpec struct {
- SandboxTemplateRef SandboxTemplateRef
- Warmpool *string
- BindDeadline *uint32
- Lifecycle *ClaimLifecycle
+ SandboxTemplateRef SandboxTemplateRef
+ Warmpool *string
+ BindDeadline *uint32
+ Lifecycle *ClaimLifecycle
+ TtlSecondsAfterCreated *uint32
}
func (r *ClaimSpec) Destroy() {
@@ -733,6 +737,7 @@ func (r *ClaimSpec) Destroy() {
FfiDestroyerOptionalString{}.Destroy(r.Warmpool)
FfiDestroyerOptionalUint32{}.Destroy(r.BindDeadline)
FfiDestroyerOptionalClaimLifecycle{}.Destroy(r.Lifecycle)
+ FfiDestroyerOptionalUint32{}.Destroy(r.TtlSecondsAfterCreated)
}
type FfiConverterClaimSpec struct{}
@@ -749,6 +754,7 @@ func (c FfiConverterClaimSpec) Read(reader io.Reader) ClaimSpec {
FfiConverterOptionalStringINSTANCE.Read(reader),
FfiConverterOptionalUint32INSTANCE.Read(reader),
FfiConverterOptionalClaimLifecycleINSTANCE.Read(reader),
+ FfiConverterOptionalUint32INSTANCE.Read(reader),
}
}
@@ -765,6 +771,7 @@ func (c FfiConverterClaimSpec) Write(writer io.Writer, value ClaimSpec) {
FfiConverterOptionalStringINSTANCE.Write(writer, value.Warmpool)
FfiConverterOptionalUint32INSTANCE.Write(writer, value.BindDeadline)
FfiConverterOptionalClaimLifecycleINSTANCE.Write(writer, value.Lifecycle)
+ FfiConverterOptionalUint32INSTANCE.Write(writer, value.TtlSecondsAfterCreated)
}
type FfiDestroyerClaimSpec struct{}
@@ -1070,15 +1077,17 @@ func (_ FfiDestroyerOsGymSandboxTemplateSpec) Destroy(value OsGymSandboxTemplate
}
type OsGymSandboxWarmPoolSpec struct {
- Replicas uint32
- SandboxTemplateRef SandboxTemplateRef
- Autoscaling *WarmPoolAutoscaling
+ Replicas uint32
+ SandboxTemplateRef SandboxTemplateRef
+ Autoscaling *WarmPoolAutoscaling
+ TtlSecondsAfterCreated *uint32
}
func (r *OsGymSandboxWarmPoolSpec) Destroy() {
FfiDestroyerUint32{}.Destroy(r.Replicas)
FfiDestroyerSandboxTemplateRef{}.Destroy(r.SandboxTemplateRef)
FfiDestroyerOptionalWarmPoolAutoscaling{}.Destroy(r.Autoscaling)
+ FfiDestroyerOptionalUint32{}.Destroy(r.TtlSecondsAfterCreated)
}
type FfiConverterOsGymSandboxWarmPoolSpec struct{}
@@ -1094,6 +1103,7 @@ func (c FfiConverterOsGymSandboxWarmPoolSpec) Read(reader io.Reader) OsGymSandbo
FfiConverterUint32INSTANCE.Read(reader),
FfiConverterSandboxTemplateRefINSTANCE.Read(reader),
FfiConverterOptionalWarmPoolAutoscalingINSTANCE.Read(reader),
+ FfiConverterOptionalUint32INSTANCE.Read(reader),
}
}
@@ -1109,6 +1119,7 @@ func (c FfiConverterOsGymSandboxWarmPoolSpec) Write(writer io.Writer, value OsGy
FfiConverterUint32INSTANCE.Write(writer, value.Replicas)
FfiConverterSandboxTemplateRefINSTANCE.Write(writer, value.SandboxTemplateRef)
FfiConverterOptionalWarmPoolAutoscalingINSTANCE.Write(writer, value.Autoscaling)
+ FfiConverterOptionalUint32INSTANCE.Write(writer, value.TtlSecondsAfterCreated)
}
type FfiDestroyerOsGymSandboxWarmPoolSpec struct{}
@@ -1669,6 +1680,121 @@ type FfiDestroyerRuntimeKind struct{}
func (_ FfiDestroyerRuntimeKind) Destroy(value RuntimeKind) {
}
+type SchemaBuildError struct {
+ err error
+}
+
+// Convenience method to turn *SchemaBuildError into error
+// Avoiding treating nil pointer as non nil error interface
+func (err *SchemaBuildError) AsError() error {
+ if err == nil {
+ return nil
+ } else {
+ return err
+ }
+}
+
+func (err SchemaBuildError) Error() string {
+ return fmt.Sprintf("SchemaBuildError: %s", err.err.Error())
+}
+
+func (err SchemaBuildError) Unwrap() error {
+ return err.err
+}
+
+// Err* are used for checking error type with `errors.Is`
+var ErrSchemaBuildErrorMissingRequiredField = fmt.Errorf("SchemaBuildErrorMissingRequiredField")
+
+// Variant structs
+type SchemaBuildErrorMissingRequiredField struct {
+ RecordType string
+ Field string
+}
+
+func NewSchemaBuildErrorMissingRequiredField(
+ recordType string,
+ field string,
+) *SchemaBuildError {
+ return &SchemaBuildError{err: &SchemaBuildErrorMissingRequiredField{
+ RecordType: recordType,
+ Field: field}}
+}
+
+func (e SchemaBuildErrorMissingRequiredField) destroy() {
+ FfiDestroyerString{}.Destroy(e.RecordType)
+ FfiDestroyerString{}.Destroy(e.Field)
+}
+
+func (err SchemaBuildErrorMissingRequiredField) Error() string {
+ return fmt.Sprint("MissingRequiredField",
+ ": ",
+
+ "RecordType=",
+ err.RecordType,
+ ", ",
+ "Field=",
+ err.Field,
+ )
+}
+
+func (self SchemaBuildErrorMissingRequiredField) Is(target error) bool {
+ return target == ErrSchemaBuildErrorMissingRequiredField
+}
+
+type FfiConverterSchemaBuildError struct{}
+
+var FfiConverterSchemaBuildErrorINSTANCE = FfiConverterSchemaBuildError{}
+
+func (c FfiConverterSchemaBuildError) Lift(eb RustBufferI) *SchemaBuildError {
+ return LiftFromRustBuffer[*SchemaBuildError](c, eb)
+}
+
+func (c FfiConverterSchemaBuildError) Lower(value *SchemaBuildError) C.RustBuffer {
+ return LowerIntoRustBuffer[*SchemaBuildError](c, value)
+}
+
+func (c FfiConverterSchemaBuildError) LowerExternal(value *SchemaBuildError) ExternalCRustBuffer {
+ return RustBufferFromC(LowerIntoRustBuffer[*SchemaBuildError](c, value))
+}
+
+func (c FfiConverterSchemaBuildError) Read(reader io.Reader) *SchemaBuildError {
+ errorID := readUint32(reader)
+
+ switch errorID {
+ case 1:
+ return &SchemaBuildError{&SchemaBuildErrorMissingRequiredField{
+ RecordType: FfiConverterStringINSTANCE.Read(reader),
+ Field: FfiConverterStringINSTANCE.Read(reader),
+ }}
+ default:
+ panic(fmt.Sprintf("Unknown error code %d in FfiConverterSchemaBuildError.Read()", errorID))
+ }
+}
+
+func (c FfiConverterSchemaBuildError) Write(writer io.Writer, value *SchemaBuildError) {
+ switch variantValue := value.err.(type) {
+ case *SchemaBuildErrorMissingRequiredField:
+ writeInt32(writer, 1)
+ FfiConverterStringINSTANCE.Write(writer, variantValue.RecordType)
+ FfiConverterStringINSTANCE.Write(writer, variantValue.Field)
+ default:
+ _ = variantValue
+ panic(fmt.Sprintf("invalid error value `%v` in FfiConverterSchemaBuildError.Write", value))
+ }
+}
+
+type FfiDestroyerSchemaBuildError struct{}
+
+func (_ FfiDestroyerSchemaBuildError) Destroy(value *SchemaBuildError) {
+ switch variantValue := value.err.(type) {
+ case SchemaBuildErrorMissingRequiredField:
+ variantValue.destroy()
+ default:
+ _ = variantValue
+ panic(fmt.Sprintf("invalid error value `%v` in FfiDestroyerSchemaBuildError.Destroy", value))
+ }
+}
+
type ServiceProtocol uint
const (
diff --git a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
index 82a8c7e8f2..fdcaa047b4 100644
--- a/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
+++ b/libs/fleet/sdk-bindings/kotlin/ai/cua/cyclops/sdk/schema/cyclops_sdk_schema.kt
@@ -694,6 +694,8 @@ internal object IntegrityCheckingUniffiLib {
): Short
external fun uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref(
): Short
+ external fun uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created(
+ ): Short
external fun uniffi_cyclops_sdk_schema_checksum_method_warmpoolautoscalingbuilder_build(
): Short
external fun uniffi_cyclops_sdk_schema_checksum_method_warmpoolautoscalingbuilder_initial_pool_size(
@@ -828,6 +830,8 @@ external fun uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder
): Long
external fun uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref(`ptr`: Long,`value`: RustBuffer.ByValue,uniffi_out_err: UniffiRustCallStatus,
): Long
+external fun uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created(`ptr`: Long,`value`: Int,uniffi_out_err: UniffiRustCallStatus,
+): Long
external fun uniffi_cyclops_sdk_schema_fn_clone_warmpoolautoscalingbuilder(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
): Long
external fun uniffi_cyclops_sdk_schema_fn_free_warmpoolautoscalingbuilder(`handle`: Long,uniffi_out_err: UniffiRustCallStatus,
@@ -1048,6 +1052,9 @@ private fun uniffiCheckApiChecksums(lib: IntegrityCheckingUniffiLib) {
if (lib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref() != 7198.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
+ if (lib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created() != 44516.toShort()) {
+ throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ }
if (lib.uniffi_cyclops_sdk_schema_checksum_method_warmpoolautoscalingbuilder_build() != 17132.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
@@ -1744,6 +1751,8 @@ public interface OsGymSandboxWarmPoolSpecBuilderInterface {
fun `sandboxTemplateRef`(`value`: SandboxTemplateRef): OsGymSandboxWarmPoolSpecBuilder
+ fun `ttlSecondsAfterCreated`(`value`: kotlin.UInt): OsGymSandboxWarmPoolSpecBuilder
+
companion object
}
@@ -1904,6 +1913,19 @@ open class OsGymSandboxWarmPoolSpecBuilder: Disposable, AutoCloseable, OsGymSand
}
+ override fun `ttlSecondsAfterCreated`(`value`: kotlin.UInt): OsGymSandboxWarmPoolSpecBuilder {
+ return FfiConverterTypeOSGymSandboxWarmPoolSpecBuilder.lift(
+ callWithHandle {
+ uniffiRustCall() { _status ->
+ UniffiLib.uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created(
+ it,
+ FfiConverterUInt.lower(`value`),_status)
+}
+ }
+ )
+ }
+
+
@@ -3621,6 +3643,8 @@ data class ClaimSpec (
var `bindDeadline`: kotlin.UInt?
,
var `lifecycle`: ClaimLifecycle?
+ ,
+ var `ttlSecondsAfterCreated`: kotlin.UInt? = null
){
@@ -3641,6 +3665,7 @@ public object FfiConverterTypeClaimSpec: FfiConverterRustBuffer<ClaimSpec> {
FfiConverterOptionalString.read(buf),
FfiConverterOptionalUInt.read(buf),
FfiConverterOptionalTypeClaimLifecycle.read(buf),
+ FfiConverterOptionalUInt.read(buf),
)
}
@@ -3648,7 +3673,8 @@ public object FfiConverterTypeClaimSpec: FfiConverterRustBuffer<ClaimSpec> {
FfiConverterTypeSandboxTemplateRef.allocationSize(value.`sandboxTemplateRef`) +
FfiConverterOptionalString.allocationSize(value.`warmpool`) +
FfiConverterOptionalUInt.allocationSize(value.`bindDeadline`) +
- FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.`lifecycle`)
+ FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.`lifecycle`) +
+ FfiConverterOptionalUInt.allocationSize(value.`ttlSecondsAfterCreated`)
)
override fun write(value: ClaimSpec, buf: ByteBuffer) {
@@ -3656,6 +3682,7 @@ public object FfiConverterTypeClaimSpec: FfiConverterRustBuffer<ClaimSpec> {
FfiConverterOptionalString.write(value.`warmpool`, buf)
FfiConverterOptionalUInt.write(value.`bindDeadline`, buf)
FfiConverterOptionalTypeClaimLifecycle.write(value.`lifecycle`, buf)
+ FfiConverterOptionalUInt.write(value.`ttlSecondsAfterCreated`, buf)
}
}
@@ -3951,6 +3978,8 @@ data class OsGymSandboxWarmPoolSpec (
var `sandboxTemplateRef`: SandboxTemplateRef
,
var `autoscaling`: WarmPoolAutoscaling?
+ ,
+ var `ttlSecondsAfterCreated`: kotlin.UInt? = null
){
@@ -3970,19 +3999,22 @@ public object FfiConverterTypeOSGymSandboxWarmPoolSpec: FfiConverterRustBuffer<O
FfiConverterUInt.read(buf),
FfiConverterTypeSandboxTemplateRef.read(buf),
FfiConverterOptionalTypeWarmPoolAutoscaling.read(buf),
+ FfiConverterOptionalUInt.read(buf),
)
}
override fun allocationSize(value: OsGymSandboxWarmPoolSpec) = (
FfiConverterUInt.allocationSize(value.`replicas`) +
FfiConverterTypeSandboxTemplateRef.allocationSize(value.`sandboxTemplateRef`) +
- FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(value.`autoscaling`)
+ FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(value.`autoscaling`) +
+ FfiConverterOptionalUInt.allocationSize(value.`ttlSecondsAfterCreated`)
)
override fun write(value: OsGymSandboxWarmPoolSpec, buf: ByteBuffer) {
FfiConverterUInt.write(value.`replicas`, buf)
FfiConverterTypeSandboxTemplateRef.write(value.`sandboxTemplateRef`, buf)
FfiConverterOptionalTypeWarmPoolAutoscaling.write(value.`autoscaling`, buf)
+ FfiConverterOptionalUInt.write(value.`ttlSecondsAfterCreated`, buf)
}
}
diff --git a/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py b/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
index e109572fc6..3720183b55 100644
--- a/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
+++ b/libs/fleet/sdk-bindings/python/fleet_sdk/_schema.py
@@ -494,6 +494,8 @@ def _uniffi_check_api_checksums(lib):
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref() != 7198:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
+ if lib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created() != 44516:
+ raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_schema_checksum_constructor_preservedjson_from_json() != 24064:
raise InternalError("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
if lib.uniffi_cyclops_sdk_schema_checksum_method_preservedjson_to_json() != 8252:
@@ -933,6 +935,12 @@ _UniffiLib.uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_s
ctypes.POINTER(_UniffiRustCallStatus),
)
_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref.restype = ctypes.c_uint64
+_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created.argtypes = (
+ ctypes.c_uint64,
+ ctypes.c_uint32,
+ ctypes.POINTER(_UniffiRustCallStatus),
+)
+_UniffiLib.uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created.restype = ctypes.c_uint64
_UniffiLib.uniffi_cyclops_sdk_schema_fn_constructor_preservedjson_from_json.argtypes = (
_UniffiRustBuffer,
ctypes.POINTER(_UniffiRustCallStatus),
@@ -1138,6 +1146,9 @@ _UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbui
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref.restype = ctypes.c_uint16
+_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created.argtypes = (
+)
+_UniffiLib.uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created.restype = ctypes.c_uint16
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_constructor_preservedjson_from_json.argtypes = (
)
_UniffiLib.uniffi_cyclops_sdk_schema_checksum_constructor_preservedjson_from_json.restype = ctypes.c_uint16
@@ -1483,17 +1494,21 @@ class _UniffiFfiConverterOptionalTypeClaimLifecycle(_UniffiConverterRustBuffer):
@dataclass
class ClaimSpec:
- def __init__(self, *, sandbox_template_ref:SandboxTemplateRef, warmpool:typing.Optional[str], bind_deadline:typing.Optional[int], lifecycle:typing.Optional[ClaimLifecycle]):
+ def __init__(self, *, sandbox_template_ref:SandboxTemplateRef, warmpool:typing.Optional[str], bind_deadline:typing.Optional[int], lifecycle:typing.Optional[ClaimLifecycle], ttl_seconds_after_created:typing.Optional[int] = _DEFAULT):
self.sandbox_template_ref = sandbox_template_ref
self.warmpool = warmpool
self.bind_deadline = bind_deadline
self.lifecycle = lifecycle
+ if ttl_seconds_after_created is _DEFAULT:
+ self.ttl_seconds_after_created = None
+ else:
+ self.ttl_seconds_after_created = ttl_seconds_after_created
def __str__(self):
- return "ClaimSpec(sandbox_template_ref={}, warmpool={}, bind_deadline={}, lifecycle={})".format(self.sandbox_template_ref, self.warmpool, self.bind_deadline, self.lifecycle)
+ return "ClaimSpec(sandbox_template_ref={}, warmpool={}, bind_deadline={}, lifecycle={}, ttl_seconds_after_created={})".format(self.sandbox_template_ref, self.warmpool, self.bind_deadline, self.lifecycle, self.ttl_seconds_after_created)
def __eq__(self, other):
if self.sandbox_template_ref != other.sandbox_template_ref:
return False
@@ -1503,6 +1518,8 @@ class ClaimSpec:
return False
if self.lifecycle != other.lifecycle:
return False
+ if self.ttl_seconds_after_created != other.ttl_seconds_after_created:
+ return False
return True
class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
@@ -1513,6 +1530,7 @@ class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
warmpool=_UniffiFfiConverterOptionalString.read(buf),
bind_deadline=_UniffiFfiConverterOptionalUInt32.read(buf),
lifecycle=_UniffiFfiConverterOptionalTypeClaimLifecycle.read(buf),
+ ttl_seconds_after_created=_UniffiFfiConverterOptionalUInt32.read(buf),
)
@staticmethod
@@ -1521,6 +1539,7 @@ class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalString.check_lower(value.warmpool)
_UniffiFfiConverterOptionalUInt32.check_lower(value.bind_deadline)
_UniffiFfiConverterOptionalTypeClaimLifecycle.check_lower(value.lifecycle)
+ _UniffiFfiConverterOptionalUInt32.check_lower(value.ttl_seconds_after_created)
@staticmethod
def write(value, buf):
@@ -1528,6 +1547,7 @@ class _UniffiFfiConverterTypeClaimSpec(_UniffiConverterRustBuffer):
_UniffiFfiConverterOptionalString.write(value.warmpool, buf)
_UniffiFfiConverterOptionalUInt32.write(value.bind_deadline, buf)
_UniffiFfiConverterOptionalTypeClaimLifecycle.write(value.lifecycle, buf)
+ _UniffiFfiConverterOptionalUInt32.write(value.ttl_seconds_after_created, buf)
@dataclass
class OsGymSandboxClaimCondition:
@@ -2771,16 +2791,20 @@ class _UniffiFfiConverterOptionalTypeWarmPoolAutoscaling(_UniffiConverterRustBuf
@dataclass
class OsGymSandboxWarmPoolSpec:
- def __init__(self, *, replicas:int, sandbox_template_ref:SandboxTemplateRef, autoscaling:typing.Optional[WarmPoolAutoscaling]):
+ def __init__(self, *, replicas:int, sandbox_template_ref:SandboxTemplateRef, autoscaling:typing.Optional[WarmPoolAutoscaling], ttl_seconds_after_created:typing.Optional[int] = _DEFAULT):
self.replicas = replicas
self.sandbox_template_ref = sandbox_template_ref
self.autoscaling = autoscaling
+ if ttl_seconds_after_created is _DEFAULT:
+ self.ttl_seconds_after_created = None
+ else:
+ self.ttl_seconds_after_created = ttl_seconds_after_created
def __str__(self):
- return "OsGymSandboxWarmPoolSpec(replicas={}, sandbox_template_ref={}, autoscaling={})".format(self.replicas, self.sandbox_template_ref, self.autoscaling)
+ return "OsGymSandboxWarmPoolSpec(replicas={}, sandbox_template_ref={}, autoscaling={}, ttl_seconds_after_created={})".format(self.replicas, self.sandbox_template_ref, self.autoscaling, self.ttl_seconds_after_created)
def __eq__(self, other):
if self.replicas != other.replicas:
return False
@@ -2788,6 +2812,8 @@ class OsGymSandboxWarmPoolSpec:
return False
if self.autoscaling != other.autoscaling:
return False
+ if self.ttl_seconds_after_created != other.ttl_seconds_after_created:
+ return False
return True
class _UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec(_UniffiConverterRustBuffer):
@@ -2797,6 +2823,7 @@ class _UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec(_UniffiConverterRustBuffer
replicas=_UniffiFfiConverterUInt32.read(buf),
sandbox_template_ref=_UniffiFfiConverterTypeSandboxTemplateRef.read(buf),
autoscaling=_UniffiFfiConverterOptionalTypeWarmPoolAutoscaling.read(buf),
+ ttl_seconds_after_created=_UniffiFfiConverterOptionalUInt32.read(buf),
)
@staticmethod
@@ -2804,12 +2831,14 @@ class _UniffiFfiConverterTypeOSGymSandboxWarmPoolSpec(_UniffiConverterRustBuffer
_UniffiFfiConverterUInt32.check_lower(value.replicas)
_UniffiFfiConverterTypeSandboxTemplateRef.check_lower(value.sandbox_template_ref)
_UniffiFfiConverterOptionalTypeWarmPoolAutoscaling.check_lower(value.autoscaling)
+ _UniffiFfiConverterOptionalUInt32.check_lower(value.ttl_seconds_after_created)
@staticmethod
def write(value, buf):
_UniffiFfiConverterUInt32.write(value.replicas, buf)
_UniffiFfiConverterTypeSandboxTemplateRef.write(value.sandbox_template_ref, buf)
_UniffiFfiConverterOptionalTypeWarmPoolAutoscaling.write(value.autoscaling, buf)
+ _UniffiFfiConverterOptionalUInt32.write(value.ttl_seconds_after_created, buf)
@dataclass
class OsGymSandboxWarmPoolStatus:
@@ -3072,6 +3101,8 @@ class OsGymSandboxWarmPoolSpecBuilderProtocol(typing.Protocol):
raise NotImplementedError
def sandbox_template_ref(self, value: SandboxTemplateRef) -> OsGymSandboxWarmPoolSpecBuilder:
raise NotImplementedError
+ def ttl_seconds_after_created(self, value: int) -> OsGymSandboxWarmPoolSpecBuilder:
+ raise NotImplementedError
class OsGymSandboxWarmPoolSpecBuilder(OsGymSandboxWarmPoolSpecBuilderProtocol):
@@ -3162,6 +3193,21 @@ class OsGymSandboxWarmPoolSpecBuilder(OsGymSandboxWarmPoolSpecBuilderProtocol):
*_uniffi_lowered_args,
)
return _uniffi_lift_return(_uniffi_ffi_result)
+ def ttl_seconds_after_created(self, value: int) -> OsGymSandboxWarmPoolSpecBuilder:
+
+ _UniffiFfiConverterUInt32.check_lower(value)
+ _uniffi_lowered_args = (
+ self._uniffi_clone_handle(),
+ _UniffiFfiConverterUInt32.lower(value),
+ )
+ _uniffi_lift_return = _UniffiFfiConverterTypeOSGymSandboxWarmPoolSpecBuilder.lift
+ _uniffi_error_converter = None
+ _uniffi_ffi_result = _uniffi_rust_call_with_error(
+ _uniffi_error_converter,
+ _UniffiLib.uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created,
+ *_uniffi_lowered_args,
+ )
+ return _uniffi_lift_return(_uniffi_ffi_result)
diff --git a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
index e8483686de..432bc48b22 100644
--- a/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
+++ b/libs/fleet/sdk-bindings/ruby/cyclops_sdk/schema.rb
@@ -139,6 +139,7 @@ end
RustBuffer.check_lower_Optionalstring(v.warmpool)
RustBuffer.check_lower_Optionalu32(v.bind_deadline)
RustBuffer.check_lower_OptionalTypeClaimLifecycle(v.lifecycle)
+ RustBuffer.check_lower_Optionalu32(v.ttl_seconds_after_created)
end
def self.alloc_from_TypeClaimSpec(v)
@@ -288,6 +289,7 @@ end
RustBuffer.check_lower_TypeSandboxTemplateRef(v.sandbox_template_ref)
RustBuffer.check_lower_OptionalTypeWarmPoolAutoscaling(v.autoscaling)
+ RustBuffer.check_lower_Optionalu32(v.ttl_seconds_after_created)
end
def self.alloc_from_TypeOSGymSandboxWarmPoolSpec(v)
@@ -1119,7 +1121,8 @@ class RustBufferStream
sandbox_template_ref: readTypeSandboxTemplateRef,
warmpool: readOptionalstring,
bind_deadline: readOptionalu32,
- lifecycle: readOptionalTypeClaimLifecycle
+ lifecycle: readOptionalTypeClaimLifecycle,
+ ttl_seconds_after_created: readOptionalu32
)
end
@@ -1191,7 +1194,8 @@ class RustBufferStream
OSGymSandboxWarmPoolSpec.new(
replicas: readU32,
sandbox_template_ref: readTypeSandboxTemplateRef,
- autoscaling: readOptionalTypeWarmPoolAutoscaling
+ autoscaling: readOptionalTypeWarmPoolAutoscaling,
+ ttl_seconds_after_created: readOptionalu32
)
end
@@ -1833,6 +1837,7 @@ class RustBufferBuilder
self.write_Optionalstring(v.warmpool)
self.write_Optionalu32(v.bind_deadline)
self.write_OptionalTypeClaimLifecycle(v.lifecycle)
+ self.write_Optionalu32(v.ttl_seconds_after_created)
end
# The Record type OSGymSandboxClaimCondition.
@@ -1891,6 +1896,7 @@ class RustBufferBuilder
self.write_U32(v.replicas)
self.write_TypeSandboxTemplateRef(v.sandbox_template_ref)
self.write_OptionalTypeWarmPoolAutoscaling(v.autoscaling)
+ self.write_Optionalu32(v.ttl_seconds_after_created)
end
# The Record type OSGymSandboxWarmPoolStatus.
@@ -2532,6 +2538,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref,
[:uint64, RustBuffer.by_value, RustCallStatus.by_ref],
:uint64
+ attach_function :uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created,
+ [:uint64, :uint32, RustCallStatus.by_ref],
+ :uint64
attach_function :uniffi_cyclops_sdk_schema_fn_clone_warmpoolautoscalingbuilder,
[:uint64, RustCallStatus.by_ref],
:uint64
@@ -2652,6 +2661,9 @@ module UniFFILib
attach_function :uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref,
[RustCallStatus.by_ref],
:uint16
+ attach_function :uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created,
+ [RustCallStatus.by_ref],
+ :uint16
attach_function :uniffi_cyclops_sdk_schema_checksum_method_warmpoolautoscalingbuilder_build,
[RustCallStatus.by_ref],
:uint16
@@ -2769,13 +2781,14 @@ end
# Record type ClaimSpec
class ClaimSpec
- attr_reader :sandbox_template_ref, :warmpool, :bind_deadline, :lifecycle
+ attr_reader :sandbox_template_ref, :warmpool, :bind_deadline, :lifecycle, :ttl_seconds_after_created
- def initialize(sandbox_template_ref:, warmpool:, bind_deadline:, lifecycle:)
+ def initialize(sandbox_template_ref:, warmpool:, bind_deadline:, lifecycle:, ttl_seconds_after_created: nil)
@sandbox_template_ref = sandbox_template_ref
@warmpool = warmpool
@bind_deadline = bind_deadline
@lifecycle = lifecycle
+ @ttl_seconds_after_created = ttl_seconds_after_created
end
def ==(other)
@@ -2791,6 +2804,9 @@ class ClaimSpec
if @lifecycle != other.lifecycle
return false
end
+ if @ttl_seconds_after_created != other.ttl_seconds_after_created
+ return false
+ end
true
end
@@ -3104,12 +3120,13 @@ end
# Record type OSGymSandboxWarmPoolSpec
class OSGymSandboxWarmPoolSpec
- attr_reader :replicas, :sandbox_template_ref, :autoscaling
+ attr_reader :replicas, :sandbox_template_ref, :autoscaling, :ttl_seconds_after_created
- def initialize(replicas:, sandbox_template_ref:, autoscaling:)
+ def initialize(replicas:, sandbox_template_ref:, autoscaling:, ttl_seconds_after_created: nil)
@replicas = replicas
@sandbox_template_ref = sandbox_template_ref
@autoscaling = autoscaling
+ @ttl_seconds_after_created = ttl_seconds_after_created
end
def ==(other)
@@ -3122,6 +3139,9 @@ class OSGymSandboxWarmPoolSpec
if @autoscaling != other.autoscaling
return false
end
+ if @ttl_seconds_after_created != other.ttl_seconds_after_created
+ return false
+ end
true
end
@@ -3661,6 +3681,12 @@ end
result = CyclopsSdkSchema.rust_call(:uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref,uniffi_clone_handle(),RustBuffer.alloc_from_TypeSandboxTemplateRef(value))
return OSGymSandboxWarmPoolSpecBuilder.uniffi_allocate(result)
end
+ def ttl_seconds_after_created(value)
+ value = CyclopsSdkSchema::uniffi_in_range(value, "u32", 0, 2**32)
+
+ result = CyclopsSdkSchema.rust_call(:uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created,uniffi_clone_handle(),value)
+ return OSGymSandboxWarmPoolSpecBuilder.uniffi_allocate(result)
+ end
end
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
index 91ea2e5cb4..b5a3b0010e 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchema.swift
@@ -660,6 +660,8 @@ public protocol OsGymSandboxWarmPoolSpecBuilderProtocol: AnyObject, Sendable {
func sandboxTemplateRef(value: SandboxTemplateRef) -> OsGymSandboxWarmPoolSpecBuilder
+ func ttlSecondsAfterCreated(value: UInt32) -> OsGymSandboxWarmPoolSpecBuilder
+
}
open class OsGymSandboxWarmPoolSpecBuilder: OsGymSandboxWarmPoolSpecBuilderProtocol, @unchecked Sendable {
fileprivate let handle: UInt64
@@ -756,6 +758,15 @@ open func sandboxTemplateRef(value: SandboxTemplateRef) -> OsGymSandboxWarmPoolS
})
}
+open func ttlSecondsAfterCreated(value: UInt32) -> OsGymSandboxWarmPoolSpecBuilder {
+ return try! FfiConverterTypeOSGymSandboxWarmPoolSpecBuilder_lift(try! rustCall() {
+ uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created(
+ self.uniffiCloneHandle(),
+ FfiConverterUInt32.lower(value),$0
+ )
+})
+}
+
}
@@ -1725,14 +1736,16 @@ public struct ClaimSpec: Equatable, Hashable {
public var warmpool: String?
public var bindDeadline: UInt32?
public var lifecycle: ClaimLifecycle?
+ public var ttlSecondsAfterCreated: UInt32?
// Default memberwise initializers are never public by default, so we
// declare one manually.
- public init(sandboxTemplateRef: SandboxTemplateRef, warmpool: String?, bindDeadline: UInt32?, lifecycle: ClaimLifecycle?) {
+ public init(sandboxTemplateRef: SandboxTemplateRef, warmpool: String?, bindDeadline: UInt32?, lifecycle: ClaimLifecycle?, ttlSecondsAfterCreated: UInt32? = nil) {
self.sandboxTemplateRef = sandboxTemplateRef
self.warmpool = warmpool
self.bindDeadline = bindDeadline
self.lifecycle = lifecycle
+ self.ttlSecondsAfterCreated = ttlSecondsAfterCreated
}
@@ -1754,7 +1767,8 @@ public struct FfiConverterTypeClaimSpec: FfiConverterRustBuffer {
sandboxTemplateRef: FfiConverterTypeSandboxTemplateRef.read(from: &buf),
warmpool: FfiConverterOptionString.read(from: &buf),
bindDeadline: FfiConverterOptionUInt32.read(from: &buf),
- lifecycle: FfiConverterOptionTypeClaimLifecycle.read(from: &buf)
+ lifecycle: FfiConverterOptionTypeClaimLifecycle.read(from: &buf),
+ ttlSecondsAfterCreated: FfiConverterOptionUInt32.read(from: &buf)
)
}
@@ -1763,6 +1777,7 @@ public struct FfiConverterTypeClaimSpec: FfiConverterRustBuffer {
FfiConverterOptionString.write(value.warmpool, into: &buf)
FfiConverterOptionUInt32.write(value.bindDeadline, into: &buf)
FfiConverterOptionTypeClaimLifecycle.write(value.lifecycle, into: &buf)
+ FfiConverterOptionUInt32.write(value.ttlSecondsAfterCreated, into: &buf)
}
}
@@ -2142,13 +2157,15 @@ public struct OsGymSandboxWarmPoolSpec: Equatable, Hashable {
public var replicas: UInt32
public var sandboxTemplateRef: SandboxTemplateRef
public var autoscaling: WarmPoolAutoscaling?
+ public var ttlSecondsAfterCreated: UInt32?
// Default memberwise initializers are never public by default, so we
// declare one manually.
- public init(replicas: UInt32, sandboxTemplateRef: SandboxTemplateRef, autoscaling: WarmPoolAutoscaling?) {
+ public init(replicas: UInt32, sandboxTemplateRef: SandboxTemplateRef, autoscaling: WarmPoolAutoscaling?, ttlSecondsAfterCreated: UInt32? = nil) {
self.replicas = replicas
self.sandboxTemplateRef = sandboxTemplateRef
self.autoscaling = autoscaling
+ self.ttlSecondsAfterCreated = ttlSecondsAfterCreated
}
@@ -2169,7 +2186,8 @@ public struct FfiConverterTypeOSGymSandboxWarmPoolSpec: FfiConverterRustBuffer {
try OsGymSandboxWarmPoolSpec(
replicas: FfiConverterUInt32.read(from: &buf),
sandboxTemplateRef: FfiConverterTypeSandboxTemplateRef.read(from: &buf),
- autoscaling: FfiConverterOptionTypeWarmPoolAutoscaling.read(from: &buf)
+ autoscaling: FfiConverterOptionTypeWarmPoolAutoscaling.read(from: &buf),
+ ttlSecondsAfterCreated: FfiConverterOptionUInt32.read(from: &buf)
)
}
@@ -2177,6 +2195,7 @@ public struct FfiConverterTypeOSGymSandboxWarmPoolSpec: FfiConverterRustBuffer {
FfiConverterUInt32.write(value.replicas, into: &buf)
FfiConverterTypeSandboxTemplateRef.write(value.sandboxTemplateRef, into: &buf)
FfiConverterOptionTypeWarmPoolAutoscaling.write(value.autoscaling, into: &buf)
+ FfiConverterOptionUInt32.write(value.ttlSecondsAfterCreated, into: &buf)
}
}
@@ -3659,6 +3678,9 @@ private let initializationResult: InitializationResult = {
if (uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref() != 7198) {
return InitializationResult.apiChecksumMismatch
}
+ if (uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created() != 44516) {
+ return InitializationResult.apiChecksumMismatch
+ }
if (uniffi_cyclops_sdk_schema_checksum_method_warmpoolautoscalingbuilder_build() != 17132) {
return InitializationResult.apiChecksumMismatch
}
diff --git a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
index 0d2a06bb6c..ad3244eadd 100644
--- a/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
+++ b/libs/fleet/sdk-bindings/swift/CyclopsSdkSchemaFFI.h
@@ -483,6 +483,11 @@ uint64_t uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_rep
uint64_t uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref(uint64_t ptr, RustBuffer value, RustCallStatus *_Nonnull out_status
);
#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_OSGYMSANDBOXWARMPOOLSPECBUILDER_TTL_SECONDS_AFTER_CREATED
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_METHOD_OSGYMSANDBOXWARMPOOLSPECBUILDER_TTL_SECONDS_AFTER_CREATED
+uint64_t uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created(uint64_t ptr, uint32_t value, RustCallStatus *_Nonnull out_status
+);
+#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_CLONE_WARMPOOLAUTOSCALINGBUILDER
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_FN_CLONE_WARMPOOLAUTOSCALINGBUILDER
uint64_t uniffi_cyclops_sdk_schema_fn_clone_warmpoolautoscalingbuilder(uint64_t handle, RustCallStatus *_Nonnull out_status
@@ -951,6 +956,12 @@ uint16_t uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuild
#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_OSGYMSANDBOXWARMPOOLSPECBUILDER_SANDBOX_TEMPLATE_REF
uint16_t uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref(void
+);
+#endif
+#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_OSGYMSANDBOXWARMPOOLSPECBUILDER_TTL_SECONDS_AFTER_CREATED
+#define UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_OSGYMSANDBOXWARMPOOLSPECBUILDER_TTL_SECONDS_AFTER_CREATED
+uint16_t uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created(void
+
);
#endif
#ifndef UNIFFI_FFIDEF_UNIFFI_CYCLOPS_SDK_SCHEMA_CHECKSUM_METHOD_WARMPOOLAUTOSCALINGBUILDER_BUILD
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
index fe7a8e7680..1e301937e6 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/cyclops_sdk_schema.ts
@@ -174,13 +174,16 @@ export type ClaimSpec = {
warmpool?: string;
bindDeadline?: number;
lifecycle?: ClaimLifecycle;
+ ttlSecondsAfterCreated?: number;
};
/**
* Generated factory for {@link ClaimSpec} record objects.
*/
export const ClaimSpec = (() => {
- const defaults = () => ({});
+ const defaults = () => ({
+ ttlSecondsAfterCreated: undefined,
+ });
const create = (() => {
return uniffiCreateRecord<ClaimSpec, ReturnType<typeof defaults>>(defaults);
})();
@@ -200,6 +203,7 @@ const FfiConverterTypeClaimSpec = (() => {
warmpool: FfiConverterOptionalString.read(from),
bindDeadline: FfiConverterOptionalUInt32.read(from),
lifecycle: FfiConverterOptionalTypeClaimLifecycle.read(from),
+ ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from),
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -207,6 +211,7 @@ const FfiConverterTypeClaimSpec = (() => {
FfiConverterOptionalString.write(value.warmpool, into);
FfiConverterOptionalUInt32.write(value.bindDeadline, into);
FfiConverterOptionalTypeClaimLifecycle.write(value.lifecycle, into);
+ FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into);
}
allocationSize(value: TypeName): number {
return (
@@ -215,7 +220,8 @@ const FfiConverterTypeClaimSpec = (() => {
) +
FfiConverterOptionalString.allocationSize(value.warmpool) +
FfiConverterOptionalUInt32.allocationSize(value.bindDeadline) +
- FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.lifecycle)
+ FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.lifecycle) +
+ FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated)
);
}
}
@@ -1109,13 +1115,16 @@ export type OsGymSandboxWarmPoolSpec = {
replicas: number;
sandboxTemplateRef: SandboxTemplateRef;
autoscaling?: WarmPoolAutoscaling;
+ ttlSecondsAfterCreated?: number;
};
/**
* Generated factory for {@link OsGymSandboxWarmPoolSpec} record objects.
*/
export const OsGymSandboxWarmPoolSpec = (() => {
- const defaults = () => ({});
+ const defaults = () => ({
+ ttlSecondsAfterCreated: undefined,
+ });
const create = (() => {
return uniffiCreateRecord<
OsGymSandboxWarmPoolSpec,
@@ -1138,6 +1147,7 @@ const FfiConverterTypeOSGymSandboxWarmPoolSpec = (() => {
replicas: FfiConverterUInt32.read(from),
sandboxTemplateRef: FfiConverterTypeSandboxTemplateRef.read(from),
autoscaling: FfiConverterOptionalTypeWarmPoolAutoscaling.read(from),
+ ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from),
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -1147,6 +1157,7 @@ const FfiConverterTypeOSGymSandboxWarmPoolSpec = (() => {
value.autoscaling,
into,
);
+ FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into);
}
allocationSize(value: TypeName): number {
return (
@@ -1156,7 +1167,8 @@ const FfiConverterTypeOSGymSandboxWarmPoolSpec = (() => {
) +
FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(
value.autoscaling,
- )
+ ) +
+ FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated)
);
}
}
@@ -1599,6 +1611,7 @@ export interface OsGymSandboxWarmPoolSpecBuilderLike {
sandboxTemplateRef(
value: SandboxTemplateRef,
): OsGymSandboxWarmPoolSpecBuilderLike;
+ ttlSecondsAfterCreated(value: number): OsGymSandboxWarmPoolSpecBuilderLike;
}
/**
* @deprecated Use `OsGymSandboxWarmPoolSpecBuilderLike` instead.
@@ -1712,6 +1725,23 @@ export class OsGymSandboxWarmPoolSpecBuilder
);
}
+ ttlSecondsAfterCreated(value: number): OsGymSandboxWarmPoolSpecBuilderLike {
+ return FfiConverterTypeOSGymSandboxWarmPoolSpecBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_schema_fn_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created(
+ uniffiTypeOsGymSandboxWarmPoolSpecBuilderObjectFactory.clonePointer(
+ this,
+ ),
+ FfiConverterUInt32.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
if (ptr !== undefined) {
@@ -2986,6 +3016,14 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_sandbox_template_ref",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created() !==
+ 44516
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_schema_checksum_method_osgymsandboxwarmpoolspecbuilder_ttl_seconds_after_created",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_schema_checksum_constructor_preservedjson_from_json() !==
24064
diff --git a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
index a26b82de92..f854af0b8f 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi-browser/ts/fleet_sdk.ts
@@ -785,6 +785,11 @@ export type HttpRequest = {
url: string;
headers: Array<HttpHeader>;
body?: ArrayBuffer;
+ /**
+ * Per-request timeout. Defaults to absent so callers written against the
+ * pre-timeout record shape keep constructing requests unchanged; absent
+ * falls back to the native client's 30-second default.
+ */
timeoutSecs?: bigint;
};
@@ -792,7 +797,9 @@ export type HttpRequest = {
* Generated factory for {@link HttpRequest} record objects.
*/
export const HttpRequest = (() => {
- const defaults = () => ({});
+ const defaults = () => ({
+ timeoutSecs: undefined,
+ });
const create = (() => {
return uniffiCreateRecord<HttpRequest, ReturnType<typeof defaults>>(
defaults,
@@ -5003,6 +5010,238 @@ const uniffiCallbackInterfaceHttpClient: { vtable: any; register: () => void } =
},
};
+export interface HttpRequestBuilderLike {
+ body(value: ArrayBuffer): HttpRequestBuilderLike;
+ build() /*throws*/ : HttpRequest;
+ headers(value: Array<HttpHeader>): HttpRequestBuilderLike;
+ method(value: string): HttpRequestBuilderLike;
+ timeoutSecs(value: bigint): HttpRequestBuilderLike;
+ url(value: string): HttpRequestBuilderLike;
+}
+/**
+ * @deprecated Use `HttpRequestBuilderLike` instead.
+ */
+export type HttpRequestBuilderInterface = HttpRequestBuilderLike;
+
+export class HttpRequestBuilder
+ extends UniffiAbstractObject
+ implements HttpRequestBuilderLike
+{
+ readonly [uniffiTypeNameSymbol] = "HttpRequestBuilder";
+ readonly [destructorGuardSymbol]: UniffiGcObject;
+ readonly [pointerLiteralSymbol]: UniffiHandle;
+ constructor() {
+ super();
+ const pointer = uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_constructor_httprequestbuilder_new(
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ );
+ this[pointerLiteralSymbol] = pointer;
+ this[destructorGuardSymbol] =
+ uniffiTypeHttpRequestBuilderObjectFactory.bless(pointer);
+ }
+
+ body(value: ArrayBuffer): HttpRequestBuilderLike {
+ return FfiConverterTypeHttpRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_httprequestbuilder_body(
+ uniffiTypeHttpRequestBuilderObjectFactory.clonePointer(this),
+ FfiConverterArrayBuffer.lower(
+ value,
+ nativeModule().rustbuffer_alloc,
+ ),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ build(): HttpRequest /*throws*/ {
+ return ((__rb: Uint8Array) => {
+ try {
+ return FfiConverterTypeHttpRequest.lift(__rb);
+ } finally {
+ nativeModule().rustbuffer_free(__rb);
+ }
+ })(
+ uniffiCaller.rustCallWithError(
+ /*liftError:*/ FfiConverterTypeSdkBuildError.lift.bind(
+ FfiConverterTypeSdkBuildError,
+ ),
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_httprequestbuilder_build(
+ uniffiTypeHttpRequestBuilderObjectFactory.clonePointer(this),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ headers(value: Array<HttpHeader>): HttpRequestBuilderLike {
+ return FfiConverterTypeHttpRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_httprequestbuilder_headers(
+ uniffiTypeHttpRequestBuilderObjectFactory.clonePointer(this),
+ FfiConverterSequenceTypeHttpHeader.lower(
+ value,
+ nativeModule().rustbuffer_alloc,
+ ),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ method(value: string): HttpRequestBuilderLike {
+ return FfiConverterTypeHttpRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_httprequestbuilder_method(
+ uniffiTypeHttpRequestBuilderObjectFactory.clonePointer(this),
+ FfiConverterString.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ timeoutSecs(value: bigint): HttpRequestBuilderLike {
+ return FfiConverterTypeHttpRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_httprequestbuilder_timeout_secs(
+ uniffiTypeHttpRequestBuilderObjectFactory.clonePointer(this),
+ FfiConverterUInt64.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ url(value: string): HttpRequestBuilderLike {
+ return FfiConverterTypeHttpRequestBuilder.lift(
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) => {
+ return nativeModule().ubrn_uniffi_cyclops_sdk_fn_method_httprequestbuilder_url(
+ uniffiTypeHttpRequestBuilderObjectFactory.clonePointer(this),
+ FfiConverterString.lower(value, nativeModule().rustbuffer_alloc),
+ callStatus,
+ );
+ },
+ /*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
+ ),
+ );
+ }
+
+ uniffiDestroy(): void {
+ const ptr = (this as any)[destructorGuardSymbol];
+ if (ptr !== undefined) {
+ const pointer = uniffiTypeHttpRequestBuilderObjectFactory.pointer(this);
+ uniffiTypeHttpRequestBuilderObjectFactory.freePointer(pointer);
+ uniffiTypeHttpRequestBuilderObjectFactory.unbless(ptr);
+ delete (this as any)[destructorGuardSymbol];
+ }
+ }
+
+ static instanceOf(obj_: any): obj_ is HttpRequestBuilder {
+ return uniffiTypeHttpRequestBuilderObjectFactory.isConcreteType(obj_);
+ }
+}
+
+const uniffiTypeHttpRequestBuilderObjectFactory: UniffiObjectFactory<HttpRequestBuilderLike> =
+ (() => {
+ /// <reference lib="es2021" />
+ const registry =
+ typeof FinalizationRegistry !== "undefined"
+ ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
+ uniffiTypeHttpRequestBuilderObjectFactory.freePointer(heldValue);
+ })
+ : null;
+
+ return {
+ create(pointer: UniffiHandle): HttpRequestBuilderLike {
+ const instance = Object.create(HttpRequestBuilder.prototype);
+ instance[pointerLiteralSymbol] = pointer;
+ instance[destructorGuardSymbol] = this.bless(pointer);
+ instance[uniffiTypeNameSymbol] = "HttpRequestBuilder";
+ return instance;
+ },
+
+ bless(p: UniffiHandle): UniffiGcObject {
+ const ptr = {
+ p, // make sure this object doesn't get optimized away.
+ markDestroyed: () => undefined,
+ };
+ if (registry) {
+ registry.register(ptr, p, ptr);
+ }
+ return ptr;
+ },
+
+ unbless(ptr_: UniffiGcObject) {
+ if (registry) {
+ registry.unregister(ptr_);
+ }
+ },
+
+ pointer(obj_: HttpRequestBuilderLike): UniffiHandle {
+ if ((obj_ as any)[destructorGuardSymbol] === undefined) {
+ throw new UniffiInternalError.UnexpectedNullPointer();
+ }
+ return (obj_ as any)[pointerLiteralSymbol];
+ },
+
+ clonePointer(obj_: HttpRequestBuilderLike): UniffiHandle {
+ const pointer = this.pointer(obj_);
+ return uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) =>
+ nativeModule().ubrn_uniffi_cyclops_sdk_fn_clone_httprequestbuilder(
+ pointer,
+ callStatus,
+ ),
+ /*liftString:*/ FfiConverterString.lift,
+ );
+ },
+
+ freePointer(pointer: UniffiHandle): void {
+ uniffiCaller.rustCall(
+ /*caller:*/ (callStatus) =>
+ nativeModule().ubrn_uniffi_cyclops_sdk_fn_free_httprequestbuilder(
+ pointer,
+ callStatus,
+ ),
+ /*liftString:*/ FfiConverterString.lift,
+ );
+ },
+
+ isConcreteType(obj_: any): obj_ is HttpRequestBuilderLike {
+ return (
+ obj_[destructorGuardSymbol] &&
+ obj_[uniffiTypeNameSymbol] === "HttpRequestBuilder"
+ );
+ },
+ };
+ })();
+const FfiConverterTypeHttpRequestBuilder = new FfiConverterObject(
+ uniffiTypeHttpRequestBuilderObjectFactory,
+);
+
export interface TemplateBuilderLike {
apiVersion(value: string): TemplateBuilderLike;
build() /*throws*/ : Template;
@@ -5797,6 +6036,62 @@ function uniffiEnsureInitialized() {
"uniffi_cyclops_sdk_checksum_method_httpclient_execute",
);
}
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_httprequestbuilder_new() !==
+ 25892
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_constructor_httprequestbuilder_new",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_httprequestbuilder_body() !==
+ 9054
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_httprequestbuilder_body",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_httprequestbuilder_build() !==
+ 14573
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_httprequestbuilder_build",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_httprequestbuilder_headers() !==
+ 19982
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_httprequestbuilder_headers",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_httprequestbuilder_method() !==
+ 4078
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_httprequestbuilder_method",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_httprequestbuilder_timeout_secs() !==
+ 40941
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_httprequestbuilder_timeout_secs",
+ );
+ }
+ if (
+ nativeModule().ubrn_uniffi_cyclops_sdk_checksum_method_httprequestbuilder_url() !==
+ 12282
+ ) {
+ throw new UniffiInternalError.ApiChecksumMismatch(
+ "uniffi_cyclops_sdk_checksum_method_httprequestbuilder_url",
+ );
+ }
if (
nativeModule().ubrn_uniffi_cyclops_sdk_checksum_constructor_templatebuilder_new() !==
19815
@@ -5873,6 +6168,7 @@ export default Object.freeze({
FfiConverterTypeHttpError,
FfiConverterTypeHttpHeader,
FfiConverterTypeHttpRequest,
+ FfiConverterTypeHttpRequestBuilder,
FfiConverterTypeHttpResponse,
FfiConverterTypeNamespace,
FfiConverterTypeNewUserApiKey,
diff --git a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
index df08f33b84..5d3fda120a 100644
--- a/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
+++ b/libs/fleet/sdk-bindings/ts-uniffi/cyclops_sdk_schema.ts
@@ -67,8 +67,8 @@ const FfiConverterTypeClaimLifecycle = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- shutdownTime: FfiConverterOptionalString.read(from),
- shutdownPolicy: FfiConverterOptionalString.read(from),
+ shutdownTime: FfiConverterOptionalString.read(from),
+ shutdownPolicy: FfiConverterOptionalString.read(from),
autoRenew: FfiConverterOptionalBoolean.read(from)
};
}
@@ -81,7 +81,7 @@ const FfiConverterTypeClaimLifecycle = (() => {
return FfiConverterOptionalString.allocationSize(value.shutdownTime) +
FfiConverterOptionalString.allocationSize(value.shutdownPolicy) +
FfiConverterOptionalBoolean.allocationSize(value.autoRenew);
-
+
}
};
return new FFIConverter();
@@ -120,7 +120,7 @@ const FfiConverterTypeSandboxTemplateRef = (() => {
}
allocationSize(value: TypeName): number {
return FfiConverterString.allocationSize(value.name);
-
+
}
};
return new FFIConverter();
@@ -130,7 +130,8 @@ export type ClaimSpec = {
sandboxTemplateRef: SandboxTemplateRef,
warmpool?: string,
bindDeadline?: number,
- lifecycle?: ClaimLifecycle
+ lifecycle?: ClaimLifecycle,
+ ttlSecondsAfterCreated?: number
}
/**
@@ -138,6 +139,7 @@ export type ClaimSpec = {
*/
export const ClaimSpec = (() => {
const defaults = () => ({
+ ttlSecondsAfterCreated: undefined
});
const create = (() => {
return uniffiCreateRecord<ClaimSpec, ReturnType<typeof defaults>>(defaults);
@@ -154,10 +156,11 @@ const FfiConverterTypeClaimSpec = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- sandboxTemplateRef: FfiConverterTypeSandboxTemplateRef.read(from),
- warmpool: FfiConverterOptionalString.read(from),
- bindDeadline: FfiConverterOptionalUInt32.read(from),
- lifecycle: FfiConverterOptionalTypeClaimLifecycle.read(from)
+ sandboxTemplateRef: FfiConverterTypeSandboxTemplateRef.read(from),
+ warmpool: FfiConverterOptionalString.read(from),
+ bindDeadline: FfiConverterOptionalUInt32.read(from),
+ lifecycle: FfiConverterOptionalTypeClaimLifecycle.read(from),
+ ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
@@ -165,13 +168,15 @@ const FfiConverterTypeClaimSpec = (() => {
FfiConverterOptionalString.write(value.warmpool, into);
FfiConverterOptionalUInt32.write(value.bindDeadline, into);
FfiConverterOptionalTypeClaimLifecycle.write(value.lifecycle, into);
+ FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into);
}
allocationSize(value: TypeName): number {
return FfiConverterTypeSandboxTemplateRef.allocationSize(value.sandboxTemplateRef) +
FfiConverterOptionalString.allocationSize(value.warmpool) +
FfiConverterOptionalUInt32.allocationSize(value.bindDeadline) +
- FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.lifecycle);
-
+ FfiConverterOptionalTypeClaimLifecycle.allocationSize(value.lifecycle) +
+ FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated);
+
}
};
return new FFIConverter();
@@ -206,10 +211,10 @@ const FfiConverterTypeOSGymSandboxClaimCondition = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- type: FfiConverterOptionalString.read(from),
- status: FfiConverterOptionalString.read(from),
- reason: FfiConverterOptionalString.read(from),
- message: FfiConverterOptionalString.read(from),
+ type: FfiConverterOptionalString.read(from),
+ status: FfiConverterOptionalString.read(from),
+ reason: FfiConverterOptionalString.read(from),
+ message: FfiConverterOptionalString.read(from),
lastTransitionTime: FfiConverterOptionalString.read(from)
};
}
@@ -226,7 +231,7 @@ const FfiConverterTypeOSGymSandboxClaimCondition = (() => {
FfiConverterOptionalString.allocationSize(value.reason) +
FfiConverterOptionalString.allocationSize(value.message) +
FfiConverterOptionalString.allocationSize(value.lastTransitionTime);
-
+
}
};
return new FFIConverter();
@@ -258,7 +263,7 @@ const FfiConverterTypeOSGymSandboxClaimSandbox = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- name: FfiConverterOptionalString.read(from),
+ name: FfiConverterOptionalString.read(from),
service: FfiConverterOptionalString.read(from)
};
}
@@ -269,7 +274,7 @@ const FfiConverterTypeOSGymSandboxClaimSandbox = (() => {
allocationSize(value: TypeName): number {
return FfiConverterOptionalString.allocationSize(value.name) +
FfiConverterOptionalString.allocationSize(value.service);
-
+
}
};
return new FFIConverter();
@@ -302,8 +307,8 @@ const FfiConverterTypeOSGymSandboxClaimStatus = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- phase: FfiConverterOptionalString.read(from),
- conditions: FfiConverterOptionalSequenceTypeOSGymSandboxClaimCondition.read(from),
+ phase: FfiConverterOptionalString.read(from),
+ conditions: FfiConverterOptionalSequenceTypeOSGymSandboxClaimCondition.read(from),
sandbox: FfiConverterOptionalTypeOSGymSandboxClaimSandbox.read(from)
};
}
@@ -316,7 +321,7 @@ const FfiConverterTypeOSGymSandboxClaimStatus = (() => {
return FfiConverterOptionalString.allocationSize(value.phase) +
FfiConverterOptionalSequenceTypeOSGymSandboxClaimCondition.allocationSize(value.conditions) +
FfiConverterOptionalTypeOSGymSandboxClaimSandbox.allocationSize(value.sandbox);
-
+
}
};
return new FFIConverter();
@@ -355,7 +360,7 @@ const FfiConverterTypeRuntimeKind = (() => {
})();
export interface PreservedJsonLike {
-
+
toJson(): string;
}
/**
@@ -376,7 +381,7 @@ private constructor(pointer: UniffiHandle) {
this[destructorGuardSymbol] = uniffiTypePreservedJsonObjectFactory.bless(pointer);
}
-
+
static fromJson(value: string): PreservedJsonLike /*throws*/ {
return FfiConverterTypePreservedJson.lift(uniffiCaller.rustCallWithError(
/*liftError:*/ FfiConverterTypeJsonValueError.lift.bind(FfiConverterTypeJsonValueError),
@@ -388,9 +393,9 @@ private constructor(pointer: UniffiHandle) {
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
-
-
+
+
toJson(): string {
return ((__rb: Uint8Array) => {
try {
@@ -407,7 +412,7 @@ private constructor(pointer: UniffiHandle) {
/*liftString:*/ FfiConverterString.lift.bind(FfiConverterString),
));
}
-
+
uniffiDestroy(): void {
const ptr = (this as any)[destructorGuardSymbol];
@@ -423,16 +428,16 @@ private constructor(pointer: UniffiHandle) {
return uniffiTypePreservedJsonObjectFactory.isConcreteType(obj_);
}
-
+
}
const uniffiTypePreservedJsonObjectFactory: UniffiObjectFactory<PreservedJsonLike> = (() => {
-
+
/// <reference lib="es2021" />
const registry = typeof FinalizationRegistry !== 'undefined' ? new FinalizationRegistry<UniffiHandle>((heldValue: UniffiHandle) => {
uniffiTypePreservedJsonObjectFactory.freePointer(heldValue);
}) : null;
-
+
return {
create(pointer: UniffiHandle): PreservedJsonLike {
const instance = Object.create(PreservedJson.prototype);
@@ -442,7 +447,7 @@ const uniffiTypePreservedJsonObjectFactory: UniffiObjectFactory<PreservedJsonLik
return instance;
},
-
+
bless(p: UniffiHandle): UniffiGcObject {
const ptr = {
p, // make sure this object doesn't get optimized away.
@@ -605,8 +610,8 @@ const FfiConverterTypeSandboxService = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- name: FfiConverterString.read(from),
- targetPort: FfiConverterUInt16.read(from),
+ name: FfiConverterString.read(from),
+ targetPort: FfiConverterUInt16.read(from),
protocol: FfiConverterOptionalTypeServiceProtocol.read(from)
};
}
@@ -619,7 +624,7 @@ const FfiConverterTypeSandboxService = (() => {
return FfiConverterString.allocationSize(value.name) +
FfiConverterUInt16.allocationSize(value.targetPort) +
FfiConverterOptionalTypeServiceProtocol.allocationSize(value.protocol);
-
+
}
};
return new FFIConverter();
@@ -654,10 +659,10 @@ const FfiConverterTypeOidcConfig = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- credentialsSecret: FfiConverterString.read(from),
- tokenUrl: FfiConverterString.read(from),
- awsRoleArn: FfiConverterOptionalString.read(from),
- awsRegion: FfiConverterOptionalString.read(from),
+ credentialsSecret: FfiConverterString.read(from),
+ tokenUrl: FfiConverterString.read(from),
+ awsRoleArn: FfiConverterOptionalString.read(from),
+ awsRegion: FfiConverterOptionalString.read(from),
refreshIntervalSeconds: FfiConverterOptionalUInt32.read(from)
};
}
@@ -674,7 +679,7 @@ const FfiConverterTypeOidcConfig = (() => {
FfiConverterOptionalString.allocationSize(value.awsRoleArn) +
FfiConverterOptionalString.allocationSize(value.awsRegion) +
FfiConverterOptionalUInt32.allocationSize(value.refreshIntervalSeconds);
-
+
}
};
return new FFIConverter();
@@ -719,16 +724,16 @@ const FfiConverterTypeVmTemplate = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- containerDiskImage: FfiConverterString.read(from),
- command: FfiConverterOptionalSequenceString.read(from),
- runtime: FfiConverterOptionalTypeRuntimeKind.read(from),
- runtimeClassName: FfiConverterOptionalString.read(from),
- nodeSelector: FfiConverterOptionalMapStringString.read(from),
- tolerations: FfiConverterOptionalSequenceTypePreservedJson.read(from),
- imagePullPolicy: FfiConverterOptionalTypeImagePullPolicy.read(from),
- imagePullSecret: FfiConverterOptionalString.read(from),
- cpuCores: FfiConverterOptionalUInt32.read(from),
- memory: FfiConverterOptionalString.read(from),
+ containerDiskImage: FfiConverterString.read(from),
+ command: FfiConverterOptionalSequenceString.read(from),
+ runtime: FfiConverterOptionalTypeRuntimeKind.read(from),
+ runtimeClassName: FfiConverterOptionalString.read(from),
+ nodeSelector: FfiConverterOptionalMapStringString.read(from),
+ tolerations: FfiConverterOptionalSequenceTypePreservedJson.read(from),
+ imagePullPolicy: FfiConverterOptionalTypeImagePullPolicy.read(from),
+ imagePullSecret: FfiConverterOptionalString.read(from),
+ cpuCores: FfiConverterOptionalUInt32.read(from),
+ memory: FfiConverterOptionalString.read(from),
firmware: FfiConverterOptionalTypeFirmware.read(from),
nestedVirtualization: FfiConverterOptionalBoolean.read(from),
probes: FfiConverterOptionalTypePreservedJson.read(from),
@@ -769,7 +774,7 @@ const FfiConverterTypeVmTemplate = (() => {
FfiConverterOptionalTypePreservedJson.allocationSize(value.probes) +
FfiConverterOptionalSequenceTypeSandboxService.allocationSize(value.services) +
FfiConverterOptionalTypeOidcConfig.allocationSize(value.oidc);
-
+
}
};
return new FFIConverter();
@@ -808,7 +813,7 @@ const FfiConverterTypeOSGymSandboxSpec = (() => {
}
allocationSize(value: TypeName): number {
return FfiConverterTypeVmTemplate.allocationSize(value.vmTemplate);
-
+
}
};
return new FFIConverter();
@@ -846,13 +851,13 @@ const FfiConverterTypeOSGymSandboxStatus = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- phase: FfiConverterOptionalString.read(from),
- runtime: FfiConverterOptionalString.read(from),
- ready: FfiConverterOptionalBoolean.read(from),
- vmName: FfiConverterOptionalString.read(from),
- service: FfiConverterOptionalString.read(from),
- message: FfiConverterOptionalString.read(from),
- resetIssuedAt: FfiConverterOptionalString.read(from),
+ phase: FfiConverterOptionalString.read(from),
+ runtime: FfiConverterOptionalString.read(from),
+ ready: FfiConverterOptionalBoolean.read(from),
+ vmName: FfiConverterOptionalString.read(from),
+ service: FfiConverterOptionalString.read(from),
+ message: FfiConverterOptionalString.read(from),
+ resetIssuedAt: FfiConverterOptionalString.read(from),
resetVmiUid: FfiConverterOptionalString.read(from)
};
}
@@ -875,7 +880,7 @@ const FfiConverterTypeOSGymSandboxStatus = (() => {
FfiConverterOptionalString.allocationSize(value.message) +
FfiConverterOptionalString.allocationSize(value.resetIssuedAt) +
FfiConverterOptionalString.allocationSize(value.resetVmiUid);
-
+
}
};
return new FFIConverter();
@@ -914,7 +919,7 @@ const FfiConverterTypeOSGymSandboxTemplateSpec = (() => {
}
allocationSize(value: TypeName): number {
return FfiConverterTypeVmTemplate.allocationSize(value.vmTemplate);
-
+
}
};
return new FFIConverter();
@@ -947,8 +952,8 @@ const FfiConverterTypeWarmPoolAutoscaling = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- minPoolSize: FfiConverterOptionalUInt32.read(from),
- initialPoolSize: FfiConverterOptionalUInt32.read(from),
+ minPoolSize: FfiConverterOptionalUInt32.read(from),
+ initialPoolSize: FfiConverterOptionalUInt32.read(from),
maxPoolSize: FfiConverterOptionalUInt32.read(from)
};
}
@@ -961,7 +966,7 @@ const FfiConverterTypeWarmPoolAutoscaling = (() => {
return FfiConverterOptionalUInt32.allocationSize(value.minPoolSize) +
FfiConverterOptionalUInt32.allocationSize(value.initialPoolSize) +
FfiConverterOptionalUInt32.allocationSize(value.maxPoolSize);
-
+
}
};
return new FFIConverter();
@@ -970,7 +975,8 @@ const FfiConverterTypeWarmPoolAutoscaling = (() => {
export type OsGymSandboxWarmPoolSpec = {
replicas: number,
sandboxTemplateRef: SandboxTemplateRef,
- autoscaling?: WarmPoolAutoscaling
+ autoscaling?: WarmPoolAutoscaling,
+ ttlSecondsAfterCreated?: number
}
/**
@@ -978,6 +984,7 @@ export type OsGymSandboxWarmPoolSpec = {
*/
export const OsGymSandboxWarmPoolSpec = (() => {
const defaults = () => ({
+ ttlSecondsAfterCreated: undefined
});
const create = (() => {
return uniffiCreateRecord<OsGymSandboxWarmPoolSpec, ReturnType<typeof defaults>>(defaults);
@@ -994,21 +1001,24 @@ const FfiConverterTypeOSGymSandboxWarmPoolSpec = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- replicas: FfiConverterUInt32.read(from),
- sandboxTemplateRef: FfiConverterTypeSandboxTemplateRef.read(from),
- autoscaling: FfiConverterOptionalTypeWarmPoolAutoscaling.read(from)
+ replicas: FfiConverterUInt32.read(from),
+ sandboxTemplateRef: FfiConverterTypeSandboxTemplateRef.read(from),
+ autoscaling: FfiConverterOptionalTypeWarmPoolAutoscaling.read(from),
+ ttlSecondsAfterCreated: FfiConverterOptionalUInt32.read(from)
};
}
write(value: TypeName, into: RustBuffer): void {
FfiConverterUInt32.write(value.replicas, into);
FfiConverterTypeSandboxTemplateRef.write(value.sandboxTemplateRef, into);
FfiConverterOptionalTypeWarmPoolAutoscaling.write(value.autoscaling, into);
+ FfiConverterOptionalUInt32.write(value.ttlSecondsAfterCreated, into);
}
allocationSize(value: TypeName): number {
return FfiConverterUInt32.allocationSize(value.replicas) +
FfiConverterTypeSandboxTemplateRef.allocationSize(value.sandboxTemplateRef) +
- FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(value.autoscaling);
-
+ FfiConverterOptionalTypeWarmPoolAutoscaling.allocationSize(value.autoscaling) +
+ FfiConverterOptionalUInt32.allocationSize(value.ttlSecondsAfterCreated);
+
}
};
return new FFIConverter();
@@ -1041,8 +1051,8 @@ const FfiConverterTypeOSGymSandboxWarmPoolStatus = (() => {
class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
read(from: RustBuffer): TypeName {
return {
- replicas: FfiConverterOptionalUInt32.read(from),
- readyReplicas: FfiConverterOptionalUInt32.read(from),
+ replicas: FfiConverterOptionalUInt32.read(from),
+ readyReplicas: FfiConverterOptionalUInt32.read(from),
selector: FfiConverterOptionalString.read(from)
};
}
@@ -1055,7 +1065,7 @@ const FfiConverterTypeOSGymSandboxWarmPoolStatus = (() => {
return FfiConverterOptionalUInt32.allocationSize(value.replicas) +
FfiConverterOptionalUInt32.allocationSize(value.readyReplicas) +
FfiConverterOptionalString.allocationSize(value.selector);
-
+
}
};
return new FFIConverter();
@@ -1070,7 +1080,7 @@ export const JsonValueError = (() => {
type Invalid__interface = {
tag: JsonValueError_Tags.Invalid;
- inner:
+ inner:
Readonly<{reason: string}>
};
class Invalid_ extends UniffiError implements Invalid__interface {
@@ -1080,7 +1090,7 @@ Readonly<{reason: string}>
*/
readonly [uniffiTypeNameSymbol] = "JsonValueError";
readonly tag = JsonValueError_Tags.Invalid;
- readonly inner:
+ readonly inner:
Readonly<{reason: string}>;
constructor(
inner: {reason: string }) {
@@ -1100,7 +1110,7 @@ inner: {reason: string }): Invalid_ {
return Invalid_.instanceOf(obj);
}
- static getInner(obj: Invalid_):
+ static getInner(obj: Invalid_):
Readonly<{reason: string}> {
return obj.inner;
}
@@ -1160,7 +1170,107 @@ const FfiConverterTypeJsonValueError = (() => {
return new FFIConverter();
})();
-// FfiConverter for string | undefined
+
+// Error type: SchemaBuildError
+export enum SchemaBuildError_Tags {
+ MissingRequiredField = "MissingRequiredField"
+}
+export const SchemaBuildError = (() => {
+
+ type MissingRequiredField__interface = {
+ tag: SchemaBuildError_Tags.MissingRequiredField;
+ inner:
+Readonly<{recordType: string; field: string}>
+ };
+ class MissingRequiredField_ extends UniffiError implements MissingRequiredField__interface {
+ /**
+ * @private
+ * This field is private and should not be used, use `tag` instead.
+ */
+ readonly [uniffiTypeNameSymbol] = "SchemaBuildError";
+ readonly tag = SchemaBuildError_Tags.MissingRequiredField;
+ readonly inner:
+Readonly<{recordType: string; field: string}>;
+ constructor(
+inner: {recordType: string; field: string }) {
+ super("SchemaBuildError", "MissingRequiredField");
+
+ this.inner = Object.freeze(inner);
+ }
+ static new(
+inner: {recordType: string; field: string }): MissingRequiredField_ {
+ return new MissingRequiredField_(inner);
+ }
+
+ static instanceOf(obj: any): obj is MissingRequiredField_ {
+ return obj.tag === SchemaBuildError_Tags.MissingRequiredField;
+ }
+ static hasInner(obj: any): obj is MissingRequiredField_ {
+ return MissingRequiredField_.instanceOf(obj);
+ }
+
+ static getInner(obj: MissingRequiredField_):
+Readonly<{recordType: string; field: string}> {
+ return obj.inner;
+ }
+
+ }
+
+ function instanceOf(obj: any): obj is SchemaBuildError {
+ return obj[uniffiTypeNameSymbol] === "SchemaBuildError";
+ }
+
+ return Object.freeze({
+ instanceOf,
+ MissingRequiredField: MissingRequiredField_
+ });
+
+})();
+export type SchemaBuildError = InstanceType<
+ typeof SchemaBuildError['MissingRequiredField']
+>;
+
+// FfiConverter for enum SchemaBuildError
+const FfiConverterTypeSchemaBuildError = (() => {
+ const ordinalConverter = FfiConverterInt32;
+ type TypeName = SchemaBuildError;
+ class FFIConverter extends AbstractFfiConverterByteArray<TypeName> {
+ read(from: RustBuffer): TypeName {
+ switch (ordinalConverter.read(from)) {
+ case 1: return new SchemaBuildError.MissingRequiredField({recordType: FfiConverterString.read(from), field: FfiConverterString.read(from) });
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ write(value: TypeName, into: RustBuffer): void {
+ switch (value.tag) {
+ case SchemaBuildError_Tags.MissingRequiredField: {
+ ordinalConverter.write(1, into);
+ const inner = value.inner;
+ FfiConverterString.write(inner.recordType, into);
+ FfiConverterString.write(inner.field, into);
+ return;
+ }
+ default:
+ // Throwing from here means that SchemaBuildError_Tags hasn't matched an ordinal.
+ throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ allocationSize(value: TypeName): number {
+ switch (value.tag) {
+ case SchemaBuildError_Tags.MissingRequiredField: {
+ const inner = value.inner;
+ let size = ordinalConverter.allocationSize(1);
+ size += FfiConverterString.allocationSize(inner.recordType);
+ size += FfiConverterString.allocationSize(inner.field);
+ return size;
+ }
+ default: throw new UniffiInternalError.UnexpectedEnumCase();
+ }
+ }
+ }
+ return new FFIConverter();
+})();
+
const FfiConverterOptionalString = new FfiConverterOptional(FfiConverterString);
// FfiConverter for boolean | undefined
@@ -1275,8 +1385,9 @@ export default Object.freeze({
FfiConverterTypeRuntimeKind,
FfiConverterTypeSandboxService,
FfiConverterTypeSandboxTemplateRef,
+ FfiConverterTypeSchemaBuildError,
FfiConverterTypeServiceProtocol,
FfiConverterTypeVmTemplate,
FfiConverterTypeWarmPoolAutoscaling,
}
-});
\ No newline at end of file
+});
diff --git a/libs/fleet/sdk-schema/src/claim.rs b/libs/fleet/sdk-schema/src/claim.rs
index e7cc045cfa..74aaa4a9a6 100644
--- a/libs/fleet/sdk-schema/src/claim.rs
+++ b/libs/fleet/sdk-schema/src/claim.rs
@@ -183,4 +183,13 @@ pub struct ClaimSpec {
#[schemars(default, schema_with = "claim_lifecycle_schema")]
#[serde(skip_serializing_if = "Option::is_none")]
pub lifecycle: Option<ClaimLifecycle>,
+ #[schemars(
+ default,
+ schema_with = "integer_schema",
+ range(min = 0, max = u32::MAX),
+ description = "Creation-age TTL in seconds. When absent, the resource is not automatically reaped based on age."
+ )]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[uniffi(default = None)]
+ pub ttl_seconds_after_created: Option<u32>,
}
diff --git a/libs/fleet/sdk-schema/src/warmpool.rs b/libs/fleet/sdk-schema/src/warmpool.rs
index 7187aa9032..883f001493 100644
--- a/libs/fleet/sdk-schema/src/warmpool.rs
+++ b/libs/fleet/sdk-schema/src/warmpool.rs
@@ -115,6 +115,15 @@ pub struct OSGymSandboxWarmPoolSpec {
)]
#[serde(skip_serializing_if = "Option::is_none")]
pub autoscaling: Option<WarmPoolAutoscaling>,
+ #[schemars(
+ default,
+ schema_with = "integer_schema",
+ range(min = 0, max = u32::MAX),
+ description = "Creation-age TTL in seconds. When absent, the resource is not automatically reaped based on age."
+ )]
+ #[serde(skip_serializing_if = "Option::is_none")]
+ #[uniffi(default = None)]
+ pub ttl_seconds_after_created: Option<u32>,
}
#[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize, JsonSchema, uniffi::Record)]
diff --git a/libs/fleet/sdk-schema/tests/claim_crds.rs b/libs/fleet/sdk-schema/tests/claim_crds.rs
index 5e7e4f87fd..0b1d22d0f5 100644
--- a/libs/fleet/sdk-schema/tests/claim_crds.rs
+++ b/libs/fleet/sdk-schema/tests/claim_crds.rs
@@ -66,6 +66,39 @@ fn normalize_known_kube_derive_artifacts(mut value: Value) -> Value {
value
}
+fn ttl_schema(crd: Value) -> Value {
+ let mut schema = crd
+ .pointer(
+ "/spec/versions/0/schema/openAPIV3Schema/properties/spec/properties/ttlSecondsAfterCreated",
+ )
+ .cloned()
+ .unwrap();
+ schema.as_object_mut().unwrap().remove("description");
+ normalize_numbers(&mut schema);
+ schema
+}
+
+#[test]
+fn pool_and_claim_ttl_are_optional_bounded_u32_integers() {
+ for crd in [
+ serde_json::to_value(OSGymSandboxWarmPool::crd()).unwrap(),
+ serde_json::to_value(OSGymSandboxClaim::crd()).unwrap(),
+ ] {
+ let required = crd
+ .pointer("/spec/versions/0/schema/openAPIV3Schema/properties/spec/required")
+ .and_then(Value::as_array)
+ .unwrap();
+ assert!(
+ !required.contains(&json!("ttlSecondsAfterCreated")),
+ "ttlSecondsAfterCreated must be optional",
+ );
+ assert_eq!(
+ ttl_schema(crd),
+ json!({"type": "integer", "minimum": 0, "maximum": 4_294_967_295u64}),
+ );
+ }
+}
+
#[test]
fn raw_kube_derive_output_has_intentional_warm_pool_and_claim_shape_differences() {
let warm_pool = serde_json::to_value(OSGymSandboxWarmPool::crd()).unwrap();
diff --git a/libs/fleet/sdk/src/claims.rs b/libs/fleet/sdk/src/claims.rs
index d584d19ef9..48dcb2fae7 100644
--- a/libs/fleet/sdk/src/claims.rs
+++ b/libs/fleet/sdk/src/claims.rs
@@ -44,6 +44,7 @@ impl CyclopsClient {
sandbox_template_ref: pool.spec.sandbox_template_ref.clone(),
warmpool: None,
bind_deadline: Some(DEFAULT_CLAIM_BIND_DEADLINE_SECONDS),
+ ttl_seconds_after_created: None,
lifecycle: None,
});
if spec.bind_deadline.is_none() {