Skip to content

Fix generated C# release contract and NuGet environment wiring - #4169

Merged
rossirpaulo merged 3 commits into
canaryfrom
paulo/fix-csharp-release-contract
Jul 24, 2026
Merged

rossirpaulo merged 3 commits into
canaryfrom
paulo/fix-csharp-release-contract

Conversation

@rossirpaulo

@rossirpaulo rossirpaulo commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • replace the stale 11-file C# generator assertion with a preparation-time SHA-256 manifest that binds the complete generated source tree through verification and publication
  • retain essential generated entry-point checks and exact copy verification in the clean package consumer
  • attach the reusable NuGet publisher to the existing boundary-tools-prod environment so Infisical-hydrated NUGET_USER is resolved where NuGet/login runs
  • align the documented trusted-publishing identity with publish2-csharp-sdk.yaml and remove the invalid caller-to-reusable-workflow secret forwarding

Why

The release integration itself was green after #4158, but the production release failed during C# preparation because Dhilan's Swift/release work also expanded the generated C# stdlib surface from 11 to 35 legitimate .g.cs files. The hard-coded filename snapshot was not a sound product invariant. This keeps Dhilan's generator output and changes the release contract to pin what preparation actually produced, including paths and hashes, so later additions, removals, or content changes still fail closed.

The NuGet trusted-publisher policy is configured for the reusable workflow and existing boundary-tools-prod environment. GitHub environment secrets are resolved in the called job; they are not passed from the caller.

Validation

  • regenerated sdk_tests/crates/csharp/primitive_slice with the current CLI
  • wrote and verified a manifest for all 35 generated .g.cs files
  • python3 -m unittest scripts.tests.test_release_pipeline_contract (9 tests)
  • Python compile checks
  • workflow YAML parse checks
  • bash -n on the package consumer
  • git diff --check
  • repository pre-commit hooks, including YAML validation

Safety

No compiler/runtime semantics, stdlib implementation, platform support, or shared CFFI artifact format is changed. This PR does not trigger a production release.

Summary by CodeRabbit

  • Improvements
    • Added SHA-256–based integrity validation for generated C# client sources via a generated generated-sources.sha256 manifest.
    • Workflow verification now produces and checks the manifest for the generated sources directory, including carrying it into product outputs.
    • NuGet publishing workflow updates to rely on the reusable workflow’s own trusted-publishing secret configuration.
  • Bug Fixes
    • Replaced brittle hardcoded *.g.cs filename list comparisons with manifest-driven validation (missing/unexpected/modified detection).
  • Tests
    • Expanded contract and pipeline tests to cover manifest “growth,” exact pinned content, missing/extra inputs, and invalid manifest data.

@vercel

vercel Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
beps Ready Ready Preview, Comment Jul 24, 2026 1:40am
promptfiddle Ready Ready Preview, Comment Jul 24, 2026 1:40am
promptfiddle2 Ready Ready Preview, Comment Jul 24, 2026 1:40am

Request Review

@coderabbitai

coderabbitai Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d52120f2-d0da-40dd-8d7d-5a456f8915f8

📥 Commits

Reviewing files that changed from the base of the PR and between bfad7cd and 3340870.

📒 Files selected for processing (1)
  • .github/workflows/release-baml-language.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/release-baml-language.yml

📝 Walkthrough

Walkthrough

The C# SDK release pipeline now records generated .g.cs files in SHA-256 manifests, verifies them during packaging and publishing, and updates NuGet workflow secret and environment wiring. Tests cover manifest integrity, required files, invalid inputs, and workflow contract assertions.

Changes

C# generated-source release flow

Layer / File(s) Summary
Generated-source manifest contract
scripts/baml-csharp-release-contract, scripts/tests/test_release_pipeline_contract.py
Adds manifest generation and verification with path, file-type, symlink, digest, sentinel, missing-entry, and unexpected-entry validation, plus focused tests.
Manifest generation and package verification
.github/workflows/prepare-csharp-sdk.reusable.yaml, .github/workflows/verify-csharp-product-slice.reusable.yaml, baml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.PrimitivePackageConsumer/verify.sh
Preparation writes generated-sources.sha256; product verification checks and packages it; the primitive consumer validates required files and matching generated-source paths.
NuGet publication wiring and contract coverage
.github/workflows/publish2-csharp-sdk.yaml, .github/workflows/release-baml-language.yml, scripts/tests/test_release_pipeline_contract.py
Adds generated-source verification, configures boundary-tools-prod, removes explicit secret forwarding, and expands workflow contract assertions.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CSharpPreparer
  participant ReleaseContract
  participant ProductSliceVerifier
  participant NuGetPublisher
  CSharpPreparer->>ReleaseContract: write-generated-manifest
  ReleaseContract-->>CSharpPreparer: generated-sources.sha256
  ProductSliceVerifier->>ReleaseContract: verify-generated-sources
  ReleaseContract-->>ProductSliceVerifier: validated packaged sources
  NuGetPublisher->>ReleaseContract: verify-generated-sources
  ReleaseContract-->>NuGetPublisher: validated packaged sources
