Repository navigation
feat(abi)!: make absent HTTP header, query, and trailer values explicit (ABI 26) - #3
Merged
Merged
Conversation
Pin the workspace to the frozen descriptor core fc8b0c81 and turn the five
HTTP getters that can be absent into explicit results instead of empty
strings:
http::request::get_header
http::request::get_query_arg
http::response::get_header
http::response::get_trailer
http::exchange::get_header
All five publish Result<Option<string>, string>: an absent member is Ok(None),
a present empty value is Ok(Some("")), a member that is not valid text is
Err(text), and an invalid header or trailer name stays a fatal VmError. The
wire tag is result_option_string over the canonical Result/Option carriers, so
absence is never a bare Null and a decode failure is never an empty-string
sentinel. Fields that always exist (method, path, uri, version, status) keep
their string/int returns. ABI_VERSION moves 25 -> 26 and the checked-in
manifest is regenerated from an --all-features build.
Void host functions now publish Unit instead of the legacy Null schema, which
the frozen compiler no longer admits.
Pin surface adaptation: HostAsyncBridge gained poll_submitted_op/cleanup_op
(edge cleanup drops the pending future, which is the cancellation), and
SourceFlavor is now RustScript | Plugin(FrontendId) in the fixture sweep. Two
toolchain lints were suppressed at pre-existing sites so clippy -D warnings
stays green.
Every RSS call site keeps its detection strings and rules unchanged and
collapses the new contract through one local helper, so Ok(None) and Err read
as "" exactly as the previous empty-string default did. The embedded stdlib
wrapper http::upstream::response::get_header propagates the new contract
instead of collapsing it.
Named tests cover absent, present-empty, invalid text, invalid name, the
repeated query key, and the response header/trailer decode paths.
…the frozen core contracts
The ABI 26 pin exposed three contract mismatches the runtime still carried:
1. The edge io overrides must encode the contracts the guest compiler
resolves from the core IO module, and they returned bare values:
- io::read_line is Result<Option<string>, string>. The line reader now
distinguishes end of stream from a blank line (Ok(None) vs Ok(Some("")),
one trailing \n stripped) and the downstream line finalizer closes the
transport on Ok(None) instead of on an empty chunk.
- io::read_all is Result<string, string>.
- io::write is Result<int, string>; io::flush and io::close are
Result<(), string>.
io::open stays the documented exception: core publishes
Result<io.file resource, string> and edge scope can only return a raw
virtual-handle int. The embedded http::upstream::response wrapper now
propagates next_line/read_line/read_all.
2. mqtt::connection::read_event overlayed its closed record with nullable
(optional<T>) members, which the frozen compiler rejects on a host output.
Every variant-specific member is now Option<T> and the runtime emits the
canonical Option carrier for an absent member, so a publish event carries
reason=None and a closed/failed event carries topic=None and friends.
3. sample_anthropic_*_program.rss still used the removed `null` type/value.
It now uses Unit (()) with identical rules and detection strings.
The embedded wrapper drops its get_headers helper: the open header map stays a
deliberate dynamic boundary in ABI 26 and the frozen compiler does not admit a
dynamic host output as a guest value, so no wrapper can publish it.
Every RSS call site keeps its detection strings and rules and collapses the new
contract through one local helper (absent/error still read as ""), except the
stdio wrapper which propagates.
Named coverage: read_next_line blank-line/EOF/delimiter unit tests, MqttEvent
carrier tests for publish and closed, and end-to-end proxy cases for
exchange::get_header present/empty/absent and a present upstream response
trailer.
…iew notes
Sixth optional-text getter: http::exchange::get_trailer published a bare string,
so an absent trailer, an empty trailer, and a trailer that is not valid text all
read as "". It now publishes Result<Option<string>, string> like the other five
(absent=Ok(None), empty=Ok(Some("")), non-text=Err, invalid name stays a fatal
VmError), over the same result_option_string wire tag and the shared
optional_header_text/optional_text_outcome helpers. ABI stays 26 (unreleased);
the checked-in abi.json is regenerated from an --all-features build and moves
only that one entry.
The selection is factored into exchange_trailer_value so the absent / present
empty / invalid text / invalid name semantics are covered by named unit tests
that decode the real guest carrier rather than a coerced string.
Also:
- read_next_line gains a named \r\n boundary test: "a\r\nb" yields Some("a\r"),
because only the \n delimiter is stripped and a preceding \r is kept, matching
the core reader.
- The io::read_line doc comment claimed a handle or read failure surfaces as the
guest Err; the implementation fails closed with a fatal host error, so the
comment now says so (and records the \r-kept rule).
- docs/EDGE_HOST_DESCRIPTOR_MIGRATION.md still pinned the pre-migration core
b1d6cffe; it now names the frozen pin fc8b0c81.
Core exposed the VMBC codec outside the runtime feature; pick up that revision so the ABI crate and its downstream consumers share one pd-vm source.
fffonion
force-pushed
the
feat/abi26-optional-text-getters
branch
from
November 15, 2026 12:46
f4a6836 to
1ab0dec
Compare
pd-edge-abi asked for pd-vm/runtime only to reach GuestOption and GuestResult, but the core crate root exports both without any feature. Feature unification pushed that runtime onto every compiler-only consumer, so IronRust's `Check compiler-only dependencies` step failed on `pd-vm ... features=runtime` on both Ubuntu and Windows. Request no pd-vm features from the ABI manifest and lock the compiler-only ABI surface down with a cargo-tree guard in the pin tests. The workspace runtime keeps vm/runtime through its own pin; only the descriptor ABI stops asking.
The runtime pinned pd-vm at fc8b0c81 while the ABI crate pinned pd-host-function and pd-vm at 8db45832, so the lock carried two copies of each core package and the single-revision pin tests failed both before and after the ABI-only change. Move the root vm pin to 8db45832: the descriptor codec is public there without the runtime feature, the runtime feature set is unchanged, and root, ABI and lock now resolve every core git package to one revision again, which is the single CORE_TARGET the migration plan assumes. Cargo.lock drops the duplicate pd-vm, pd-host-function and pd-host-schema entries; no other package moves. FROZEN_CORE_REV and the migration note now name 8db45832, and pd_vm_enabled_features goes back to a plain name lookup: its source filter only existed to pick the runtime copy out of the temporary two-pin graph. The strict per-manifest and lock assertions are untouched.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Moves pd-edge onto the frozen core revision
2f433edaand replaces the empty-string absence sentinels on the HTTP header/query/trailer getters withResult<Option<string>, string>.ABI 26 (
abi.jsonregenerated; drift test passes)http::request::get_header,http::request::get_query_arg,http::response::get_header,http::response::get_trailer,http::exchange::get_header,http::exchange::get_trailerall returnResult<Option<string>, string>: absent =Ok(None), present-but-empty =Ok(Some("")), undecodable bytes =Err(original text), invalid header name stays a fatalVmError. Fixed fields (method,path,uri,version,status) keep their scalar types.{tag, payload}Result/Option shapes (vm::result::carrier+vm::option::{some,none}_carrier), not an app envelope.Core pin and contract alignment
pd-vmandpd-host-functionpin2f433edab3f1907e8cb060e901357d7e2af016ce; bridge gainspoll_submitted_op/cleanup_op,SourceFlavorfollows the new shape,AbiValueType::NullbecomesUnit.read_all/write/flush/closeasResult<...>,read_lineasResult<Option<string>, string>with EOF =Ok(None), blank line =Ok(Some("")), one trailing\nstripped and\rkept (CRLF covered by a named test).MqttEventemits all eight members on every variant, usingOption<T>carriers instead of missing keys.null(()and Unit), and the wrapper stops publishingget_headers()because dynamic-header maps remain deliberately untyped in ABI 26; the typedget_headeris the supported path (migration note instdlib/rss/http/upstream/response.rss).Known residual: edge
io::openstill returns a raw virtual handleint; the edge scope cannot mint a coreresource, so the descriptor contract is documented and allow-listed (docs/EDGE_HOST_DESCRIPTOR_MIGRATION.md).Verified on head
a0f3aacc1209276e7f158f1061848169abea925c:cargo test --locked(withRUST_TEST_THREADS=1) — 11 suites, 275 passed, 0 failed, 0 ignored;cargo check --locked,cargo clippy --locked --tests -- -D warnings,cargo fmt --all -- --check, andgit diff --checkall pass. All checked-in RSS examples and embedded test-script Option patterns use bareSome/Noneas required by the pinned core;Result::Ok/Result::Errremain qualified. Debugger integration-test timeouts were extended for loaded runners after the initial broad run timed out; the three focused debugger tests and the final complete run pass.