Move HTTP runtime session adapters into enclave to break http->enclave/node cycles - #8284
Conversation
59b1dae to
8398233
Compare
There was a problem hiding this comment.
🟢 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) intosrc/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 updatedscripts/source-dependencies.jsonto declare the now-acyclichttpcomponent 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.
8398233 to
f62f38d
Compare
f62f38d to
561d786
Compare
…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>
561d786 to
ddf6606
Compare
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 -> enclaveandhttp -> node, makinghttpan acyclic source component (layer 1, in #8281, already replacedhttp -> hostwithhttp -> uv).Changes
Moved internal runtime adapters from
src/http/tosrc/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 onccf::RpcHandler/ccf::RPCMapfromenclave/andccf::RpcContextImplfromnode/)These headers were the true source of the
http -> enclaveandhttp -> nodeedges; moving them (notccf::RpcContextImplitself, per the plan) reuses the existingenclave -> nodeandenclave -> httpdirections instead of just relocating the cycle.Updated consumers:
enclave/rpc_sessions.h,node/rpc/forwarder.h,node/jwt_key_auto_refresh.hnow include the new paths.node/rpc/frontend.h'shttp/http_rpc_context.hinclude was unused and has been removed outright.Made moved headers self-contained: explicit
enclave/rpc_handler.h/enclave/rpc_map.hincludes added rather than relying on include order; relativehttp/...includes fixed up for the new location.Cleaned incidental
http -> enclaveedges in the remaining protocol headers:http2_parser.h: dropped unusedenclave/session.handhttp_rpc_context.hhttp_parser.h: dropped unusedenclave/tls_session.h, added the directds/internal_logger.hit needed for itsLOG_TRACE_FMTcallshttp_proc.h: dropped unusedenclave/tls_session.hPolicy:
scripts/source-dependencies.jsonnow 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 viascripts/includes-checks.sh): no violations - confirms no remaininghttp -> enclave,http -> host, orhttp -> nodeedges.ninjabuild succeeds (206/206 targets, includingccf,ccf_launcher(cchost lib),http_test,frontend_test,node_frontend_test, and all samples).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
achamayou-crispy-sniffleachamayou-bookish-memory@3da855945ac0f31a8bd2f1265eca0654a6d69fb759b1dae2b("Move HTTP runtime session adapters into enclave to break http->enclave/node cycles")