@@ -5,6 +5,274 @@ All notable changes to the Effect Patterns Hub will be documented in this file.
55The format is based on [ Keep a Changelog] ( https://keepachangelog.com/en/1.0.0/ ) ,
66and this project adheres to [ Semantic Versioning] ( https://semver.org/spec/v2.0.0.html ) .
77
8+ ## [ 0.3.0] - 2025-09-30
9+
10+ ### Added
11+
12+ #### 42 New Effect Patterns
13+
14+ ** Combinators (8 patterns)**
15+ - ` combinator-map.mdx ` - Transform values with map
16+ - ` combinator-flatmap.mdx ` - Chain computations with flatMap
17+ - ` combinator-filter.mdx ` - Filter results with filter
18+ - ` combinator-zip.mdx ` - Combine values with zip
19+ - ` combinator-foreach-all.mdx ` - Map over collections with forEach and all
20+ - ` combinator-sequencing.mdx ` - Sequence with andThen, tap, and flatten
21+ - ` combinator-conditional.mdx ` - Conditional branching with if, when, and cond
22+ - ` combinator-error-handling.mdx ` - Handle errors with catchAll, orElse, and match
23+
24+ ** Constructors (6 patterns)**
25+ - ` constructor-succeed-some-right.mdx ` - Lift values with succeed, some, and right
26+ - ` constructor-fail-none-left.mdx ` - Lift errors with fail, none, and left
27+ - ` constructor-sync-async.mdx ` - Wrap synchronous and asynchronous computations
28+ - ` constructor-from-nullable-option-either.mdx ` - Convert from nullable, Option, or Either
29+ - ` constructor-from-iterable.mdx ` - Create from collections
30+ - ` constructor-try-trypromise.mdx ` - Wrap computations with try (pattern exists but fixed)
31+
32+ ** Data Types (15 patterns)**
33+ - ` data-option.mdx ` - Check Option and Either cases
34+ - ` data-either.mdx ` - Work with Either values
35+ - ` data-exit.mdx ` - Model Effect results with Exit
36+ - ` data-struct.mdx ` - Compare data by value with Data.struct
37+ - ` data-class.mdx ` - Type classes for equality, ordering, and hashing
38+ - ` data-case.mdx ` - Model tagged unions with Data.taggedEnum
39+ - ` data-ref.mdx ` - Manage shared state with Ref
40+ - ` data-redacted.mdx ` - Redact and handle sensitive data
41+ - ` data-array.mdx ` - Work with immutable arrays using Data.Array
42+ - ` data-tuple.mdx ` - Work with tuples using Data.Tuple
43+ - ` data-hashset.mdx ` - Work with immutable sets using HashSet
44+ - ` data-chunk.mdx ` - Work with high-performance collections using Chunk
45+ - ` data-bigdecimal.mdx ` - Work with arbitrary-precision numbers using BigDecimal
46+ - ` data-datetime.mdx ` - Work with dates and times using DateTime
47+ - ` data-duration.mdx ` - Represent time spans with Duration
48+ - ` data-cause.mdx ` - Handle unexpected errors by inspecting the Cause
49+
50+ ** Brand Types (2 patterns)**
51+ - ` brand-model-domain-type.mdx ` - Model validated domain types with Brand
52+ - ` brand-validate-parse.mdx ` - Validate and parse branded types
53+
54+ ** Pattern Matching (5 patterns)**
55+ - ` pattern-match.mdx ` - Match on success and failure with match
56+ - ` pattern-matcheffect.mdx ` - Effectful pattern matching with matchEffect
57+ - ` pattern-matchtag.mdx ` - Match tagged unions with matchTag and matchTags
58+ - ` pattern-catchtag.mdx ` - Handle specific errors with catchTag and catchTags
59+ - ` pattern-option-either-checks.mdx ` - Check Option and Either cases
60+
61+ ** Observability (5 patterns)**
62+ - ` observability-structured-logging.mdx ` - Leverage structured logging
63+ - ` observability-tracing-spans.mdx ` - Trace operations with spans
64+ - ` observability-custom-metrics.mdx ` - Add custom metrics to your application
65+ - ` observability-opentelemetry.mdx ` - Integrate Effect tracing with OpenTelemetry
66+ - ` observability-effect-fn.mdx ` - Instrument and observe function calls with Effect.fn
67+
68+ #### 4-Layer QA Validation System
69+
70+ ** Phase 1: Behavioral Tests** (` scripts/publish/test-behavioral.ts ` )
71+ - Memory monitoring for streaming patterns
72+ - Timing validation for parallel execution
73+ - Concurrency option checking
74+ - Runtime: ~ 1 second
75+ - Coverage: Runtime behavior validation
76+
77+ ** Phase 2: Effect Patterns Linter** (` scripts/publish/lint-effect-patterns.ts ` )
78+ - Custom Effect-specific linting rules:
79+ - ` effect-use-taperror ` - Prefer tapError over catchAll for logging
80+ - ` effect-explicit-concurrency ` - Require explicit concurrency options
81+ - ` effect-deprecated-api ` - Detect deprecated Effect APIs
82+ - ` effect-prefer-pipe ` - Enforce pipe-based composition
83+ - ` effect-stream-memory ` - Validate streaming memory behavior
84+ - ` effect-error-model ` - Verify typed error channels
85+ - Runtime: ~ 30ms
86+ - Coverage: Syntax patterns and idioms
87+
88+ ** Phase 3: Enhanced LLM QA** (` scripts/qa/prompts/qa-schema-enhanced.mdx ` )
89+ - Semantic validation criteria:
90+ - Memory behavior analysis
91+ - Concurrency claims verification
92+ - Effect idiom enforcement
93+ - API modernization checks
94+ - Runtime: ~ 5-10s per pattern
95+ - Coverage: Semantic validation
96+
97+ ** Phase 4: Integration Tests** (` scripts/publish/test-integration.ts ` )
98+ - End-to-end test scenarios:
99+ - Streaming with large files (90MB+)
100+ - Parallel vs. sequential performance
101+ - Error handling under stress
102+ - Resource management and cleanup
103+ - Runtime: ~ 5 seconds
104+ - Coverage: Integration validation
105+
106+ ### Fixed
107+
108+ #### Critical Bug Fixes (Community Reported)
109+
110+ ** PR #11 : Stream-from-file Memory Bug** (reported by @ToliaGuy )
111+ - ** Issue** : "Good Example" was loading entire file into memory instead of streaming
112+ - ** Root Cause** : Used ` fs.readFileString() ` which reads entire file
113+ - ** Fix** : Replaced with ` fs.readFile().pipe(Stream.decodeText, Stream.splitLines) ` for true streaming
114+ - ** File** : ` content/published/stream-from-file.mdx `
115+ - ** Impact** : Pattern now demonstrates constant-memory streaming as documented
116+
117+ ** PR #10 : Effect.all Concurrency Bug** (reported by @ToliaGuy )
118+ - ** Issue** : ` Effect.all ` running sequentially instead of in parallel
119+ - ** Root Cause** : Missing explicit ` concurrency ` option (defaults to sequential)
120+ - ** Fix** : Added ` { concurrency: "unbounded" } ` to all parallel execution examples
121+ - ** Files** :
122+ - ` content/published/run-effects-in-parallel-with-all.mdx `
123+ - ` content/published/combinator-foreach-all.mdx `
124+ - ` content/new/published/combinator-foreach-all.mdx `
125+ - ** Impact** : Patterns now correctly demonstrate parallel execution
126+
127+ ** PR #9 : Error Handling Idiom** (reported by @ToliaGuy )
128+ - ** Issue** : Verbose error logging using ` catchAll ` + ` Effect.gen `
129+ - ** Improvement** : Simplified to use ` Effect.tapError ` for more idiomatic error logging
130+ - ** File** : ` content/published/wrap-synchronous-computations.mdx `
131+ - ** Impact** : Improved code clarity and reduced boilerplate
132+
133+ #### TypeScript API Fixes (89 errors resolved)
134+
135+ ** Schema API Updates**
136+ - ` Schema.string ` → ` Schema.String ` (uppercase constructors)
137+ - Modern Schema API usage throughout
138+
139+ ** Brand API Updates**
140+ - ` Brand.Branded<T, "X"> ` → ` T & Brand.Brand<"X"> ` (type-level branding)
141+ - ` Brand.schema() ` → ` Schema.brand() ` (new API)
142+
143+ ** Effect Constructor Updates**
144+ - ` Effect.fromOption ` → ` Option.match ` + ` Effect.succeed/fail `
145+ - ` Effect.fromEither ` → ` Either.match ` + ` Effect.succeed/fail `
146+
147+ ** Data Type API Updates**
148+ - ` Data.case ` → ` Data.taggedEnum ` (renamed API)
149+ - ` Chunk.fromArray ` → ` Chunk.fromIterable `
150+ - ` Chunk.concat ` → ` Chunk.appendAll `
151+ - ` Chunk.toArray ` → ` Chunk.toReadonlyArray `
152+
153+ ** BigDecimal API Updates**
154+ - ` BigDecimal.make ` → ` BigDecimal.fromNumber `
155+ - ` BigDecimal.add/mul ` → ` BigDecimal.sum/multiply `
156+ - ` BigDecimal.toString/toNumber ` → ` BigDecimal.format/unsafeToNumber `
157+
158+ ** DateTime API Updates**
159+ - ` DateTime.now ` now returns an ` Effect `
160+ - ` DateTime.plus/minus ` → ` DateTime.add/subtract `
161+ - ` DateTime.toISOString ` → ` DateTime.formatIso `
162+ - ` DateTime.before ` → ` DateTime.lessThan `
163+ - Duration parameters now use object syntax ` { hours: 1 } `
164+
165+ ** Duration API Updates**
166+ - ` Duration.add ` → ` Duration.sum `
167+ - ` Duration.toISOString ` → ` Duration.format `
168+
169+ ** Cause API Updates**
170+ - ` Cause.isFail ` → ` Cause.isFailure `
171+
172+ ** Metric API Updates**
173+ - ` Effect.updateMetric ` → Direct ` Metric ` methods (` increment ` , ` set ` , ` update ` )
174+ - ` Metric.histogram ` boundaries → ` MetricBoundaries.linear() `
175+
176+ ** Pattern Matching Updates**
177+ - ` Effect.matchTag ` → ` Effect.catchTags `
178+
179+ ** Option/Either API Updates**
180+ - ` Option.zip/Either.zip ` → ` Option.all/Either.all `
181+ - ` Option.cond/Either.cond ` → Replaced with ternary expressions
182+ - ` Effect.if ` updated to use lazy callbacks
183+
184+ ### Changed
185+
186+ #### Package Scripts
187+
188+ Added new validation and testing commands:
189+ ``` json
190+ "test:behavioral" : " bun run scripts/publish/test-behavioral.ts" ,
191+ "test:integration" : " bun run scripts/publish/test-integration.ts" ,
192+ "test:all" : " bun run test && bun run test:behavioral && bun run test:integration" ,
193+ "lint:effect" : " bun run scripts/publish/lint-effect-patterns.ts" ,
194+ "lint:all" : " bun run lint && bun run lint:effect" ,
195+ "qa:test" : " bun run scripts/qa/test-enhanced-qa.ts"
196+ ```
197+
198+ #### QA Process Improvements
199+
200+ - Enhanced ` scripts/qa/qa-process.sh ` to use ` qa-schema-enhanced.mdx ` when available
201+ - Added dynamic fallback to ` qa-schema.mdx ` for backward compatibility
202+ - Integrated behavioral tests into validation pipeline
203+
204+ ### Documentation
205+
206+ #### New Documentation Files
207+
208+ - ** ` QA_GAP_ANALYSIS.md ` ** - Root cause analysis of why bugs slipped through QA
209+ - Analyzed gaps in existing QA process
210+ - Identified missing validations: semantic correctness, behavioral verification, idiomatic code checks
211+ - Proposed 4-phase improvement plan
212+
213+ - ** ` EFFECT_LINTER_RULES.md ` ** - Custom Effect patterns linter rules reference
214+ - Documents all 6 custom linting rules
215+ - Provides examples of good vs bad patterns
216+ - Integration guide with Biome
217+
218+ - ** ` ENHANCED_QA_GUIDE.md ` ** - Enhanced LLM semantic validation guide
219+ - Explains semantic validation criteria
220+ - Documents integration with existing QA pipeline
221+ - Usage examples
222+
223+ - ** ` INTEGRATION_TESTING_GUIDE.md ` ** - Integration testing scenarios and usage
224+ - Documents all 4 test scenarios
225+ - Explains how to run and interpret tests
226+ - Contribution guidelines for new tests
227+
228+ - ** ` MERGE_COMPLETE.md ` ** - Comprehensive PR #12 merge summary
229+ - Complete release documentation
230+ - Statistics and impact analysis
231+ - Next steps and acknowledgments
232+
233+ #### Updated Documentation
234+
235+ - ** ` README.md ` ** - Regenerated to include all 42 new patterns
236+ - ** ` rules/ ` directory** - Updated AI coding rules for Cursor and Windsurf IDEs
237+ - 42 new pattern-specific rule files
238+ - Updated consolidated rules files
239+ - Expanded use-case-based organization
240+
241+ ### Performance
242+
243+ #### Validation Speed
244+
245+ - ** Quick validation** (behavioral + linting): ~ 1 second
246+ - ** Comprehensive validation** (integration + LLM QA): ~ 15 seconds
247+ - ** Full pipeline** (all validations): ~ 6 seconds average
248+ - ** Zero false positives** across all validation layers
249+
250+ #### Bug Prevention
251+
252+ The 4-layer QA system now catches:
253+ - ✅ Memory/Streaming issues (PR #11 type bugs)
254+ - ✅ Concurrency bugs (PR #10 type bugs)
255+ - ✅ Non-idiomatic patterns (PR #9 type bugs)
256+ - ✅ Deprecated API usage
257+ - ✅ Documentation inaccuracies
258+ - ✅ Real I/O issues
259+ - ✅ Error handling problems
260+ - ✅ Resource cleanup issues
261+
262+ ### Contributors
263+
264+ - ** @PaulJPhilp ** - 42 new patterns, 4-layer QA system, comprehensive documentation
265+ - ** @ToliaGuy ** - Critical bug reports (PR #9 , #10 , #11 )
266+
267+ ### Statistics
268+
269+ - ** Files Changed** : 1,095
270+ - ** Lines Added** : +77,424
271+ - ** Lines Removed** : -2,035
272+ - ** TypeScript Errors Fixed** : 89
273+ - ** Total Patterns** : 88 → 130 (48% increase)
274+ - ** QA Layers** : 1 → 4 (4x improvement)
275+
8276## [ 0.2.1] - 2025-09-30
9277
10278### Fixed
0 commit comments