Loading

Possibly related PRs

  • BoundaryML/baml#4158: Both changes extend the C# release-contract implementation and its verification flow.

Poem

I’m a rabbit with checks in a row,
Hashing each source as I go.
No stray files may hide,
Required paths abide,
And NuGet hops safely aglow.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes to the C# release contract and NuGet workflow wiring.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch paulo/fix-csharp-release-contract

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown

⏭️ Performance benchmarks were skipped

Perf benchmarks (CodSpeed) are opt-in on pull requests — they no longer run on every push. They always run automatically after merge to canary/main.

To run them on this PR, do any of the following, then push a commit (or re-run CI):

  • Add RUN_CODSPEED=1 to the PR description, or
  • Include run-perf or /perf in the PR title or any commit message.

@vercel
vercel Bot temporarily deployed to Preview – beps July 24, 2026 00:43 Inactive
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 24, 2026 00:50 Inactive
@github-actions

github-actions Bot commented Jul 24, 2026 •

Copy link
Copy Markdown

Binary size checks passed

✅ 7 passed

Artifact Platform File Gzip Gated on Baseline Delta Status
✅ baml-cli Linux 🔒 26.9 MB 11.5 MB file 26.2 MB +748.2 KB (+2.9%) OK
✅ packed-program Linux 🔒 17.4 MB 7.2 MB file 17.0 MB +392.9 KB (+2.3%) OK
✅ baml-cli macOS 🔒 20.9 MB 10.0 MB file 20.3 MB +596.1 KB (+2.9%) OK
✅ packed-program macOS 🔒 13.6 MB 6.3 MB file 13.2 MB +347.3 KB (+2.6%) OK
✅ baml-cli Windows 🔒 22.6 MB 10.2 MB file 21.9 MB +651.3 KB (+3.0%) OK
✅ packed-program Windows 🔒 14.5 MB 6.4 MB file 14.2 MB +342.8 KB (+2.4%) OK
✅ bridge_wasm WASM 16.4 MB 🔒 4.5 MB gzip 4.4 MB +72.1 KB (+1.6%) OK

🔒 = the size this artifact is GATED on (ceiling + delta). Binaries gate on file size (installed binary); WASM gates on gzip (download size). The other size is shown for information only.


Generated by cargo size-gate · workflow run

@rossirpaulo
rossirpaulo marked this pull request as ready for review July 24, 2026 01:02

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@baml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.PrimitivePackageConsumer/verify.sh`:
- Around line 53-57: Update the package comparison pipeline in verify.sh to
replace GNU-only find -printf with portable find -print and equivalent
sed/truncation that preserves paths relative to each root. Apply the same change
to both generated_source_root and consumer/baml_client listings, keeping the
sorted .g.cs comparison unchanged.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 085a69a1-eeb0-4ba3-a39a-406f35f242a3

📥 Commits

Reviewing files that changed from the base of the PR and between c534bbc and a032ea6.

📒 Files selected for processing (7)
  • .github/workflows/prepare-csharp-sdk.reusable.yaml
  • .github/workflows/publish2-csharp-sdk.yaml
  • .github/workflows/release-baml-language.yml
  • .github/workflows/verify-csharp-product-slice.reusable.yaml
  • baml_language/sdks/csharp/bridge_csharp/tests/Baml.Bridge.PrimitivePackageConsumer/verify.sh
  • scripts/baml-csharp-release-contract
  • scripts/tests/test_release_pipeline_contract.py
💤 Files with no reviewable changes (1)
  • .github/workflows/release-baml-language.yml

@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 24, 2026 01:10 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps July 24, 2026 01:14 Inactive
@vercel
vercel Bot temporarily deployed to Preview – beps July 24, 2026 01:19 Inactive
@rossirpaulo
rossirpaulo enabled auto-merge July 24, 2026 01:20
@rossirpaulo
rossirpaulo added this pull request to the merge queue Jul 24, 2026
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle2 July 24, 2026 01:27 Inactive
Merged via the queue into canary with commit 9db2430 Jul 24, 2026
69 of 70 checks passed
@rossirpaulo
rossirpaulo deleted the paulo/fix-csharp-release-contract branch July 24, 2026 01:33
@vercel
vercel Bot temporarily deployed to Preview – promptfiddle July 24, 2026 01:40 Inactive

This branch was previously deployed

3 inactive deployments
Preview – promptfiddle — 3340870a Deployed Jul 24, 2026 by vercel[bot]
Preview – promptfiddle2 — 3340870a Deployed Jul 24, 2026 by vercel[bot]
Preview – beps — 3340870a Deployed Jul 24, 2026 by vercel[bot]
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