test: assert --fork-session flag composition in Query.build_args#77
Merged
Conversation
The Query struct field, setter, and apply_opts entry for fork_session were wired in #62 along with the other previously-missing opts, and the apply_opts coverage at query_test.exs already asserts the struct field is set. But there was no direct assertion that the flag actually appears in the args list produced by Query.build_args/1, either via the setter or via apply_opts. Adds two focused tests: one via the setter (alongside --resume), and one via apply_opts (alongside --continue). Both also verify that the flag is absent when fork_session is not set. Closes #75.
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.
Summary
--fork-sessionwas actually already wired end-to-end. PR #62 added thefork_sessionstruct field, theQuery.fork_session/1setter, the:fork_sessionentry inapply_opts/2, and theadd_bool(\"--fork-session\", ...)call inbuild_args/1. The existing apply_opts tests assert the struct field flips, but no test directly asserts that the CLI flag actually shows up in the args list.This PR fills that gap, which is what issue #75 explicitly asked for ("Add a test that asserts the flag composition").
Test plan
Query.fork_session/1setter alongsideQuery.resume/2, asserting--fork-session,--resume, and the session id all appear (and that--fork-sessionis absent when not set).apply_opts/2alongside:continue_session, since that is the path most callers actually use.mix format --check-formattedmix compile --warnings-as-errorsmix credo --strictmix test(133 tests, 0 failures)Note
No production code changes -- the flag was already callable from
ClaudeWrapper.query/2,ClaudeWrapper.stream/2,Session.send/3, and directQueryuse. No high-level helpers (fork_from/2etc.) added per the issue's out-of-scope list.Closes #75.