feat(pi): --no-session / --no-persist-tool-output flags (Batch 3 Unit 4) - #14
Merged
Conversation
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
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>
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
parseApprovalFlagsintoparseExpertFlagsreturning anExpertFlagsstruct (policy+no_session+no_persist_tool_output).repl.runandtui_app.runsignatures as plumbing only; Batch 4 will consume them to gate theevents.jsonlwriter added in Unit 2.renderHelp(REPL) andprintExpertHelp(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-appzig build testzig buildprintf '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 expertprintf 'hi\nquit\n' | timeout 10 ./zig-out/bin/zigts expert --no-sessionprintf 'hi\nquit\n' | timeout 10 ./zig-out/bin/zigts expert --no-persist-tool-outputprintf 'hi\nquit\n' | timeout 10 ./zig-out/bin/zigts expert --yes --no-session --no-persist-tool-output./zig-out/bin/zigts expert --yes --no-editexits 2 with the mutual-exclusion message