fix(csharp): add v1.1.0 9-field BridgeDeclaration record (task #224)#99
Conversation
Adds the spec-shaped Provekit.IR.BridgeDeclaration record (kind, name, sourceSymbol, sourceLayer, sourceContractCid, targetContractCid, targetProofCid, targetLayer, optional notes) plus a JCS emission helper that mirrors how ContractDeclaration is serialized through the canonicalizer Value tree. The existing Provekit.IR.BridgeDecl in Collector.cs is a lift-adapter helper carrying TargetContractName / IrArgSorts / IrReturnSort; it serves a different purpose and is left in place. The two records coexist by design. Test: BridgeDeclarationConformanceTests builds a BridgeDeclaration with all 9 fields and asserts byte-equality against the bridge_decl fixture in conformance/fixtures.toml. A second test pins the optional notes contract: when null, the JCS output omits the key entirely (no "notes":null), matching the Rust peer's skip_serializing_if = "Option::is_none". Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> 🤖 Generated with [Claude Code](https://claude.com/claude-code)
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Review rate limit: 0/1 reviews remaining, refill in 8 minutes and 23 seconds.Comment |
There was a problem hiding this comment.
Pull request overview
This PR adds a new C# IR type for the v1.1.0 bridge declaration shape and a canonicalizer serializer so the C# kit can match the shared bridge_decl conformance fixture. It fits into the repository’s cross-kit IR work by bringing the C# implementation closer to the spec-defined bridge declaration format used across languages.
Changes:
- Adds
Provekit.IR.BridgeDeclaration, a spec-shaped bridge declaration record with optionalNotes. - Adds
Serialize.BridgeDeclarationToValueto emit canonicalizerValuetrees for bridge declarations. - Adds conformance tests for full-field bridge serialization and omission of the optional
notesfield when null.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
implementations/csharp/Provekit.Tests/BridgeDeclarationConformanceTests.cs |
Adds fixture-based tests for bridge JCS output and optional-notes omission. |
implementations/csharp/Provekit.IR/Serialize.cs |
Adds canonical Value serialization for the new bridge declaration type. |
implementations/csharp/Provekit.IR/Bridge.cs |
Introduces the new public BridgeDeclaration record matching the v1.1.0 spec shape. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| // This record is DISTINCT from `Provekit.IR.BridgeDecl` in Collector.cs, | ||
| // which is a lift-adapter helper carrying TargetContractName / | ||
| // IrArgSorts / IrReturnSort. They serve different purposes and coexist | ||
| // by design; do not unify them. |
| public static V BridgeDeclarationToValue(BridgeDeclaration b) | ||
| { | ||
| var entries = new List<KeyValuePair<string, V>>(9) | ||
| { | ||
| new("kind", V.String("bridge")), | ||
| new("name", V.String(b.Name)), | ||
| new("sourceSymbol", V.String(b.SourceSymbol)), | ||
| new("sourceLayer", V.String(b.SourceLayer)), | ||
| new("sourceContractCid", V.String(b.SourceContractCid)), | ||
| new("targetContractCid", V.String(b.TargetContractCid)), | ||
| new("targetProofCid", V.String(b.TargetProofCid)), | ||
| new("targetLayer", V.String(b.TargetLayer)), | ||
| }; | ||
| if (b.Notes is not null) | ||
| { | ||
| entries.Add(new("notes", V.String(b.Notes))); | ||
| } | ||
| return V.Object(entries); |
Summary
Provekit.IR.BridgeDeclaration, the v1.1.0 spec-shaped 9-field record perprotocol/specs/2026-04-30-ir-formal-grammar.mdandbridge_declinconformance/fixtures.toml.Serialize.BridgeDeclarationToValue(canonicalizerValuetree, JCS sorts at emit time,notesomitted when null to match Rust peer'sskip_serializing_if = "Option::is_none").Provekit.IR.BridgeDecllift-adapter helper inCollector.csis untouched; the two coexist by design.Test plan
BridgeDeclarationConformanceTests.BridgeDeclaration_AllFields_MatchesFixtureJcsasserts byte-equality vs thebridge_declfixture JCS literalBridgeDeclarationConformanceTests.BridgeDeclaration_OmittedNotes_DoesNotEmitNotesKeypins the optional-notes contract (no"notes":null)cd implementations/csharp && dotnet test --nologogreen: 44/44 inProvekit.Tests, 8/8 inProvekit.Lift.DataAnnotations, 9/9 inProvekit.Lift.Linq.Tests🤖 Generated with Claude Code