Commit f0d8abd
feat(metadata): FR-016 canonical-serializer per-kind rewrite
Adds the round-trip canonicalization promised in FR-016: when a source.rdb
on input uses the pre-1.0 legacy @table spelling with a non-table @kind, the
canonical-serializer output renames the attr key to the kind-matching alias
(@view / @MaterializedView / @proc / @function). This pins per-kind naming
as the on-disk conformance contract.
Implementation: a post-parse pre-sort pass in canonicalSerialize and
canonicalSerializeEffective that walks the parsed JSON tree, finds source.rdb
node wrappers, and rewrites @table → kind-matching alias in place when the
canonical alias is set on the source's effective @kind. Idempotent; a no-op
for inputs already in canonical form (@table with @kind: "table" is preserved).
6 new behavior tests in fr016-source-name-and-kind-aliases.test.ts cover the
four non-table kinds, the canonical no-op case, and an already-canonical
@view round-trip. Full metadata suite: 1372 pass / 0 fail.
This closes the last metadata-side piece of FR-016 (the loader accepts +
warns on legacy; the serializer auto-canonicalizes on round-trip). What
remains for this workstream:
- 9 dedicated FR-016 conformance fixtures (formalize the legacy-rewrite +
per-kind matrix in the cross-port corpus).
- Generator-stack sweep (codegen-ts / runtime-ts / codegen-spring /
codegen-kotlin) to use MetaSource.physicalName instead of reading @table.
- Per-port fan-out (Java / Kotlin / C# / Python) for the alias registration
+ the canonical-serializer rewrite.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent 11f2cdb commit f0d8abd
2 files changed
Lines changed: 110 additions & 0 deletions
File tree
- server/typescript/packages/metadata
- src
- test
Lines changed: 50 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
28 | 38 | | |
29 | 39 | | |
30 | 40 | | |
| |||
153 | 163 | | |
154 | 164 | | |
155 | 165 | | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
156 | 170 | | |
157 | 171 | | |
158 | 172 | | |
| |||
170 | 184 | | |
171 | 185 | | |
172 | 186 | | |
| 187 | + | |
173 | 188 | | |
174 | 189 | | |
175 | 190 | | |
176 | 191 | | |
177 | 192 | | |
178 | 193 | | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
| 204 | + | |
| 205 | + | |
| 206 | + | |
| 207 | + | |
| 208 | + | |
| 209 | + | |
| 210 | + | |
| 211 | + | |
| 212 | + | |
| 213 | + | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
179 | 229 | | |
180 | 230 | | |
181 | 231 | | |
| |||
Lines changed: 60 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
0 commit comments