Skip to content

chore: fallow duplication cleanup post Phase 3#12

Merged
ethanj merged 1 commit intoarchitecture2from
phase3cleanup
Apr 17, 2026
Merged

chore: fallow duplication cleanup post Phase 3#12
ethanj merged 1 commit intoarchitecture2from
phase3cleanup

Conversation

@ethanj
Copy link
Copy Markdown
Contributor

@ethanj ethanj commented Apr 17, 2026

Summary

  • Extract shared bindEphemeral + BootedApp test helper to eliminate duplication across integration test files
  • Extract twoLowSimilarityResults + createVectorRepo helpers in search-pipeline runtime config tests
  • Extract resolveSearchPreamble in routes to deduplicate /search and /search/fast preamble
  • Reduces fallow duplication from 367 lines (1.0%) to 234 lines (0.7%)

Test plan

  • npx tsc --noEmit passes
  • fallow --no-cache exits 0 with 0 dead code issues and 0 complexity above threshold
  • dotenv -e .env.test -- npx vitest run src/services/__tests__/search-pipeline-runtime-config.test.ts — 5/5 pass

🤖 Generated with Claude Code

Extract shared test helpers and deduplicate search pipeline test setup:

- Extract bindEphemeral + BootedApp into src/__tests__/test-helpers.ts,
  used by memory-route-config-seam.test.ts and composed-boot-parity.test.ts
- Extract twoLowSimilarityResults + createVectorRepo helpers in
  search-pipeline-runtime-config.test.ts to eliminate repeated 4-test
  setup boilerplate
- Extract resolveSearchPreamble in routes/memories.ts to deduplicate
  the parse-scope-limit pattern between /search and /search/fast

Remaining 234 lines (0.7%) are structural patterns that can't be
meaningfully extracted: camelCase/snake_case config snapshots,
idiomatic Express route handler preambles, port interface shapes,
and test mock config objects. fallow exits 0 (no threshold configured).
@ethanj ethanj merged commit b36e0a3 into architecture2 Apr 17, 2026
@ethanj ethanj deleted the phase3cleanup branch April 17, 2026 10:25
ethanj added a commit that referenced this pull request Apr 19, 2026
Cuts over `main` to the Phase 1A–7 rearchitecture (composition root,
  explicit scope/observability contracts, store-narrowed repository access,
  public consumption seams, config split, leaf-module config threading,
  retrieval orchestration polish) plus the OSS-release-prep on top.

  ⚠️ Breaking changes for HTTP / SDK consumers
  - All API endpoints are now mounted under `/v1` (e.g.
    `POST /v1/memories/ingest`, `PUT /v1/agents/trust`). The unversioned
    `/health` liveness probe is unchanged.
  - Workspace `GET /memories/list`, `GET /memories/:id`, and
    `DELETE /memories/:id` now require `agent_id` when `workspace_id`
    is present; missing returns 400 (no visibility-unsafe fallback).
  - `PUT /memories/config` returns 410 Gone in production. Provider/model
    fields (embedding_provider, embedding_model, llm_provider, llm_model)
    are rejected with 400 — they were never honored mid-flight (provider
    caches are fixed at first use). Set via env at process start.
  - npm package renamed `@atomicmemory/atomicmemory-engine` →
    `@atomicmemory/atomicmemory-core`. Tarball now ships `dist/` (built
    via `tsc`); `main`/`types`/`exports` point at compiled output.
  - Deep-importers of `services/embedding` and `services/llm` must call
    `initEmbedding(config)` / `initLlm(config)` before hot-path APIs.
    Consumers using `createCoreRuntime({ pool })` are auto-initialized.

  Rearchitecture (Phases 1A–7)
  - Phase 1A: composition root via `createCoreRuntime` + `createApp` (#8)
  - Phase 2A: canonical search scope contract (#9)
  - Phase 2B: explicit retrieval observability contract (#10)
  - Phase 3: runtime-config seam cleanup to Phase 4 boundary (#11)
  - Phase 4: ingest pipeline decomposition (475 → 215 lines) (#13)
  - Post-Phase 4: unify scope contract via `scopedSearch`/`scopedExpand`,
    document schema scoping gaps as deferred (#15)
  - Phase 5: narrow repository access behind 8 domain-facing stores;
    workspace ingest now flows through canonical lineage (#16)
  - Phase 6: publish stable consumption seams (HTTP, in-process, docker)
    with two-direction parity contract test (#17)
  - Phase 7 Steps 3a–3c: split runtime config into supported/internal
    partitions; deprecate `PUT /memories/config` for production (#18)
  - Phase 7 Step 3d: thread config through 5 leaf modules (33→28
    singleton audit) (#21)
  - Phase 7 Item 4: retrieval polish — `memory-search.ts` reduced to
    pure orchestration (374 → 248 lines, -34%) (#22)
  - Chore: reduce fallow duplication 367 → 234 lines (#12)

  OSS release prep
  - `"private": true` removed; package renamed to
    `@atomicmemory/atomicmemory-core`. `files` field scopes the tarball.
  - `tsconfig.build.json` + `prepublishOnly` so `npm publish` always ships
    compiled `dist/`. Bare-import smoke test passes.
  - `release.yml` publishes to public npm on tag push (NPM_TOKEN secret).
  - SuperMem codename scrubbed from `src/`, tests, docker-compose, and
    `.env.example` (DB user/name/password renamed to `atomicmemory`).
  - Private-research-repo URLs unlinked from public docs.
  - README links to docs.atomicmemory.ai.
  - `/v1` API prefix on all routes; mount-coverage test added.
  - CI workflow: set `CORE_RUNTIME_CONFIG_MUTATION_ENABLED=true` to
    match `.env.test` (gitignored) and unblock the composed-boot-parity
    test on `PUT /v1/memories/config`.

  Verification
  - 966/966 tests pass (100 files)
  - npx tsc --noEmit clean
  - fallow --no-cache: 0 above threshold (maintainability 91.0)
  - npm publish --dry-run succeeds
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