Skip to content

Trim and consolidate the memory test suite - #39

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-8219-consolidate-memory-test-suite-and-fix-test-isolation
Sep 21, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-8219-consolidate-memory-test-suite-and-fix-test-isolation

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Sep 17, 2026 •

Copy link
Copy Markdown
Contributor

Tests-only consolidation for CL-8219. No production code touched.

Pruned (dead weight with surviving justification):

  • search.test.ts: belt-and-suspenders never-dispatches-embed duplicate (untouchable sql/fetch fakes already fail the suite if reached)
  • degrade-metrics.test.ts: impossible-config runtime test (highWatermark=1 behavior of a validator-rejected config)
  • retention.test.ts: file was a single typeof-assert test; removed (lockstep enum test + import surface carry the coverage)
  • routes.test.ts: forget-route 401 twin (search-route 401 kept; deps.test.ts pins the path)
  • adapt-and-plan.test.ts: contentHash duplicate (core/hash.test.ts keeps the canonical one)
  • feed.test.ts: FEED_LIMIT_MIN/MAX magic-constant asserts (DEFAULT-within-bounds relational check kept)

Consolidated into tables/loops: authorityWeightedScore, snippet, hnswEfSearch, deriveHybridEvidence (search); truncation + budget blocks (rerank-client); clamp/bound/temporal (hybrid-search); config-validation (degrade-metrics); 500 quartet (deps); whitespace trio (routes); migration CHECK + arktype lockstep (enums.lockstep).

Shared fixture: routes.test.ts builds one Hono app per harness (browser + machine-caller) instead of per test; grants, catalog, session principal, and callerResolver flow through mutable boxes reset by the existing buildApp signatures, so test bodies are unchanged.

Mock leak: memory.test.ts snapshots pristine module namespaces before mocking and reinstalls them in afterAll (mock.restore leaves module mocks installed); search.test.ts cache-busted dynamic import removed in favor of a static import.

Kept intact (judged load-bearing, flagging for follow-up): the no-embed lexical-results test and the HTTP-layer ownership 403 tests; the route stub was not slimmed.

Verification:

  • Before (HEAD worktree): bun test ./src -> 481 pass, 0 fail, 1140 expects, 1269ms, 44 files
  • After: bun test ./src -> 447 pass, 0 fail, 1142 expects, ~1160-1217ms, 43 files
  • bun run typecheck -> clean
  • Leak pair: bun test ./src/memory.test.ts ./src/services/search.test.ts -> 50 pass, 0 fail

Parameterized micro-case groups, pruned dead-weight asserts, and reinstalled pristine module snapshots so mock.module stops leaking across test files. Tests only; no production code touched.
@TheGreatAxios

Copy link
Copy Markdown
Contributor Author

Review

Verdict: approve. MERGEABLE against current main. CI test green. Tests-only; production code untouched. No prior reviews.

The load-bearing change is the memory.test.ts pristine-namespace snapshot (pristineDb/Search/Capture/Retention reinstalled in afterAll). That actually plugs the Bun mock.module leak across files — #45 still works around the same leak with cache-busted imports.

Deletions look justified: retention.test.ts was a typeof smoke; lockstep + import surface remain. Search “never dispatches embed” is covered by the remaining degraded-flags test plus untouchable fakes.

Does not touch files main added (sidecar-bundle.test.ts, workflow-mount.test.ts).

Do not stack with #40. Both shrink tests off the same 2026-09-17 base and conflict in deps.test.ts, routes.test.ts, and search.test.ts. Prefer this PR; rebase or close #40.

@TheGreatAxios
TheGreatAxios merged commit a83765a into main Sep 21, 2026
1 check passed
@TheGreatAxios
TheGreatAxios deleted the cl-8219-consolidate-memory-test-suite-and-fix-test-isolation branch September 21, 2026 04:22
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