Repository navigation
fix(organization): keep stored metadata when an update does not set it - #2019
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review.
|
| Layer / File(s) | Summary |
|---|---|
Handle optional metadata in update requests internal/api/v1beta1connect/organization.go, internal/api/v1beta1connect/organization_test.go |
UpdateOrganization leaves omitted metadata nil and validates supplied metadata. Tests cover ID and slug requests, including explicitly empty metadata. |
Apply metadata update semantics in PostgreSQL internal/store/postgres/organization_repository.go, internal/store/postgres/organization_repository_test.go |
Both update methods use a shared helper that omits the metadata column when metadata is nil. Updated models supply metadata for audit records. Tests check that nil preserves stored metadata, populated metadata replaces it, and an empty map clears it. |
Preserve metadata in admin updates and verify end-to-end behavior web/sdk/admin/views/organizations/details/edit/organization.tsx, test/e2e/regression/organization_metadata_test.go |
The admin edit payload includes existing metadata before applying edited fields. An end-to-end test checks omitted, populated, and empty metadata updates. |
Priority:
Estimated code review effort: 3 (Moderate) | ~20 minutes
Change: Bug fix
Suggested reviewers: amangit07, mabdh
Merge Risk: 
Minimal · up to cd65d
-
No actionable merge-blocking risk remains.
Pre-merge checks: 
2
- Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands.
Coverage Report for CI Build 40315589019Warning Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes. Coverage increased (+0.1%) to 55.736%Details
Uncovered Changes
Coverage Regressions293 previously-covered lines in 7 files lost coverage.
Coverage Stats
💛 - Coveralls |
rohanchkrabrty
left a comment
There was a problem hiding this comment.
Before this change, the audit record always had the same metadata as the org row. Now, when an update does not send metadata, the org keeps its metadata but the audit record has none. Is this intended?
Problem
Updating an organization replaced the whole
metadatacolumn. The settings forms in the client and admin UI do not send the full metadata. Saving them removed keys such aspocfrom the org.Change
metadatais not set in the update request, the metadata column is left as it is and schema validation is skipped.metadatais set, it replaces the stored value. This includes an empty{}, so metadata can still be cleared on purpose.UpdateOrganizationis the only place that updates an org. The change is in the handler and inUpdateByIDandUpdateByNamein the org repository.Notes
Tests
{}.{}clears it, for both update by id and by name. Each case also checks the metadata in the update audit record.