test(insession): e2e model-backed child extraction via stub seam (#135)#186
Merged
Merged
Conversation
Add a minimal, deterministic stub-seam to the RecallInSession child: when RECALL_INSESSION_EXTRACT_STUB names a readable file, the spawned child uses its contents as a fake extractor instead of runExtractionCascade (one env var, one branch). This lets the full child path — parent past cadence -> detached spawn -> real runInSessionExtraction -> extraction_sessions row — be driven end-to-end in CI with no live model backend. The new e2e test drives the parent past the turn cadence, lets it spawn the detached child, and asserts a row lands in extraction_sessions whose summary equals the stub's exact sentence. Non-vacuous: without the stub (or a real backend) the child returns extraction_failed and writes no row (verified by mutation). Reuses the existing runHook subprocess harness. Closes #135
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
Closes #135 — the model-backed full child path is now covered end-to-end: parent past cadence → detached spawn → real
runInSessionExtraction→ a row inextraction_sessions— deterministically, in CI, with no live model backend.Scope note (for the gate)
This issue is labeled
type:test, but a non-vacuous model-backed e2e required a small production change: the spawned child (hooks/RecallInSession.tsrunChild) hardcodedextract: runExtractionCascadewith no injection point, so a subprocess test could not substitute a deterministic model. Per Themis's authorization (Option A), I added a minimal stub-seam:resolveExtract()— whenRECALL_INSESSION_EXTRACT_STUBnames a readable file, the child uses its contents as a fake extractor; otherwise it returns the realrunExtractionCascade. One env var, one branch, no other config (KarpathyGuidelines).What changed
hooks/RecallInSession.ts(+20):resolveExtract()helper + swap the child's hardcodedextract:forresolveExtract(). Production default behavior is unchanged when the env var is unset.tests/hooks/RecallInSession.test.ts(+98): one new e2e test (reuses the existingrunHooksubprocess harness — DRY) that drives the parent past the turn cadence, lets it spawn the detached child, and polls (bounded, mirrorsRecallClearExtract.test.ts) for theextraction_sessionsrow. Header note updated.Why it is not vacuous
summaryto equal the stub's exact one-sentence summary, so a real model running instead of the stub would also fail.Verification
bun run lint(tsc --noEmit): cleanbun test: 1175 pass / 0 fail (baseline 1174 + this test)