Commit f6adc61
authored
fix: wire account type cache and register product types in seed-demo (#1272)
* fix: wire account type cache and register product types in seed-demo
Three interrelated issues prevented seed-demo from creating internal
accounts with product types on demo:
1. AccountTypeRegistryService was listed in gateway service names but
never registered on the gRPC server. Wire it in wireReferenceData.
2. Internal account service had no account type cache (nil), causing
FailedPrecondition when ProductTypeCode is provided. Wire
LocalAccountTypeCache using the registry as loader.
3. seed-demo didn't register product type definitions before creating
accounts. Add Step 2.5 to create and activate INVENTORY_KWH and
ENERGY_TRADING product types via AccountTypeRegistryService.
Also regenerate descriptor.binpb to fix stale proto descriptors that
caused the HTTP transcoder to incorrectly map fields like
instrument_code for newer proto definitions.
* fix: remove dead AlreadyExists guard from seed-demo CreateDraft
CreateDraft uses ON CONFLICT (code, version) DO NOTHING at the DB layer
and returns the existing draft on conflict — it never returns
AlreadyExists. Remove the misleading error handler that could mask
legitimate errors.
* fix: handle activation race conditions in seed-demo product types
Treat AlreadyExists and FailedPrecondition from ActivateAccountType as
non-fatal, so concurrent or repeated seed runs don't fail when the
product type was already activated by another process.
---------
Co-authored-by: Ben Coombs <bjcoombs@users.noreply.github.com>1 parent 36f0c73 commit f6adc61
4 files changed
Lines changed: 168 additions & 10 deletions
Binary file not shown.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| 78 | + | |
| 79 | + | |
78 | 80 | | |
79 | 81 | | |
80 | 82 | | |
| |||
334 | 336 | | |
335 | 337 | | |
336 | 338 | | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
337 | 342 | | |
338 | 343 | | |
339 | 344 | | |
340 | 345 | | |
341 | 346 | | |
342 | 347 | | |
343 | | - | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
344 | 353 | | |
345 | 354 | | |
346 | 355 | | |
347 | | - | |
| 356 | + | |
348 | 357 | | |
349 | 358 | | |
350 | 359 | | |
| |||
419 | 428 | | |
420 | 429 | | |
421 | 430 | | |
422 | | - | |
| 431 | + | |
| 432 | + | |
| 433 | + | |
| 434 | + | |
| 435 | + | |
| 436 | + | |
| 437 | + | |
| 438 | + | |
423 | 439 | | |
424 | 440 | | |
425 | | - | |
| 441 | + | |
426 | 442 | | |
427 | 443 | | |
428 | 444 | | |
429 | 445 | | |
430 | | - | |
| 446 | + | |
431 | 447 | | |
432 | 448 | | |
433 | 449 | | |
434 | 450 | | |
435 | | - | |
| 451 | + | |
436 | 452 | | |
437 | 453 | | |
438 | 454 | | |
439 | 455 | | |
440 | 456 | | |
441 | | - | |
| 457 | + | |
442 | 458 | | |
443 | 459 | | |
444 | 460 | | |
445 | 461 | | |
446 | 462 | | |
| 463 | + | |
| 464 | + | |
| 465 | + | |
| 466 | + | |
| 467 | + | |
| 468 | + | |
| 469 | + | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
447 | 474 | | |
448 | 475 | | |
| 476 | + | |
449 | 477 | | |
450 | 478 | | |
451 | | - | |
| 479 | + | |
| 480 | + | |
| 481 | + | |
| 482 | + | |
452 | 483 | | |
453 | 484 | | |
454 | 485 | | |
| |||
478 | 509 | | |
479 | 510 | | |
480 | 511 | | |
481 | | - | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
482 | 526 | | |
483 | | - | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
484 | 538 | | |
485 | 539 | | |
486 | 540 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
38 | 38 | | |
39 | 39 | | |
40 | 40 | | |
| 41 | + | |
41 | 42 | | |
42 | 43 | | |
43 | 44 | | |
| |||
126 | 127 | | |
127 | 128 | | |
128 | 129 | | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
129 | 136 | | |
130 | 137 | | |
131 | 138 | | |
| |||
228 | 235 | | |
229 | 236 | | |
230 | 237 | | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
| 251 | + | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
| 268 | + | |
| 269 | + | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
| 290 | + | |
| 291 | + | |
| 292 | + | |
| 293 | + | |
| 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 | + | |
231 | 326 | | |
232 | 327 | | |
233 | 328 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
47 | 56 | | |
48 | 57 | | |
49 | 58 | | |
| |||
0 commit comments