Skip to content

feat(#849): Bridge D - 4-language HTTP trinity payload#865

Merged
TSavo merged 1 commit into
mainfrom
bridge-d-4lang-http-payload
May 14, 2026
Merged

feat(#849): Bridge D - 4-language HTTP trinity payload#865
TSavo merged 1 commit into
mainfrom
bridge-d-4lang-http-payload

Conversation

@TSavo
Copy link
Copy Markdown
Owner

@TSavo TSavo commented May 14, 2026

Extends the trinity round-trip from 3 legs (Rust -> Java -> Python -> Rust) to 4 legs (Rust -> Java -> Python -> C -> Rust) and adds an HTTP-using fixture function that exercises the concept hub at the API tier. Empirical receipt for paper 21 §3 (cross-language at API tier).

What

  • HTTP body templates added to all four canonical-bodies.json files (rust/java/python/c) for `concept:http-request` and `concept:http-response`, citing Bridge B's hub CIDs exactly.
  • Canonical libraries per language: `reqwest` (Rust), `java.net.http.HttpClient` (Java stdlib), `urllib.request` (Python stdlib), `libcurl` (C).
  • CID pins in `substrate_default_cids.rs` updated for the four new body-template files.
  • Trinity fixture gains `fetch_url_status(url) -> u16`; leg 1 (Rust source -> Java realize) recognizes it as `concept:http-request` and emits a `java.net.http.HttpClient` call in the realized Java output.
  • C leg wired (Java/C build helpers + manifest plumbing + dispatch) but not executed because Java lift is unavailable in this environment.

Acceptance gate

Fresh `CARGO_TARGET_DIR` run passes:

```
trinity_round_trip: HTTP fixture recognized as concept:http-request in leg 1 Java output
trinity_round_trip: v0 loudly-bounded-lossy outcome (3 loss entries; Branch 2 per-line characterization gated until real lifters land):
[kit-plugin-unavailable] no `kind = "lift"` plugin available for source language `java`
[leg-3-not-reached] leg 3 (python->c) was not executed because leg 2 produced no translated/python/ output
[leg-4-not-reached] leg 4 (c->rust) was not executed because leg 3 was not reached
test trinity_round_trip ... ok
```

Honest claim shape

The HTTP fixture lifts and is tagged `concept:http-request` at the concept hub. The 4-leg cycle is wired for all four languages. Reaching legs 3 and 4 requires a Java lift kit, which is the structural blocker (`implementations/java/provekit-walk-java` exists but does not yet expose the bind lift RPC protocol). v0 loudly-bounded-lossy with those losses named.

Files

  • `implementations/rust/provekit-cli/tests/fixtures/trinity_roundtrip/src/lib.rs` (+8)
  • `implementations/rust/provekit-cli/tests/trinity_roundtrip_test.rs` (+452/-)
  • `implementations/rust/provekit-plugin-loader/tests/substrate_default_cids.rs` (+8/-)
  • `menagerie/{c,java,python,rust}-language-signature/specs/body-templates/*-canonical-bodies.json`

Refs #849.

Summary by CodeRabbit

  • New Features

    • Added HTTP request and response handling capabilities across multiple programming languages (C, Java, Python, Rust).
    • Expanded integration testing to validate a 4-language translation chain.
  • Tests

    • Updated expected canonical values for language signature validations.

Review Change Stack

Extends the trinity round-trip from 3 legs (Rust -> Java -> Python -> Rust)
to 4 legs (Rust -> Java -> Python -> C -> Rust) and adds an HTTP-using
fixture function that exercises the concept hub at the API tier.

Body templates added to all four canonical-bodies.json files
(rust/java/python/c) for concept:http-request and concept:http-response,
citing Bridge B's hub CIDs exactly. Canonical libraries per language:
reqwest (Rust), java.net.http.HttpClient (Java stdlib), urllib.request
(Python stdlib), libcurl (C). CID pins in substrate_default_cids.rs
updated for the four new body-template files.

Trinity fixture gains fetch_url_status(url) -> u16; leg 1 (Rust source
-> Java realize) recognizes it as concept:http-request and emits a
java.net.http.HttpClient call in the realized Java output. The C leg
is wired (Java/C build helpers + manifest plumbing + dispatch) but
not executed because Java lift is unavailable in this environment.

Acceptance gate (fresh CARGO_TARGET_DIR): trinity_round_trip passes
as v0 loudly-bounded-lossy with three loss entries -
kit-plugin-unavailable (java lift), leg-3-not-reached, leg-4-not-reached.
HTTP recognition asserted explicitly.

Refs #849.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@TSavo TSavo merged commit 785855a into main May 14, 2026
4 of 6 checks passed
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 14, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 897403c9-9004-4cb0-92e5-929f419c99b9

📥 Commits

Reviewing files that changed from the base of the PR and between e495e67 and 0aae9fd.

📒 Files selected for processing (7)
  • implementations/rust/provekit-cli/tests/fixtures/trinity_roundtrip/src/lib.rs
  • implementations/rust/provekit-cli/tests/trinity_roundtrip_test.rs
  • implementations/rust/provekit-plugin-loader/tests/substrate_default_cids.rs
  • menagerie/c-language-signature/specs/body-templates/c-canonical-bodies.json
  • menagerie/java-language-signature/specs/body-templates/java-canonical-bodies.json
  • menagerie/python-language-signature/specs/body-templates/python-canonical-bodies.json
  • menagerie/rust-language-signature/specs/body-templates/rust-canonical-bodies.json

Walkthrough

This PR adds HTTP request and response support across the provekit system by implementing canonical body templates for C, Java, Python, and Rust, updating the trinity round-trip integration test from a 3-leg to a 4-leg transport chain, and adding a Rust HTTP fetch function to the test fixture.

Changes

HTTP request/response concepts across language implementations

Layer / File(s) Summary
Language canonical body templates for HTTP
menagerie/c-language-signature/specs/body-templates/c-canonical-bodies.json, menagerie/java-language-signature/specs/body-templates/java-canonical-bodies.json, menagerie/python-language-signature/specs/body-templates/python-canonical-bodies.json, menagerie/rust-language-signature/specs/body-templates/rust-canonical-bodies.json
Adds HTTP request and response templates to C, Java, Python, and Rust canonical body specifications, including signature guards, loss-record contributions, and language-specific emission templates. Each language spec updates its header CID to reflect the new content.
Rust fixture HTTP implementation
implementations/rust/provekit-cli/tests/fixtures/trinity_roundtrip/src/lib.rs
Adds module documentation noting API-tier HTTP request concepts and implements fetch_url_status(url: String) -> i64 as an async function that performs HTTP GET via reqwest::get, unwraps the response, and returns the status code as i64.
Trinity test helpers and build infrastructure
implementations/rust/provekit-cli/tests/trinity_roundtrip_test.rs (helpers section)
Adds foundational helpers for the expanded 4-leg test: repo_root() and cargo_profile_dir() compute paths; ensure_java_realize_rpc_built(), java_bin(), ensure_c_realize_rpc_built(), and ensure_c_lift_rpc_built() manage Java and C binary builds via Maven and Make; manifest/command utilities provide general-purpose manifest installation and environment setup including PROVEKIT_REPO_ROOT and PYTHONPATH injection.
Trinity test leg 1 (Rust→Java) setup and assertions
implementations/rust/provekit-cli/tests/trinity_roundtrip_test.rs (leg 1 execution)
Constructs and runs the Rust-to-Java leg of the trinity test: builds Java and C realize/lift RPC binaries, installs Java realize manifest, reads and asserts that the Java-generated output contains expected HTTP concept usage and Java HTTP client patterns, then prepares the Python manifest for leg 2.
Trinity test legs 2–3 (Java→Python, Python→C) with conditional chaining
implementations/rust/provekit-cli/tests/trinity_roundtrip_test.rs (leg 2–3 execution)
Implements conditional execution for legs 2 and 3: leg 2 runs bind with auto→python and records gaps; leg 3 only proceeds if the expected translated Python directory exists, otherwise records boundary gap evidence with updated wording reflecting the (python→c) boundary and leg-2 source language context.
Trinity test leg 4 (C→Rust) execution and loss composition
implementations/rust/provekit-cli/tests/trinity_roundtrip_test.rs (leg 4 execution and assertions)
Adds full leg 4 (C→Rust) execution logic: runs only if translated/c exists, otherwise verifies boundary gap evidence and records a "leg-4-not-reached" gap. Integrates all four legs into composed loss, updated Branch 1 empty-loss assertion to require leg 4 output and verify whitespace-normalized byte-equivalence, and extends Branch 2 v0 expectations and diagnostics to include leg 4 behavior and the expanded acceptable lift-boundary gap set.
CID pinning tests for canonical body templates
implementations/rust/provekit-plugin-loader/tests/substrate_default_cids.rs
Updates pinned CID expectations in four substrate tests: java_canonical_bodies, python_canonical_bodies, c_canonical_bodies, and rust_canonical_bodies, each refreshed to match the newly minted Blake3 values resulting from the added HTTP template entries.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related issues

  • TSavo/provekit#859: The main changes directly address the missing Rust body-template and trinity baseline gaps by adding Rust HTTP canonical body templates and extending the trinity test to include a Rust leg.
  • TSavo/provekit#848: The main changes add language-specific HTTP canonical body templates across all languages (C, Java, Python, Rust) and expand the trinity round-trip test to exercise HTTP-request/response realizations.
  • TSavo/provekit#849: The main changes implement HTTP-using functions and extend the trinity round-trip test to exercise HTTP concept CIDs across all four language legs, directly addressing Bridge D trinity HTTP payload behavior.
  • TSavo/provekit#845: The main changes add a Rust HTTP request function (fetch_url_status) and trinity test/templates that implement the concept:http-request behavior.

Possibly related PRs

  • TSavo/provekit#767: Both PRs modify the Java body-template spec at menagerie/java-language-signature/specs/body-templates/java-canonical-bodies.json—the main PR expands it with http-request/http-response entries and a new header.cid, which is exactly the sort of declared-vs-minted CID behavior exercised by the retrieved PR's mint-plugin-cid binary and drift-prevention tests.

Poem

🐰 Hops of HTTP now cross the four-leg dance,
From Rust to Java, Python, C—a language romance!
Each template tutored in request and response,
Trinity round-trips to prove the concept's force.
Whitespace normalized, gaps recorded true,
The Bridge runs brightly in every hue! 🌉

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bridge-d-4lang-http-payload

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 and usage tips.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

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: 0aae9fdb05

ℹ️ 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".

"concept_name": "http-request",
"emission_template": {
"kind": "verbatim",
"template": "let response = reqwest::get(${param0}).await.unwrap();\nresponse.status().as_u16() as i64"
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 Avoid emitting await in Rust body templates

The new http-request Rust template injects reqwest::get(...).await, but Rust realization currently always wraps emitted bodies in a synchronous pub fn (function_source in implementations/rust/provekit-realize-rust-core/src/lib.rs does not emit async fn). As soon as this concept is selected, the generated Rust source is syntactically invalid (await outside async), so Rust-target realizations for http-request cannot compile.

Useful? React with 👍 / 👎.

Comment on lines +557 to +559
let java_realize_jar = ensure_java_realize_rpc_built();
let c_realize_rpc = ensure_c_realize_rpc_built();
let c_lift_rpc = ensure_c_lift_rpc_built();
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 Defer non-Rust kit builds until the leg is reachable

The test now unconditionally builds Java/C realize and C lift binaries before leg execution. In environments where Maven or C toolchains are absent, trinity_round_trip fails during setup even though the documented v0 path is allowed to stop early with bounded-loss gaps when later legs are unavailable. This turns an expected lossy outcome into an immediate hard failure unrelated to bind-gap behavior.

Useful? React with 👍 / 👎.

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