Skip to content

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

Closed
dev-arya23 wants to merge 1 commit into
go-core-stack:mainfrom
dev-arya23:feat/org-unit-status-proto
Closed

proto: add OrgUnitStatus enum and status/deleted fields#184
dev-arya23 wants to merge 1 commit into
go-core-stack:mainfrom
dev-arya23:feat/org-unit-status-proto

Conversation

@dev-arya23

@dev-arya23 dev-arya23 commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

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 include a clear status indicator, showing whether an item is active or deleted.
    • Org unit details now return deletion information, making soft-deleted records easier to identify.
    • Org unit lists now display the current status for each entry.

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 go-core-stack#179
@coderabbitai

coderabbitai Bot commented Jun 27, 2026

Copy link
Copy Markdown

Walkthrough

api/org-unit.proto gains an OrgUnitStatus enum (Active=0, Deleted=1), a status field on OrgUnitsListEntry, and both a status and a deleted int64 UNIX timestamp field on OrgUnitGetResp.

OrgUnit soft-delete proto contract

Layer / File(s) Summary
OrgUnitStatus enum and message field extensions
api/org-unit.proto
Adds OrgUnitStatus enum with Active and Deleted values; extends OrgUnitsListEntry with a status field and OrgUnitGetResp with status and deleted (int64 UNIX timestamp) fields.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~3 minutes

Poem

A bunny hops through proto land,
Adding Deleted with a careful hand.
Active = 0, soft-delete at 1,
The timestamp tells when the unit is done.
🐇 Proto fields, cleanly spun!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Linked Issues check ❓ Inconclusive The proto additions match #179, but the provided summary does not confirm regenerated Go code compiles cleanly. Regenerate the protobuf Go code and verify the generated package 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 accurately summarizes the main proto change by naming the new enum and added status/deleted fields.
Out of Scope Changes check ✅ Passed The only described changes are the requested org-unit proto additions, with no unrelated scope visible.
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

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@api/org-unit.proto`:
- Around line 119-120: The proto contract has new org unit fields that are not
yet reflected in the generated Go types or wired into responses. Regenerate the
protobuf artifacts so api/org-unit.pb.go includes the new field definitions and
serialization logic, then update the org unit response builders in
pkg/server/org-unit.go to populate the new status-related fields instead of
leaving the defaults. Make sure both the org unit getters/builders and any
response construction paths use the regenerated symbols so the soft-delete state
is actually emitted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 4bb927b4-0eb2-4401-b59d-95ddfa784521

📥 Commits

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

📒 Files selected for processing (1)
  • api/org-unit.proto

Comment thread api/org-unit.proto

@Prabhjot-Sethi Prabhjot-Sethi left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

missing generated files, i have created a new pull request #185 with the changes, i will be closing this one

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