Skip to content

Move HTTP runtime session adapters into enclave to break http->enclave/node cycles - #8284

Open
Amaury Chamayou (achamayou) wants to merge 1 commit into
achamayou-bookish-memoryfrom
achamayou-crispy-sniffle
Open

Move HTTP runtime session adapters into enclave to break http->enclave/node cycles#8284
Amaury Chamayou (achamayou) wants to merge 1 commit into
achamayou-bookish-memoryfrom
achamayou-crispy-sniffle

Conversation

@achamayou

Copy link
Copy Markdown
Member

Summary

Layer 2 of the acyclic source components stack. Base branch is achamayou-bookish-memory (PR #8281). Refs #3517 (not closing it - more layers remain).

Eliminates the remaining cyclic source dependencies http -> enclave and http -> node, making http an acyclic source component (layer 1, in #8281, already replaced http -> host with http -> uv).

Changes

  1. Moved internal runtime adapters from src/http/ to src/enclave/, preserving namespaces/type names:

    • http_session.h (HTTP/1.1 session adapter binding the protocol layer to enclave sessions/RPC)
    • http2_session.h (HTTP/2 equivalent)
    • http_rpc_context.h (HttpRpcContext : ccf::RpcContextImpl, fetch_rpc_handler, make_rpc_context, etc. - these directly depend on ccf::RpcHandler/ccf::RPCMap from enclave/ and ccf::RpcContextImpl from node/)

    These headers were the true source of the http -> enclave and http -> node edges; moving them (not ccf::RpcContextImpl itself, per the plan) reuses the existing enclave -> node and enclave -> http directions instead of just relocating the cycle.

  2. Updated consumers: enclave/rpc_sessions.h, node/rpc/forwarder.h, node/jwt_key_auto_refresh.h now include the new paths. node/rpc/frontend.h's http/http_rpc_context.h include was unused and has been removed outright.

  3. Made moved headers self-contained: explicit enclave/rpc_handler.h / enclave/rpc_map.h includes added rather than relying on include order; relative http/... includes fixed up for the new location.

  4. Cleaned incidental http -> enclave edges in the remaining protocol headers:

    • http2_parser.h: dropped unused enclave/session.h and http_rpc_context.h
    • http_parser.h: dropped unused enclave/tls_session.h, added the direct ds/internal_logger.h it needed for its LOG_TRACE_FMT calls
    • http_proc.h: dropped unused enclave/tls_session.h
  5. Policy: scripts/source-dependencies.json now declares "http": ["ccf-api", "crypto", "ds", "uv"].

No compatibility shims were left at the old paths (these are internal headers, not part of include/ccf). No public API or behavioral changes.

Verification

  • scripts/check-source-dependencies.py (also run via scripts/includes-checks.sh): no violations - confirms no remaining http -> enclave, http -> host, or http -> node edges.
  • Full ninja build succeeds (206/206 targets, including ccf, ccf_launcher (cchost lib), http_test, frontend_test, node_frontend_test, and all samples).
  • Targeted tests via build/tests.sh -R "http_test|frontend_test|node_frontend_test" -L unit: 3/3 passed (1445, 1685, and 65 assertions respectively, all green).
  • scripts/ci-checks.sh -f: all checks pass (format, includes, copyright, ASCII, CI test buckets, etc.).

For the stack creator

  • Branch: achamayou-crispy-sniffle
  • Base ref: achamayou-bookish-memory @ 3da855945ac0f31a8bd2f1265eca0654a6d69fb7
  • Head commit: 59b1dae2b ("Move HTTP runtime session adapters into enclave to break http->enclave/node cycles")
  • Please register this as layer 2 in the stack, based on PR Extract libuv ownership primitives into acyclic uv component #8281.

Copilot AI left a comment

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.

🟢 Approval recommended

The changes are self-contained include/path refactors that remove confirmed src/http dependencies on enclave/ and node/ headers, and the updated include sites and dependency policy are consistent with the new layout.

Pull request overview

This PR is the second layer of a stack working toward an acyclic internal source-component dependency graph by removing remaining http -> enclave and http -> node source edges. It achieves this by relocating the HTTP runtime session “adapters” (which depended on enclave/node RPC types) from src/http/ into src/enclave/, while updating include sites and the dependency policy accordingly.

Changes:

  • Moved HTTP runtime session adapter headers (http_session.h, http2_session.h, http_rpc_context.h) into src/enclave/ and updated their includes to be self-contained.
  • Updated node/enclave consumers to include the new header locations and removed a now-unused include from src/node/rpc/frontend.h.
  • Cleaned up remaining incidental src/http/ includes of enclave headers and updated scripts/source-dependencies.json to declare the now-acyclic http component dependencies.

Custom instructions used: .github/copilot-instructions.md, .github/instructions/reviewing.instructions.md

File summaries
File Description
src/node/rpc/frontend.h Removes unused include of the relocated HTTP RPC context header.
src/node/rpc/forwarder.h Switches include to enclave/http_rpc_context.h after header relocation.
src/node/jwt_key_auto_refresh.h Switches include to enclave/http_rpc_context.h after header relocation.
src/http/http2_parser.h Drops unused enclave/RPC-context includes to remove http -> enclave edges.
src/http/http_proc.h Drops unused enclave/tls_session.h include to remove http -> enclave edges.
src/http/http_parser.h Drops unused enclave TLS include and adds direct internal logger include needed for tracing.
src/enclave/rpc_sessions.h Updates includes to reference the moved enclave-local session adapter headers.
src/enclave/http2_session.h Fixes include paths for moved header location (now includes http/... headers explicitly).
src/enclave/http_session.h Fixes include paths for moved header location (now includes http/... headers explicitly).
src/enclave/http_rpc_context.h Makes the moved header self-contained by adding explicit enclave RPC includes and updated parser include path.
scripts/source-dependencies.json Declares http as an acyclic component depending only on ccf-api, crypto, ds, and uv.
Review details
  • Files reviewed: 11/11 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

…e/node cycles

Relocate src/http/http_session.h, http2_session.h, and http_rpc_context.h
into src/enclave/, preserving their http:: namespace and type names.
These are internal runtime adapters that bind the HTTP protocol layer to
enclave session/RPC machinery and ccf::RpcContextImpl (in src/node), so
they belonged with their consumers rather than with the protocol-only
http component.

Update all in-tree consumers (rpc_sessions.h, forwarder.h,
jwt_key_auto_refresh.h) to the new paths, and drop the now-unused
http_rpc_context.h include from frontend.h. Make the moved headers
self-contained by including enclave/rpc_handler.h and enclave/rpc_map.h
directly, and updating relative http/ includes to explicit paths.

Clean incidental http -> enclave edges from the remaining protocol
headers: http2_parser.h and http_proc.h no longer include
enclave/session.h and enclave/tls_session.h respectively (unused),
and http_parser.h drops enclave/tls_session.h in favour of a direct
ds/internal_logger.h include for the logging macros it actually uses.

Extend scripts/source-dependencies.json with the http component's
final allowed dependencies (ccf-api, crypto, ds, uv), matching the
acyclic policy already enforced for other components. The dependency
checker confirms no remaining http -> enclave, http -> host, or
http -> node edges.

Layer 2 of the acyclic source components stack, based on #8281.
Refs #3517.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
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