Skip to content

Commit 1982a22

Browse files
matte1782claude
andcommitted
docs(w45): add week 45 plan — LangChain v0.2.0 + PQ research + API audit
- Day-by-day task files (DAY_1 through DAY_6) - LangChain v0.2.0: 15 edge case tests, usage guide, npm publish - PQ literature review pulled forward from W46 - API stability audit for v1.0 prep - Hostile review of plan: APPROVED (all C1+M1-M4+m1-m5 fixed) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 5300052 commit 1982a22

8 files changed

Lines changed: 1264 additions & 0 deletions

File tree

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
# Week 45 — Day 1 Tasks (Monday, Mar 24)
2+
3+
**Date:** 2026-03-24
4+
**Focus:** LangChain.js FilterExpression Edge Cases + Testing
5+
**Agent:** TEST_ENGINEER + RUST_ENGINEER
6+
**Status:** PENDING
7+
8+
---
9+
10+
## Day Objective
11+
12+
Harden the FilterExpression integration with comprehensive edge case tests. The W44 implementation added 6 happy-path tests; Day 1 adds adversarial and boundary tests to ensure robustness before v0.2.0 publish.
13+
14+
**Success Criteria:**
15+
- 15 new `it()` blocks added to `pkg/langchain/tests/store.test.ts` (149 total)
16+
- All edge cases documented in test descriptions
17+
- Full regression passes (Rust 980+ / LangChain 149)
18+
- No compilation or runtime regressions
19+
20+
---
21+
22+
## Tasks
23+
24+
### W45.1a: FilterExpression Edge Case Tests (2h)
25+
26+
**Description:** Add tests for boundary conditions in FilterExpression handling.
27+
28+
**Test Cases:**
29+
1. **Empty AND/OR:** `Filter.and([])` — should handle gracefully (tautology/contradiction)
30+
2. **Deeply nested filters:** AND(OR(eq, ne), AND(gt, lt)) — verify depth 3+ works
31+
3. **Unicode field names:** `Filter.eq("città", "Milano")` — non-ASCII metadata keys
32+
4. **Special characters in values:** Values containing quotes, backslashes, null bytes
33+
5. **Numeric edge cases:** `Filter.eq("score", 0)`, `Filter.eq("score", -1)`, `Filter.eq("score", Infinity)`
34+
35+
**Files:**
36+
- `pkg/langchain/tests/store.test.ts` — new `describe("FilterExpression edge cases")`
37+
38+
**Acceptance:**
39+
- [ ] All 5 test cases pass
40+
- [ ] Each test has descriptive name explaining the edge case
41+
42+
### W45.1b: Null/Undefined Filter Handling Tests (1h)
43+
44+
**Description:** Verify that null, undefined, and empty string filters are handled correctly at the adapter boundary.
45+
46+
**Test Cases:**
47+
1. **Explicit `null` filter:** `similaritySearchVectorWithScore(query, k, null)` — should search without filter
48+
2. **Empty string filter:** `similaritySearchVectorWithScore(query, k, "")` — should search without filter or throw clear error
49+
3. **Whitespace-only filter:** `similaritySearchVectorWithScore(query, k, " ")` — same behavior as empty
50+
51+
**Files:**
52+
- `pkg/langchain/tests/store.test.ts` — extend existing filter tests
53+
54+
**Acceptance:**
55+
- [ ] All 3 test cases pass
56+
- [ ] Behavior is consistent and documented
57+
58+
### W45.1c: Complex Nested Filter Tests (1.5h)
59+
60+
**Description:** Test real-world complex filter patterns that users will actually write.
61+
62+
**Test Cases:**
63+
1. **E-commerce pattern:** `Filter.and([Filter.eq("category", "electronics"), Filter.ge("price", 100), Filter.le("price", 500)])`
64+
2. **Multi-tenant pattern:** `Filter.and([Filter.eq("tenant_id", "org_123"), Filter.or([Filter.eq("status", "active"), Filter.eq("status", "pending")])])`
65+
3. **Date range pattern:** `Filter.and([Filter.ge("created_at", "2026-01-01"), Filter.lt("created_at", "2026-04-01")])`
66+
4. **Negation pattern:** `Filter.and([Filter.eq("type", "document"), Filter.not(Filter.eq("deleted", true))])``Filter.not` is confirmed in `pkg/filter.js`
67+
68+
**Files:**
69+
- `pkg/langchain/tests/store.test.ts` — new `describe("FilterExpression real-world patterns")`
70+
71+
**Acceptance:**
72+
- [ ] All patterns compile and produce valid filter expressions
73+
- [ ] Mock search receives the correct serialized filter
74+
75+
### W45.1d: FilterExpression Error Handling (1h)
76+
77+
**Description:** Verify behavior when FilterExpression objects are malformed or have unexpected shapes.
78+
79+
**Test Cases:**
80+
1. **Missing `_json` field:** Object without `_json` property
81+
2. **Invalid `toJSON` return:** `toJSON` returns non-object
82+
3. **Type coercion:** Plain object passed as FilterExpression (not from Filter factory)
83+
84+
**Note:** Since the adapter passes filters through to WASM without transformation, these tests verify that the TypeScript type system prevents misuse at compile time, and document runtime behavior for JavaScript users.
85+
86+
**Files:**
87+
- `pkg/langchain/tests/store.test.ts` — extend edge case describe block
88+
89+
**Acceptance:**
90+
- [ ] Runtime behavior documented for each case
91+
- [ ] TypeScript compiler rejects invalid types (verified via `// @ts-expect-error` annotations)
92+
93+
### W45.1e: Full Regression (0.5h)
94+
95+
**Description:** Run complete test suites to verify no regressions.
96+
97+
**Commands:**
98+
```bash
99+
cargo test --lib # 980+ Rust tests
100+
cargo clippy -- -D warnings # Clean linting
101+
cd pkg/langchain && npx vitest run # 142+ LangChain tests
102+
```
103+
104+
**Acceptance:**
105+
- [ ] All Rust lib tests pass
106+
- [ ] Clippy clean
107+
- [ ] All LangChain tests pass (149 after 15 new additions)
108+
109+
---
110+
111+
## Day 1 Totals
112+
113+
| Metric | Target |
114+
|:-------|:-------|
115+
| Hours | ~6h |
116+
| New `it()` blocks | 15 (5 + 3 + 4 + 3) |
117+
| Files modified | 1 (`store.test.ts`) |
118+
| Regressions allowed | 0 |
119+
120+
---
121+
122+
## Handoff
123+
124+
After Day 1 completion:
125+
- **Status:** PENDING_HOSTILE_REVIEW (bundled with Day 5 review)
126+
- **Next:** Day 2 — Documentation + v0.2.0 prep
127+
- **Artifacts:** Updated `pkg/langchain/tests/store.test.ts`
128+
129+
---
130+
131+
**END OF DAY 1 TASKS**
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
# Week 45 — Day 2 Tasks (Tuesday, Mar 25)
2+
3+
**Date:** 2026-03-25
4+
**Focus:** LangChain.js Documentation + v0.2.0 Release Prep
5+
**Agent:** DOCWRITER + WASM_SPECIALIST
6+
**Status:** PENDING
7+
8+
---
9+
10+
## Day Objective
11+
12+
Create comprehensive FilterExpression usage documentation with real-world examples. Prepare the edgevec-langchain package for v0.2.0 publish. Update CHANGELOG and verify build output.
13+
14+
**Success Criteria:**
15+
- Usage guide with 3+ real-world examples complete
16+
- README updated with expanded code examples
17+
- package.json bumped to 0.2.0
18+
- Backward compatibility verified (existing `string` filter code compiles against v0.2.0 types)
19+
- Build output verified (ESM + CJS, size under 10KB each)
20+
- CHANGELOG v0.2.0 entry drafted
21+
- ROADMAP.md updated to reflect PQ research pulled forward to W45
22+
23+
---
24+
25+
## Tasks
26+
27+
### W45.2a: FilterExpression Usage Guide (2h)
28+
29+
**Description:** Write a comprehensive guide showing how to use FilterExpression with edgevec-langchain for common retrieval patterns.
30+
31+
**Content Structure:**
32+
1. **Introduction** — Why FilterExpression vs DSL strings
33+
2. **Basic Usage** — Simple equality, comparison filters
34+
3. **Combining Filters** — AND, OR, NOT composition
35+
4. **Real-World Examples:**
36+
- Semantic search with metadata constraints (e-commerce product search)
37+
- RAG pipeline with document type filtering
38+
- Multi-tenant vector store with tenant isolation
39+
- Time-bounded search (recent documents only)
40+
5. **Migration from DSL Strings** — Side-by-side comparison
41+
6. **TypeScript Types Reference** — Key interfaces and methods
42+
43+
**Files:**
44+
- `pkg/langchain/docs/FILTER_GUIDE.md` (new file)
45+
46+
**Acceptance:**
47+
- [ ] 3+ real-world examples with complete, runnable code
48+
- [ ] Each example explains the use case and expected behavior
49+
- [ ] Migration section shows DSL string equivalent for each FilterExpression example
50+
51+
### W45.2b: README Code Examples Update (1h)
52+
53+
**Description:** Enhance the main edgevec-langchain README with more practical code examples demonstrating the full workflow.
54+
55+
**Updates:**
56+
1. **Quick Start** — Expand with FilterExpression example alongside DSL string
57+
2. **Advanced Usage** — Add section showing LangChain retriever chain with filters
58+
3. **API Quick Reference** — Add concise table of all Filter factory methods with one-liner examples
59+
60+
**Files:**
61+
- `pkg/langchain/README.md`
62+
63+
**Acceptance:**
64+
- [ ] Quick Start includes both filter forms
65+
- [ ] Advanced usage shows a realistic retriever chain
66+
- [ ] All Filter factory methods listed with examples
67+
68+
### W45.2c: CHANGELOG v0.2.0 Entry (0.5h)
69+
70+
**Description:** Draft the CHANGELOG entry for edgevec-langchain@0.2.0.
71+
72+
**Content:**
73+
- FilterExpression object support (from W44)
74+
- New edge case tests
75+
- Usage guide and documentation
76+
- Filter re-exports from package root
77+
78+
**Files:**
79+
- `pkg/langchain/CHANGELOG.md` (new file, or update existing)
80+
81+
**Acceptance:**
82+
- [ ] Follows Keep a Changelog format
83+
- [ ] Lists all user-facing changes
84+
85+
### W45.2d: Version Bump to 0.2.0 (0.5h)
86+
87+
**Description:** Update package.json version, verify peer dependencies, update any version references.
88+
89+
**Changes:**
90+
1. `pkg/langchain/package.json``"version": "0.1.0"``"version": "0.2.0"`
91+
2. `pkg/langchain/src/index.ts``@version 0.1.0``@version 0.2.0`
92+
3. Verify `@langchain/core` peer dependency range still valid
93+
94+
**Files:**
95+
- `pkg/langchain/package.json`
96+
- `pkg/langchain/src/index.ts`
97+
98+
**Backward Compatibility Verification:**
99+
The `FilterType` widening from `string` to `string | FilterExpression` is additive at the value level. Verify that existing user code compiles without changes:
100+
```typescript
101+
// This must still compile without errors:
102+
const store = new EdgeVecStore(...);
103+
const results = await store.similaritySearchVectorWithScore(query, k, "category = 'docs'");
104+
```
105+
Document the type widening as a known non-breaking change in the CHANGELOG.
106+
107+
**Acceptance:**
108+
- [ ] Version is 0.2.0 in package.json
109+
- [ ] Version comment updated in index.ts
110+
- [ ] Peer dependency range unchanged (no breaking changes in @langchain/core)
111+
- [ ] Existing `string` filter usage compiles against v0.2.0 types (verified via typecheck)
112+
113+
### W45.2e: Build Output Verification (0.5h)
114+
115+
**Description:** Build the package and verify output sizes and correctness.
116+
117+
**Commands:**
118+
```bash
119+
cd pkg/langchain
120+
npm run build # tsup build
121+
ls -la dist/ # Check output files
122+
```
123+
124+
**Checks:**
125+
1. `dist/index.js` (ESM) exists and < 10KB
126+
2. `dist/index.cjs` (CJS) exists and < 10KB
127+
3. `dist/index.d.ts` type declarations include FilterExpression
128+
4. No unexpected files in dist/
129+
130+
**Acceptance:**
131+
- [ ] ESM output < 10KB
132+
- [ ] CJS output < 10KB
133+
- [ ] Type declarations include Filter and FilterExpression exports
134+
- [ ] `npm pack --dry-run` shows expected file list
135+
136+
### W45.2f: Update ROADMAP.md — PQ Schedule Pull-Forward (0.5h)
137+
138+
**Description:** Update ROADMAP.md Milestone 10.4 to reflect that PQ Phase 1 (literature review) was pulled forward from W46 to W45. This prevents the document drift pattern caught in W44 Round 2.
139+
140+
**Changes:**
141+
1. `docs/planning/ROADMAP.md` line 458: Change "Phase 1: Research (8h, Week 46)" to "Phase 1: Research (8h, Week 45 — pulled forward)"
142+
2. Update Milestone 10.4 status from "RESEARCH" to "IN PROGRESS (Phase 1: W45 literature review)"
143+
3. Add note explaining the pull-forward rationale (W44 NO-GO freed capacity)
144+
145+
**Acceptance:**
146+
- [ ] ROADMAP Milestone 10.4 reflects W45 schedule
147+
- [ ] Rationale for pull-forward documented
148+
- [ ] No other ROADMAP sections affected
149+
150+
---
151+
152+
## Day 2 Totals
153+
154+
| Metric | Target |
155+
|:-------|:-------|
156+
| Hours | ~5h |
157+
| New files | 1 (FILTER_GUIDE.md) |
158+
| Modified files | 4 (README.md, package.json, index.ts, ROADMAP.md) |
159+
| v0.2.0 ready for review | YES |
160+
161+
---
162+
163+
## Handoff
164+
165+
After Day 2 completion:
166+
- **Status:** PENDING_HOSTILE_REVIEW (bundled with Day 5 review)
167+
- **Next:** Day 3 — Product Quantization Literature Review
168+
- **Artifacts:** `FILTER_GUIDE.md`, updated README, v0.2.0 package ready
169+
170+
---
171+
172+
**END OF DAY 2 TASKS**

0 commit comments

Comments
 (0)