Skip to content

build(sdk): check in operation descriptors and drop build.rs - #3069

Open
devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1791126770-sdk-checked-in-operations
Open

devin-ai-integration[bot] wants to merge 1 commit into
masterfrom
devin/1791126770-sdk-checked-in-operations

Conversation

@devin-ai-integration

@devin-ai-integration devin-ai-integration Bot commented Oct 4, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Delete crates/tracedecay-sdk/build.rs and its [build-dependencies]. src/operations.rs is checked in again, generated through the same contracts:generate path as the TypeScript SDK.
  • Add a drift test, codegen::tests::checked_in_rust_operations_match_canonical_registry, and extend contracts:check so it also compares operations.rs.

Motivation

build.rs made tracedecay-contracts, -domain, -policy and -tool-catalog build dependencies. The host graph resolves different features for them than the normal graph does (for example, serde_json raw_value vs preserve_order, and schemars chrono04). As a result, Cargo compiled that spine a second time on every cold build. Pinning profiles does not fix this, because the duplicate units come from the feature differences.

This undoes part of 0f6784d, which moved the descriptors into OUT_DIR so there would be no checked-in copy that could drift. Drift is now a hard test failure instead.

A/B: cold cargo build -p tracedecay-cli --timings --locked, workspace packages cleaned, third-party crates cached, 8 cores, one run each:

units wall CPU (workspace)
master (7aa7877) 846 470s 1999s
this PR 797 473s 1682s (+34s third-party rebuilt after the feature change)

The change saves about 317s of workspace CPU (about 16%) and removes 49 units. Wall time on 8 cores does not change, because the critical path goes through tracedecay, not the SDK. The saving matters on machines with fewer cores and on parallel CI jobs. tracedecay-sdk itself now starts at 94s instead of 163s.

Changes

  • src/codegen.rs: write_sdk_sources writes crates/tracedecay-sdk/src/operations.rs along with the TS sources. It renders everything before writing anything. The rendered Rust file has a module doc and #![cfg_attr(rustfmt, rustfmt::skip)], so no rustfmt step is needed. Its body is byte-identical to the previous OUT_DIR output.
  • src/bin/generate.rs: calls write_sdk_sources. The dead_code allow is no longer needed.
  • dashboard/codegen/src/cli.ts: exportSdkSources also returns operations.rs, so contracts:generate writes it and contracts:check compares it.
  • AGENTS.md: lists operations.rs among the generated files.

Test plan

  • cargo fmt --all -- --check
  • cargo clippy -p tracedecay-sdk --all-targets --locked -- -D warnings and cargo clippy --all-targets --locked -- -D warnings in sdks/codegen
  • cargo test -p tracedecay-sdk --lib (10 passed), cargo test --locked in sdks/codegen (13 passed)
  • Drift test fails as expected after hand-editing one DeadlineBehavior in operations.rs: "crates/tracedecay-sdk/src/operations.rs is stale; run pnpm --dir dashboard run contracts:generate"
  • pnpm --dir dashboard run contracts:check: "contracts up to date"
  • cargo tree -p tracedecay-sdk -e build shows no build dependencies

Checklist

  • CHANGELOG.md updated (build-internal, no user-facing change)
  • No secrets, credentials, or .env files included
  • Breaking changes documented (none)

Link to Devin session: https://app.devin.ai/sessions/4b9be38fe30b4b79a456673a3ad33483
Open in Devin Desktop: https://app.devin.ai/desktop/session/4b9be38fe30b4b79a456673a3ad33483?variant=devin
Requested by: @ScriptedAlchemy


Devin Review

tracedecay-sdk/build.rs made tracedecay-contracts, -domain, -policy and -tool-catalog build dependencies. Their host-graph feature sets differ from the normal graph (serde_json raw_value vs preserve_order, schemars chrono04), so Cargo compiled each of them a second time for the build script on every cold build.

The generator now writes src/operations.rs next to the TypeScript SDK sources, through the same contracts:generate / contracts:check path. A codegen unit test compares the checked-in file with a fresh render, so drift fails cargo test in sdks/codegen as well as contracts:check. The rendered body is byte-identical to the previous OUT_DIR output and is marked rustfmt::skip.

Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@devin-ai-integration

Copy link
Copy Markdown
Contributor Author

I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".

  • Disable automatic comment, CI, and merge conflict monitoring

@changeset-bot

changeset-bot Bot commented Oct 4, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 966efbc

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔍 Devin Review: 1 flag

Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)

Devin Review

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant