Skip to content

fix(csharp): add v1.1.0 9-field BridgeDeclaration record (task #224)#99

Merged
TSavo merged 1 commit into
mainfrom
fix/csharp-bridge-declaration-v1-1-0
May 3, 2026
Merged

fix(csharp): add v1.1.0 9-field BridgeDeclaration record (task #224)#99
TSavo merged 1 commit into
mainfrom
fix/csharp-bridge-declaration-v1-1-0

Conversation

@TSavo
Copy link
Copy Markdown
Owner

@TSavo TSavo commented May 3, 2026

Summary

  • Adds Provekit.IR.BridgeDeclaration, the v1.1.0 spec-shaped 9-field record per protocol/specs/2026-04-30-ir-formal-grammar.md and bridge_decl in conformance/fixtures.toml.
  • Adds Serialize.BridgeDeclarationToValue (canonicalizer Value tree, JCS sorts at emit time, notes omitted when null to match Rust peer's skip_serializing_if = "Option::is_none").
  • The existing Provekit.IR.BridgeDecl lift-adapter helper in Collector.cs is untouched; the two coexist by design.

Test plan

  • BridgeDeclarationConformanceTests.BridgeDeclaration_AllFields_MatchesFixtureJcs asserts byte-equality vs the bridge_decl fixture JCS literal
  • BridgeDeclarationConformanceTests.BridgeDeclaration_OmittedNotes_DoesNotEmitNotesKey pins the optional-notes contract (no "notes":null)
  • cd implementations/csharp && dotnet test --nologo green: 44/44 in Provekit.Tests, 8/8 in Provekit.Lift.DataAnnotations, 9/9 in Provekit.Lift.Linq.Tests

🤖 Generated with Claude Code

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)
Copilot AI review requested due to automatic review settings May 3, 2026 06:04
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 3, 2026

Warning

Rate limit exceeded

@TSavo has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 8 minutes and 23 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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 configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 3d2716b2-6dd0-4a75-b803-7922f46eebd0

📥 Commits

Reviewing files that changed from the base of the PR and between 8122374 and bdee119.

📒 Files selected for processing (3)
  • implementations/csharp/Provekit.IR/Bridge.cs
  • implementations/csharp/Provekit.IR/Serialize.cs
  • implementations/csharp/Provekit.Tests/BridgeDeclarationConformanceTests.cs
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/csharp-bridge-declaration-v1-1-0

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
Review rate limit: 0/1 reviews remaining, refill in 8 minutes and 23 seconds.

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

@TSavo TSavo merged commit b3275a2 into main May 3, 2026
5 of 6 checks passed
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 optional Notes.
  • Adds Serialize.BridgeDeclarationToValue to emit canonicalizer Value trees for bridge declarations.
  • Adds conformance tests for full-field bridge serialization and omission of the optional notes field 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.

Comment on lines +26 to +29
// 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.
Comment on lines +117 to +134
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);
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.

2 participants