Skip to content

feature: EE2-1557 http handler module#5

Merged
rustatian merged 1 commit into
mainfrom
feature/EE2-1557-http-handler-module
Dec 12, 2024
Merged

feature: EE2-1557 http handler module#5
rustatian merged 1 commit into
mainfrom
feature/EE2-1557-http-handler-module

Conversation

@rustatian

Copy link
Copy Markdown
Contributor

Reason for This PR

closes: https://jira.spiralscout.com/browse/EE2-1557

Description of Changes

API:
Task now contains two new methods (Context which returns the current context and UpdateCtx which updates (or set) current context for the Task + new field: context.)

New carrier type: (types.go): HttpContextCarrier
New context key for that: HttpHandlerKey

In the http layer, HttpContextCarrier should be initialized with the http request + response write and populated into the Task's context via UpdateCtx method.

http_handler module contains a few basic methods: method which returns current http method + write which writes some data. This PR does not support multiple writes (because in Go, after the first write, StatusOK header would be sent automatically), but needed data structures have been prepared and located in the http_wrapper.go file (would be used via separate PR after API stabilization).

Signed-off-by: Valery Piashchynski <piashchynski.valery@gmail.com>
@rustatian rustatian requested a review from wolfy-j December 12, 2024 16:29
@rustatian rustatian self-assigned this Dec 12, 2024
@rustatian rustatian added the enhancement New feature or request label Dec 12, 2024
Comment thread runtime/lua/modules/http_handler/http_wrapper.go
@rustatian rustatian merged commit 78b0a8b into main Dec 12, 2024
@rustatian rustatian deleted the feature/EE2-1557-http-handler-module branch December 12, 2024 18:40
@rustatian rustatian removed their assignment Jul 2, 2025
wolfy-j added a commit that referenced this pull request Feb 7, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Feb 23, 2026
wolfy-j added a commit that referenced this pull request Jul 4, 2026
- Keep api/net.ApplyOverlayPair as a deprecated thin wrapper over
  OverlayResolver so out-of-tree Go callers do not break (codex).
- Network boot component fails loud (ErrFrameResolversMissing) instead of
  silently skipping registration when the registry is absent, so a wiring
  bug cannot degrade the overlay to clearnet (fable #1).
- Remove the now-redundant SetMultiple(task.Context) from the wasm and lua
  Execute handlers: the function registry executor already applies task.Context
  to the same forked frame and is the sole caller (fable #3).
- Drop the speculative FrameResolverOrderFSRoot constant and fs-root comment
  references; this PR migrates only the network overlay (fable #4).
- Fix stale comments and the test section header (fable #5).
wolfy-j added a commit that referenced this pull request Jul 4, 2026
* refactor(runtime): generic frame-context resolver registry

Frame-decorating options (the network overlay, and future ones like a
filesystem root) were hand-wired into every dispatcher: the process manager
and both the wasm and lua function lifecycles each called
netapi.ApplyOverlayPair, leaking api/net into generic machinery and forcing
every new option to touch every dispatcher.

Introduce ctxapi.FrameResolvers: an ordered registry of
(ctx, options) -> ([]Pair, error) resolvers, carried on the AppContext and
populated once at boot. The two real choke points — the function registry
executor (shared by lua and wasm) and the process manager Start — apply the
whole set generically. Reads are lock-free (atomic snapshot, copy-on-write on
register), mirroring the interceptor registry; the no-resolver path is ~1.4ns
with zero allocations.

Network migrates onto it: api/net.OverlayResolver replaces ApplyOverlayPair
and is registered by the network boot component. The dispatchers no longer
import api/net or api/fs; a new frame-context option is one resolver plus one
Register line, with no dispatcher edits.

* review: address codex + fable findings on frame resolvers

- Keep api/net.ApplyOverlayPair as a deprecated thin wrapper over
  OverlayResolver so out-of-tree Go callers do not break (codex).
- Network boot component fails loud (ErrFrameResolversMissing) instead of
  silently skipping registration when the registry is absent, so a wiring
  bug cannot degrade the overlay to clearnet (fable #1).
- Remove the now-redundant SetMultiple(task.Context) from the wasm and lua
  Execute handlers: the function registry executor already applies task.Context
  to the same forked frame and is the sole caller (fable #3).
- Drop the speculative FrameResolverOrderFSRoot constant and fs-root comment
  references; this PR migrates only the network overlay (fable #4).
- Fix stale comments and the test section header (fable #5).

* review: fail closed on missing frame resolver

* review: harden frame resolver claims

* test: isolate frame resolver claim tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants