Skip to content

refactor(memory-core): consolidate manager test fixtures - #122671

Merged
steipete merged 3 commits into
mainfrom
steipete/memory-core-test-support-0812
Aug 12, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/memory-core-test-support-0812

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The memory-core manager suites copied the same embedding mock, mutable provider controls, manager lifecycle cleanup, SQLite teardown, config builder, and transcript seeding across seven files. That duplication added thousands of test lines and made fixture fixes easy to apply inconsistently.

Why This Change Was Made

This consolidates the seven manager suites on one typed manager-index.test-support.ts fixture. The fixture injects manager runtime functions, registers the existing embedding mock before dynamically loading the manager module, canonicalizes its temporary root, and owns the established cleanup order. Existing High and Medium repetition cases are table-driven as separately named Vitest rows with unchanged assertions.

The approved config-helper amendment was used: test-config-helpers.ts remains unchanged because importing the new manager support from the two custom-mock suites would register its embedding mock and contaminate those suites' intentionally distinct mock factories. The narrow test-manager-helpers.ts module was absorbed and deleted.

The guarded provider-lifecycle fallback matrix was intentionally not table-driven. Its optional/thrown case has a unique provider call-order assertion, and combining the required/optional failure paths risked obscuring their distinct retry scheduling; the coordinator explicitly allowed this skip when scheduling preservation was uncertain.

AI-assisted implementation; the resulting code and validation evidence were reviewed before opening this PR.

User Impact

There is no production or user-visible behavior change. Memory-core contributors get one canonical manager test fixture, 2,627 fewer net test/test-support lines, and less risk of lifecycle or mock drift between suites.

Evidence

  • Full memory-core suite before: 83 files; 1,061 cases total; 1,058 passed; 3 skipped.
  • Full memory-core suite after, exact head: 83 files; 1,061 cases total; 1,058 passed; 3 skipped.
  • Command: node scripts/run-vitest.mjs extensions/memory-core
  • node scripts/check-changed.mjs: passed all selected guards, extension production/test typechecks, full extension lint, sidecar-loader guard, database-first guard, and import-cycle check. Configured remote backends were unavailable, so the wrapper completed through its local fallback with a worktree-scoped heavy-check lock.
  • Branch autoreview against origin/main: clean, with no accepted/actionable findings.
  • Assertion semantics: no assertions added, removed, weakened, or reordered outside the approved named-row table conversions; total case count is unchanged.
  • Production LOC: +0 / -0 (net 0).
  • Test files: +588 / -3,786 (net -3,198).
  • Test support: +604 / -33 (net +571).
  • Total test + test-support: +1,192 / -3,819 (net -2,627).

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@openclaw-barnacle openclaw-barnacle Bot added the extensions: memory-core Extension: memory-core label Aug 12, 2026
@steipete
steipete marked this pull request as ready for review August 12, 2026 14:51
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Aug 12, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 11:18 AM ET / 15:18 UTC.

ClawSweeper review

What this changes

The PR replaces duplicated Memory Core manager-test setup with one typed fixture, deletes the narrow helper it subsumes, and table-drives equivalent state cases.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness or security defect was found in this test-only refactor. This maintainer-labelled PR should remain open for owner approval and exact-head merge checks.

Priority: P3
Reviewed head: e80b921d4e415d6a2504e8cf45104d60eb79d2de
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has a coherent fixture boundary and no identified correctness defect; current-base exact-head checks remain the final merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored, test-only refactor has no user-visible behavior requiring contributor real-world proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored, test-only refactor has no user-visible behavior requiring contributor real-world proof.
Evidence reviewed 4 items Shared fixture owns lifecycle: The new fixture registers the embedding mock, injects the manager entry points, creates canonical temporary roots, and preserves the prior before/after cleanup sequence.
Mock-before-load caller path: The refactored index suite imports the fixture before dynamically loading the manager entry point, so the fixture’s Vitest mock is registered before the runtime module is evaluated.
Current-main provenance: The duplicated manager-test fixture and the deleted helper were introduced with the current Memory Core test surface by commit 3e6aec1.
Findings None None.
Security None None.

How this fits together

Memory Core manager tests create mocked embedding providers, temporary SQLite and transcript state, then load the Memory Core index manager. The shared fixture supplies that setup and teardown to the manager-focused suites before their assertions run.

flowchart LR
  A[Manager test suites] --> B[Shared test fixture]
  B --> C[Embedding and runtime mocks]
  B --> D[Temporary SQLite and transcript state]
  C --> E[Memory index manager]
  D --> E
  E --> F[Test assertions and cleanup]
Loading

Decision needed

Question Recommendation
Should this maintainer-labelled fixture consolidation merge once its current-base result and exact-head checks are confirmed? Confirm canonical fixture: Merge after GitHub confirms the current-base result and required checks for the exact head.

Why: The patch is a low-risk test-only consolidation, but the maintainer label requires an explicit owner decision rather than automated cleanup.

Before merge

  • Resolve merge risk (P1) - GitHub reports the branch behind current main; merge should use the actual three-way result and completed exact-head required checks rather than infer a regression from base drift.
  • Complete next step (P2) - The remaining action is maintainer approval plus normal current-base and exact-head merge gating, not an automatable repair.
Agent review details

Security

None.

PR surface

Source +571, Tests -3198. Total -2627 across 12 files.

View PR surface stats
Area Files Added Removed Net
Source 2 604 33 +571
Tests 10 588 3786 -3198
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 1192 3819 -2627

Review metrics

Metric Value Why it matters
Production versus test LOC production +0/-0; test files +588/-3,786; test support +604/-33; net test/test-support -2,627 The new canonical fixture removes substantial repeated test setup without growing production code.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/memory-core/src/memory/index.test.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-index.test-support.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-keyword-retrieval.test.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-provider-lifecycle-fallback.test.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-provider-lifecycle-leases.test.ts, unknown-data-model-change: extensions/memory-core/src/memory/manager-provider-lifecycle.test.ts, and 16 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land one canonical fixture after the owner confirms its cleanup and mock-isolation contract against the current merge result.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land one canonical fixture after the owner confirms its cleanup and mock-isolation contract against the current merge result.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR refactors test infrastructure rather than reporting a user-facing failure.

Is this the best way to solve the issue?

Yes: the shared fixture centralizes repeated mock, setup, and cleanup behavior while preserving the suites’ injected runtime boundary; current-base and exact-head checks remain the final merge proof.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8624b9acb812.

Labels

Label justifications:

  • P3: This is a test-only maintainability refactor with no claimed user-visible or production behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored, test-only refactor has no user-visible behavior requiring contributor real-world proof.

Evidence

What I checked:

Likely related people:

  • vincentkoc: Commit 3e6aec1 introduced the current duplicated manager fixtures and helper that this PR consolidates. (role: introduced current manager-test surface; confidence: high; commits: 3e6aec1d55ae; files: extensions/memory-core/src/memory/index.test.ts, extensions/memory-core/src/memory/test-manager-helpers.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Confirm the clean current-base merge result and completed required checks for the exact head.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-12T15:13:09.741Z sha e80b921 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit 1f8fdf4 into main Aug 12, 2026
242 of 244 checks passed
@steipete
steipete deleted the steipete/memory-core-test-support-0812 branch August 12, 2026 15:50
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 13, 2026
…2671)

* test(memory-core): consolidate manager index fixtures

* test(memory-core): table-drive manager state cases

* test(memory-core): type shared fixture surface
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extensions: memory-core Extension: memory-core maintainer Maintainer-authored PR P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant