|
| 1 | +# Maatify Exceptions |
| 2 | + |
| 3 | +## API Freeze Policy (1.x Series) |
| 4 | + |
| 5 | +> Status: ACTIVE |
| 6 | +> Applies to: `maatify/exceptions` 1.x |
| 7 | +> Effective from: v1.0.0 and all subsequent 1.x releases |
| 8 | +
|
| 9 | +--- |
| 10 | + |
| 11 | +# 1️⃣ Purpose |
| 12 | + |
| 13 | +This document defines the stability and compatibility guarantees of the public API surface of: |
| 14 | + |
| 15 | +> `maatify/exceptions` |
| 16 | +
|
| 17 | +The goal is to ensure long-term predictability, deterministic behavior, and safe ecosystem adoption. |
| 18 | + |
| 19 | +--- |
| 20 | + |
| 21 | +# 2️⃣ Versioning Model |
| 22 | + |
| 23 | +This library follows **Semantic Versioning (SemVer)**. |
| 24 | + |
| 25 | +* `MAJOR` → Breaking changes |
| 26 | +* `MINOR` → Additive, backward-compatible features |
| 27 | +* `PATCH` → Bug fixes only |
| 28 | + |
| 29 | +--- |
| 30 | + |
| 31 | +# 3️⃣ 1.x Stability Guarantee |
| 32 | + |
| 33 | +For all versions `>=1.0.0 <2.0.0`: |
| 34 | + |
| 35 | +### ❌ No Breaking Changes Allowed |
| 36 | + |
| 37 | +The following are frozen: |
| 38 | + |
| 39 | +* Public class names |
| 40 | +* Public method signatures |
| 41 | +* Constructor signatures |
| 42 | +* Public return types |
| 43 | +* Exception category identities |
| 44 | +* HTTP family guard behavior |
| 45 | +* Escalation logic behavior |
| 46 | +* NormalizedError structure |
| 47 | +* ErrorEnvelope JSON structure |
| 48 | +* RFC7807 mapping structure |
| 49 | +* ErrorResponseModel structure |
| 50 | +* ErrorContext structure |
| 51 | + |
| 52 | +--- |
| 53 | + |
| 54 | +# 4️⃣ Public Surface Definition |
| 55 | + |
| 56 | +The following namespaces constitute the public API: |
| 57 | + |
| 58 | +* `Domain\` (Exception Engine) |
| 59 | +* `Application\Error\` (Normalization Layer) |
| 60 | +* `Application\Format\` (Formatting Layer) |
| 61 | + |
| 62 | +Everything else is considered internal unless explicitly documented. |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | +# 5️⃣ What Is Allowed in 1.x |
| 67 | + |
| 68 | +The following changes are allowed: |
| 69 | + |
| 70 | +### ✅ Add new classes |
| 71 | + |
| 72 | +As long as they do not alter existing behavior. |
| 73 | + |
| 74 | +### ✅ Add new interfaces |
| 75 | + |
| 76 | +Without modifying existing signatures. |
| 77 | + |
| 78 | +### ✅ Add optional constructor parameters |
| 79 | + |
| 80 | +Only if: |
| 81 | + |
| 82 | +* Default value preserves behavior |
| 83 | +* No ambiguity introduced |
| 84 | + |
| 85 | +### ✅ Add new formatters |
| 86 | + |
| 87 | +Without changing existing formatter behavior. |
| 88 | + |
| 89 | +### ✅ Add new exception categories |
| 90 | + |
| 91 | +If: |
| 92 | + |
| 93 | +* They do not alter existing category behavior |
| 94 | +* They respect HTTP family constraints |
| 95 | + |
| 96 | +--- |
| 97 | + |
| 98 | +# 6️⃣ What Is Strictly Forbidden in 1.x |
| 99 | + |
| 100 | +### ❌ Changing JSON envelope structure |
| 101 | + |
| 102 | +The following keys are locked: |
| 103 | + |
| 104 | +Default JSON: |
| 105 | + |
| 106 | +* root.error |
| 107 | +* root.trace_id |
| 108 | +* error.code |
| 109 | +* error.message |
| 110 | +* error.status |
| 111 | +* error.category |
| 112 | +* error.retryable |
| 113 | +* error.safe |
| 114 | +* error.meta |
| 115 | + |
| 116 | +RFC7807: |
| 117 | + |
| 118 | +* type |
| 119 | +* title |
| 120 | +* status |
| 121 | +* detail |
| 122 | +* instance |
| 123 | +* extensions structure |
| 124 | + |
| 125 | +--- |
| 126 | + |
| 127 | +### ❌ Changing code naming convention |
| 128 | + |
| 129 | +* Must remain UPPERCASE_SNAKE_CASE |
| 130 | +* No numeric codes introduced |
| 131 | +* No class-name-derived codes |
| 132 | + |
| 133 | +--- |
| 134 | + |
| 135 | +### ❌ Removing or renaming fields |
| 136 | + |
| 137 | +Even if technically “optional”, removal is breaking. |
| 138 | + |
| 139 | +--- |
| 140 | + |
| 141 | +### ❌ Changing fallback behavior |
| 142 | + |
| 143 | +External throwable fallback must remain: |
| 144 | + |
| 145 | +``` |
| 146 | +code = INTERNAL_ERROR |
| 147 | +status = 500 |
| 148 | +category = internal |
| 149 | +retryable = false |
| 150 | +safe = true |
| 151 | +meta = {} |
| 152 | +``` |
| 153 | + |
| 154 | +--- |
| 155 | + |
| 156 | +### ❌ Adding implicit behavior |
| 157 | + |
| 158 | +* No automatic timestamps |
| 159 | +* No implicit environment detection |
| 160 | +* No debug leaks |
| 161 | +* No global state coupling |
| 162 | + |
| 163 | +--- |
| 164 | + |
| 165 | +# 7️⃣ Determinism Lock |
| 166 | + |
| 167 | +The following are part of the frozen behavior: |
| 168 | + |
| 169 | +* Same Throwable + same Context → identical output |
| 170 | +* No randomness |
| 171 | +* No hidden data injection |
| 172 | +* No stack trace exposure |
| 173 | + |
| 174 | +Breaking determinism = breaking change. |
| 175 | + |
| 176 | +--- |
| 177 | + |
| 178 | +# 8️⃣ Extension Rules |
| 179 | + |
| 180 | +All extension mechanisms must: |
| 181 | + |
| 182 | +* Preserve determinism |
| 183 | +* Preserve output contract |
| 184 | +* Not mutate existing structures |
| 185 | +* Not override core fallback logic unless explicitly injected |
| 186 | + |
| 187 | +--- |
| 188 | + |
| 189 | +# 9️⃣ Deprecation Policy |
| 190 | + |
| 191 | +If deprecation becomes necessary: |
| 192 | + |
| 193 | +1. Mark with `@deprecated` |
| 194 | +2. Keep functionality intact for full 1.x lifecycle |
| 195 | +3. Document migration path |
| 196 | +4. Remove only in 2.0 |
| 197 | + |
| 198 | +--- |
| 199 | + |
| 200 | +# 🔟 2.0 Eligibility |
| 201 | + |
| 202 | +The following may justify a 2.0 release: |
| 203 | + |
| 204 | +* Changing JSON envelope shape |
| 205 | +* Introducing numeric error codes |
| 206 | +* Modifying fallback behavior |
| 207 | +* Changing category model semantics |
| 208 | +* Altering status resolution logic |
| 209 | + |
| 210 | +--- |
| 211 | + |
| 212 | +# 🔚 Final Authority |
| 213 | + |
| 214 | +This document is binding for all 1.x releases. |
| 215 | + |
| 216 | +If any ambiguity exists: |
| 217 | + |
| 218 | +> Determinism and stability take precedence over convenience. |
| 219 | +
|
| 220 | +--- |
0 commit comments