Initial Commit
This commit is contained in:
87
openspec/archive/2026-04-24-enterprise-search/tasks.md
Normal file
87
openspec/archive/2026-04-24-enterprise-search/tasks.md
Normal file
@@ -0,0 +1,87 @@
|
||||
# Tasks: enterprise-search
|
||||
|
||||
- **Change ID**: enterprise-search
|
||||
- **Package**: `@suaveplan/search`
|
||||
- **Date**: 2026-04-24
|
||||
|
||||
## Prerequisites (must be published to Verdaccio first)
|
||||
|
||||
- [x] `@suaveplan/error`
|
||||
- [x] `@suaveplan/types`
|
||||
- [x] `@suaveplan/pagination`
|
||||
|
||||
## Tasks
|
||||
|
||||
### 1. Scaffold package
|
||||
|
||||
- [x] Create `universal/data/search/` directory tree per file layout in `proposal.md`
|
||||
- [x] Write `package.json` (name `@suaveplan/search`, version `0.1.0`, `sideEffects: false`, correct workspace deps and catalog externals)
|
||||
- [x] Write `tsconfig.json` extending `@suaveplan/typescript-config/library.json`
|
||||
- [x] Write `vitest.config.ts` using `createTestConfig()` from `@suaveplan/testing/config`
|
||||
|
||||
### 2. Error codes (`src/error-codes.ts`)
|
||||
|
||||
- [x] Define `SearchErrorCode` union type
|
||||
- [x] Call `defineCodes` to register all `SEARCH.*` codes
|
||||
- [x] Export `registerSearchErrorCodes()` and `SearchError`
|
||||
|
||||
### 3. Types (`src/types/common.ts`)
|
||||
|
||||
- [x] Define and export all public interfaces: `SearchEngine`, `SearchDocument`, `SearchQuery`, `SearchFilter`, `SortSpec`, `PaginationSpec`, `SearchResult`, `SearchHit`, `FacetBucket`, `FieldConfig`, `MemorySearchEngineOptions`
|
||||
- [x] Write `common.md`
|
||||
|
||||
### 4. Text utilities
|
||||
|
||||
- [x] Implement `tokenize`, `normalize` in `src/text/tokenizer/`
|
||||
- [x] Implement `buildTrigrams`, `trigramSimilarity` in `src/text/trigram/`
|
||||
- [x] Implement `tfIdfScore`, `bm25Score` in `src/text/scorer/`
|
||||
- [x] Each module: `.ts`, `.md`, `.test.ts`, `index.ts`
|
||||
|
||||
### 5. In-memory engine (`src/engine/memory-engine/`)
|
||||
|
||||
- [x] Implement inverted-index full-text search with configurable `FieldConfig`
|
||||
- [x] Implement BM25 scoring
|
||||
- [x] Implement trigram-based fuzzy matching
|
||||
- [x] Implement faceted search (`facetable` fields → bucket counts)
|
||||
- [x] Implement highlight extraction
|
||||
- [x] Implement `suggest` prefix search
|
||||
- [x] Integrate `@suaveplan/pagination` cursor and offset pagination on results
|
||||
- [x] Write `memory-engine.md`, `.types.ts`, `.test.ts`, `index.ts`
|
||||
|
||||
### 6. `SearchEngine` interface (`src/engine/search-engine/`)
|
||||
|
||||
- [x] Define and export the generic `SearchEngine<T>` interface
|
||||
- [x] Write `search-engine.md`, `.types.ts`, `.test.ts`, `index.ts`
|
||||
|
||||
### 7. OTel instrumentation
|
||||
|
||||
- [x] Add spans, counters, histograms per `proposal.md` §4
|
||||
|
||||
### 8. Tests
|
||||
|
||||
- [x] Unit tests co-located with each feature module (100% coverage target)
|
||||
- [x] `tests/integration.test.ts` — index → search → paginate round-trip
|
||||
- [x] `tests/property.test.ts` — fast-check properties per `proposal.md` §5
|
||||
|
||||
### 9. Benchmarks (`src/__benchmarks__/search.bench.ts`)
|
||||
|
||||
- [x] Implement benchmark cases per `proposal.md` §6
|
||||
|
||||
### 10. Docs
|
||||
|
||||
- [x] Every `.ts` implementation file has a sibling `.md`
|
||||
- [x] Root `README.md`
|
||||
|
||||
### 11. Pre-publish gate
|
||||
|
||||
- [x] `bunx turbo lint typecheck test --filter=@suaveplan/search` green
|
||||
- [x] `bunx turbo test:coverage --filter=@suaveplan/search` ≥ 100% on touched modules
|
||||
|
||||
### 12. Publish
|
||||
|
||||
- [x] `bun scripts/publish.ts --package @suaveplan/search`
|
||||
|
||||
### 13. Archive
|
||||
|
||||
- [x] Fold spec delta into `openspec/specs/data/spec.md`
|
||||
- [x] `mv openspec/changes/enterprise-search openspec/archive/2026-04-24-enterprise-search`
|
||||
Reference in New Issue
Block a user