Skip to content

test: assert --fork-session flag composition in Query.build_args#77

Merged
joshrotenberg merged 1 commit into
mainfrom
feat/fork-session
May 13, 2026
Merged

test: assert --fork-session flag composition in Query.build_args#77
joshrotenberg merged 1 commit into
mainfrom
feat/fork-session

Conversation

@joshrotenberg

Copy link
Copy Markdown
Collaborator

Summary

--fork-session was actually already wired end-to-end. PR #62 added the fork_session struct field, the Query.fork_session/1 setter, the :fork_session entry in apply_opts/2, and the add_bool(\"--fork-session\", ...) call in build_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

  • Added a build_args test that flips the flag via the Query.fork_session/1 setter alongside Query.resume/2, asserting --fork-session, --resume, and the session id all appear (and that --fork-session is absent when not set).
  • Added a second build_args test driving the same outcome through apply_opts/2 alongside :continue_session, since that is the path most callers actually use.
  • mix format --check-formatted
  • mix compile --warnings-as-errors
  • mix credo --strict
  • mix 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 direct Query use. No high-level helpers (fork_from/2 etc.) added per the issue's out-of-scope list.

Closes #75.

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.
@joshrotenberg joshrotenberg merged commit 3c559a8 into main May 13, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add --fork-session support

1 participant