refactor(build): consolidate zigts_expert_examples module registration (Unit C) - #10
Merged
Merged
Conversation
…es/tools/build.zig (Unit C) Unifies embedded-content module registration so both zigts_expert_skill and zigts_expert_examples are declared in packages/tools/build.zig. Root build.zig now pulls zigts_expert_examples via the same pi_host_tools_dep pattern already used for the skill module, eliminating the duplicate b.createModule call that existed for pi_tests. examples/data.zig stays put so its @embedfile references keep resolving. Co-Authored-By: Claude Sonnet 4.6 <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>
srdjan
added a commit
that referenced
this pull request
Jun 28, 2026
…high #10/#13) Two lower-severity cleanups from the xhigh review: - pool.zig deinit ran an O(n^2) scan of all later slots for a duplicate publication on every shutdown. That case is a poisoned slot table that runtime-safety release() already rejects, so gate the scan behind std.debug.runtime_safety like the sibling poison checks: a release-build pool (esp. a large `-n N`) no longer pays N^2/2 atomic loads to guard an unchecked precondition. - smt_solver tmpQueryPath keyed the query file only on pid, so it was not safe to parallelize the obligation loop (the natural optimization, since the z3 calls dominate runtime): two concurrent solve() calls would clobber one file. Add a monotonic per-call suffix so each query gets a unique path. spec-check --audit green; pool and zigts-cli tests pass. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
srdjan
added a commit
that referenced
this pull request
Jul 12, 2026
#10 Cap a tool_result body at 32 KB before it enters the transcript, with a marker pointing the model at a workspace_read_file range re-read. A single large output (a full-file read, a long diagnostic blob) no longer inflates the input token count of every subsequent roundtrip in the turn. #12 Auto-compact after each RPC turn, mirroring the interactive REPL, so a long-lived IDE session on the RPC surface never dead-ends on a PromptTooLong the machine client cannot resolve with /compact. A notification is emitted when compaction fires. 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
zigts_expert_examplesmodule declaration from rootbuild.zigintopackages/tools/build.zig, alongside the siblingzigts_expert_skillregistration.build.zignow pulls the module viapi_host_tools_dep.module("zigts_expert_examples"), matching the existing skill-module pattern.b.createModulethat previously existed forpi_testsinto a single shared declaration consumed by bothpi_app_modandpi_tests.examples/data.zigstays in place so@embedFile("handler/handler.ts")and friends keep resolving. The new registration uses../../examples/data.zigto reach the same file frompackages/tools/.Part of Batch 2 of the lockdown-first pi roadmap.
Test plan
zig build test-expert-apppasses (exercisesexpert_persona.zigwhich imports both skill and examples modules)zig buildcompiles cleanlyzig build testgreen (1433/1439 pass, 4 skipped, known flake feat(pi): session persister — entry-to-event mapping + capped writer (Batch 4 Unit 1) #15 on retry)zigts expertprints registered tools and/metareturnscompiler_versiongrep -c "zigts_expert_examples" build.zig= 3 (all dep-pull / addImport, zeroaddModule)grep -n "b.addModule.*zigts_expert_examples" packages/tools/build.zigyields exactly one matchGenerated with Claude Code