Repository navigation
WIP: api: Session::call_function_with_env — env channel on the contract surface (Refs #2001) - #2357
Merged
Merged
Conversation
…in was wrong)
The pin asserted resolved_value(SEEN_ABSENT) == None, but the probe
assigns SEEN_ABSENT=${CH_ABSENT+set}: with CH_ABSENT unbound the
expansion is empty and the assignment binds the marker set-but-empty
(GNU 5.3.20: M=${A+set} with A unset gives declare -- M="" and -v
true). resolved_value documents None only when the read is unset, so
the marker reads Some(""). The channel contract point of the test
(SEEN_EMPTY == "set": a "" channel value is set-but-empty during the
call, and CH_EMPTY is unbound again after rollback) is unchanged and
was already passing. Test-only; no product change.
Refs #2001
caomengxuan666
force-pushed
the
fix/2001-callfn-env
branch
from
October 31, 2026 16:36
5f8c764 to
0207570
Compare
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.
Refs #2001 (contract batch, post-release; lands if clean, gates nothing).
What
Adds
Session::call_function_with_env— the twin ofSession::call_functioncarryingExecutor::call_function_with_env's exact generic shape and bind-and-rollback semantics — so a host injecting per-call variables (niubash's compdefNIU_COMP_WORDS/NIU_COMP_CWORD, two call sites in niubash-runtime shell.rs) no longer has to drop to the Tier-C seamSession::executor(). This is the issue's option A (contract gains the env form); §8 of the design doc promised this pair under one mapping row.src/api/session.rs: the method (pure delegation; error mapped through the sameSessionError::from_execute_errorascall_function). Each channel name is saved (unset is a distinct saved state), bound for the call, restored in reverse; the function's other side effects persist. No shell semantics changed — the behavior is the executor's existing one, re-homed.src/api/mod.rs: surface listing names the pair.tests/session_api.rs: sixissue2001_*tests throughrubash::apionly — bind/rollback incl. mid-call reassignment, previously-unset rollback to unset, set-but-empty vs unmentioned, nested-call composition, the compdef round-trip shape, missing-function applies nothing.docs/design/1.5.0-session-api.md: §13 post-final successor note (frozen text untouched) recording the §8 inaccuracy and this resolution.docs/api-ledger.md: §6 symbol line + §2.2 mapping-row correction.Verification (finisher, on the merged tree)
cargo check --test session_api— clean, both pre-merge (base d758fd0) and post-merge with current master 711ad72 (merge was conflict-free; PR diff vs master = exactly the 5 intended files, +223/−2).python3 scripts/check-api-ledger.py— all 188 ledger symbols present, rc 0.docs/api-ledger.mdmust stay byte-identical across rubash/niubash. This PR edits only the rubash copy; the identical ledger change needs the niubash-side backfill PR, or this PR's canary (ledger-matches job) will red on the mismatch. Until niubash consumes the new method, the checker's completeness half reports it recorded-but-not-consumed (warning class). Follow-up after this lands: migrate niu's two seam call sites (run_compdef_function/run_widget_function) toSession::call_function_with_env.