Skip to content

feat(pi): --no-session / --no-persist-tool-output flags (Batch 3 Unit 4) - #14

Merged
srdjan merged 1 commit into
mainfrom
feat/unit-4-session-flags
Apr 20, 2026
Merged

feat(pi): --no-session / --no-persist-tool-output flags (Batch 3 Unit 4)#14
srdjan merged 1 commit into
mainfrom
feat/unit-4-session-flags

Conversation

@srdjan

@srdjan srdjan commented Apr 20, 2026

Copy link
Copy Markdown
Owner

Summary

  • Generalize parseApprovalFlags into parseExpertFlags returning an ExpertFlags struct (policy + no_session + no_persist_tool_output).
  • Thread the two new bools through repl.run and tui_app.run signatures as plumbing only; Batch 4 will consume them to gate the events.jsonl writer added in Unit 2.
  • Extend renderHelp (REPL) and printExpertHelp (zigts expert --help) to document both new flags.

Plan: /Users/srdjans/.claude/plans/study-the-plan-provided-clever-wadler.md (Batch 3 Unit 4).

Test plan

  • zig build test-expert-app
  • zig build test
  • zig build
  • printf 'help\nquit\n' | timeout 10 ./zig-out/bin/zigts expert (shows new Session flags block)
  • printf '/meta\nquit\n' | timeout 10 ./zig-out/bin/zigts expert
  • printf 'hi\nquit\n' | timeout 10 ./zig-out/bin/zigts expert --no-session
  • printf 'hi\nquit\n' | timeout 10 ./zig-out/bin/zigts expert --no-persist-tool-output
  • printf 'hi\nquit\n' | timeout 10 ./zig-out/bin/zigts expert --yes --no-session --no-persist-tool-output
  • ./zig-out/bin/zigts expert --yes --no-edit exits 2 with the mutual-exclusion message

Generalize parseApprovalFlags into parseExpertFlags returning an
ExpertFlags struct (policy + no_session + no_persist_tool_output).
Thread the two new bools through repl.run and tui_app.run signatures
as plumbing; Batch 4 will consume them to gate the events.jsonl writer.
Help text in both the REPL and printExpertHelp now documents the flags.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@srdjan
srdjan merged commit d7cc7f1 into main Apr 20, 2026
@srdjan
srdjan deleted the feat/unit-4-session-flags branch April 20, 2026 14:01
srdjan added a commit that referenced this pull request Apr 27, 2026
CLAUDE.md and two internals docs lagged the 2026-04-25 docs reorg, the
modules peer-package extraction, and the Task #14 handler_contract
split. Restores link integrity (docs/architecture.md ->
docs/internals/architecture.md, types.zig path), points at the actual
packages/modules/src/ tree for virtual-module implementations, and adds
the missing zigttp:scope row to the module table.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
srdjan added a commit that referenced this pull request Jun 8, 2026
Code-review cleanup follow-ups (#10, #11, #14) plus one fidelity fix (#2).

#10 - extract replayRecordedEntry(state, ctx, entry): the result-parse +
parse-failure divergence heuristic now has a single owner, shared by
makeReplayStub and makeReplayStubWithFallback instead of being copy-pasted.

#14 - add ReplayState.consumeHead(): the fallback trusts a prior peekMatches
and advances without re-checking bounds/names, dropping the redundant nextIO
re-scan and its dead orelse branch.

#2 - add ReplayState.hasEntryAhead(): when a pure call's recorded entry is not
at the head but exists further on, the fallback counts a divergence (structural
drift) before running real, so replay verification still fails closed; a
genuinely-new call with no recording stays silent. modules_all (entry at head)
and validate-external (no entries) are unaffected.

#11 - add trace.unescapeBody(allocator, body) -> {slice, owned}: test_runner
and replay_runner share it for request-body unescaping, replacing the
duplicated unescape-with-guarded-free idiom (the owned flag also retires the
misleading .ptr re-check).

New unit test covers consumeHead/hasEntryAhead. Verified: test-zigts, test-cli
(497), test-examples 23/23, test-zruntime clean; env exclusion and validate
passthrough intact.

Note: #4 (env fallback under restrictive policy) is already moot - env has
replay_pure=false and never falls through. #5 (matched-path arg checking) is
deferred: it needs the recorder's JSValue serializer extracted and reused for
byte-identical arg comparison, with real risk of false divergences against
existing fixtures; better as a dedicated, test-gated change.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.

1 participant