Commit 20bdf75
authored
feat(fmodata): use Effect.ts internally (#141)
feat(fmodata): use Effect.ts internally for error handling pipelines
Replace manual error-threading boilerplate in all builders with Effect
pipelines. Effect is used as an internal implementation detail — the
public API (Result<T>) is unchanged.
Changes:
- Add `effect` dependency, remove unused `neverthrow`
- Add `src/effect.ts` with bridge utilities (fromResult, makeRequestEffect,
runAsResult, tryEffect, fromValidation)
- Refactor `_makeRequest` into an Effect pipeline with extracted helpers
(_classifyError, _parseHttpError, _checkEmbeddedODataError)
- Refactor InsertBuilder.execute() to use Effect.gen pipeline
- Refactor UpdateBuilder.execute() to use Effect.gen pipeline
- Refactor DeleteBuilder.execute() to use Effect.gen pipeline
- Refactor QueryBuilder.execute() to use Effect pipe composition
- Refactor BatchBuilder.execute() to use Effect.gen pipeline
All 873 tests pass with zero type errors.
https://claude.ai/code/session_01VdwR8FRDc9f1qS68z2Sfzo
feat(fmodata): add retry policies, validation accumulation, and tracing spans
Phase 2 of Effect.ts integration:
- Add opt-in RetryPolicy for transient errors (SchemaLockedError, NetworkError, TimeoutError, HTTP 5xx)
with exponential backoff and jitter via Effect Schedule
- Accumulate all validation errors instead of fail-fast, returning all field issues in a single ValidationError
- Add Effect.withSpan tracing to all builder execute() methods and HTTP requests for zero-cost observability
All changes remain non-breaking — public API (Result<T>, error classes, type guards) is unchanged.
https://claude.ai/code/session_01VdwR8FRDc9f1qS68z2Sfzo
feat(fmodata): add Effect services, MockFMServerConnection, and migrate tests
Phase 3 of Effect.ts integration:
- Define Effect Services (HttpClient, ODataConfig, ODataLogger) for dependency injection
- Create MockFMServerConnection with router-style fetch handler and request spy
- Export testing utilities via @proofkit/fmodata/testing subpath
- Migrate 22 test files from createMockClient/fetchHandler to MockFMServerConnection
- All 870 tests passing, 0 type errors, publint passes
https://claude.ai/code/session_01VdwR8FRDc9f1qS68z2Sfzo
fix(fmodata): limit retries to idempotent HTTP methods
fix(fmodata): address remaining PR review findings
fix(fmodata): harden write requests and batch response handling
refactor(fmodata): migrate all builders to Effect DI via Context/Layer pattern
Replace constructor parameter threading (ExecutionContext, databaseName,
useEntityIds, etc.) with Effect's Context.Tag + Layer pattern across all
builders. Each builder now receives an FMODataLayer and extracts config
synchronously via extractConfigFromLayer() for non-Effect methods.
Key changes:
- All builders (Query, Record, Insert, Update, Delete, Batch) use layer-based DI
- SchemaManager and WebhookManager converted to use Effect pipelines
- Database.getMetadata/listTableNames/runScript use requestFromService
- Removed deprecated makeRequestEffect() and runWithContext() from effect.ts
- Simplified ExecutionContext interface to just _getLayer()
- Removed unused BuilderConfig interface from shared-types.ts
- createDatabaseLayer() enables database-scoped config overrides
https://claude.ai/code/session_01EpwtyTQeyjVu3Qykf6aMBd
fix(fmodata): resolve DI branch lint regressions
<!-- This is an auto-generated comment: release notes by coderabbit.ai -->
## Summary by CodeRabbit
* **New Features**
* Route-based testing utilities with request spying and included testing entry in the build
* New RetryPolicy type and exported isTransientError helper
* **Improvements**
* Layered, effect-driven request pipeline with improved error classification and retry support
* Centralized runtime/configuration for entity-id and special-column handling; expanded service/type exports
* **Tests**
* Test suites migrated to use the new mock server and spy-driven patterns
<!-- end of auto-generated comment: release notes by coderabbit.ai -->1 parent 3458afb commit 20bdf75
63 files changed
Lines changed: 3777 additions & 3110 deletions
File tree
- .codex/environments
- packages
- fmodata
- skills/fmodata-client
- src
- client
- builders
- query
- tests
- typegen/src/server
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
23 | 41 | | |
24 | 42 | | |
25 | 43 | | |
| |||
48 | 66 | | |
49 | 67 | | |
50 | 68 | | |
51 | | - | |
52 | 69 | | |
53 | 70 | | |
54 | 71 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
1 | 4 | | |
| 5 | + | |
2 | 6 | | |
3 | 7 | | |
4 | 8 | | |
5 | 9 | | |
6 | 10 | | |
7 | 11 | | |
8 | | - | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
67 | | - | |
68 | | - | |
| 71 | + | |
| 72 | + | |
69 | 73 | | |
70 | | - | |
| 74 | + | |
71 | 75 | | |
72 | 76 | | |
73 | | - | |
74 | | - | |
75 | | - | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
76 | 80 | | |
77 | 81 | | |
78 | 82 | | |
79 | 83 | | |
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
83 | | - | |
| 87 | + | |
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| |||
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
92 | | - | |
| 96 | + | |
93 | 97 | | |
94 | | - | |
| 98 | + | |
95 | 99 | | |
96 | 100 | | |
97 | 101 | | |
| |||
100 | 104 | | |
101 | 105 | | |
102 | 106 | | |
103 | | - | |
104 | | - | |
105 | 107 | | |
106 | 108 | | |
107 | | - | |
| 109 | + | |
108 | 110 | | |
109 | 111 | | |
110 | 112 | | |
111 | 113 | | |
112 | 114 | | |
113 | | - | |
114 | | - | |
115 | | - | |
| 115 | + | |
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
| |||
124 | 124 | | |
125 | 125 | | |
126 | 126 | | |
127 | | - | |
128 | | - | |
129 | 127 | | |
130 | 128 | | |
131 | 129 | | |
| |||
137 | 135 | | |
138 | 136 | | |
139 | 137 | | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
140 | 160 | | |
141 | 161 | | |
142 | 162 | | |
| |||
146 | 166 | | |
147 | 167 | | |
148 | 168 | | |
149 | | - | |
| 169 | + | |
150 | 170 | | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | | - | |
156 | | - | |
157 | | - | |
158 | | - | |
159 | | - | |
160 | | - | |
161 | | - | |
162 | | - | |
163 | | - | |
164 | | - | |
165 | | - | |
166 | | - | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
173 | 176 | | |
174 | 177 | | |
175 | | - | |
176 | | - | |
| 178 | + | |
| 179 | + | |
177 | 180 | | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
178 | 185 | | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
| 186 | + | |
| 187 | + | |
184 | 188 | | |
185 | 189 | | |
186 | 190 | | |
| |||
191 | 195 | | |
192 | 196 | | |
193 | 197 | | |
194 | | - | |
195 | | - | |
196 | | - | |
197 | | - | |
198 | | - | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
206 | | - | |
207 | | - | |
208 | | - | |
209 | | - | |
210 | | - | |
211 | | - | |
212 | | - | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
| 198 | + | |
| 199 | + | |
217 | 200 | | |
218 | | - | |
219 | | - | |
220 | 201 | | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
| 202 | + | |
226 | 203 | | |
| 204 | + | |
227 | 205 | | |
228 | 206 | | |
229 | 207 | | |
230 | 208 | | |
231 | 209 | | |
232 | 210 | | |
233 | 211 | | |
234 | | - | |
235 | 212 | | |
236 | 213 | | |
237 | 214 | | |
238 | 215 | | |
239 | 216 | | |
240 | | - | |
241 | 217 | | |
242 | 218 | | |
243 | 219 | | |
| |||
249 | 225 | | |
250 | 226 | | |
251 | 227 | | |
252 | | - | |
253 | 228 | | |
254 | 229 | | |
255 | 230 | | |
| |||
267 | 242 | | |
268 | 243 | | |
269 | 244 | | |
270 | | - | |
271 | 245 | | |
272 | | - | |
273 | | - | |
274 | | - | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
275 | 250 | | |
276 | 251 | | |
277 | | - | |
278 | | - | |
279 | | - | |
280 | | - | |
281 | | - | |
| 252 | + | |
282 | 253 | | |
283 | 254 | | |
284 | 255 | | |
285 | 256 | | |
286 | 257 | | |
287 | | - | |
288 | | - | |
289 | | - | |
290 | | - | |
291 | | - | |
| 258 | + | |
292 | 259 | | |
293 | 260 | | |
294 | 261 | | |
| |||
300 | 267 | | |
301 | 268 | | |
302 | 269 | | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | | - | |
317 | | - | |
| 270 | + | |
| 271 | + | |
318 | 272 | | |
319 | | - | |
320 | | - | |
321 | | - | |
322 | | - | |
323 | | - | |
324 | | - | |
325 | | - | |
326 | | - | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
327 | 277 | | |
| 278 | + | |
328 | 279 | | |
329 | 280 | | |
0 commit comments