docs: align set_goal docs with append semantics (W-405) - #4
Merged
Merged
Conversation
set_goal appends a new root state per call and returns its id (0 on the first call in a fresh session) — it does not reset to state 0. Unify the misleading 'returns state 0' wording across the Rust docstring, the Python docstring, and the README API table, and add a regression test covering two consecutive set_goal calls and the independence of the resulting root states. No runtime behavior change.
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.
目标
W-405:
set_goal文档与实际语义对齐(append 语义,修误导性文档),不改运行时行为。改动
src/lib.rsset_goalrustdoc:「Returns state 0」→「创建新的 root goal state(不影响已有 state),返回该 state 的 id(新会话首次调用为 0)」。python/leotower/__init__.pyset_goaldocstring:同步修改。Repl.set_goal行:同步修改。tests/test_repl.py:新增回归测试test_set_goal_appends_independent_root_states— 同一会话连续两次set_goal分别返回 0 与 1,两个 root state 的 goal 相互独立(证明其中一个不影响另一个),第三次set_goal(中间夹了一次run_tac)正确返回 3。测试
cargo fmt -- --check✓cargo clippy -- -D warnings✓uv run pytest✓(64 passed, 1 skipped — Mathlib 环境缺失的既有 skip)评审已通过(Leo3 Reviewer,见 W-405 评论)。