Skip to content

proto: add OrgUnitStatus enum and status/deleted fields#185

Merged
Prabhjot-Sethi merged 2 commits into
mainfrom
pr-branch
Jun 27, 2026
Merged

proto: add OrgUnitStatus enum and status/deleted fields#185
Prabhjot-Sethi merged 2 commits into
mainfrom
pr-branch

Conversation

@Prabhjot-Sethi

@Prabhjot-Sethi Prabhjot-Sethi commented Jun 27, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds proto definitions required for org-unit soft-delete (issue #179):

  • OrgUnitStatus enumActive = 0, Deleted = 1 (PascalCase, consistent with existing ApiKeyDef.Status convention)
  • OrgUnitsListEntry.status (field 6) — exposes status in list responses so internal callers can see deleted OUs
  • OrgUnitGetResp.status (field 6) — exposes status in get responses
  • OrgUnitGetResp.deleted (field 7) — int64 unix timestamp recording when the OU was soft-deleted (0 if active)

Design decisions

Decision Rationale
Enum at package level, not nested Reusable across messages; matches ApiKeyDef.Status pattern
deleted only on GetResp, not on ListEntry List callers need status for filtering; only detail view needs the exact deletion timestamp
PascalCase enum values Follows existing convention in myaccount.proto

Wire compatibility

All new fields use previously unused field numbers (6, 7). Existing clients that don't know about these fields will simply ignore them (standard proto3 behaviour). No breaking changes.

Closes #179

Summary by CodeRabbit

  • New Features

    • Org units now show a clear status, such as active or deleted, in list and detail views.
    • Deleted org units now include a deletion timestamp in their details.
  • Bug Fixes

    • Improved consistency in org-unit records by exposing soft-deletion state directly in API responses.

dev-arya23 and others added 2 commits June 27, 2026 20:52
Add OrgUnitStatus enum (Active=0, Deleted=1) for org-unit soft-delete
support. Add status field to OrgUnitsListEntry and OrgUnitGetResp, and
deleted timestamp field to OrgUnitGetResp.

Closes #179
Signed-off-by: Prabhjot Singh Sethi <prabhjot.sethi@gmail.com>
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 2a287a65-9b2a-45ad-914b-76f6dac701dd

📥 Commits

Reviewing files that changed from the base of the PR and between 398a755 and 85cff4a.

⛔ Files ignored due to path filters (1)
  • api/org-unit.pb.go is excluded by !**/*.pb.go
📒 Files selected for processing (2)
  • api/org-unit.proto
  • api/swagger/apidocs.swagger.json

Walkthrough

Adds an OrgUnitStatus enum (Active = 0, Deleted = 1) to the org-unit proto, extends OrgUnitsListEntry with a status field, extends OrgUnitGetResp with status and deleted (Unix timestamp) fields, and regenerates corresponding Swagger schema definitions.

OrgUnit Soft-Delete Status

Layer / File(s) Summary
OrgUnitStatus enum and message fields
api/org-unit.proto
Defines OrgUnitStatus enum with Active and Deleted values; adds status field to OrgUnitsListEntry and adds status + deleted Unix timestamp fields to OrgUnitGetResp.
Swagger schema updates
api/swagger/apidocs.swagger.json
Adds apiOrgUnitStatus string enum definition and extends apiOrgUnitGetResp and apiOrgUnitsListEntry schemas with the corresponding status and deleted properties.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~5 minutes

Poem

🐇 Hop hop, a new enum appears,
Active or Deleted — the status is clear!
A timestamp of zero means life carries on,
A soft little delete when the unit is gone.
The swagger now knows what the proto has done! ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The proto/schema changes match #179's soft-delete fields, but regenerated Go code can't be verified because api/org-unit.pb.go was excluded. Provide or review the excluded api/org-unit.pb.go file (filtered by !**/*.pb.go) to confirm regenerated Go code compiles cleanly.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly matches the main change set: adding OrgUnitStatus plus status and deleted fields for org-unit soft-delete support.
Out of Scope Changes check ✅ Passed Changes stay within org-unit soft-delete support: proto enums/fields and matching Swagger schema updates, with no unrelated code paths.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr-branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@dev-arya23 dev-arya23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I verified

  • Proto enum convention: OrgUnitStatus uses PascalCase values (Active = 0, Deleted = 1) — consistent with the existing ApiKeyDef.Status enum in myaccount.proto (Active = 0, Expired = 1, Disabled = 2). Verified at source.
  • Package-level enum placement: Placing the enum at package level (not nested inside a message) is the right call since it's referenced by two different messages (OrgUnitsListEntry.status and OrgUnitGetResp.status). Reusable and clean.
  • Field number safety: New fields use previously unused numbers — status at field 6 on both OrgUnitsListEntry and OrgUnitGetResp, deleted at field 7 on OrgUnitGetResp. No wire-compatibility issues; existing clients will ignore unknown fields per standard proto3 behaviour.
  • Asymmetric field exposure: deleted timestamp only on GetResp (not ListEntry) is a sound design — list callers need status for filtering but the exact deletion timestamp is a detail-view concern.
  • Generated code consistency: org-unit.pb.go and apidocs.swagger.json are consistent with the .proto definitions — enum types registered, dependency indexes updated, swagger $ref entries correct.

Clean, well-scoped proto-first change. LGTM.

@Prabhjot-Sethi Prabhjot-Sethi merged commit 6272f10 into main Jun 27, 2026
1 of 3 checks passed
@Prabhjot-Sethi Prabhjot-Sethi deleted the pr-branch branch June 27, 2026 15:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Proto: add OrgUnitStatus enum and deleted field

2 participants