Skip to content

feat: pin the cross-SDK call envelope as shared wire vectors - #638

Merged
pratyush618 merged 9 commits into
masterfrom
feat/wire-vectors
Aug 7, 2026
Merged

feat: pin the cross-SDK call envelope as shared wire vectors#638
pratyush618 merged 9 commits into
masterfrom
feat/wire-vectors

Conversation

@pratyush618

@pratyush618 pratyush618 commented Aug 6, 2026

Copy link
Copy Markdown
Collaborator

Step 1 of the polyglot versioning plan: make the wire format testable across
runtimes instead of trusting three independent implementations to agree.

The vector quoted in BINDING_CONTRACT.md lived as a copied hex literal in the
Python and Node test suites, and nowhere at all in the JVM suite. Nothing tied
them together, so a change to one runtime's encoding could pass every build.

contracts/wire-vectors.json now holds the vectors — 9 byte-exact encode cases
and 3 decode_only cases for types whose CBOR encoding legitimately varies
(float width, bignum, byte strings). Every SDK reads that one file in its own
suite.

It immediately found two real divergences

1. Keyword arguments are producible from one runtime only. The Node and JVM
serializers hardcode an empty kwargs map, so neither can enqueue a call with
keyword arguments — only decode one. That is a reasonable consequence of the host
languages, so it is now written into the contract as a deliberate asymmetry
rather than left to be discovered.

2. The JVM SDK's payload bytes differ from its peers' — and that breaks
idempotency.
Jackson writes CBOR maps with indefinite length (0xbf … 0xff)
where Python and Node write definite length (0xa0). Both decode identically, so
payloads still interoperate. But every call body ends in the empty kwargs map, so
every JVM payload is byte-different from the same logical call encoded
elsewhere — and IdempotencyKeys documents that peer SDKs "compute the identical
key for the same (name, payload) so idempotent enqueues dedupe across languages".
That key is a SHA-256 over the serialized payload, so the guarantee does not hold:
the same logical enqueue from two runtimes derives two different keys and does not
dedupe.

I have not fixed that here. Jackson has no definite-length setting — I checked the
CBORGenerator.Feature enum on the classpath, it is an API-level
writeStartObject(value, size) call only — so the fix is either custom container
serializers on the JVM side or changing what the key hashes, and that is a
decision worth making on its own. The JVM suite therefore asserts these vectors by
decoding rather than byte-for-byte, plus one test that pins the divergence so a
fix has to update it deliberately. The contract file records it too.

Verification

Python 22 passed, Node 20 passed, JVM 24 passed. Lint and typecheck clean on all
three. The existing inline vector assertions are left in place as independent
confirmation.

Summary by CodeRabbit

  • Compatibility

    • Standardized CBOR serialization across Java, Node.js, and Python SDKs for consistent cross-SDK payloads.
    • Writers now use definite-length maps and arrays with compact integer encoding.
    • Readers continue accepting both definite- and indefinite-length encodings.
  • Tests

    • Added shared validation for positional, keyword, nested, Unicode, numeric, null, boolean, and binary values.
    • Added round-trip and pinned-encoding checks across SDKs.
  • Documentation

    • Documented wire-format interoperability expectations and encoding behavior.

The contract vector lived as a copied literal in two SDK test files and nowhere in the third, so an encoding change could pass every build.
Each suite reads the same file, so a runtime that changes its encoding fails its own build instead of producing payloads its peers cannot read.
@coderabbitai

coderabbitai Bot commented Aug 6, 2026

Copy link
Copy Markdown

Review Change Stack

Warning

Review limit reached

You’ve reached a temporary PR review limit under our Fair Usage Limits Policy.

Your recent review volume is higher than typical usage, so adaptive limits are currently applied.

Next review available in: 11 minutes

Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available.
You're only billed for reviews past your plan's rate limits ($0.25/file).

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b370ce58-7fad-4c3e-ae8b-8b3b3dd95ce1

📥 Commits

Reviewing files that changed from the base of the PR and between 37a7974 and 43b75f0.

📒 Files selected for processing (3)
  • sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java
  • sdks/node/test/core/wireVectors.test.ts
  • sdks/python/tests/core/test_wire_vectors.py
📝 Walkthrough

Walkthrough

The pull request defines shared CBOR call-envelope vectors, updates Java serialization to use definite-length containers, documents reader and writer rules, and adds Java, Node.js, and Python interoperability tests.

Changes

CBOR wire vector validation

Layer / File(s) Summary
Wire vector contract
contracts/wire-vectors.json, crates/taskito-core/BINDING_CONTRACT.md
Defines tagged CBOR call-envelope metadata, pinned encoding vectors, decode-only vectors, and definite-length writer requirements. Readers must accept both definite- and indefinite-length containers.
Java definite-length encoding
sdks/java/src/main/java/org/byteveda/taskito/serialization/*.java, sdks/java/src/test/java/org/byteveda/taskito/serialization/DefiniteLengthCborTest.java
Adds recursive definite-length CBOR encoding and routes regular and call payloads through it. Tests cover containers, numeric values, binary data, null handling, mapper inclusion, and decimal round trips.
Cross-SDK vector validation
sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java, sdks/node/test/core/wireVectors.test.ts, sdks/python/tests/core/test_wire_vectors.py
Loads the shared vectors and validates pinned encoding, decoding, round trips, legacy indefinite-length decoding, and the documented contract vector.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 35.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 clearly and concisely describes the main change: adding shared wire vectors to pin the cross-SDK call envelope.
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 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@contracts/wire-vectors.json`:
- Around line 13-16: Update the decode_only contract text in
contracts/wire-vectors.json at lines 13-16 and round_trip_only guidance at lines
106-115 to require logical-value preservation rather than identical encoded
bytes. In sdks/node/test/core/wireVectors.test.ts lines 77-80 and
sdks/python/tests/core/test_wire_vectors.py lines 55-57, deserialize each
re-encoded payload and compare its logical call value with the original, while
retaining exact-byte assertions for encode cases.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 71d413d6-a7d4-4c9b-add3-2f447f58f551

📥 Commits

Reviewing files that changed from the base of the PR and between ad0b3cc and e156c8d.

📒 Files selected for processing (4)
  • contracts/wire-vectors.json
  • sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java
  • sdks/node/test/core/wireVectors.test.ts
  • sdks/python/tests/core/test_wire_vectors.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ByteVeda/taskito (manual)

Comment thread contracts/wire-vectors.json Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@crates/taskito-core/BINDING_CONTRACT.md`:
- Around line 62-63: Update the CBOR encoding requirement in BINDING_CONTRACT.md
to identify both a0 and 80 as examples of definite-length headers, while
preserving the requirement that writers use definite-length maps and arrays and
readers accept both definite- and indefinite-length forms.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b216c56d-4c6a-47cb-a830-28624d92d884

📥 Commits

Reviewing files that changed from the base of the PR and between e156c8d and 2b1acef.

📒 Files selected for processing (6)
  • contracts/wire-vectors.json
  • crates/taskito-core/BINDING_CONTRACT.md
  • sdks/java/src/main/java/org/byteveda/taskito/serialization/CborSerializer.java
  • sdks/java/src/main/java/org/byteveda/taskito/serialization/DefiniteLengthCbor.java
  • sdks/java/src/test/java/org/byteveda/taskito/serialization/DefiniteLengthCborTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ByteVeda/taskito (manual)
🚧 Files skipped from review as they are similar to previous changes (2)
  • contracts/wire-vectors.json
  • sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java

Comment thread crates/taskito-core/BINDING_CONTRACT.md Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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 `@contracts/wire-vectors.json`:
- Around line 13-14: Update the introductory requirement in the wire-vectors
documentation to require every SDK to decode all encode cases, while requiring
exact byte production only for cases representable by that runtime. Keep the
existing distinction that Node and JVM decode non-empty kwargs cases but do not
produce them.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 88e8d4be-b8d9-4fcd-9605-2a5b98c84685

📥 Commits

Reviewing files that changed from the base of the PR and between 2b1acef and d3fa0c4.

📒 Files selected for processing (2)
  • contracts/wire-vectors.json
  • crates/taskito-core/BINDING_CONTRACT.md
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ByteVeda/taskito (manual)
🚧 Files skipped from review as they are similar to previous changes (1)
  • crates/taskito-core/BINDING_CONTRACT.md

Comment thread contracts/wire-vectors.json Outdated
@pratyush618

Copy link
Copy Markdown
Collaborator Author

@CodeRabbit full review

@coderabbitai

coderabbitai Bot commented Aug 7, 2026

Copy link
Copy Markdown
✅ Action performed

Full review finished.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

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
`@sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java`:
- Around line 159-165: Extend keepsTheVectorQuotedInTheBindingContract in
sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java:159-165
to read crates/taskito-core/BINDING_CONTRACT.md and compare its documented
example with the shared contract-vector. Apply the same validation to the
wire-vector test at sdks/node/test/core/wireVectors.test.ts:87-90 and
sdks/python/tests/core/test_wire_vectors.py:63-66, while preserving the existing
shared-vector assertions.
🪄 Autofix

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: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: d9135652-5889-4b69-a9d8-61d9fb5da7be

📥 Commits

Reviewing files that changed from the base of the PR and between c7ecf92 and 37a7974.

📒 Files selected for processing (8)
  • contracts/wire-vectors.json
  • crates/taskito-core/BINDING_CONTRACT.md
  • sdks/java/src/main/java/org/byteveda/taskito/serialization/CborSerializer.java
  • sdks/java/src/main/java/org/byteveda/taskito/serialization/DefiniteLengthCbor.java
  • sdks/java/src/test/java/org/byteveda/taskito/serialization/DefiniteLengthCborTest.java
  • sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java
  • sdks/node/test/core/wireVectors.test.ts
  • sdks/python/tests/core/test_wire_vectors.py
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • ByteVeda/taskito (manual)

Comment thread sdks/java/src/test/java/org/byteveda/taskito/serialization/WireVectorsTest.java Outdated
@pratyush618
pratyush618 merged commit e76baea into master Aug 7, 2026
34 checks passed
@pratyush618
pratyush618 deleted the feat/wire-vectors branch August 7, 2026 16:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants