Commit 47e9313
fix(resource): emit metadata.resource_id on pause/resume audit rows (#270)
The resource.paused / resource.resumed audit events set only the
ResourceID column, not metadata.resource_id. The dashboard per-resource
AuditPanel (instanode-web fetchResourceAudit) filters the team audit
window client-side by metadata.resource_id, and the JSON serializer
(auditEventToMap) surfaces ONLY the JSONB metadata — the ResourceID
column is never echoed onto the wire. Result: a resource's two most
important state-change events were invisible in its Audit tab even
though the rows existed.
Add resource_id (+ resource_type) to both emit sites, matching the
existing convention in emitResourceReadAudit and emitBackupAudit. Also
restores the server-side resource-ownership OR branch in
ListAuditEventsForCustomerExport, which keys on metadata->>'resource_id'
for cross-actor events on a team's resource.
Regression guards: TestPauseResource_EmitsMetadataResourceID +
TestResumeResource_EmitsMetadataResourceID assert the row's
metadata.resource_id equals the resource UUID (verified to fail without
the fix).
Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>1 parent 021bb7e commit 47e9313
2 files changed
Lines changed: 95 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
661 | 661 | | |
662 | 662 | | |
663 | 663 | | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
664 | 673 | | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
665 | 678 | | |
666 | 679 | | |
667 | 680 | | |
668 | 681 | | |
669 | 682 | | |
670 | 683 | | |
671 | 684 | | |
| 685 | + | |
672 | 686 | | |
673 | 687 | | |
674 | 688 | | |
| |||
779 | 793 | | |
780 | 794 | | |
781 | 795 | | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
782 | 800 | | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
783 | 805 | | |
784 | 806 | | |
785 | 807 | | |
786 | 808 | | |
787 | 809 | | |
788 | 810 | | |
789 | 811 | | |
| 812 | + | |
790 | 813 | | |
791 | 814 | | |
792 | 815 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| 27 | + | |
26 | 28 | | |
27 | 29 | | |
28 | 30 | | |
| |||
343 | 345 | | |
344 | 346 | | |
345 | 347 | | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
| 380 | + | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
| 399 | + | |
| 400 | + | |
| 401 | + | |
| 402 | + | |
| 403 | + | |
| 404 | + | |
| 405 | + | |
| 406 | + | |
| 407 | + | |
| 408 | + | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
0 commit comments