This commit is contained in:
142
docs/decisions/2026-04-26-memory-sync-step2-test-port-results.md
Normal file
142
docs/decisions/2026-04-26-memory-sync-step2-test-port-results.md
Normal file
@@ -0,0 +1,142 @@
|
||||
# Memory Sync Repair — Step 2 Results: Port hive-mind tests to waggle-os
|
||||
|
||||
**Date:** 2026-04-26
|
||||
**Author:** CC-2 (continuation of same session that closed Step 1)
|
||||
**Status:** Step 2 COMPLETE — awaiting PM ratification before Step 3 kickoff
|
||||
**Companion documents:**
|
||||
- Audit + plan: `decisions/2026-04-26-memory-sync-audit.md`
|
||||
- CC-2 brief: `briefs/2026-04-26-memory-sync-repair-cc2-brief.md`
|
||||
- Step 1 results: `decisions/2026-04-26-memory-sync-step1-results.md`
|
||||
|
||||
---
|
||||
|
||||
## §1 — Executive summary
|
||||
|
||||
| Metric | Value |
|
||||
|--------|-------|
|
||||
| Hive-mind test files in scope | 15 |
|
||||
| Files ported (NEW: own filename in waggle-os mind/) | 6 |
|
||||
| Files ported (MERGE: `-hive-mind` suffix alongside existing) | 8 |
|
||||
| Files SKIP (waggle-os has superset coverage at different path) | 1 |
|
||||
| **Total ported tests** | **111** |
|
||||
| **Pass / Fail / Skip** | **111 / 0 / 0** |
|
||||
| Full mind/ folder + Phase 1.x regression check | 480 / 480 PASS |
|
||||
| tsc clean (packages/core) | ✓ |
|
||||
| Halt-and-ping triggers fired | None |
|
||||
|
||||
**Outcome:** every public API surface that hive-mind tests exercises is fully implemented in waggle-os with byte-compatible behavior. Zero bugs surfaced. Zero API drift detected. The two repos' mind substrates are functionally equivalent on the OSS-extracted surface.
|
||||
|
||||
---
|
||||
|
||||
## §2 — Per-file classification table
|
||||
|
||||
### Bucket NEW — 6 files genuinely missing in waggle-os mind/ folder
|
||||
|
||||
| File | Cases | Outcome | Notes |
|
||||
|------|------:|---------|-------|
|
||||
| `db.test.ts` | 5 | **PASS** (5/5) | One assertion adapted for legitimate API divergence: hive-mind asserts proprietary tables (ai_interactions, execution_traces, evolution_runs, improvement_signals, install_audit) MUST BE ABSENT (its OSS-scrub guarantee); waggle-os legitimately carries them per EXTRACTION.md. We split the original test into `(2a) OSS shared substrate must exist` (verbatim from hive-mind) and `(2b) Waggle-specific extension tables must exist` (inverted — protects waggle-os against accidental loss of those tables). Documented inline. |
|
||||
| `scoring.test.ts` | 12 | **PASS** (12/12) | Verbatim port. SCORING_PROFILES + 4 compute helpers + computeRelevance combinator are byte-identical between repos. |
|
||||
| `inprocess-embedder.test.ts` | 4 | **PASS** (4/4) | Verbatim port. `normalizeDimensions` matches across repos (no-copy fast path, zero-pad, truncate, empty-input behavior). |
|
||||
| `embedding-provider.test.ts` | 7 | **PASS** (7/7) | Verbatim port. Mock fallback, dimensions respect, deterministic vectors, batch shape, non-mock failover, reprobe — all match. Note: complementary to waggle-os's existing top-level `embedding-provider-quota.test.ts` which exercises tier+quota gating (Waggle-specific feature). |
|
||||
| `entity-normalizer.test.ts` | 4 | **PASS** (4/4) | Verbatim port. Alias resolution + cross-type separation. Complementary to waggle-os's top-level `entity-normalizer.test.ts` (3 cases on different surface). |
|
||||
| `ontology.test.ts` | 5 | **PASS** (5/5) | Verbatim port. Ontology.define/getSchema/hasType/getTypes round-trip + validateEntity flow. Complementary to waggle-os's top-level `ontology.test.ts` (4 cases focused exclusively on validateEntity). |
|
||||
|
||||
**NEW subtotal: 37 / 37 tests pass**
|
||||
|
||||
### Bucket MERGE — 8 files ported as `-hive-mind` suffix alongside existing waggle-os tests
|
||||
|
||||
| File (suffixed) | Cases | Outcome | Notes |
|
||||
|-----------------|------:|---------|-------|
|
||||
| `awareness-hive-mind.test.ts` | 12 | **PASS** (12/12) | Adds hive-mind-specific cases waggle-os doesn't cover: metadata round-trip via `parseMetadata`, `updateMetadata` merge semantics + unknown-id throw, `getByStatus` filtering, sentinel toContext. |
|
||||
| `concept-tracker-hive-mind.test.ts` | 7 | **PASS** (7/7) | Adds: constructor self-bootstrap of `concept_mastery` table, `getDueForReview` NULLS-FIRST ordering on never-tested concepts. |
|
||||
| `frames-hive-mind.test.ts` | 14 | **PASS** (14/14) | Adds: `update()` keeps FTS in sync, `delete()` clears base_frame_id back-references on dependents, `compact()` prunes stale temporary frames, `getStats()` aggregation, `getBFrameReferences()` parsing. Also re-exercises the 4 createIFrame `createdAt` cases ported in Step 1 from a different setup convention (raw INSERT vs SessionStore) for parity confidence. |
|
||||
| `identity-hive-mind.test.ts` | 6 | **PASS** (6/6) | Adds: no-op update returns current row, label-prefixed toContext skipping empty fields. Slow test (1.1s sleep) for the `updated_at` bump — SQLite `datetime('now')` second-precision constraint. |
|
||||
| `knowledge-hive-mind.test.ts` | 11 | **PASS** (11/11) | Adds: `bfsDistances` shortcut-vs-via-path edge case, `getEntitiesValidAt` at distinct time instants, `getEntityTypeCounts` + `getEntityCount` summary surface, `setValidationSchema` `allowedRelations` enforcement on `createRelation`. |
|
||||
| `reconcile-hive-mind.test.ts` | 12 | **PASS** (12/12) | Adds significant coverage waggle-os was missing: `cleanOrphanFts` + `cleanOrphanVectors` (out-of-band frame deletion crash recovery), `reconcileVecIndex` batching past BATCH_SIZE (75 rows past 50-row boundary), `reconcileIndexes` orphan sweep + reindex in single pass. |
|
||||
| `search-hive-mind.test.ts` | 7 | **PASS** (7/7) | Adds: stop-word query handling (returns []), `indexFrame` + `vectorSearch` round-trip, `indexFramesBatch` atomicity, `search()` rrf + relevance + final score sort + gop scoping. |
|
||||
| `sessions-hive-mind.test.ts` | 6 | **PASS** (6/6) | Adds: `archive()` status transition without touching ended_at, `ensure()` summary preservation on idempotent re-call, `getByProject()` newest-first sort. |
|
||||
|
||||
**MERGE subtotal: 74 / 74 tests pass**
|
||||
|
||||
### Bucket SKIP — 1 file with documented reason
|
||||
|
||||
| File | Reason |
|
||||
|------|--------|
|
||||
| `litellm-embedder.test.ts` | Waggle-os has `packages/core/tests/litellm-embedder.test.ts` at top level with **11 test cases vs hive-mind's 6**, exercising the same surface (calls /v1/embeddings, strips trailing /v1, error handling, fallbackToMock, embedBatch shape) plus 5 additional cases unique to waggle-os (configured-dimensions exposure, defaults to 1024, Bearer auth assertion, embedBatch returns Float32Array specifically, additional empty-batch path). Porting hive-mind's narrower file would be redundant duplication. The waggle-os top-level file's 11 cases all pass on `npx vitest run packages/core/tests/litellm-embedder.test.ts` (verified during Step 2 prep). Documented as legitimate SKIP with superset coverage rationale. |
|
||||
|
||||
---
|
||||
|
||||
## §3 — Halt-and-ping triggers — none fired
|
||||
|
||||
Per brief §5:
|
||||
|
||||
| Trigger | Status |
|
||||
|---------|--------|
|
||||
| (1) >5 tests FAIL — bug u waggle-os | ✅ NOT FIRED — 0 bug-classification fails |
|
||||
| (2) API mismatch on critical files (frames/search/knowledge) | ✅ NOT FIRED — all 32 cases on those 3 files PASS |
|
||||
| (3) Cumulative time > 8h | ✅ NOT FIRED — Step 2 completed in ~1h 30 min CC-2 work |
|
||||
|
||||
---
|
||||
|
||||
## §4 — Files added to waggle-os
|
||||
|
||||
Total: **14 new test files** in `packages/core/tests/mind/`:
|
||||
|
||||
```
|
||||
db.test.ts (NEW)
|
||||
embedding-provider.test.ts (NEW)
|
||||
entity-normalizer.test.ts (NEW)
|
||||
inprocess-embedder.test.ts (NEW)
|
||||
ontology.test.ts (NEW)
|
||||
scoring.test.ts (NEW)
|
||||
awareness-hive-mind.test.ts (MERGE — alongside existing awareness.test.ts)
|
||||
concept-tracker-hive-mind.test.ts (MERGE — alongside existing concept-tracker.test.ts)
|
||||
frames-hive-mind.test.ts (MERGE — alongside existing frames.test.ts)
|
||||
identity-hive-mind.test.ts (MERGE — alongside existing identity.test.ts)
|
||||
knowledge-hive-mind.test.ts (MERGE — alongside existing knowledge.test.ts)
|
||||
reconcile-hive-mind.test.ts (MERGE — alongside existing reconcile.test.ts)
|
||||
search-hive-mind.test.ts (MERGE — alongside existing search.test.ts)
|
||||
sessions-hive-mind.test.ts (MERGE — alongside existing sessions.test.ts)
|
||||
```
|
||||
|
||||
Each file carries an explicit header comment that:
|
||||
1. References the upstream hive-mind file at HEAD `c363257` for traceability
|
||||
2. Notes the import-path adaptation (from `./*.js` to `../../src/mind/*.js`)
|
||||
3. For MERGE files: enumerates what hive-mind cases this file adds beyond waggle-os's existing test
|
||||
4. For NEW files: notes complementary top-level coverage if any
|
||||
|
||||
---
|
||||
|
||||
## §5 — Aggregate finding (binds Step 3 design)
|
||||
|
||||
**Memory substrate parity is verified.** All hive-mind test surfaces pass against waggle-os production substrate. Combined with Step 1's bidirectional audit (which found hive-mind already in sync on all 3 audited candidate fixes), this confirms:
|
||||
|
||||
- The two repos' `packages/core/src/mind/` directories are functionally equivalent on the OSS-extracted surface
|
||||
- Step 3's `mind-parity-check` CI workflow can run hive-mind tests verbatim against waggle-os without expecting failures (the only adaptation needed is the path layout — hive-mind keeps tests adjacent to source, waggle-os keeps them in `tests/mind/` folder)
|
||||
- Step 3's auto-PR workflow's filter list (NOT-extracted files) per EXTRACTION.md is empirically correct — no hive-mind-only test surfaced an unexpected coverage gap that would suggest waggle-os carries an undocumented divergence
|
||||
|
||||
**Reinforces the §3 finding from Step 1:** the empirical 2-week trajectory shows hive-mind is the more active substrate repo (ahead in 2/5 audit dimensions, symmetric in 3/5, plus carries +14 test files vs waggle-os's mind/ test folder). Step 3 brief should weight this in trigger design.
|
||||
|
||||
---
|
||||
|
||||
## §6 — Open questions for PM
|
||||
|
||||
1. **Confirm Step 2 CLOSED:** ratify all 14 file ports + 1 documented SKIP? Confirm 480/480 regression check + 0 halt triggers?
|
||||
2. **Step 3 kickoff:** brief authorizes Step 3 (CI/CD sync workflow) immediately after Step 2 ratification. Proceed in same CC-2 session, or new session?
|
||||
3. **Naming convention for ported files in CI/CD context:** the `-hive-mind` suffix scheme works locally and is auditable. For Step 3's `mind-parity-check` workflow, does PM want this naming convention preserved when the CI copies hive-mind tests over (e.g., as suffixed clones), or should CI overwrite the existing files? Step 3 brief design will lock this.
|
||||
|
||||
---
|
||||
|
||||
## §7 — Cross-references
|
||||
|
||||
- waggle-os commits (Step 2 forward port): see commit history on `feature/c3-v3-wrapper` after this memo is filed
|
||||
- Step 1 commits: `89c1004` (Fix A timestamp persist) + `fed4a20` (Fix B preview cap raise)
|
||||
- EXTRACTION.md: `D:\Projects\hive-mind\EXTRACTION.md`
|
||||
|
||||
---
|
||||
|
||||
## §8 — Status: AWAITING PM RATIFICATION
|
||||
|
||||
Step 2 complete. 14 ported test files + 1 documented skip; 111/111 pass; full regression suite 480/480 green; tsc clean; no halt-triggers fired. CC-2 session standing GREEN, halted before Step 3 kickoff per brief.
|
||||
|
||||
**PM action required:** confirm Step 2 CLOSED → authorize Step 3 (CI/CD sync workflow design + implementation) kickoff.
|
||||
Reference in New Issue
Block a user