Skip to content

#70: Add v2 UDF protocol design - #18

Merged
tkilias merged 55 commits into
mainfrom
documentation/design_v2_protocol
Sep 26, 2026
Merged

tkilias merged 55 commits into
mainfrom
documentation/design_v2_protocol

Conversation

@tkilias

@tkilias tkilias commented Aug 14, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • Add the v2 UDF protocol design covering transport, framing, call lifecycle, data streams, orchestration, flow control, and close/error semantics.
  • Add the FlatBuffers protocol schema, JSON schemas, examples, and Mermaid diagrams.
  • Add protocol encoding/decoding tests and remove the obsolete standalone JSON schema validation workflow.

Validation

  • git diff --check
  • bazel build --verbose_failures --config clang-format //...
  • bazel test --spawn_strategy=local --test_output=errors //:udf_protocol_test
  • poetry check --lock
  • Confirmed no stale references to the removed schema validator remain.
  • Full GitHub Actions validation is delegated to the checks triggered by this PR update.

Fixes #70

Comment thread udf-runner-cpp/v2/json_schema/call_metadata.schema.json
Comment thread doc/design/v2/protocol/high_level/calls.md
Comment thread doc/design/v2/protocol/high_level/calls.md Outdated
Comment thread doc/design/v2/protocol/high_level/calls.md Outdated
Comment thread doc/design/v2/protocol/high_level/calls.md Outdated
Comment thread doc/design/v2/protocol/high_level/calls.md
Comment thread doc/design/v2/protocol/high_level/calls.md
Comment thread doc/design/v2/protocol/high_level/payloads.md Outdated
Comment thread doc/design/v2/protocol/high_level/payloads.md Outdated
Comment thread doc/design/v2/protocol/high_level/payloads.md Outdated
Comment thread doc/design/v2/protocol/low_level/protocol.md
Receive path:

1. bytes on the socket
2. one length-prefixed and decoded `Frame`

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.

What is the size of prefix length? Didn't find it anywhere


Receive path:

1. bytes on the socket

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.

How many bytes?

Comment thread doc/design/v2/protocol/high_level/endpoint_scheduling.mmd
@tomuben

tomuben commented Sep 24, 2026

Copy link
Copy Markdown
Contributor

One improvement could be to move the SQL Column Schema from JSON to the DataSchema. @tkilias

@tkilias
tkilias requested a deployment to v2-fuzzing-pr-approval September 26, 2026 14:09 — with GitHub Actions Waiting
@tkilias
tkilias requested a deployment to v2-fuzzing-pr-approval September 26, 2026 17:14 — with GitHub Actions Waiting
@tkilias
tkilias requested a deployment to v2-fuzzing-pr-approval September 26, 2026 18:14 — with GitHub Actions Waiting
@sonarqubecloud

Copy link
Copy Markdown

@tkilias
tkilias marked this pull request as ready for review September 26, 2026 18:22
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-26T18:28:33.510977Z 5bfa9b0 Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@tkilias tkilias changed the title protocol: add v2 protocol design #70: Add v2 UDF protocol design Sep 26, 2026

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5bfa9b0731

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +75 to +78
- the first record batch may be sent without a received `Next(...)`
- subsequent batches require an available budget from a previously received `Next(...)`
- the sender may send less than the hinted budget and may send multiple batches while budget remains
- an indivisible batch may exceed the remaining budget

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Make byte budgets hard transfer limits

When the peer is untrusted or memory-constrained, allowing the first batch without credit and permitting any indivisible batch to exceed the remaining budget lets a sender announce arbitrarily large buffers and force the receiver to allocate/read them despite granting zero or minimal credit. This defeats the stated resource-safety purpose of Next(byte_budget) and can turn one stream into a memory-exhaustion path; define a negotiated absolute batch limit and require every batch, including the first, to stay within granted or pre-negotiated credit.

Useful? React with 👍 / 👎.

Comment on lines +243 to 245
table CloseControlMessage {
close_call: CloseCall;
close_connection: CloseConnection;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Make the close variants mutually exclusive

A CloseControlMessage can contain both fields simultaneously, and the new protocol test actually constructs that combination on stream 7. However, CloseCall is valid only on a nonzero call stream while CloseConnection is valid only on stream 0, so no stream_id makes such a message valid and receivers are left with conflicting call-versus-connection shutdown semantics. Represent these as mutually exclusive union variants, or explicitly reject the combined state rather than describing it as supported.

Useful? React with 👍 / 👎.

Comment on lines +16 to +17
"size": { "type": "integer", "minimum": 0, "maximum": 4294967295, "description": "Existing size property: character length for CHAR/VARCHAR or declared hash size for HASHTYPE." },
"size_unit": { "enum": ["BYTE", "BIT"], "description": "HASHTYPE size unit; required for hash declarations." },

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Require HASHTYPE sizing metadata

For a HASHTYPE column that omits size or size_unit, this schema still accepts the object because only name, type, and type_name are required, despite size_unit being documented here as required. The consumer then cannot derive the required FixedSizeBinary byte width without parsing type_name, contrary to the dedicated-property contract; add type-conditional requirements here and to the duplicated import-specification column definition.

Useful? React with 👍 / 👎.

Comment on lines +58 to +60
[type_mapping.md](type_mapping.md). The shared column-definition contract is defined in
[column.schema.json](../../../../../udf-runner-cpp/v2/json_schema/column.schema.json) and is referenced by both column
metadata and import specifications.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Add the referenced shared column schema

The documented column.schema.json contract does not exist in the repository: a repo-wide file search finds only column_metadata.schema.json, while the column definitions are duplicated inline in that schema and import_specification.schema.json. Consequently this link is broken and protocol implementers cannot consume the claimed shared contract; add and reference the shared schema, or remove this claim and link to the actual definitions.

Useful? React with 👍 / 👎.

@tkilias
tkilias merged commit 160330f into main Sep 26, 2026
29 of 30 checks passed
@tkilias
tkilias deleted the documentation/design_v2_protocol branch September 26, 2026 18:58

This branch is waiting to be deployed

1 waiting deployment
v2-fuzzing-pr-approval — 5bfa9b07 Waiting Sep 26, 2026 by tkilias via pr_approval #113
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.

Add v2 UDF protocol design

2 participants