build(sdk): check in operation descriptors and drop build.rs - #3069
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
devin-ai-integration[bot] wants to merge 1 commit into
devin-ai-integration[bot] wants to merge 1 commit into
Conversation
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>
Contributor
Author
|
I'll fix CI failures and address comments from users with write access. I'll skip comments containing "(aside)".
|
|
Contributor
Author
There was a problem hiding this comment.
🔍 Devin Review: 1 flag
Not posted on this PR by your GitHub settings — view it in Devin Review. (Configure)
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
crates/tracedecay-sdk/build.rsand its[build-dependencies].src/operations.rsis checked in again, generated through the samecontracts:generatepath as the TypeScript SDK.codegen::tests::checked_in_rust_operations_match_canonical_registry, and extendcontracts:checkso it also comparesoperations.rs.Motivation
build.rsmadetracedecay-contracts,-domain,-policyand-tool-catalogbuild dependencies. The host graph resolves different features for them than the normal graph does (for example,serde_jsonraw_valuevspreserve_order, andschemarschrono04). 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_DIRso 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: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-sdkitself now starts at 94s instead of 163s.Changes
src/codegen.rs:write_sdk_sourceswritescrates/tracedecay-sdk/src/operations.rsalong 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 previousOUT_DIRoutput.src/bin/generate.rs: callswrite_sdk_sources. Thedead_codeallow is no longer needed.dashboard/codegen/src/cli.ts:exportSdkSourcesalso returnsoperations.rs, socontracts:generatewrites it andcontracts:checkcompares it.AGENTS.md: listsoperations.rsamong the generated files.Test plan
cargo fmt --all -- --checkcargo clippy -p tracedecay-sdk --all-targets --locked -- -D warningsandcargo clippy --all-targets --locked -- -D warningsinsdks/codegencargo test -p tracedecay-sdk --lib(10 passed),cargo test --lockedinsdks/codegen(13 passed)DeadlineBehaviorinoperations.rs: "crates/tracedecay-sdk/src/operations.rs is stale; runpnpm --dir dashboard run contracts:generate"pnpm --dir dashboard run contracts:check: "contracts up to date"cargo tree -p tracedecay-sdk -e buildshows no build dependenciesChecklist
CHANGELOG.mdupdated (build-internal, no user-facing change).envfiles includedLink 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